:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --panel: #ffffff;
  --line: #cfd9e3;
  --line-strong: #9eb0c1;
  --text: #071827;
  --muted: #50657a;
  --blue: #1168d8;
  --blue-soft: #e8f1ff;
  --green: #088653;
  --green-soft: #e7f6ef;
  --red: #d12f36;
  --red-soft: #fff0f1;
  --grey: #748395;
  --grey-soft: #eef2f5;
  --amber: #d97706;
  --amber-soft: #fff7e8;
  --panel-soft: #f8fbfd;
  --shadow: 0 12px 30px rgba(29, 45, 61, 0.08);
  --shadow-soft: 0 8px 22px rgba(31, 52, 73, 0.07);
  font-family: "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg, #eef4f8 0, #f7f9fb 260px, var(--bg) 100%); color: var(--text); }
button, input, select { font: inherit; }
::placeholder { color: var(--muted); opacity: 0.42; font-weight: 400; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.68; }

.shell { width: min(1760px, calc(100vw - 48px)); margin: 0 auto; padding: 26px 0 48px; }
.topbar {
  position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 16px;
  border: 1px solid #d8e3ec; border-radius: 10px; background: linear-gradient(135deg, #ffffff 0%, #f5faff 100%);
  box-shadow: var(--shadow-soft); padding: 18px 20px 18px 22px; overflow: hidden;
}
.topbar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: linear-gradient(180deg, var(--blue), var(--green)); }
.topbar > div:first-child { min-width: 260px; }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 0.76rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
h1 { margin: 0; font-size: 2rem; line-height: 1.08; letter-spacing: 0; }
.muted { margin: 7px 0 0; color: var(--muted); }
.small-status { font-size: 0.86rem; }
.actions { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.actions button, .record-dialog button {
  min-height: 40px; border: 1px solid #b7c8d8; border-radius: 7px; background: var(--panel); color: var(--text); padding: 8px 15px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset; transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.actions button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.actions button:hover, .record-dialog button:hover { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.actions button:active { transform: translateY(1px); }
#addButton, .record-dialog footer button[type="submit"] { border-color: var(--blue); background: var(--blue); color: #ffffff; font-weight: 800; }
#addButton:hover, .record-dialog footer button[type="submit"]:hover { background: #0d5fc8; color: #ffffff; }
.actions button:not(.help-button)::before {
  content: ""; width: 15px; height: 15px; flex: 0 0 auto; background: currentColor; opacity: 0.78;
  -webkit-mask: var(--icon) center / 15px 15px no-repeat; mask: var(--icon) center / 15px 15px no-repeat;
}
#addButton { --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 5v14M5 12h14' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E"); }
#authProfilesButton { --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15 7a4 4 0 1 0-3.2 3.9L5 17.7V21h3.3l1.2-1.2H12v-2.3l1.2-1.2V14h2.3l2.6-2.6A4 4 0 0 0 15 7Z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E"); }
#scanButton { --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 12a8 8 0 0 1 8-8m8 8a8 8 0 0 1-8 8m0-11a3 3 0 1 1 0 6 3 3 0 0 1 0-6Z' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"); }
#refreshButton { --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 6v5h-5M4 18v-5h5M18.5 10A7 7 0 0 0 6.8 6.8L4 9.6M5.5 14a7 7 0 0 0 11.7 3.2L20 14.4' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.actions .help-button { width: 40px; min-width: 40px; padding: 0; border-radius: 999px; color: #074a9a; background: #f7fbff; font-weight: 900; font-size: 1rem; }
.search-box { position: relative; display: grid; gap: 5px; min-width: min(360px, 38vw); color: var(--muted); font-size: 0.82rem; font-weight: 800; text-align: left; }
.search-box::after {
  content: ""; position: absolute; left: 12px; bottom: 12px; width: 15px; height: 15px; background: var(--muted); opacity: 0.72;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m21 21-4.7-4.7M10.8 18a7.2 7.2 0 1 1 0-14.4 7.2 7.2 0 0 1 0 14.4Z' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / 15px 15px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m21 21-4.7-4.7M10.8 18a7.2 7.2 0 1 1 0-14.4 7.2 7.2 0 0 1 0 14.4Z' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / 15px 15px no-repeat;
}
.search-box input { width: 100%; min-height: 40px; border: 1px solid #b7c8d8; border-radius: 7px; padding: 8px 10px 8px 36px; color: var(--text); background: var(--panel); box-shadow: 0 1px 0 rgba(255,255,255,0.85) inset; }
.search-box input:focus, .server-select-card select:focus, .interval-box select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.refresh-controls { display: grid; grid-template-columns: auto auto; gap: 5px 12px; align-items: end; min-height: 58px; border: 1px solid #d8e3ec; border-radius: 8px; background: rgba(255,255,255,0.84); padding: 8px 11px; box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset; }
.toggle-line { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 0.88rem; font-weight: 700; white-space: nowrap; }
.toggle-line input { width: 16px; height: 16px; accent-color: var(--blue); }
.interval-box { display: grid; gap: 4px; color: var(--muted); font-size: 0.76rem; font-weight: 700; }
.interval-box select { min-height: 30px; border: 1px solid #b7c8d8; border-radius: 6px; background: var(--panel); color: var(--text); padding: 3px 7px; }
.next-refresh { grid-column: 1 / -1; color: var(--muted); font-size: 0.8rem; }

.summary-grid { display: grid; grid-template-columns: repeat(5, minmax(135px, 1fr)); gap: 10px; margin-bottom: 14px; }
.summary-card {
  --card-color: var(--blue); --card-soft: var(--blue-soft); --card-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 12h14M5 17h10M5 7h14' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  position: relative; min-height: 86px; border: 1px solid #d5e1ec; border-radius: 8px; background: var(--panel);
  padding: 15px 56px 14px 14px; box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset; overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.summary-card::after {
  content: ""; position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 9px;
  background: var(--card-color); opacity: 0.18; -webkit-mask: var(--card-icon) center / 18px 18px no-repeat; mask: var(--card-icon) center / 18px 18px no-repeat;
}
.summary-card[data-filter] { cursor: pointer; }
.summary-card[data-filter]:hover, .summary-card[data-filter].selected { border-color: var(--card-color); box-shadow: 0 0 0 3px var(--card-soft) inset, var(--shadow-soft); transform: translateY(-1px); }
.summary-card[data-filter].selected { background: linear-gradient(180deg, var(--card-soft), #ffffff); }
.summary-card strong { display: block; font-size: 1.7rem; line-height: 1; }
.summary-card span { display: block; margin-top: 9px; color: var(--muted); font-size: 0.9rem; }
.summary-card.good { --card-color: var(--green); --card-soft: var(--green-soft); --card-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m5 12 4 4L19 6' fill='none' stroke='black' stroke-width='2.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.summary-card.danger { --card-color: var(--red); --card-soft: var(--red-soft); --card-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 7v6m0 4h.01M10.2 3.8 2.7 17a2 2 0 0 0 1.7 3h15.2a2 2 0 0 0 1.7-3L13.8 3.8a2 2 0 0 0-3.6 0Z' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.summary-card.neutral { --card-color: var(--grey); --card-soft: var(--grey-soft); --card-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01' fill='none' stroke='black' stroke-width='2.7' stroke-linecap='round'/%3E%3C/svg%3E"); }
.summary-card.good strong { color: var(--green); }
.summary-card.danger strong { color: var(--red); }
.summary-card.neutral strong { color: var(--grey); }
.server-select-card { display: grid; gap: 6px; padding-top: 10px; }
.server-select-card label { display: grid; gap: 5px; }
.server-select-card label span { margin: 0; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.server-select-card select { width: 100%; min-height: 36px; border: 1px solid #b7c8d8; border-radius: 6px; background: var(--panel); color: var(--text); padding: 6px 9px; }
.server-select-card small { color: var(--muted); font-size: 0.78rem; }

.record-dialog input, .record-dialog select { width: 100%; min-height: 38px; border: 1px solid var(--line-strong); border-radius: 5px; padding: 8px 10px; color: var(--text); background: var(--panel); }
.dashboard { display: grid; gap: 12px; }

.server-row { border: 1px solid var(--line); border-radius: 7px; background: var(--panel); box-shadow: var(--shadow); overflow: visible; }
.server-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; background: #eef5f8; border-bottom: 1px solid var(--line); }
.server-name { display: grid; gap: 3px; }
.server-name strong { font-size: 1rem; }
.server-name span { color: var(--muted); font-size: 0.86rem; overflow-wrap: anywhere; }
.server-meta { display: grid; justify-items: end; gap: 7px; }
.server-sla-window { color: var(--muted); font-size: 0.78rem; }
.server-sla { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; color: var(--text); font-size: 0.82rem; }
.server-sla span { border: 1px solid var(--line); border-radius: 999px; background: var(--panel); padding: 4px 9px; white-space: nowrap; }
.server-sla strong { color: var(--muted); font-size: 0.72rem; letter-spacing: 0; }
.server-sla button { min-height: 26px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--panel); color: var(--text); padding: 3px 9px; font-size: 0.78rem; font-weight: 700; }
.server-sla button:hover { border-color: var(--blue); color: #074a9a; }
.server-counts { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 0.86rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; padding: 12px; }

.check-tile { position: relative; min-height: 116px; border: 1px solid var(--line); border-left-width: 5px; border-radius: 7px; background: var(--panel); padding: 12px 12px 34px; outline: none; }
.check-tile.green { border-left-color: var(--green); }
.check-tile.red { border-left-color: var(--red); background: #fffafb; }
.check-tile.disabled { border-left-color: var(--grey); background: var(--grey-soft); color: #516173; }
.env-icon { display: block; width: 28px; height: 28px; margin-bottom: 8px; }
.disabled .env-icon { opacity: 0.58; }
.check-tile strong { display: block; line-height: 1.2; overflow-wrap: anywhere; padding-right: 50px; }
.path { margin-top: 4px; color: var(--muted); font-size: 0.82rem; overflow-wrap: anywhere; }
.auth-badge { position: absolute; top: 10px; right: 10px; display: inline-flex; width: fit-content; border: 1px solid var(--blue); border-radius: 999px; color: #074a9a; background: var(--blue-soft); padding: 2px 7px; font-size: 0.72rem; font-weight: 800; line-height: 1.2; }
.tile-edit { position: absolute; left: 12px; bottom: 8px; min-height: 28px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--panel); color: var(--text); padding: 4px 10px; font-size: 0.82rem; font-weight: 700; }
.tile-edit:hover { border-color: var(--blue); color: #074a9a; }
.status-code { position: absolute; right: 12px; bottom: 10px; color: var(--muted); font-size: 0.86rem; font-weight: 700; }
.tile-popover { display: none; position: fixed; z-index: 30; left: 0; top: 0; width: min(360px, calc(100vw - 24px)); overflow: auto; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--text); box-shadow: var(--shadow); padding: 11px 12px; font-size: 0.82rem; line-height: 1.45; }
.check-tile:hover .tile-popover, .check-tile:focus .tile-popover { display: grid; gap: 3px; }

.empty-state { border: 1px dashed var(--line-strong); border-radius: 7px; background: var(--panel); padding: 26px; text-align: center; color: var(--muted); }
.record-dialog { width: min(560px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 0; }
.record-dialog::backdrop { background: rgba(7, 24, 39, 0.42); }
.record-dialog form { display: grid; gap: 14px; padding: 18px; }
.record-dialog header, .record-dialog footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.record-dialog h2 { margin: 0; font-size: 1.25rem; }
.record-dialog p { margin: 5px 0 0; color: var(--muted); line-height: 1.45; }
.record-dialog label { display: grid; gap: 5px; color: var(--muted); font-size: 0.84rem; font-weight: 700; }
.record-dialog .checkline { display: flex; align-items: center; gap: 8px; }
.record-dialog .checkline input { width: auto; min-height: 0; }
.auth-profile-list { display: grid; gap: 8px; max-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: #f8fbfd; }
.auth-profile-item { display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 9px; }
.auth-profile-item span, .auth-profile-item small, .empty-mini { color: var(--muted); overflow-wrap: anywhere; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 160px); gap: 12px; }
.record-dialog footer { justify-content: space-between; border-top: 1px solid var(--line); padding-top: 14px; flex-wrap: wrap; }
.dialog-record-actions, .dialog-primary-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dialog-primary-actions { margin-left: auto; }
.record-dialog button.danger-action { border-color: #e28b8f; background: var(--red-soft); color: #9f1f25; font-weight: 700; }
.record-dialog button.danger-action:hover { border-color: var(--red); color: var(--red); }
#closeDialog { width: 36px; padding: 0; }
#closeHelpDialog { width: 36px; padding: 0; }
.help-dialog { width: min(780px, calc(100vw - 32px)); }
.help-dialog article { display: grid; gap: 18px; padding: 18px; }
.help-dialog section { display: grid; gap: 8px; }
.help-dialog h3 { margin: 0; font-size: 1rem; }
.help-dialog p { margin: 0; color: var(--muted); line-height: 1.5; }
.help-dialog code { border: 1px solid var(--line); border-radius: 4px; background: #f8fbfd; padding: 1px 4px; color: var(--text); }
.help-list { display: grid; gap: 8px; margin: 0; }
.help-list div { border: 1px solid var(--line); border-radius: 6px; background: #f8fbfd; padding: 10px 12px; }
.help-list dt { margin: 0 0 4px; font-weight: 800; }
.help-list dd { margin: 0; color: var(--muted); line-height: 1.45; }
.help-list.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.icon-help-list dt { display: flex; align-items: center; gap: 8px; }
.icon-help-list img { width: 22px; height: 22px; flex: 0 0 auto; }

@media (max-width: 880px) {
  .field-row { grid-template-columns: 1fr; }
  .shell { width: min(100vw - 24px, 1760px); padding-top: 18px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .topbar > div:first-child { min-width: 0; }
  .actions { justify-content: flex-start; }
  .search-box { min-width: 100%; }
  .refresh-controls { width: 100%; grid-template-columns: minmax(0, 1fr) auto; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .server-header { align-items: flex-start; flex-direction: column; }
  .server-meta { justify-items: start; }
  .server-sla { justify-content: flex-start; }
  .help-list.compact { grid-template-columns: 1fr; }
}
