/* ============================================================
   SiteCrawler — theme tokens & global
   ============================================================ */
:root {
  --bg:          #0f1117;
  --surface:     #1a1d27;
  --surface-2:   #21242f;
  --surface-3:   #272b38;
  --border:      #272b38;
  --border-soft: #20232e;
  --text:        #e6e8ee;
  --text-dim:    #8b91a3;
  --text-faint:  #5b6072;

  --accent:      #4f8ef7;
  --accent-dim:  rgba(79, 142, 247, 0.14);
  --accent-bord: rgba(79, 142, 247, 0.45);

  /* status palette */
  --ok:      #3fb950;  --ok-bg:     rgba(63, 185, 80, 0.13);
  --redir:   #e3873c;  --redir-bg:  rgba(227, 135, 60, 0.13);
  --notfound:#f85149;  --notfound-bg:rgba(248, 81, 73, 0.13);
  --server:  #a371f7;  --server-bg: rgba(163, 113, 247, 0.14);
  --neterr:  #8b91a3;  --neterr-bg: rgba(139, 145, 163, 0.13);

  --row-404: rgba(248, 81, 73, 0.05);
  --row-3xx: rgba(227, 135, 60, 0.05);

  --radius:   10px;
  --radius-sm: 7px;
  --shadow:   0 10px 30px -12px rgba(0,0,0,0.6);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,0.7);

  --sidebar-w: 220px;

  --font-ui:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --t: 200ms ease;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-dim); }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #2c303d; border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: #3a3f4f; }

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--font-mono); }

/* ============================================================
   App shell
   ============================================================ */
.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  height: 100vh;
  z-index: 60;
  transition: transform var(--t);
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
}
.sidebar__brand-mark {
  width: 30px; height: 30px; flex: 0 0 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-bord);
}
.sidebar__brand-mark svg { width: 18px; height: 18px; }
.sidebar__brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.sidebar__brand-tag { font-size: 10.5px; color: var(--text-faint); margin-top: -2px; letter-spacing: 0.02em; }

.sidebar__new {
  margin: 4px 14px 14px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 12px;
  background: var(--accent);
  color: #07111f;
  font-weight: 600; font-size: 13px;
  border: none; border-radius: var(--radius-sm);
  transition: filter var(--t), transform var(--t);
}
.sidebar__new:hover { filter: brightness(1.08); }
.sidebar__new:active { transform: translateY(1px); }
.sidebar__new svg { width: 15px; height: 15px; }

.sidebar__section-label {
  padding: 6px 18px;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint);
}
.sidebar__projects { flex: 1 1 auto; overflow-y: auto; padding: 2px 8px 12px; }

