/* ============================================================
   Kant SEO Manager — Design System
   Light theme · Manrope · deep-blue accent
   ============================================================ */

:root {
  /* — Surfaces (warm near-white) — */
  --bg:        #FAFAF9;
  --bg-sunken: #F4F3F1;
  --surface:   #FFFFFF;
  --surface-2: #FCFCFB;

  /* — Borders / hairlines — */
  --border:        #ECEAE6;
  --border-strong: #DEDBD5;

  /* — Text — */
  --ink:      #1A1916;
  --ink-2:    #514E48;
  --ink-3:    #8A867E;
  --ink-4:    #B4AFA6;

  /* — Brand accent (deep blue) — */
  --accent:        #0F4C8A;
  --accent-hover:  #0C3F73;
  --accent-press:  #093256;
  --accent-soft:   #EAF1F8;
  --accent-softer: #F3F7FB;
  --accent-ink:    #0C3F73;
  --accent-ring:   rgba(15, 76, 138, 0.16);

  /* — Status semantics (the language of the app) — */
  --red:    #D7382E;   --red-soft:    #FCECEA;   --red-ink:    #9E251D;
  --orange: #E0691C;   --orange-soft: #FBEEE2;   --orange-ink: #9A4811;
  --yellow: #C99211;   --yellow-soft: #FAF2DE;   --yellow-ink: #8A6406;
  --green:  #1E9E5A;   --green-soft:  #E6F4EC;   --green-ink:  #137240;
  --blue:   #2563D8;   --blue-soft:   #EAF0FC;   --blue-ink:   #1B49A0;
  --violet: #6B47C9;   --violet-soft: #F0EBFA;   --violet-ink: #4E2FA0;

  /* — Radius — */
  --r-sm: 7px;
  --r:    11px;
  --r-lg: 15px;
  --r-xl: 20px;

  /* — Shadow — */
  --sh-1: 0 1px 2px rgba(28,25,20,.04), 0 1px 1px rgba(28,25,20,.03);
  --sh-2: 0 2px 6px rgba(28,25,20,.05), 0 1px 2px rgba(28,25,20,.04);
  --sh-3: 0 8px 24px rgba(28,25,20,.08), 0 2px 6px rgba(28,25,20,.05);
  --sh-pop: 0 16px 48px rgba(28,25,20,.14), 0 4px 12px rgba(28,25,20,.08);

  --sidebar-w: 244px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 60px;

  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent-ring); }

.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* — Scrollbars — */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb {
  background: #D8D4CD; border-radius: 999px;
  border: 3px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: #C3BEB5; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   App shell
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100%;
  transition: grid-template-columns .2s cubic-bezier(.4,0,.2,1);
}
.app.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* — Window chrome (Electron-style) — */
.winframe {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.titlebar {
  height: 36px; flex: 0 0 36px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: #F1EFEB;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.titlebar .tb-title {
  font-size: 12px; font-weight: 600; color: var(--ink-3);
  letter-spacing: .01em;
}
.win-dots { display: flex; gap: 8px; }
.win-dots i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.win-ctl { display: flex; gap: 18px; color: var(--ink-4); }
.win-ctl svg { width: 13px; height: 13px; }

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sb-brand {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}
.sb-logo {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 30px;
  background: linear-gradient(150deg, var(--accent), #1769b8);
  color: #fff; font-weight: 800; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-2); letter-spacing: -.02em;
}
.sb-wordmark { display: flex; flex-direction: column; line-height: 1.1; white-space: nowrap; }
.sb-wordmark b { font-size: 15px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.sb-wordmark span { font-size: 10.5px; font-weight: 600; color: var(--ink-4); letter-spacing: .04em; text-transform: uppercase; }

.sb-nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.sb-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-4); padding: 14px 10px 6px;
}
.app.collapsed .sb-group-label { opacity: 0; height: 10px; padding: 6px 0; }

.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 13.5px; font-weight: 600;
  border: none; background: transparent; width: 100%; text-align: left;
  position: relative; transition: background .12s, color .12s;
  white-space: nowrap;
}
.sb-item svg { width: 17px; height: 17px; flex: 0 0 17px; stroke-width: 1.75; color: var(--ink-3); transition: color .12s; }
.sb-item:hover { background: var(--bg-sunken); color: var(--ink); }
.sb-item:hover svg { color: var(--ink-2); }
.sb-item.active { background: var(--accent-soft); color: var(--accent-ink); }
.sb-item.active svg { color: var(--accent); }
.sb-item .sb-badge {
  margin-left: auto; font-size: 10.5px; font-weight: 700;
  background: var(--red); color: #fff; border-radius: 999px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
}
.app.collapsed .sb-item span { display: none; }
.app.collapsed .sb-item .sb-badge { position: absolute; top: 3px; right: 4px; margin: 0; transform: scale(.78); }
.app.collapsed .sb-item { justify-content: center; padding: 9px; }

