/* WentaCert UI – GitHub Primer-inspired product interface */
:root {
  color-scheme: dark;
  --page: #0d1117;
  --sidebar: #010409;
  --surface: #0d1117;
  --surface-raised: #161b22;
  --surface-soft: #161b22;
  --surface-muted: #21262d;
  --border: #30363d;
  --border-strong: #484f58;
  --text: #e6edf3;
  --muted: #8b949e;
  --subtle: #6e7681;
  --accent: #2f81f7;
  --accent-hover: #388bfd;
  --accent-soft: rgba(47, 129, 247, .14);
  --button-bg: #238636;
  --button-bg-hover: #2ea043;
  --button-text: #ffffff;
  --hover: #161b22;
  --field: #0d1117;
  --success: #3fb950;
  --success-soft: rgba(63, 185, 80, .13);
  --warning: #d29922;
  --warning-soft: rgba(210, 153, 34, .13);
  --danger: #f85149;
  --danger-soft: rgba(248, 81, 73, .13);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --radius: 6px;
  --shadow: 0 8px 24px rgba(1, 4, 9, .22);
}

body[data-theme="light"] {
  color-scheme: light;
  --page: #ffffff;
  --sidebar: #f6f8fa;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-soft: #f6f8fa;
  --surface-muted: #eef1f4;
  --border: #d1d9e0;
  --border-strong: #afb8c1;
  --text: #1f2328;
  --muted: #59636e;
  --subtle: #818b98;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --accent-soft: rgba(9, 105, 218, .09);
  --button-bg: #1f883d;
  --button-bg-hover: #1a7f37;
  --button-text: #ffffff;
  --hover: #f6f8fa;
  --field: #ffffff;
  --success: #1a7f37;
  --success-soft: rgba(31, 136, 61, .09);
  --warning: #9a6700;
  --warning-soft: rgba(191, 135, 0, .11);
  --danger: #cf222e;
  --danger-soft: rgba(207, 34, 46, .08);
  --shadow: 0 8px 24px rgba(31, 35, 40, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
::selection { background: var(--accent-soft); }

/* App frame and navigation */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}
.sidebar {
  min-height: 100vh;
  padding: 22px 16px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 9px 27px;
  text-decoration: none;
  color: var(--text);
}
.brand-monogram {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
  font-size: 17px;
  letter-spacing: -1.5px;
  line-height: 1;
  border-radius: 7px;
  background: var(--surface-raised);
}
.brand-name { font-size: 18px; font-weight: 650; letter-spacing: -.45px; }
.side-nav { display: grid; gap: 3px; }
.nav-link {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 10px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.nav-link:hover { color: var(--text); background: var(--hover); }
.nav-link.active {
  color: var(--text);
  background: var(--surface-muted);
  border-color: var(--border);
  font-weight: 600;
}
.nav-icon { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: 0 0 auto; }
.nav-link.active .nav-icon { color: var(--accent); }
.nav-icon svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-divider { height: 1px; background: var(--border); margin: 12px 4px; }
.sidebar-bottom { margin-top: auto; padding: 14px 4px 0; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}
.user-meta { min-width: 0; flex: 1; display: grid; gap: 1px; }
.user-meta b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--muted); font-size: 12px; }
.logout-button {
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
}
.logout-button:hover { color: var(--text); background: var(--hover); border-color: var(--border); }
.main-panel { min-width: 0; }
.topbar {
  min-height: 76px;
  padding: 14px clamp(22px, 3.2vw, 46px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
}
.topbar-heading { min-width: 0; }
.clock-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}
.clock-separator { color: var(--subtle); }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.25px; line-height: 1.3; }
.topbar-account { color: var(--muted); font-size: 13px; }
.content-area { width: min(1500px, 100%); margin: 0 auto; padding: 28px clamp(22px, 3.2vw, 46px) 56px; }

