/* Domain Health — app styles. Matches the Secure Web Labs store design. */

:root {
  --ink: #0F1B2D;
  --ink-2: #344256;
  --muted: #4A5568;
  --muted-2: #5A6578;
  --line: #DDE2EA;
  --line-soft: #EEF1F5;
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --navy: #0F1B2D;
  --blue: #1D4ED8;
  --blue-dark: #1E3A8A;
  --blue-soft: #EEF3FD;

  --ok: #15803D;      --ok-bg: #E7F6EC;
  --warn: #B45309;    --warn-bg: #FEF3C7;
  --crit: #B91C1C;    --crit-bg: #FEE2E2;
  --err: #5B6475;     --err-bg: #EEF1F5;

  --radius: 12px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", Inter, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); }
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
:focus-visible { outline: 3px solid #93B4FF; outline-offset: 2px; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }

.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; color: var(--ink); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.optional { font-weight: 400; color: var(--muted-2); }

/* ---- Top bar ---------------------------------------------------------- */
.topbar { background: var(--navy); color: #fff; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 14px 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.brand-by { font-size: 13px; color: #A9B7CB; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a, .nav-button { color: #D6DEEA; text-decoration: none; font: 500 15px var(--font); padding: 10px 14px; border-radius: 8px; background: none; border: 0; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover, .nav-button:hover { color: #fff; background: #1A2B44; }
.nav a.active { color: #fff; background: #1F3150; }
.nav-form { margin: 0; }

/* ---- Page structure --------------------------------------------------- */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.page-title { font-family: var(--display); font-size: 32px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; word-break: break-word; }
.page-sub { color: var(--muted); margin-top: 6px; }
.lead { font-size: 17px; color: var(--ink-2); margin: 12px 0 24px; }
.section { margin-top: 36px; }
.section-title { font-family: var(--display); font-size: 21px; font-weight: 600; margin-bottom: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card-title { font-family: var(--display); font-size: 19px; font-weight: 600; margin-bottom: 14px; }
.footer { border-top: 1px solid var(--line); background: #fff; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 20px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }

/* ---- Flash messages --------------------------------------------------- */
.flash { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; }
.flash-success { background: var(--ok-bg); color: #14532D; border-color: #B7E4C7; }
.flash-error { background: var(--crit-bg); color: #7F1D1D; border-color: #FCA5A5; }
.flash-info { background: var(--blue-soft); color: var(--blue-dark); border-color: #C7D7FB; }

/* ---- Forms ------------------------------------------------------------ */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.grow { flex: 1 1 260px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field-pair { display: flex; flex-wrap: wrap; gap: 16px; }
label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%; min-height: 46px; padding: 10px 14px; font: 15px var(--font); color: var(--ink);
  background: #fff; border: 1px solid #B8C2D0; border-radius: 10px;
}
input[readonly] { background: var(--line-soft); color: var(--muted); }
input:focus, select:focus { border-color: var(--blue); outline: 3px solid #C7D7FB; outline-offset: 0; }
.help { font-size: 13px; color: var(--muted-2); }
.check-field { display: flex; align-items: center; gap: 10px; }
.check-field input { width: 20px; height: 20px; accent-color: var(--blue); }
.check-field label { font-weight: 500; }
.small-link { font-size: 13px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Buttons ---------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; font: 600 15px var(--font); border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: #B8C2D0; }
.btn-secondary:hover { background: var(--line-soft); color: var(--ink); }
.btn-danger { background: #fff; color: var(--crit); border-color: #F1A9A9; }
.btn-danger:hover { background: var(--crit-bg); color: #7F1D1D; }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 14px; }

/* ---- Auth pages ------------------------------------------------------- */
.auth-body { background: var(--bg); }
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 56px 16px 40px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 22px; margin-bottom: 24px; }
.auth-brand:hover { color: var(--ink); }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.auth-title { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.auth-sub { color: var(--muted); margin-top: -8px; }
.auth-switch { text-align: center; color: var(--muted); font-size: 14px; }
.auth-foot { text-align: center; font-size: 13px; color: var(--muted-2); margin-top: 20px; }
.auth-icon { display: flex; justify-content: center; }

/* ---- Dashboard -------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-family: var(--display); font-size: 30px; font-weight: 700; }
.stat-of { font-family: var(--font); font-size: 15px; font-weight: 500; color: var(--muted); }
.stat-note { font-size: 13px; color: var(--muted-2); }
.stat-critical { border-color: #F1A9A9; background: #FFF7F7; }
.stat-critical .stat-value { color: var(--crit); }
.stat-warning .stat-value { color: var(--warn); }

.add-card { margin-bottom: 20px; }
.add-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.add-form .field:not(.grow) { flex: 0 1 240px; }

.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; position: relative; } /* relative: keeps screen-reader-only labels inside the scroll box */
table.domains { width: 100%; border-collapse: collapse; font-size: 14px; }
.domains th, .domains td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.domains thead th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; background: #FAFBFC; border-bottom: 1px solid var(--line); white-space: nowrap; }
.domains tbody tr:last-child th, .domains tbody tr:last-child td { border-bottom: 0; }
.domains tbody tr:hover { background: #FAFBFD; }
.domain-cell { font-weight: 400; min-width: 200px; }
.domain-link { font-weight: 600; font-size: 15px; color: var(--ink); text-decoration: none; display: inline-block; }
.domain-link:hover { color: var(--blue); text-decoration: underline; }
.domain-label { display: block; font-size: 13px; color: var(--muted-2); }
.issue-count { display: block; font-size: 12px; color: var(--warn); font-weight: 600; margin-top: 2px; }
.issue-count.has-critical { color: var(--crit); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 12px; }
.legend-note { margin-left: auto; }
.empty p { max-width: 640px; }

/* status with dot */
.st { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--err); }
.st-ok .dot { background: var(--ok); }
.st-warning .dot { background: #D97706; }
.st-critical .dot { background: var(--crit); }
.st-error .dot { background: #8A93A3; }
.st-pending .dot { background: #fff; border: 2px solid #8A93A3; }
.st-critical { color: var(--crit); font-weight: 600; }

/* grade badge */
.grade { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; font-family: var(--display); font-weight: 700; font-size: 18px; }
.grade-a { background: var(--ok-bg); color: var(--ok); }
.grade-b { background: #DDF3F0; color: #0F766E; }
.grade-c { background: var(--warn-bg); color: var(--warn); }
.grade-d { background: #FFEDD5; color: #C2410C; }
.grade-f { background: var(--crit-bg); color: var(--crit); }
.grade-none { background: var(--line-soft); color: var(--muted-2); }
.grade-lg { width: 64px; height: 64px; font-size: 32px; border-radius: 16px; flex: none; }

/* pill */
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: #166534; }
.pill-warning { background: var(--warn-bg); color: #92400E; }
.pill-critical { background: var(--crit-bg); color: #991B1B; }
.pill-error, .pill-pending { background: var(--err-bg); color: var(--err); }

/* ---- Domain page ------------------------------------------------------ */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.crumbs span[aria-hidden] { margin: 0 6px; }
.domain-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; }
.domain-head-text { flex: 1 1 280px; min-width: 0; }
.domain-head-action { margin: 0; }

.all-clear { display: flex; align-items: center; gap: 12px; color: #14532D; background: var(--ok-bg); border-color: #B7E4C7; font-weight: 500; }
.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.issue { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.issue-critical { border-color: #F1A9A9; }
.issue-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.issue-type { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.issue-since { font-size: 13px; color: var(--muted-2); margin-left: auto; }
.issue-msg { font-size: 15px; }
.issue-fix { font-size: 14px; color: var(--muted); background: #FAFBFC; border-radius: 8px; padding: 10px 12px; }

.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 16px; }
.check { display: flex; flex-direction: column; gap: 14px; }
.check-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.check-title { font-size: 16px; font-weight: 600; }
.check-error { color: var(--err); background: var(--err-bg); padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.check-foot { font-size: 12px; color: var(--muted-2); margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.kv { margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.kv div { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; } /* breaks inside a word only when a single item can't fit */
.kv-line { display: block; }
.note { font-size: 13px; color: var(--muted); background: var(--blue-soft); border-radius: 8px; padding: 8px 12px; }
.selectors { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }

.activity { list-style: none; margin: 0; padding: 4px 20px; }
.activity li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.activity li:last-child { border-bottom: 0; }
.activity-when { color: var(--muted-2); font-size: 13px; min-width: 120px; }
.activity-msg { flex: 1 1 320px; }

.danger-card { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.danger-card form { margin: 0; }

/* ---- Settings --------------------------------------------------------- */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.settings .card .muted { margin-bottom: 16px; }
.settings .field-pair .field:first-child { flex: 0 1 160px; }

.error-page { max-width: 640px; }

/* ---- Small screens ---------------------------------------------------- */
@media (max-width: 640px) {
  .container { padding: 24px 16px 48px; }
  .topbar-inner { padding: 10px 16px; }
  .brand-by { display: none; }
  .page-title { font-size: 26px; }
  .card { padding: 18px; }
  .table-card { padding: 0; }
  .auth-card { padding: 24px; }
  .checks { grid-template-columns: 1fr; }
  .kv div { grid-template-columns: 1fr; gap: 2px; }
  .add-form .field:not(.grow) { flex: 1 1 100%; }
  .add-form .btn { width: 100%; }
  .legend-note { margin-left: 0; }
  .settings { grid-template-columns: 1fr; }
}