.proj-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px 8px 12px;
  border: none; background: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  margin-bottom: 2px;
  transition: background var(--t);
}
.proj-item:hover { background: var(--surface-2); }
.proj-item.is-active { background: var(--surface-2); border-left-color: var(--accent); }
.proj-item__top { display: flex; align-items: center; gap: 8px; }
.proj-item__name { font-size: 13px; font-weight: 550; color: var(--text); flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-item__domain { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); margin-left: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar__footer {
  border-top: 1px solid var(--border);
  padding: 11px 18px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; color: var(--text-faint);
}
.sidebar__footer a { color: var(--text-dim); display: inline-flex; align-items: center; gap: 5px; }
.sidebar__footer a:hover { color: var(--accent); }
.sidebar__footer svg { width: 13px; height: 13px; }

/* status dot */
.dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; position: relative; }
.dot--idle    { background: var(--neterr); }
.dot--done    { background: var(--accent); }
.dot--error   { background: var(--notfound); }
.dot--running { background: var(--ok); }
.dot--running::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  background: var(--ok); opacity: 0.5;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(0.7); opacity: 0.55; }
  70%  { transform: scale(2.4); opacity: 0; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* ---------- Content ---------- */
.content {
  flex: 1 1 auto;
  margin-left: var(--sidebar-w);
  min-width: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.view { padding: 30px 36px 60px; animation: viewIn 240ms ease; flex: 1; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.view-title { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; margin: 0; }
.view-sub { color: var(--text-dim); font-size: 13px; margin-top: 3px; }
.view-sub .mono { color: var(--text-dim); }

/* contextual project tabs */
.ctx { display: flex; align-items: center; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.ctx__tab {
  padding: 9px 14px; background: none; border: none;
  color: var(--text-dim); font-size: 13px; font-weight: 550;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color var(--t);
}
.ctx__tab:hover { color: var(--text); }
.ctx__tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.ctx__count { font-family: var(--font-mono); font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); padding: 1px 6px; border-radius: 20px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  transition: background var(--t), border-color var(--t), filter var(--t), transform var(--t);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn--primary { background: var(--accent); color: #07111f; border-color: transparent; }
.btn--primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn--danger { background: var(--notfound); color: #1b0807; border-color: transparent; }
.btn--danger:hover { filter: brightness(1.07); background: var(--notfound); }
.btn--ghost { background: none; border-color: transparent; color: var(--text-dim); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--sm { padding: 6px 10px; font-size: 12px; }

/* ============================================================
   Status badge
   ============================================================ */
.sbadge {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  padding: 2px 7px; border-radius: 5px; display: inline-block;
  min-width: 38px; text-align: center; line-height: 1.5;
}
.sbadge--ok       { color: var(--ok);       background: var(--ok-bg); }
.sbadge--redir    { color: var(--redir);    background: var(--redir-bg); }
.sbadge--notfound { color: var(--notfound); background: var(--notfound-bg); }
.sbadge--server   { color: var(--server);   background: var(--server-bg); }
.sbadge--neterr   { color: var(--neterr);   background: var(--neterr-bg); }

/* ============================================================
   Cards (home grid)
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.pcard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color var(--t), transform var(--t), box-shadow var(--t);
  position: relative; cursor: pointer;
}
.pcard:hover { border-color: #353a4a; transform: translateY(-2px); box-shadow: var(--shadow); }
.pcard__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pcard__name { font-weight: 650; font-size: 15.5px; letter-spacing: -0.01em; }
.pcard__url { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; padding: 3px 9px 3px 8px;
  border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border);
  text-transform: capitalize; white-space: nowrap;
}
.pcard__metrics { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-dim); }
.pcard__metrics .m { display: inline-flex; align-items: center; gap: 5px; }
.pcard__metrics .m b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pcard__metrics .m svg { width: 14px; height: 14px; opacity: 0.8; }
.pcard__foot { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-faint); margin-top: auto; }
.pcard__menu-btn {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid transparent;
  background: none; color: var(--text-dim); display: grid; place-items: center;
  transition: background var(--t), color var(--t);
}
.pcard__menu-btn:hover { background: var(--surface-2); color: var(--text); }
.pcard__menu-btn svg { width: 16px; height: 16px; }

/* progress bar */
.progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress__fill { height: 100%; background: linear-gradient(90deg, var(--accent), #7db0ff); border-radius: 6px; transition: width 400ms ease; }

/* dropdown menu */
.menu {
  position: fixed; z-index: 80; min-width: 180px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 5px; animation: viewIn 120ms ease;
}
.menu__item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 9px; border: none; background: none; color: var(--text);
  font-size: 13px; border-radius: 6px; transition: background var(--t);
}
.menu__item:hover { background: var(--surface-3); }
.menu__item svg { width: 15px; height: 15px; color: var(--text-dim); }
.menu__item--danger { color: var(--notfound); }
.menu__item--danger svg { color: var(--notfound); }
.menu__sep { height: 1px; background: var(--border); margin: 4px 2px; }

/* empty state */
.empty { display: grid; place-items: center; text-align: center; padding: 80px 20px; }
.empty__art { width: 96px; height: 96px; margin-bottom: 22px; opacity: 0.9; }
.empty__title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.empty__text { color: var(--text-dim); margin-bottom: 22px; max-width: 360px; }

/* ============================================================
   Forms
   ============================================================ */
.form-wrap { max-width: 600px; margin: 0 auto; }
.field { margin-bottom: 20px; }
.field__label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 7px; color: var(--text); }
.field__hint { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; }
.input {
  width: 100%; padding: 11px 13px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; transition: border-color var(--t), box-shadow var(--t);
}
.input::placeholder { color: var(--text-faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.input--url { font-family: var(--font-mono); font-size: 15px; padding: 14px 42px 14px 14px; }
.input.is-valid { border-color: var(--ok); }
.input.is-invalid { border-color: var(--notfound); }
.input-wrap { position: relative; }
.input-wrap__icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* accordion */
.accordion { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
.accordion__head {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 14px 16px; background: var(--surface); border: none; color: var(--text);
  font-size: 13.5px; font-weight: 600; transition: background var(--t);
}
.accordion__head:hover { background: var(--surface-2); }
.accordion__head svg { width: 16px; height: 16px; transition: transform var(--t); color: var(--text-dim); }
.accordion.is-open .accordion__head svg { transform: rotate(90deg); }
.accordion__body { display: none; padding: 6px 16px 18px; background: var(--surface); border-top: 1px solid var(--border); }
.accordion.is-open .accordion__body { display: block; }

/* slider */
.slider-row { display: flex; align-items: center; gap: 14px; }
.range { flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; background: var(--surface-3); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); cursor: pointer; transition: transform var(--t); }
.range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); cursor: pointer; }
.range-val { font-family: var(--font-mono); font-size: 13px; min-width: 42px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

/* toggle */
.toggle { position: relative; width: 38px; height: 22px; flex: 0 0 38px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__track { position: absolute; inset: 0; background: var(--surface-3); border-radius: 20px; transition: background var(--t); }
.toggle__track::before { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-dim); transition: transform var(--t), background var(--t); }
.toggle input:checked + .toggle__track { background: var(--accent); }
.toggle input:checked + .toggle__track::before { transform: translateX(16px); background: #fff; }

.form-actions { display: flex; gap: 12px; margin-top: 4px; }

/* ============================================================
   Crawl view
   ============================================================ */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.metric {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.metric__label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); display: flex; align-items: center; gap: 7px; }
.metric__label svg { width: 14px; height: 14px; }
.metric__value { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; margin-top: 8px; font-family: var(--font-mono); }
.metric__sub { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }

.crawl-progress { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 22px; }
.crawl-progress__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; font-size: 13px; }
.crawl-progress__pct { font-family: var(--font-mono); font-weight: 700; font-size: 15px; }
.crawl-progress__eta { color: var(--text-dim); }

.crawl-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.panel__head { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.panel__head .mono { color: var(--text-faint); font-weight: 500; }

.feed { height: 340px; overflow-y: auto; padding: 6px; }
.feed__line { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; font-size: 12px; animation: feedIn 300ms ease; }
.feed__line:hover { background: var(--surface-2); }
@keyframes feedIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.feed__url { font-family: var(--font-mono); color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed__time { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }

/* live bar chart */
.barchart { padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 52px 1fr 48px; align-items: center; gap: 10px; }
.bar-row__label { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.bar-track { height: 22px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; transition: width 500ms ease; }
.bar-row__val { font-family: var(--font-mono); font-size: 12px; text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ============================================================
   Results
   ============================================================ */
.stat-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; cursor: pointer; transition: border-color var(--t), background var(--t);
  position: relative;
}
.stat:hover { border-color: #353a4a; }
.stat.is-active { border-color: var(--accent-bord); background: var(--accent-dim); }
.stat__value { font-size: 26px; font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat__label { font-size: 12px; color: var(--text-dim); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.stat__swatch { width: 8px; height: 8px; border-radius: 2px; }

.collapse-toggle { background: none; border: none; color: var(--text-dim); font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.collapse-toggle:hover { color: var(--text); }
.collapse-toggle svg { width: 14px; height: 14px; transition: transform var(--t); }
.collapse-toggle.is-collapsed svg { transform: rotate(-90deg); }

.filters { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 400px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }
.search input { width: 100%; padding: 8px 12px 8px 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; }
.search input:focus { outline: none; border-color: var(--accent); }
.select { padding: 8px 30px 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%238b91a3' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; cursor: pointer; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.scroll-x { overflow-x: auto; }
table.results { width: 100%; border-collapse: collapse; font-size: 13px; }
table.results thead th {
  text-align: left; padding: 11px 14px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint);
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
  position: sticky; top: 0; z-index: 2;
}
table.results tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.results tbody tr { cursor: pointer; transition: background var(--t); }
table.results tbody tr:hover { background: var(--surface-2); }
table.results tbody tr:last-child td { border-bottom: none; }
tr.row--404 { background: var(--row-404); }
tr.row--3xx { background: var(--row-3xx); }
.cell-url { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-title { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-h1 { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-dim); }
.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.depth-chip { font-family: var(--font-mono); font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 7px; border-radius: 5px; color: var(--text-dim); }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-dim); }
.pagination__right { display: flex; align-items: center; gap: 10px; }
.page-size { display: inline-flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px; }
.page-size button { background: none; border: none; color: var(--text-dim); font-size: 12px; padding: 3px 9px; border-radius: 4px; font-family: var(--font-mono); }
.page-size button.is-active { background: var(--accent); color: #07111f; font-weight: 600; }
.pager-btn { width: 28px; height: 28px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; color: var(--text-dim); }
.pager-btn:hover:not(:disabled) { color: var(--text); }
.pager-btn:disabled { opacity: 0.4; cursor: default; }
.pager-btn svg { width: 14px; height: 14px; }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 4px; height: 12px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ============================================================
   Drawer
   ============================================================ */
.drawer-scrim { position: fixed; inset: 0; background: rgba(8,10,15,0.6); z-index: 90; opacity: 0; transition: opacity var(--t); }
.drawer-scrim.is-open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 460px; max-width: 92vw;
  background: var(--surface); border-left: 1px solid var(--border); z-index: 91;
  transform: translateX(100%); transition: transform 260ms cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.drawer.is-open { transform: none; }
.drawer__head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer__close { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); display: grid; place-items: center; flex: 0 0 30px; }
.drawer__close:hover { color: var(--text); background: var(--surface-3); }
.drawer__close svg { width: 16px; height: 16px; }
.drawer__url { font-family: var(--font-mono); font-size: 12.5px; color: var(--text); word-break: break-all; margin-top: 8px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 20px; }
.detail-grid { display: grid; grid-template-columns: 130px 1fr; gap: 0; }
.detail-grid dt { color: var(--text-faint); font-size: 12.5px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.detail-grid dd { margin: 0; font-size: 13px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); word-break: break-word; }
.detail-grid dd.mono { font-family: var(--font-mono); font-size: 12px; }
.redirect-box { margin-top: 18px; padding: 14px; background: var(--redir-bg); border: 1px solid rgba(227,135,60,0.3); border-radius: var(--radius-sm); }
.redirect-box__label { font-size: 11.5px; font-weight: 600; color: var(--redir); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.redirect-box__chain { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 11.5px; }

/* ============================================================
   Export
   ============================================================ */
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 28px; max-width: 760px; }
.exp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; gap: 16px; align-items: flex-start; transition: border-color var(--t); }
.exp-card:hover { border-color: #353a4a; }
.exp-card__icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-dim); border: 1px solid var(--accent-bord); }
.exp-card__icon svg { width: 22px; height: 22px; }
.exp-card__name { font-weight: 650; font-size: 15px; }
.exp-card__desc { color: var(--text-dim); font-size: 12.5px; margin-top: 4px; margin-bottom: 14px; }

.code-block { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; max-width: 900px; }
.code-block__tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--border); background: var(--surface); }
.code-tab { padding: 7px 14px; background: none; border: none; color: var(--text-dim); font-size: 12.5px; font-family: var(--font-mono); border-radius: 6px 6px 0 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.code-tab.is-active { color: var(--text); border-bottom-color: var(--accent); background: var(--bg); }
.code-block__head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--border-soft); }
.code-block__name { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); font-size: 11.5px; padding: 4px 9px; border-radius: 6px; }
.copy-btn:hover { color: var(--text); }
.copy-btn svg { width: 13px; height: 13px; }
/* syntax */
.tok-key { color: #79c0ff; } .tok-str { color: #a5d6a3; } .tok-num { color: #d2a8ff; }
.tok-punc { color: var(--text-faint); } .tok-comment { color: var(--text-faint); font-style: italic; }
.tok-200 { color: var(--ok); } .tok-404 { color: var(--notfound); } .tok-3xx { color: var(--redir); }

/* ============================================================
   Toast + Modal
   ============================================================ */
.toast-root { position: fixed; bottom: 24px; right: 24px; z-index: 120; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 11px; padding: 12px 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: 13px; min-width: 260px;
  animation: toastIn 240ms cubic-bezier(.2,.8,.2,1);
}
.toast.is-out { animation: toastOut 220ms ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
.toast__icon { width: 18px; height: 18px; flex: 0 0 18px; }
.toast__icon--ok { color: var(--ok); }
.toast__icon--info { color: var(--accent); }
.toast__icon--warn { color: var(--redir); }
.toast__close { margin-left: auto; background: none; border: none; color: var(--text-faint); display: grid; place-items: center; }
.toast__close svg { width: 15px; height: 15px; }

.modal-scrim { position: fixed; inset: 0; background: rgba(8,10,15,0.66); z-index: 110; display: grid; place-items: center; opacity: 0; transition: opacity var(--t); padding: 20px; }
.modal-scrim.is-open { opacity: 1; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 420px; max-width: 100%; padding: 24px; box-shadow: var(--shadow-lg); transform: scale(0.96); transition: transform var(--t); }
.modal-scrim.is-open .modal { transform: none; }
.modal__icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--notfound-bg); margin-bottom: 16px; }
.modal__icon svg { width: 22px; height: 22px; color: var(--notfound); }
.modal__title { font-size: 17px; font-weight: 650; margin-bottom: 8px; }
.modal__text { color: var(--text-dim); font-size: 13.5px; margin-bottom: 22px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ============================================================
   Mobile chrome
   ============================================================ */
.hamburger { display: none; position: fixed; top: 14px; left: 14px; z-index: 70; width: 38px; height: 38px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); place-items: center; }
.hamburger svg { width: 18px; height: 18px; }
.scrim-mobile { display: none; position: fixed; inset: 0; background: rgba(8,10,15,0.6); z-index: 55; }
.scrim-mobile.is-open { display: block; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1279px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-row { grid-template-columns: repeat(3, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .crawl-cols { grid-template-columns: 1fr; }
  .col-title, .col-h1 { display: none; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: none; }
  .content { margin-left: 0; }
  .hamburger { display: grid; }
  .view { padding: 60px 28px 60px; }
}
@media (max-width: 767px) {
  .card-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .export-grid { grid-template-columns: 1fr; }
  .col-time-extra, .col-depth, .col-discovered { display: none; }
  .view { padding: 60px 16px 50px; }
  .view-head { flex-direction: column; }
}

/* ============================================================
   Sidebar account block
   ============================================================ */
.sidebar__nav { padding: 4px 8px; }
.sidebar__nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 10px 8px 12px; border: none; background: none; color: var(--text-dim);
  border-radius: var(--radius-sm); border-left: 2px solid transparent; font-size: 13px; font-weight: 550;
  transition: background var(--t), color var(--t);
}
.sidebar__nav-item:hover { background: var(--surface-2); color: var(--text); }
.sidebar__nav-item.is-active { background: var(--surface-2); color: var(--text); border-left-color: var(--accent); }
.sidebar__nav-item svg { width: 16px; height: 16px; }
.account {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-top: 1px solid var(--border); margin-top: 4px;
}
.account__name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account__role { font-size: 10.5px; color: var(--text-faint); }
.account__logout { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--text-faint); display: grid; place-items: center; transition: background var(--t), color var(--t); }
.account__logout:hover { background: var(--surface-2); color: var(--notfound); }
.account__logout svg { width: 15px; height: 15px; }
.avatar {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; font-family: var(--font-ui);
  background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-bord);
}

/* ============================================================
   Admin
   ============================================================ */
.admin-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.admin-bar__title { font-size: 14px; font-weight: 600; }
.user-cell { display: flex; align-items: center; gap: 11px; }
.user-cell__name { font-weight: 600; font-size: 13.5px; }
.user-cell__mail { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }
.you-tag { font-family: var(--font-ui); font-size: 10px; font-weight: 600; background: var(--accent-dim); color: var(--accent); padding: 1px 6px; border-radius: 10px; vertical-align: middle; margin-left: 4px; }
.role-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 6px; border: 1px solid var(--border);
}
.role-badge svg { width: 13px; height: 13px; }
.role-badge--admin  { color: var(--accent); background: var(--accent-dim); border-color: var(--accent-bord); }
.role-badge--editor { color: var(--ok); background: var(--ok-bg); border-color: rgba(63,185,80,0.3); }
.role-badge--viewer { color: var(--text-dim); background: var(--surface-2); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.settings-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.settings-card__head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.settings-card__head > svg { width: 20px; height: 20px; flex: 0 0 20px; color: var(--accent); margin-top: 1px; }
.settings-card__title { font-weight: 650; font-size: 14.5px; }
.settings-card__desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.setting-row__label { font-size: 13px; font-weight: 550; }
.setting-row__desc { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

.usage-list { display: flex; flex-direction: column; gap: 16px; }
.usage-item__top { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; margin-bottom: 7px; }
.plan-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--border); }

.key-list { display: flex; flex-direction: column; gap: 10px; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.key-row__name { font-weight: 600; font-size: 13px; }
.key-row__token { font-size: 12px; color: var(--accent); margin-top: 3px; }
.key-row__meta { font-size: 11px; color: var(--text-faint); margin-top: 3px; }

@media (max-width: 1023px) { .settings-grid { grid-template-columns: 1fr; } }