/* Page headings and dashboard metrics */
.page-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 25px; margin: 0 0 24px; }
.page-intro h2, .detail-header h2 {
  font-size: clamp(23px, 2.4vw, 28px);
  line-height: 1.25;
  letter-spacing: -.55px;
  font-weight: 600;
  margin: 0 0 5px;
}
.page-intro p, .detail-header p { color: var(--muted); margin: 0; font-size: 14px; max-width: 720px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 34px; }
.metric-card {
  min-height: 122px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 0 rgba(255,255,255,.025) inset;
}
.metric-card:first-child { border-top: 2px solid var(--accent); padding-top: 15px; }
.metric-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.metric-value { font-size: 32px; line-height: 1.05; letter-spacing: -.9px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric-note { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--subtle); }
.status-dot.healthy { background: var(--success); }
.status-dot.warning { background: var(--warning); }
.status-dot.expired { background: var(--danger); }
.section-block { margin-top: 32px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 11px; }
.section-heading h2 { margin: 0 0 3px; font-size: 17px; letter-spacing: -.15px; font-weight: 600; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.muted-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.surface { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }

/* Tables, search and labels */
.table-toolbar { display: flex; gap: 9px; padding: 12px; align-items: center; border-bottom: 1px solid var(--border); }
.search-input {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 180px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--muted);
}
.search-input input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 13px; }
.search-input input::placeholder { color: var(--subtle); }
.table-toolbar select, .field input, .field select, .field textarea, .user-controls select {
  width: 100%;
  min-height: 39px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
  font-size: 14px;
}
.table-toolbar select { width: 160px; }
.field input:focus, .field select:focus, .field textarea:focus, .search-input:focus-within, .table-toolbar select:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
}
.field input[readonly] { color: var(--muted); background: var(--surface-soft); }
.table-scroll { overflow-x: auto; width: 100%; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  background: var(--surface-soft);
  letter-spacing: .01em;
}
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--hover); }
.clickable-row { cursor: pointer; }
.clickable-row:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.primary-cell { font-weight: 600; min-width: 150px; }
.primary-cell small, .table-subline { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.cell-muted { color: var(--muted); }
.status-label {
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface-muted);
  color: var(--muted);
}
.status-label.healthy { color: var(--success); background: var(--success-soft); }
.status-label.warning, .status-label.critical { color: var(--warning); background: var(--warning-soft); }
.status-label.expired, .status-label.error { color: var(--danger); background: var(--danger-soft); }
.status-label.unknown { color: var(--muted); }
.source-label { display: inline-flex; align-items: center; border-radius: 999px; background: var(--surface-muted); color: var(--muted); padding: 3px 9px; font-size: 12px; white-space: nowrap; }
.empty-state { padding: 36px 22px; text-align: center; }
.empty-state h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.empty-state p { max-width: 520px; margin: 0 auto 16px; color: var(--muted); font-size: 14px; }
.dashboard-footnote { margin-top: 15px; color: var(--muted); font-size: 12px; }

/* Buttons and links */
.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}
.button:hover { background: var(--hover); border-color: var(--border-strong); }
.button-primary { background: var(--button-bg); border-color: rgba(240,246,252,.1); color: var(--button-text); }
.button-primary:hover { background: var(--button-bg-hover); border-color: rgba(240,246,252,.12); }
.button-secondary { background: var(--surface-raised); }
.button-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 38%, var(--border)); }
.button-danger:hover { background: var(--danger-soft); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.text-link, .text-link-line a { color: var(--accent); font-size: 13px; text-decoration: none; }
.text-link:hover, .text-link-line a:hover { text-decoration: underline; }

/* Forms */
.form-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.form-card { padding: 20px; }
.form-card-heading { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.form-number { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; font-weight: 600; background: var(--surface-soft); }
.form-card-heading h3 { margin: 0 0 2px; font-size: 16px; font-weight: 600; }
.form-card-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.form-stack { display: grid; gap: 15px; }
.field { display: grid; gap: 6px; min-width: 0; font-size: 13px; font-weight: 600; }
.field small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.5; }
.field textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
.field input[type=file] { padding: 7px; }
.field input[type=checkbox], .toggle-row input, .check-label input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.form-hint { margin: 13px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.form-hint code { color: var(--text); overflow-wrap: anywhere; }
.form-card > .form-hint { border-top: 1px solid var(--border); padding-top: 14px; }

/* Certificate and host details */
.detail-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; }
.back-link { display: inline-block; color: var(--accent); text-decoration: none; font-size: 13px; margin-bottom: 10px; }
.back-link:hover { text-decoration: underline; }
.detail-header-actions { display: flex; gap: 8px; }
.detail-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 18px; }
.detail-summary > div { min-width: 0; display: grid; align-content: start; gap: 7px; }
.detail-summary strong { font-size: 14px; overflow-wrap: anywhere; }
.detail-label { color: var(--muted); font-size: 12px; }
.detail-big { font-size: 29px !important; line-height: 1; }
.detail-big + small { color: var(--muted); font-size: 12px; margin-top: -4px; }
.inside-heading { margin: 0 0 17px; }
.facts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; padding: 5px 18px; }
.facts-grid > div { min-width: 0; display: grid; gap: 5px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.facts-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
.facts-grid small { color: var(--muted); font-size: 12px; }
.facts-grid strong { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px !important; }
.wrap-anywhere { overflow-wrap: anywhere; }
.inline-message { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--muted); font-size: 13px; background: var(--surface-soft); }
.detail-footer-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.detail-footer-actions form { margin: 0; }

