/* /mnt/python_share/certguard/frontend/static/css/certguard.css */
:root {
  --bg: #0B0B0B;
  --panel: #141414;
  --panel-2: #1A1A1A;
  --panel-3: #222222;
  --border: #2A2416;
  --border-soft: #1F1F1F;
  --gold: #D4AF37;
  --gold-bright: #F2D37A;
  --gold-deep: #9C7F22;
  --gold-glow: rgba(212, 175, 55, 0.18);
  --text: #EEE8D8;
  --text-2: #C9C2AE;
  --muted: #8E8775;
  --valid: #3FB27F;
  --notice: #4EA3E0;
  --warning: #E3B341;
  --high: #E9823A;
  --critical: #E5484D;
  --expired: #B4232A;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Cinzel", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sidebar-w: 264px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 4px 0 0; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- App shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, #0E0E0E, #080808);
  border-right: 1px solid var(--border);
  padding: 20px 14px 18px;
  display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; border-bottom: 1px solid var(--border); }
.brand-mark { width: 38px; height: 38px; color: var(--gold); filter: drop-shadow(0 0 8px var(--gold-glow)); flex: 0 0 auto; }
.brand-name { display: block; font-family: var(--font-display); font-size: 17px; letter-spacing: 0.06em; color: var(--gold); }
.brand-sub { display: block; font-size: 10.5px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title { font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-deep); padding: 0 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; border: 1px solid transparent;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.16), rgba(212, 175, 55, 0.03));
  border-color: var(--border); color: var(--gold-bright);
}
.nav-item.is-disabled, .nav-item.is-disabled:hover { color: #5F5A4D; background: transparent; cursor: not-allowed; }
.nav-item em {
  margin-left: auto; font-style: normal; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid #2B2B2B; border-radius: 99px; padding: 0 7px; color: #6D6758;
}
.nav-ico { width: 18px; text-align: center; color: var(--gold); }
.sidebar-foot { margin-top: auto; font-size: 11px; color: var(--muted); padding: 12px 10px 0; border-top: 1px solid var(--border); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px;
  background: rgba(11, 11, 11, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-family: var(--font-display); letter-spacing: 0.08em; color: var(--gold); font-size: 15px; white-space: nowrap; }
.search { flex: 1; max-width: 520px; margin-left: 8px; }
.search input {
  width: 100%; background: var(--panel); border: 1px solid var(--border-soft); color: var(--text);
  border-radius: 99px; padding: 8px 16px; font: inherit;
}
.search input:disabled { opacity: 0.55; cursor: not-allowed; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.clock { font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 4px 4px; border: 1px solid var(--border); border-radius: 99px; background: var(--panel);
}
.user-chip form { margin: 0; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: #111; font-weight: 700; font-size: 12px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--muted); }

.icon-btn {
  background: var(--panel); border: 1px solid var(--border); color: var(--gold);
  width: 36px; height: 36px; border-radius: 10px; font-size: 18px; cursor: pointer;
}
.icon-btn.menu { display: none; place-items: center; }

/* ---------- Buttons, badges, pills ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: filter 0.15s, background 0.15s, border-color 0.15s;
}
.btn-gold { background: linear-gradient(180deg, #E2C04F, var(--gold)); color: #141414; border-color: var(--gold-deep); }
.btn-gold:hover { filter: brightness(1.08); color: #141414; }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-bright); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 99px; }
.btn-block { width: 100%; }
.btn.is-loading { opacity: 0.7; cursor: progress; }

.badge {
  display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; border: 1px solid var(--border);
}
.badge-gold { color: var(--gold-bright); background: rgba(212, 175, 55, 0.08); }

.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 99px;
  font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: var(--panel);
}
.pill[data-state="ok"] { color: var(--valid); border-color: rgba(63, 178, 127, 0.4); }
.pill[data-state="degraded"] { color: var(--critical); border-color: rgba(229, 72, 77, 0.45); }
.pill[data-state="checking"] { color: var(--gold); }

/* ---------- Content ---------- */
.content { padding: 26px 28px 40px; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-size: 26px; letter-spacing: 0.04em; color: var(--text); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.kpi {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--panel), #0F0F0F);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 16px 18px; transition: transform 0.15s, border-color 0.15s;
}
.kpi::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 3px; background: var(--tone, var(--gold)); }
.kpi:hover { transform: translateY(-2px); border-color: var(--border); }
.kpi-label { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-family: var(--font-mono); font-size: 30px; font-weight: 600; margin: 6px 0 2px; color: var(--tone, var(--text)); }
.kpi-hint { font-size: 11.5px; color: var(--muted); }
.kpi-gold { --tone: var(--gold); }
.kpi-valid { --tone: var(--valid); }
.kpi-notice { --tone: var(--notice); }
.kpi-warning { --tone: var(--warning); }
.kpi-high { --tone: var(--high); }
.kpi-critical { --tone: var(--critical); }
.kpi-expired { --tone: var(--expired); }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel {
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); min-width: 0;
}
.panel-wide { grid-column: 1 / -1; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 12.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }

.svc-list { list-style: none; margin: 0; padding: 0; }
.svc { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.svc:last-child { border-bottom: 0; }
.svc-name { font-weight: 500; }
.svc-detail { margin-left: auto; color: var(--muted); font-size: 12px; text-align: right; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #555; flex: 0 0 auto; }
.dot[data-state="up"] { background: var(--valid); box-shadow: 0 0 0 4px rgba(63, 178, 127, 0.15); }
.dot[data-state="down"] { background: var(--critical); box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.18); animation: pulse 1.4s infinite; }
.dot[data-state="not_configured"] { background: #4A4A4A; }
.dot[data-state="checking"] { background: var(--gold); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.horizon { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.horizon-seg { border-radius: 10px; padding: 12px 8px; background: var(--panel-2); border-top: 3px solid var(--tone); text-align: center; }
.horizon-count { font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--tone); }
.horizon-label { font-size: 11px; color: var(--muted); }
.tone-expired { --tone: var(--expired); }
.tone-critical { --tone: var(--critical); }
.tone-high { --tone: var(--high); }
.tone-warning { --tone: var(--warning); }
.tone-notice { --tone: var(--notice); }
.tone-valid { --tone: var(--valid); }

.empty-state {
  margin-top: 16px; padding: 16px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  color: var(--muted); text-align: center; font-size: 13px;
}

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); color: var(--text-2); }
table.data tr:hover td { background: rgba(212, 175, 55, 0.035); }
.tag { font-family: var(--font-mono); font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--panel-3); color: var(--gold-bright); white-space: nowrap; }
.tag-bad { color: #FF9A9E; background: rgba(229, 72, 77, 0.12); }

/* ---------- Auth and error pages ---------- */
.auth-body {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(ellipse at 50% -10%, rgba(212, 175, 55, 0.14), transparent 55%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: linear-gradient(180deg, #151515, #0F0F0F);
  border: 1px solid var(--border); border-radius: 18px;
  padding: 34px 32px 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand .brand-mark { width: 58px; height: 58px; }
.auth-title { font-family: var(--font-display); color: var(--gold); letter-spacing: 0.08em; font-size: 23px; margin-top: 10px; }
.auth-sub { font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.field input {
  background: #0C0C0C; border: 1px solid #2A2A2A; border-radius: 10px; padding: 11px 13px;
  color: var(--text); font: inherit; transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
.alert { padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: rgba(229, 72, 77, 0.1); border: 1px solid rgba(229, 72, 77, 0.35); color: #FFB3B6; }
.alert-info { background: rgba(212, 175, 55, 0.08); border: 1px solid var(--border); color: var(--gold-bright); }
.auth-foot { text-align: center; margin-top: 18px; font-size: 11px; color: var(--muted); line-height: 1.7; }
.error-card { text-align: center; }
.error-code { font-family: var(--font-mono); font-size: 64px; font-weight: 600; color: var(--gold); line-height: 1; }
.error-message { color: var(--text-2); margin: 14px 0 22px; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  min-width: 260px; max-width: 380px; background: var(--panel-2);
  border: 1px solid var(--border); border-left: 3px solid var(--gold);
  border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 13px;
  animation: toast-in 0.2s ease-out;
}
.toast-error { border-left-color: var(--critical); }
.toast-success { border-left-color: var(--valid); }
.toast.is-leaving { opacity: 0; transition: opacity 0.3s; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.scrim { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50; width: var(--sidebar-w);
    transform: translateX(-100%); transition: transform 0.2s ease;
  }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 40; }
  .icon-btn.menu { display: inline-grid; }
  .search, .clock, .user-meta { display: none; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .horizon { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 24px; }
  .auth-card { padding: 28px 20px 22px; }
}

/* ===== Login split layout (m1.1) ===== */
:root { --font-serif: "Playfair Display", Georgia, "Times New Roman", serif; }

.login-body { background: var(--bg); }
.login-shell { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); min-height: 100vh; }

.login-brand {
  position: relative; overflow: hidden;
  border-right: 1px solid var(--border);
  background:
    radial-gradient(ellipse at 0% 0%, rgba(212, 175, 55, 0.16), transparent 55%),
    repeating-linear-gradient(135deg, rgba(212, 175, 55, 0.045) 0 1px, transparent 1px 16px),
    linear-gradient(180deg, #121008, #090909 70%);
}
.login-brand-inner { position: relative; display: flex; flex-direction: column; min-height: 100vh; padding: 44px 60px 28px; }

.login-logo { display: flex; align-items: center; gap: 14px; }
.login-logo-mark {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--gold); color: var(--gold);
  background: rgba(212, 175, 55, 0.08); box-shadow: 0 0 18px var(--gold-glow);
}
.login-logo-mark svg { width: 26px; height: 26px; }
.login-logo-name { font-family: var(--font-serif); font-weight: 700; font-size: 24px; letter-spacing: 0.03em; color: var(--gold); }

.login-hero { margin: auto 0; max-width: 560px; padding: 48px 0; }
.login-eyebrow { font-size: 12.5px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--text-2); margin-bottom: 12px; }
.login-headline {
  font-family: var(--font-serif); font-weight: 800;
  font-size: clamp(38px, 4.4vw, 60px); line-height: 1.08; color: #F5F0E3; letter-spacing: -0.005em;
}
.login-headline span { color: var(--gold); }
.login-lede { color: var(--text-2); font-size: 16px; line-height: 1.7; margin-top: 22px; max-width: 500px; }

.login-features { list-style: none; margin: 40px 0 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.login-features li { display: flex; gap: 16px; align-items: flex-start; }
.login-features svg { width: 22px; height: 22px; color: var(--gold); flex: 0 0 auto; margin-top: 2px; }
.login-features strong { display: block; font-weight: 500; font-size: 15.5px; color: var(--text); }
.login-features span { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }

.login-brand-foot { display: flex; gap: 18px; align-items: center; font-size: 12.5px; color: var(--muted); }
.login-brand-foot .mono { color: var(--gold-deep); font-size: 12px; }

.login-panel {
  display: flex; align-items: center; justify-content: center; padding: 48px 32px;
  background: radial-gradient(ellipse at 100% 100%, rgba(212, 175, 55, 0.05), transparent 50%), var(--bg);
}
.login-card { width: 100%; max-width: 380px; }
.login-title { font-family: var(--font-serif); font-weight: 800; font-size: 38px; color: var(--gold); letter-spacing: 0.005em; }
.login-sub { color: var(--text-2); margin: 6px 0 28px; font-size: 15px; }

.login-note {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 16px; border-radius: 10px; font-size: 14px; line-height: 1.45; margin-bottom: 22px;
}
.login-note svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.login-note-info { background: rgba(212, 175, 55, 0.06); border: 1px solid rgba(212, 175, 55, 0.35); color: var(--text); }
.login-note-info svg { color: var(--gold); }
.login-note-error { background: rgba(229, 72, 77, 0.08); border: 1px solid rgba(229, 72, 77, 0.4); color: #FFC2C4; }
.login-note-error svg { color: var(--critical); }

.login-card .field { margin-bottom: 16px; }
.login-card .field input { padding: 13px 14px; background: #0E0E0E; }
.login-card .field input::placeholder { color: #4F4A3E; }
.login-submit {
  margin-top: 10px; padding: 14px 18px; font-size: 15px; letter-spacing: 0.02em;
  box-shadow: 0 10px 28px rgba(212, 175, 55, 0.18);
}
.login-submit:hover { box-shadow: 0 12px 32px rgba(212, 175, 55, 0.28); }

.login-assurance {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 22px; font-size: 12px; color: var(--muted); text-align: center;
}
.login-assurance svg { width: 14px; height: 14px; color: var(--gold-deep); flex: 0 0 auto; }

@media (max-width: 960px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { border-right: 0; border-bottom: 1px solid var(--border); }
  .login-brand-inner { min-height: auto; padding: 28px 20px 24px; }
  .login-hero { margin: 0; padding: 26px 0 6px; }
  .login-lede, .login-features, .login-brand-foot { display: none; }
  .login-headline { font-size: 32px; }
  .login-panel { padding: 32px 16px 48px; }
  .login-title { font-size: 30px; }
}

/* ===== Login polish (m1.2) ===== */
/* Headline: wider column and balanced line breaks so it never orphans a word */
.login-hero { max-width: 700px; }
.login-headline { font-size: clamp(36px, 3.9vw, 58px); text-wrap: balance; }
.login-lede { max-width: 540px; }

/* Keep browser autofill on-theme (Chrome, Edge, Safari, Firefox) */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus,
.field input:autofill {
  -webkit-box-shadow: 0 0 0 1000px #0E0E0E inset !important;
  box-shadow: 0 0 0 1000px #0E0E0E inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--gold);
  border-color: #2A2A2A;
  transition: background-color 99999s ease-out 0s;
}
.field input:-webkit-autofill:focus,
.field input:autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #0E0E0E inset, 0 0 0 3px var(--gold-glow) !important;
  box-shadow: 0 0 0 1000px #0E0E0E inset, 0 0 0 3px var(--gold-glow) !important;
  border-color: var(--gold);
}

/* Assurance line: icon flows inline with the first word, centered as one block */
.login-assurance { display: block; text-align: center; line-height: 1.6; }
.login-assurance svg { display: inline-block; vertical-align: -2px; margin-right: 6px; }
.login-assurance span { display: inline; }

/* ===== Module 2 UI (m2) ===== */
/* Sidebar: never clip the brand or scroll sideways */
.sidebar { overflow-x: hidden; }
.brand-text { min-width: 0; }
.brand-name { font-size: 15.5px; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item { min-width: 0; }
.nav-item em { flex: 0 0 auto; }

/* Flash messages */
.flash-stack { display: flex; flex-direction: column; gap: 10px; }
.flash { padding: 12px 16px; border-radius: 10px; font-size: 13.5px; border: 1px solid var(--border); background: var(--panel); margin-bottom: 14px; }
.flash-stack .flash { margin-bottom: 0; }
.flash-success { border-color: rgba(63, 178, 127, 0.45); background: rgba(63, 178, 127, 0.08); color: #BFF0D8; }
.flash-error { border-color: rgba(229, 72, 77, 0.45); background: rgba(229, 72, 77, 0.08); color: #FFC2C4; }
.flash-info { border-color: rgba(212, 175, 55, 0.4); background: rgba(212, 175, 55, 0.07); color: var(--gold-bright); }

/* Page head */
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted-link { font-size: 12.5px; color: var(--muted); display: inline-block; margin-bottom: 6px; }
.muted-link:hover { color: var(--gold); }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Inputs on application pages */
.input, .field select, .field textarea {
  background: #0E0E0E; border: 1px solid #2A2A2A; border-radius: 10px;
  padding: 10px 12px; color: var(--text); font: inherit; min-width: 0;
}
.input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
.input::placeholder { color: #57513F; }
.input[type="date"] { color-scheme: dark; }
.field .hint { font-size: 11.5px; color: var(--muted); letter-spacing: 0; text-transform: none; }

/* Filter toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; }
.toolbar .input { flex: 1 1 150px; }
.toolbar .input[type="search"] { flex: 2 1 220px; }

/* Forms */
.form-panel { max-width: 880px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 18px; }
.checks { border: 1px solid var(--border-soft); border-radius: 12px; padding: 12px 14px 6px; margin: 8px 0 14px; min-width: 0; }
.checks legend { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 0 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--gold); width: 16px; height: 16px; flex: 0 0 auto; }
.check strong { display: block; font-weight: 600; font-size: 13.5px; color: var(--text); }
.check em { display: block; font-style: normal; font-size: 12px; color: var(--muted); }
.check-inline { padding: 4px 0 14px; font-size: 13.5px; color: var(--text-2); }
.checks.is-locked { opacity: 0.55; }
.checks.is-locked .check { cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.btn-danger { background: rgba(229, 72, 77, 0.12); color: #FFB3B6; border-color: rgba(229, 72, 77, 0.45); }
.btn-danger:hover { background: rgba(229, 72, 77, 0.22); color: #FFFFFF; }

/* Status badges */
.badge-ok { color: var(--valid); border-color: rgba(63, 178, 127, 0.4); background: rgba(63, 178, 127, 0.08); }
.badge-danger { color: #FF9A9E; border-color: rgba(229, 72, 77, 0.45); background: rgba(229, 72, 77, 0.08); }
.badge-warn { color: var(--warning); border-color: rgba(227, 179, 65, 0.45); background: rgba(227, 179, 65, 0.08); }
.badge-info { color: var(--notice); border-color: rgba(78, 163, 224, 0.45); background: rgba(78, 163, 224, 0.08); }

/* Tables and pagination */
table.data a { color: var(--gold-bright); font-weight: 500; }
table.data a:hover { color: var(--gold); text-decoration: underline; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }

/* Detail pages */
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; padding-top: 2px; }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }
.danger-zone { border-color: rgba(229, 72, 77, 0.35); }
.danger-zone .panel-head h2 { color: #FF9A9E; }
.action-block { padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.action-block:first-child { padding-top: 0; }
.action-block:last-child { border-bottom: 0; padding-bottom: 0; }
.action-block p { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.action-block form { margin: 0; }
.code-block {
  background: #0A0A0A; border: 1px solid var(--border-soft); border-radius: 10px; padding: 14px; margin: 0;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-2); overflow-x: auto; white-space: pre;
}

/* Role matrix */
table.matrix th.c, table.matrix td.c { text-align: center; }
table.matrix th.c { white-space: normal; min-width: 100px; }
table.matrix .group-row td {
  background: rgba(212, 175, 55, 0.05); color: var(--gold);
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600;
}
.tick { color: var(--gold); font-weight: 700; font-size: 15px; }
.dash { color: #444444; }

@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}

/* ===== Layout polish (m2.1) ===== */
/* Brand fits the sidebar at 100-125% zoom without truncation */
.brand-name { font-size: 14px; letter-spacing: 0.02em; overflow: visible; text-overflow: clip; }
.brand-mark { width: 34px; height: 34px; }

/* Top bar never forces horizontal page scroll */
.topbar { min-width: 0; }
.search { min-width: 0; }
.search input { min-width: 0; }
.topbar-right { flex-shrink: 0; }
.user-meta { max-width: 220px; min-width: 0; }
.user-name, .user-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1440px) { .clock { display: none; } }
@media (max-width: 1240px) { .search { display: none; } }

/* ===== Module 3 UI (m3) ===== */
/* Certificate status badges */
.st {
  display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 99px; border: 1px solid currentColor;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
}
.st-valid { color: var(--valid); background: rgba(63, 178, 127, 0.08); }
.st-notice { color: var(--notice); background: rgba(78, 163, 224, 0.08); }
.st-warning { color: var(--warning); background: rgba(227, 179, 65, 0.08); }
.st-high { color: var(--high); background: rgba(233, 130, 58, 0.1); }
.st-critical { color: var(--critical); background: rgba(229, 72, 77, 0.1); }
.st-expired { color: #FF6B70; background: rgba(180, 35, 42, 0.2); }
.st-none { color: var(--muted); border-color: #333333; }

.days { font-family: var(--font-mono); font-weight: 700; }
.days-valid { color: var(--valid); }
.days-notice { color: var(--notice); }
.days-warning { color: var(--warning); }
.days-high { color: var(--high); }
.days-critical { color: var(--critical); }
.days-expired { color: #FF6B70; }

.dot-sm { width: 8px; height: 8px; display: inline-block; vertical-align: middle; margin-right: 6px; box-shadow: none !important; }
.dot[data-state="warn"] { background: var(--warning); }
.row-muted td { opacity: 0.55; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form, td.actions a { display: inline-block; margin: 0 0 0 4px; }
.btn-xs { padding: 3px 10px; font-size: 11.5px; border-radius: 99px; }
.yes { color: var(--valid); font-weight: 600; }
.no { color: #FF9A9E; font-weight: 600; }
.section-label { margin: 6px 0 6px; letter-spacing: 0.12em; text-transform: uppercase; font-size: 10.5px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.plain-list li:last-child { border-bottom: 0; }
.kv-spaced { margin-top: 18px; }
.page-actions form { margin: 0; }
.field textarea { min-height: 80px; resize: vertical; }
.search form { margin: 0; }

/* Clickable KPI cards and horizon bands */
a.kpi, a.horizon-seg { display: block; color: inherit; text-decoration: none; }
a.kpi:hover { border-color: var(--tone, var(--gold)); }
a.horizon-seg:hover { filter: brightness(1.2); }

/* Countdown and lifetime bar */
.countdown { display: flex; flex-direction: column; gap: 12px; }
.cd-days { display: flex; align-items: baseline; gap: 12px; }
.cd-num { font-family: var(--font-mono); font-size: 58px; font-weight: 700; line-height: 1; color: var(--tone, var(--gold)); }
.cd-unit { color: var(--text-2); font-size: 14px; }
.cd-meta { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.lifebar { height: 12px; border-radius: 99px; background: #1C1C1C; border: 1px solid var(--border-soft); overflow: hidden; }
.lifebar-fill { height: 100%; min-width: 3px; border-radius: 99px; background: var(--tone, var(--gold)); box-shadow: 0 0 14px var(--tone, var(--gold)); }
.w-0 { width: 0; } .w-5 { width: 5%; } .w-10 { width: 10%; } .w-15 { width: 15%; } .w-20 { width: 20%; }
.w-25 { width: 25%; } .w-30 { width: 30%; } .w-35 { width: 35%; } .w-40 { width: 40%; } .w-45 { width: 45%; }
.w-50 { width: 50%; } .w-55 { width: 55%; } .w-60 { width: 60%; } .w-65 { width: 65%; } .w-70 { width: 70%; }
.w-75 { width: 75%; } .w-80 { width: 80%; } .w-85 { width: 85%; } .w-90 { width: 90%; } .w-95 { width: 95%; } .w-100 { width: 100%; }

/* Chain, timeline, chips, hex */
.chain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chain li { border: 1px solid var(--border-soft); border-left: 3px solid var(--gold-deep); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); }
.chain li:first-child { border-left-color: var(--gold); }
.chain-role { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.timeline li { position: relative; padding: 0 0 16px 18px; border-left: 1px solid var(--border); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.timeline li.ev-changed::before { background: var(--warning); box-shadow: 0 0 0 4px rgba(227, 179, 65, 0.15); }
.timeline .tag-list { margin-top: 6px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--font-mono); font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--panel-3); color: var(--text-2); }
.hex { font-family: var(--font-mono); font-size: 11.5px; word-break: break-all; color: var(--text-2); }

/* Test connection result */
.test-result { margin: 6px 0 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: #0E0E0E; font-size: 13px; }
.test-result.is-ok { border-color: rgba(63, 178, 127, 0.55); }
.test-result.is-warn { border-color: rgba(227, 179, 65, 0.55); }
.test-result.is-error { border-color: rgba(229, 72, 77, 0.55); color: #FFC2C4; }
.test-result strong { display: block; margin-bottom: 8px; font-size: 14px; }
.test-result.is-ok strong { color: var(--valid); }
.test-result.is-warn strong { color: var(--warning); }
.kv-compact { grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; font-size: 12.5px; }
.verify-list { margin: 10px 0 0; padding-left: 18px; color: var(--warning); font-size: 12px; }