/* ============================================================
   Topbar
   ============================================================ */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: rgba(250,250,249,.82);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}
.tb-collapse {
  width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: transparent; color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
}
.tb-collapse:hover { background: var(--bg-sunken); color: var(--ink); }
.tb-collapse svg { width: 18px; height: 18px; }

.tb-spacer { flex: 1; }
.tb-icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink-2); display: flex; align-items: center; justify-content: center;
  position: relative; transition: background .12s, border-color .12s;
}
.tb-icon-btn:hover { background: var(--bg-sunken); border-color: var(--border-strong); }
.tb-icon-btn svg { width: 18px; height: 18px; }
.tb-icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--red); border: 2px solid var(--surface);
}
.tb-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(140deg,#2c6db0,#0f4c8a); color: #fff;
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}

/* — Site selector — */
.site-sel {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 12px 0 10px; border-radius: var(--r);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-weight: 700; color: var(--ink); font-size: 13.5px;
  transition: box-shadow .12s, border-color .12s;
}
.site-sel:hover { box-shadow: var(--sh-1); border-color: var(--ink-4); }
.site-favicon {
  width: 22px; height: 22px; border-radius: 6px; flex: 0 0 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
}
.site-sel .chev { color: var(--ink-3); margin-left: 2px; }
.site-sel .chev svg { width: 16px; height: 16px; display: block; }

/* — Dropdown menu — */
.menu {
  position: absolute; z-index: 60;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-pop);
  padding: 6px; min-width: 260px;
  animation: pop .14s cubic-bezier(.2,.9,.3,1);
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu-label { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-4); padding: 8px 10px 5px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: var(--r-sm); border: none; background: transparent;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-align: left;
}
.menu-item:hover { background: var(--bg-sunken); color: var(--ink); }
.menu-item.sel { background: var(--accent-soft); color: var(--accent-ink); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ============================================================
   Content area
   ============================================================ */
.canvas { flex: 1; overflow-y: auto; }
.page { max-width: 1320px; margin: 0 auto; padding: 26px 30px 64px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-title { font-size: 23px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.page-sub { font-size: 13.5px; color: var(--ink-3); margin: 3px 0 0; font-weight: 500; }
.page-head .spacer { flex: 1; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.card-head .spacer { flex: 1; }

.section-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-4); margin: 0 0 12px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 700; letter-spacing: -.005em;
  border: 1px solid transparent; transition: background .12s, border-color .12s, box-shadow .12s, transform .04s;
  white-space: nowrap;
}
.btn:active { transform: translateY(.5px); }
.btn svg { width: 16px; height: 16px; stroke-width: 2; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--sh-1); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-press); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-sunken); border-color: var(--ink-4); }
.btn-soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn-soft:hover { background: #DEEAF6; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: var(--r); }
.btn-block { width: 100%; }

.icon-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2);
}
.icon-btn:hover { background: var(--bg-sunken); }
.icon-btn svg { width: 16px; height: 16px; }

/* ============================================================
   Badges / chips / status
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: -.005em;
  white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; stroke-width: 2.25; }
.b-red    { background: var(--red-soft);    color: var(--red-ink); }
.b-orange { background: var(--orange-soft); color: var(--orange-ink); }
.b-yellow { background: var(--yellow-soft); color: var(--yellow-ink); }
.b-green  { background: var(--green-soft);  color: var(--green-ink); }
.b-blue   { background: var(--blue-soft);   color: var(--blue-ink); }
.b-violet { background: var(--violet-soft); color: var(--violet-ink); }
.b-gray   { background: var(--bg-sunken);   color: var(--ink-2); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; display: inline-block; }
.d-red { background: var(--red); } .d-orange { background: var(--orange); }
.d-yellow { background: var(--yellow); } .d-green { background: var(--green); }
.d-blue { background: var(--blue); } .d-gray { background: var(--ink-4); }

.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 800; font-size: 12.5px; }
.delta svg { width: 13px; height: 13px; stroke-width: 2.5; }
.delta.up { color: var(--green-ink); }
.delta.down { color: var(--red-ink); }
.delta.flat { color: var(--ink-4); }

/* — priority bar (left edge color) — */
.prio-bar { width: 3px; border-radius: 999px; align-self: stretch; flex: 0 0 3px; }