/* Automations and activity */
.coming-soon { padding: clamp(28px, 5vw, 52px); text-align: center; }
.coming-mark { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; margin: 0 auto 17px; font-size: 22px; background: var(--surface-soft); }
.coming-soon h2 { margin: 0 0 7px; font-size: 20px; font-weight: 600; }
.coming-soon p { max-width: 600px; margin: 0 auto; color: var(--muted); font-size: 14px; }
.coming-list { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.coming-list span { border: 1px solid var(--border); border-radius: 999px; padding: 5px 10px; color: var(--muted); font-size: 12px; background: var(--surface-soft); }
.event-list { padding: 4px 18px; }
.event-row { display: grid; grid-template-columns: 108px 9px minmax(0, 1fr); align-items: start; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.event-row:last-child { border-bottom: 0; }
.event-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.event-time small { display: block; margin-top: 2px; color: var(--subtle); }
.event-indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--subtle); margin-top: 6px; }
.event-indicator.success { background: var(--success); }
.event-indicator.warning { background: var(--warning); }
.event-indicator.error { background: var(--danger); }
.event-content { display: grid; gap: 3px; min-width: 0; }
.event-content strong { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.event-content small { color: var(--muted); font-size: 12px; }

/* Settings, users and account */
.settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 22px; align-items: start; }
.settings-nav { position: sticky; top: 20px; display: grid; gap: 5px; padding: 8px 0; }
.settings-nav strong { font-size: 12px; color: var(--muted); margin: 10px 10px 2px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.settings-nav a { color: var(--muted); text-decoration: none; font-size: 13px; padding: 7px 10px; border-radius: var(--radius); }
.settings-nav a:hover { background: var(--hover); color: var(--text); }
.settings-content { min-width: 0; }
.settings-section { scroll-margin-top: 20px; }
.toggle-list { margin-top: 16px; border-top: 1px solid var(--border); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; min-height: 62px; border-bottom: 1px solid var(--border); cursor: pointer; }
.toggle-row span { display: grid; gap: 3px; }
.toggle-row b { font-size: 14px; font-weight: 600; }
.toggle-row small { color: var(--muted); font-size: 12px; }
.toggle-row input { flex: 0 0 auto; }
.test-email-card { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.test-email-card h3 { margin: 0 0 4px; font-size: 15px; }
.test-email-card p { margin: 0; color: var(--muted); font-size: 13px; }
.test-email-card form { flex: 0 0 auto; }
.text-link-line { margin: 16px 0 0; }
.user-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: 0; }
.user-ident { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 175px; }
.user-ident > div { min-width: 0; display: grid; gap: 3px; }
.user-ident strong { font-size: 14px; overflow-wrap: anywhere; }
.user-ident small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.user-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.user-controls select { width: auto; min-width: 145px; }
.check-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; font-size: 12px; }
.theme-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.theme-option { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface-raised); }
.theme-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-option input { accent-color: var(--accent); }
.theme-option b { font-size: 14px; }
.theme-option small { color: var(--muted); font-size: 12px; }
.theme-swatch { height: 74px; border-radius: 4px; border: 1px solid var(--border); padding: 9px; display: flex; gap: 6px; align-items: flex-start; }
.theme-swatch i { display: block; height: 7px; width: 24%; border-radius: 2px; }
.theme-dark { background: #0d1117; }
.theme-dark i { background: #e6edf3; }
.theme-light { background: #ffffff; }
.theme-light i { background: #1f2328; }

/* Notifications and authentication */
.flash { padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 14px; background: var(--surface-raised); }
.flash-success { color: var(--success); }
.flash-warning { color: var(--warning); }
.flash-error { color: var(--danger); }
.flash-close { border: 0; background: transparent; color: inherit; font-size: 20px; cursor: pointer; }
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 80px 20px 30px; position: relative; }
.auth-brand { position: absolute; top: 25px; left: 28px; padding: 0; }
.auth-card { width: min(440px, 100%); padding: 28px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-raised); box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 6px; font-size: 23px; letter-spacing: -.35px; font-weight: 600; }
.auth-card > p { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.auth-card .form-stack { gap: 16px; }
.auth-card .button { width: 100%; }
.button-full { width: 100%; }
.auth-or { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.auth-or::before, .auth-or::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.auth-flash { position: absolute; top: 20px; width: min(440px, calc(100% - 40px)); }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 218px minmax(0, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-row { align-items: flex-start; flex-wrap: wrap; }
  .user-ident { flex-basis: 100%; }
  .user-controls { flex: 1; }
}
@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar {
    min-height: auto;
    padding: 12px 16px 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
  }
  .brand { padding: 0 0 9px; flex: 1; min-width: 150px; }
  .brand-monogram { width: 30px; height: 30px; }
  .brand-name { font-size: 17px; }
  .side-nav { order: 3; flex-basis: 100%; display: flex; gap: 3px; overflow-x: auto; padding: 0 0 9px; scrollbar-width: thin; }
  .nav-link { flex: 0 0 auto; min-height: 36px; padding: 0 9px; font-size: 13px; gap: 7px; }
  .nav-icon { width: 16px; height: 16px; }
  .nav-icon svg { width: 15px; height: 15px; }
  .nav-divider { width: 1px; height: 22px; margin: 6px 4px; flex: 0 0 1px; }
  .sidebar-bottom { margin: 0 0 9px auto; padding: 0; border: 0; }
  .user-meta { display: none; }
  .topbar { min-height: 70px; padding: 13px 22px; }
  .content-area { padding: 23px 22px 44px; }
  .settings-layout { grid-template-columns: 1fr; gap: 8px; }
  .settings-nav { position: static; display: flex; flex-wrap: wrap; gap: 5px; padding: 0 0 8px; }
  .settings-nav strong { width: 100%; margin: 8px 0 0; }
  .settings-nav a { padding: 6px 8px; border: 1px solid var(--border); }
}
@media (max-width: 650px) {
  .content-area { padding: 19px 14px 36px; }
  .topbar { padding: 12px 14px; }
  .topbar h1 { font-size: 18px; }
  .clock-line { font-size: 11px; }
  .topbar-account { display: none; }
  .page-intro, .detail-header { display: flex; align-items: flex-start; flex-direction: column; gap: 14px; }
  .page-intro .button { width: 100%; }
  .page-intro h2, .detail-header h2 { font-size: 23px; }
  .metric-grid { gap: 9px; margin-bottom: 27px; }
  .metric-card { min-height: 108px; padding: 13px; }
  .metric-card:first-child { padding-top: 12px; }
  .metric-label { font-size: 12px; }
  .metric-value { font-size: 28px; }
  .metric-note { font-size: 11px; }
  .section-block { margin-top: 26px; }
  .section-heading { align-items: flex-start; }
  .section-heading h2 { font-size: 16px; }
  .table-toolbar { flex-wrap: wrap; padding: 10px; }
  .search-input { flex-basis: 100%; }
  .table-toolbar select { flex: 1; width: auto; }
  .data-table th, .data-table td { padding: 11px 10px; }
  .data-table { font-size: 13px; }
  .form-columns, .form-grid, .detail-summary, .facts-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .form-card { padding: 16px; }
  .detail-summary { gap: 13px; }
  .facts-grid > div:nth-last-child(2) { border-bottom: 1px solid var(--border); }
  .detail-header-actions, .detail-header-actions .button { width: 100%; }
  .detail-footer-actions { justify-content: stretch; }
  .detail-footer-actions form, .detail-footer-actions .button { width: 100%; }
  .test-email-card { align-items: flex-start; flex-direction: column; }
  .test-email-card form, .test-email-card .button { width: 100%; }
  .user-controls { width: 100%; }
  .user-controls select { flex: 1; }
  .event-row { grid-template-columns: 82px 8px minmax(0, 1fr); gap: 9px; }
  .theme-options { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 22px 18px; }
  .auth-brand { left: 15px; top: 15px; }
}
@media (max-width: 390px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: 11px; }
  .metric-note { font-size: 10px; }
  .brand-name { font-size: 16px; }
  .nav-link { gap: 6px; padding: 0 7px; font-size: 12px; }
}
