/* TrackKeywords design system — inspired by modern rank-tracking SaaS layouts,
   implemented from scratch. No third-party brand assets are used. */

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --surface-3: #f1f5f9;
  --border: #e4e9f0;
  --border-strong: #cfd8e3;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #7c8a9e;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eaf1ff;
  --green: #0e9f6e;
  --green-soft: #e6f7f1;
  --red: #e02424;
  --red-soft: #fdecec;
  --amber: #b45309;
  --amber-soft: #fff5e6;
  --violet: #6d28d9;
  --violet-soft: #f1ebff;
  --nav: #0d1728;
  --nav-2: #142138;
  --nav-text: #a9b6c9;
  --nav-active: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.16);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 244px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
p { margin: 0 0 10px; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
button { cursor: pointer; }
img { max-width: 100%; }
::selection { background: #cfe0ff; }

/* Layout ------------------------------------------------------------------ */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: linear-gradient(180deg, var(--nav), #0a1220);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  z-index: 40;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #3b82f6, #22c55e);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.03em;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.brand small { display: block; font-size: 10px; font-weight: 500; color: #8ea0ba; letter-spacing: 0.06em; text-transform: uppercase; }
.nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 18px;
  scrollbar-width: thin;
}
.nav-group { margin: 14px 0 4px; padding: 0 10px; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #64748b; font-weight: 650; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin: 2px 0;
  border-radius: 8px;
  color: var(--nav-text);
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav a.active { background: rgba(59, 130, 246, 0.18); color: var(--nav-active); }
.nav a.active .icon { color: #60a5fa; }
.nav .icon { width: 18px; height: 18px; flex: 0 0 18px; color: #7f92ab; }
.nav .badge-count { margin-left: auto; background: rgba(255, 255, 255, 0.1); color: #cbd5e1; border-radius: 99px; padding: 1px 7px; font-size: 10.5px; }
.sidebar-foot { padding: 12px 14px 16px; border-top: 1px solid rgba(255, 255, 255, 0.07); font-size: 11px; color: #6f819b; }
.sidebar-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: 6px; }

.main-wrap { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
.topbar-sub { color: var(--text-3); font-size: 12.5px; }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 9px; padding: 5px 8px 5px 5px; border-radius: 99px; border: 1px solid var(--border); background: #fff; color: var(--text-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; }
.user-pop { position: relative; }
.user-menu { position: absolute; right: 0; top: 42px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 190px; padding: 6px; display: none; }
.user-menu.open { display: block; }
.user-menu a, .user-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 7px; color: var(--text-2); font-size: 13px; }
.user-menu a:hover, .user-menu button:hover { background: var(--surface-3); color: var(--text); }
.menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; width: 36px; height: 36px; align-items: center; justify-content: center; }
.content { padding: 24px; max-width: 1560px; width: 100%; margin: 0 auto; flex: 1; }

.overlay { position: fixed; inset: 0; background: rgba(8, 15, 28, 0.45); z-index: 35; display: none; }
.overlay.show { display: block; }

/* Typography helpers ------------------------------------------------------ */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; }
.page-sub { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title { font-size: 15px; font-weight: 650; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 13px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
  color: var(--text);
  background: #fff;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3); }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-secondary { border-color: var(--border-strong); background: #fff; color: var(--text-2); }
.btn-secondary:hover { background: var(--surface-3); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.btn-xs { padding: 3px 7px; font-size: 11px; border-radius: 6px; }
.btn[disabled], .btn.disabled { opacity: 0.55; pointer-events: none; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: 13px; }

/* Cards ------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-body { padding: 18px; }
.card-head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 14px; font-weight: 650; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

/* KPI cards --------------------------------------------------------------- */
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi-label { color: var(--text-3); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin: 7px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-meta { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.kpi-icon { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.kpi.green .kpi-icon { background: var(--green-soft); color: var(--green); }
.kpi.amber .kpi-icon { background: var(--amber-soft); color: var(--amber); }
.kpi.violet .kpi-icon { background: var(--violet-soft); color: var(--violet); }

/* Badges ------------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 650; line-height: 1.6; white-space: nowrap; }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-blue { background: var(--accent-soft); color: var(--accent); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pos { display: inline-flex; min-width: 30px; justify-content: center; padding: 1px 6px; border-radius: 6px; font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.pos-top3 { background: #d9f7ea; color: #066e4b; }
.pos-top10 { background: #e3efff; color: #1d4ed8; }
.pos-top20 { background: #e7f8fa; color: #0e7490; }
.pos-top50 { background: #fff5e0; color: #92400e; }
.pos-top100 { background: #f1f5f9; color: #475569; }
.pos-none { background: #f3f4f6; color: #94a3b8; }
.change-up { color: var(--green); font-weight: 650; }
.change-down { color: var(--red); font-weight: 650; }
.change-same { color: var(--text-3); }
.change-new { color: var(--violet); font-weight: 650; }
.change-lost { color: var(--red); font-weight: 650; }

/* Tables ------------------------------------------------------------------ */
.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 720px; }
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
table.data tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fbfcfe; }
table.data tbody tr.selected { background: #eff5ff; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .kw { font-weight: 550; max-width: 360px; }
.table-empty { padding: 42px 18px; text-align: center; color: var(--text-3); }
.table-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }

/* Forms ------------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field .hint { margin-top: 4px; font-size: 11.5px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 36px;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.textarea { min-height: 90px; resize: vertical; }
.input-sm { padding: 5px 8px; min-height: 30px; font-size: 12.5px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.checkbox input { margin-top: 2px; accent-color: var(--accent); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.search { position: relative; }
.search input { padding-left: 32px; min-width: 210px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 15px; height: 15px; }
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 8px; padding: 2px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.segmented button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* Tabs -------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { padding: 9px 13px; border: 0; background: none; color: var(--text-3); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .active { color: var(--accent); border-bottom-color: var(--accent); }

/* Modals ------------------------------------------------------------------ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 15, 28, 0.5); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: modal-in 0.16s ease-out; }
.modal-lg { max-width: 820px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title { font-size: 16px; font-weight: 650; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 14px 14px; }
.modal-close { background: none; border: 0; color: var(--text-3); font-size: 20px; line-height: 1; padding: 4px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Toasts ------------------------------------------------------------------ */
#toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast { background: #0f172a; color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; animation: toast-in 0.18s ease-out; }
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }
.toast.warn { background: #92400e; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Charts ------------------------------------------------------------------ */
.chart-card { padding: 16px 18px 10px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.chart-title { font-weight: 650; font-size: 14px; }
.chart-sub { color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 190px; }
.chart-box.lg { height: 320px; }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--text-3); font-size: 12.5px; }

/* Project / keyword specifics --------------------------------------------- */
.kw-device-cell { display: flex; align-items: center; gap: 8px; }
.device-label { color: var(--text-3); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; width: 44px; }
.kw-actions { display: flex; gap: 5px; opacity: 0.55; }
tr:hover .kw-actions { opacity: 1; }
.url-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-cell a { color: var(--text-2); }
.history-table td { min-width: 58px; text-align: center; }
.history-table td:first-child { text-align: left; min-width: 220px; }
.dot-status { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-ok { background: var(--green); }
.dot-not_found { background: var(--red); }
.dot-error { background: var(--amber); }
.dot-no_data { background: #cbd5e1; }

/* Clients / projects grid ------------------------------------------------- */
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.entity-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: border-color 0.15s, box-shadow 0.15s; }
.entity-card:hover { border-color: #cbd8e8; box-shadow: var(--shadow); }
.entity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.entity-name { font-weight: 650; font-size: 14.5px; }
.entity-sub { color: var(--text-3); font-size: 12px; }
.entity-stats { display: flex; gap: 16px; border-top: 1px solid var(--border); padding-top: 10px; }
.entity-stat { font-size: 11.5px; color: var(--text-3); }
.entity-stat b { display: block; font-size: 15px; color: var(--text); font-weight: 650; }

/* Empty / loading --------------------------------------------------------- */
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); color: var(--text-3); display: grid; place-items: center; margin: 0 auto 12px; }
.empty h3 { font-size: 15px; color: var(--text-2); margin-bottom: 4px; }
.empty p { font-size: 12.5px; max-width: 420px; margin: 0 auto 14px; }
.skeleton { border-radius: 8px; background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; }
.skeleton-row { height: 44px; margin-bottom: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
.spinner.dark { border-color: rgba(15, 23, 42, 0.15); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Misc -------------------------------------------------------------------- */
.alert { padding: 12px 14px; border-radius: 9px; font-size: 13px; border: 1px solid; }
.alert-info { background: var(--accent-soft); border-color: #c7dbff; color: #1e40af; }
.alert-warn { background: var(--amber-soft); border-color: #fde3b3; color: #92400e; }
.alert-error { background: var(--red-soft); border-color: #f7c9c9; color: #991b1b; }
.alert-success { background: var(--green-soft); border-color: #b7ebd6; color: #065f46; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.progress { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.progress.green > span { background: var(--green); }
.progress.amber > span { background: var(--amber); }
.progress.red > span { background: var(--red); }
.metric-line { display: flex; align-items: baseline; gap: 8px; }
.metric-line b { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.copy-box { display: flex; gap: 6px; }
.copy-box input { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 5px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; }
.hr-label { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; margin: 18px 0 12px; }
.hr-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Auth & public pages ----------------------------------------------------- */
.auth-body { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 0.95fr; background: #fff; }
.auth-alt { background: linear-gradient(150deg, #0c1628, #12233d 55%, #0c2b3a); color: #dbe7f7; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-alt h1 { color: #fff; font-size: 32px; line-height: 1.15; max-width: 460px; letter-spacing: -0.03em; }
.auth-alt p { color: #9fb2ca; max-width: 430px; }
.auth-points { display: grid; gap: 12px; margin-top: 28px; max-width: 430px; }
.auth-point { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #c3d2e5; }
.auth-point .tick { color: #34d399; font-weight: 700; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 390px; }
.auth-card h2 { font-size: 23px; margin-bottom: 6px; letter-spacing: -0.02em; }
.auth-card .sub { color: var(--text-3); font-size: 13px; margin-bottom: 24px; }
.auth-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; margin-bottom: 28px; }
.auth-foot { color: var(--text-3); font-size: 12px; margin-top: 18px; text-align: center; }
.demo-note { margin-top: 20px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 9px; color: var(--text-3); font-size: 12px; }

.public-body { background: #f4f7fb; }
.public-top { background: #0c1628; color: #fff; padding: 16px 0; }
.public-top-inner { max-width: 1240px; margin: 0 auto; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.public-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.public-project { text-align: right; }
.public-project .name { font-weight: 650; }
.public-project .domain { color: #94a8c2; font-size: 12px; }
.public-main { max-width: 1240px; margin: 0 auto; padding: 22px; }
.public-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.public-badge { font-size: 11px; color: #7e93ad; border: 1px solid rgba(255,255,255,0.16); padding: 3px 8px; border-radius: 99px; }
.public-footer { text-align: center; color: var(--text-3); font-size: 11.5px; padding: 24px; }
.lock-card { max-width: 420px; margin: 12vh auto; }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.open { transform: none; }
  .main-wrap { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px; }
  .topbar { padding: 0 16px; }
  .auth-body { grid-template-columns: 1fr; }
  .auth-alt { display: none; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page-title { font-size: 20px; }
  .kpi-value { font-size: 24px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .table-toolbar { align-items: stretch; }
  .search input { min-width: 0; width: 100%; }
  .modal-backdrop { padding: 3vh 8px 12px; }
  .topbar-sub { display: none; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .content { padding: 14px; }
  .public-main { padding: 14px; }
}
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-wrap { margin-left: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
}