/* ============================================================
   Tables
   ============================================================ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-4); padding: 11px 14px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.tbl th.num, .tbl td.num { text-align: right; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--ink); }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tr:last-child td { border-bottom: none; }

/* ============================================================
   Form controls
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 13px;
  border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); font-family: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }

/* — segmented control — */
.seg { display: inline-flex; background: var(--bg-sunken); border-radius: var(--r); padding: 3px; gap: 2px; }
.seg button {
  height: 30px; padding: 0 13px; border: none; background: transparent; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 700; color: var(--ink-3); transition: all .12s;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* — chips (filter) — */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px; transition: all .12s;
}
.chip:hover { border-color: var(--ink-4); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip .cnt { font-size: 11px; opacity: .7; font-weight: 700; }

/* — checkbox — */
.cbx {
  width: 19px; height: 19px; border-radius: 6px; flex: 0 0 19px;
  border: 1.75px solid var(--border-strong); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  transition: all .12s;
}
.cbx.on { background: var(--accent); border-color: var(--accent); }
.cbx svg { width: 12px; height: 12px; stroke-width: 3; opacity: 0; transition: opacity .1s; }
.cbx.on svg { opacity: 1; }

/* — progress — */
.bar { height: 8px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .4s cubic-bezier(.4,0,.2,1); }

/* — tooltip on (?) — */
.help {
  width: 15px; height: 15px; border-radius: 50%; border: 1.4px solid var(--ink-4);
  color: var(--ink-4); font-size: 10px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; cursor: help;
  position: relative; vertical-align: middle;
}
.help:hover { border-color: var(--accent); color: var(--accent); }
.help .tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 500; line-height: 1.4;
  padding: 9px 11px; border-radius: 9px; width: 230px; text-align: left;
  opacity: 0; pointer-events: none; transition: opacity .14s; z-index: 80;
  box-shadow: var(--sh-3);
}
.help:hover .tip { opacity: 1; }
.help .tip::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ink);
}

/* — drawer — */
.scrim { position: fixed; inset: 0; background: rgba(26,25,22,.34); z-index: 100; animation: fade .16s; backdrop-filter: blur(1px); }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 92vw;
  background: var(--bg); border-left: 1px solid var(--border); z-index: 101;
  box-shadow: var(--sh-pop); display: flex; flex-direction: column;
  animation: slidein .26s cubic-bezier(.2,.85,.3,1);
}
@keyframes slidein { from { transform: translateX(100%); } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }

/* — modal — */
.modal {
  position: fixed; z-index: 101; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 540px; max-width: 92vw; background: var(--surface);
  border-radius: var(--r-xl); box-shadow: var(--sh-pop); overflow: hidden;
  animation: pop .18s cubic-bezier(.2,.9,.3,1);
}

/* — empty state — */
.empty { text-align: center; padding: 54px 24px; }
.empty .ic { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.empty .ic svg { width: 26px; height: 26px; }
.empty h3 { margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.empty p { margin: 0 0 18px; color: var(--ink-3); font-size: 13.5px; max-width: 360px; margin-inline: auto; line-height: 1.5; }

/* — metric — */
.metric-num { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.metric-label { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }

.grid { display: grid; gap: 16px; }

/* — spark / chart helpers — */
.spark { display: block; }

/* fade-in for route changes */
.route-fade { animation: rfade .24s ease; }
@keyframes rfade { from { transform: translateY(7px); } }

/* skeleton */
.skel { background: linear-gradient(90deg, #f0eee9 25%, #f7f6f3 37%, #f0eee9 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* stream cursor */
.cursor::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; margin-left: 1px; }
@keyframes blink { 50% { opacity: 0; } }
