/* ==========================================================================
   AI & Plagiarism Report Generator — design system
   Light + dark themes, sidebar shell, component library.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/Inter-var.woff2") format("woff2");
}

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --card-2: #f8fafd;
  --ink: #1b2333;
  --ink-2: #3d465c;
  --muted: #6b7487;
  --line: #e4e8f0;
  --line-2: #eef1f7;
  --primary: #2f5bea;
  --primary-dark: #2448c4;
  --primary-soft: #eef3ff;
  --grad: linear-gradient(135deg, #2f5bea 0%, #6c5ce7 100%);
  --grad-2: linear-gradient(135deg, #2f5bea 0%, #4f8cff 100%);
  --success: #158a4c;
  --success-bg: #e8f7ef;
  --error: #c93030;
  --error-bg: #fdecec;
  --warn: #9a6700;
  --warn-bg: #fff6e0;
  --sidebar-bg: #ffffff;
  --sidebar-ink: #4a5468;
  --shadow-1: 0 1px 2px rgba(16, 23, 40, .04), 0 6px 18px rgba(16, 23, 40, .05);
  --shadow-2: 0 12px 34px rgba(16, 23, 40, .10);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0b1020;
  --card: #121a2e;
  --card-2: #161f37;
  --ink: #e7ecf7;
  --ink-2: #c2cade;
  --muted: #8b96ad;
  --line: #222c46;
  --line-2: #1a2338;
  --primary: #6c8cff;
  --primary-dark: #5a7af5;
  --primary-soft: #172344;
  --success: #4ade80;
  --success-bg: #10291d;
  --error: #f87171;
  --error-bg: #2d1416;
  --warn: #fbbf24;
  --warn-bg: #2b2210;
  --sidebar-bg: #0e1526;
  --sidebar-ink: #9aa6bf;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px rgba(0, 0, 0, .28);
  --shadow-2: 0 16px 40px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(47, 91, 234, .22); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.container { max-width: 1080px; margin: 0 auto; padding: 24px 18px; }

/* ---------------------------------------------------------------- shell -- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 254px;
  flex: 0 0 254px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  z-index: 40;
  overflow-y: auto;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 16px;
  color: var(--ink);
  text-decoration: none;
}
.sb-brand:hover { text-decoration: none; }
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sb-brand-text strong { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.sb-brand-text small { font-size: 11.5px; color: var(--muted); font-weight: 500; }

.brand-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  background: var(--grad);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .4px;
  box-shadow: 0 6px 14px rgba(47, 91, 234, .32);
}
.brand-tile.sm { width: 32px; height: 32px; flex-basis: 32px; font-size: 12px; border-radius: 9px; }

.sb-nav { flex: 1; padding: 4px 12px 12px; }

.sb-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--muted);
  padding: 12px 10px 6px;
}
.sb-label-gap { margin-top: 6px; border-top: 1px solid var(--line-2); padding-top: 16px; }

.sb-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  margin: 1px 0;
  border-radius: 9px;
  color: var(--sidebar-ink);
  font-size: 14px;
  font-weight: 550;
  text-decoration: none;
  transition: background .14s ease, color .14s ease;
}
.sb-link:hover { background: var(--line-2); color: var(--ink); text-decoration: none; }
.sb-link.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 650;
}
.sb-ic { display: inline-flex; opacity: .9; }
.sb-link.is-active .sb-ic { opacity: 1; }

.sb-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--error);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sb-user { border-top: 1px solid var(--line); padding: 12px; }
.sb-user-row { display: flex; align-items: center; gap: 10px; }

.avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sb-user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sb-user-meta strong {
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-user-meta small { font-size: 11.5px; color: var(--muted); }

.sb-actions { display: flex; gap: 4px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn.on-dark { color: var(--muted); }

.ic { display: block; }

[data-theme="light"] .ic-moon { display: none; }
[data-theme="dark"] .ic-sun { display: none; }

.sb-backdrop { display: none; }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.content {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 26px clamp(16px, 3vw, 34px) 40px;
}

.content-footer {
  border-top: 1px solid var(--line);
  padding: 16px clamp(16px, 3vw, 34px);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
.content-footer p { margin: 0; }

.mobilebar { display: none; }

/* logged-out topbar (auth pages) */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 650;
  font-size: 14.5px;
  text-decoration: none;
}
.topbar-brand:hover { text-decoration: none; }
.topbar-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar-nav a { color: var(--ink-2); }
.user-email { color: var(--muted); font-size: 13px; }

/* legacy alias (old brand mark) */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--grad);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .5px;
  box-shadow: 0 8px 18px rgba(47, 91, 234, .3);
}
.credits-pill {
  background: var(--primary-soft);
  border: 1px solid var(--line);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-2);
}
.credits-pill strong { color: var(--primary); }

/* -------------------------------------------------------------- forms --- */

label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; color: var(--ink-2); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
  transition: border-color .14s ease, box-shadow .14s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 91, 234, .15);
}
input:disabled { background: var(--card-2); color: var(--muted); }

/* ------------------------------------------------------------- buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none !important;
  transition: background .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 14px rgba(47, 91, 234, .25);
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: #c7cedd; background: var(--card-2); }
[data-theme="dark"] .btn-secondary:hover { border-color: #33406220; background: var(--card-2); }
.btn-danger { background: var(--error); color: #fff; }
.btn-ghost { color: var(--ink-2); border: 1px solid var(--line); background: transparent; }
.btn-ghost:hover { background: var(--line-2); }
.btn-block { width: 100%; margin-top: 20px; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* -------------------------------------------------------------- alerts --- */

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin: 14px 0;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: rgba(21, 138, 76, .25); }
.alert-error { background: var(--error-bg); color: var(--error); border-color: rgba(201, 48, 48, .25); }
.alert-warning { background: var(--warn-bg); color: var(--warn); border-color: rgba(154, 103, 0, .25); }
.reset-link { margin-top: 8px; word-break: break-all; font-size: 13px; }

/* --------------------------------------------------------------- cards --- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-1);
}
.card h2 { margin: 0 0 4px; font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }
.card .subtitle { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h2 { margin: 0; }
.card-head .view-all {
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 23px; font-weight: 750; letter-spacing: -.02em; }
.page-head p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.grid-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
@media (max-width: 900px) {
  .grid-split { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ stat row --- */

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 18px;
  box-shadow: var(--shadow-1);
  display: flex;
  gap: 13px;
  align-items: flex-start;
}
.stat-ic {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.stat-ic.tint-blue { background: rgba(47, 91, 234, .12); color: var(--primary); }
.stat-ic.tint-green { background: rgba(21, 138, 76, .12); color: var(--success); }
.stat-ic.tint-amber { background: rgba(154, 103, 0, .13); color: var(--warn); }
.stat-ic.tint-violet { background: rgba(108, 92, 231, .13); color: #6c5ce7; }
[data-theme="dark"] .stat-ic.tint-violet { color: #a78bfa; }
.stat-body { min-width: 0; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; }
.stat .value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; line-height: 1.15; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* activity bar chart */
.activity { display: flex; align-items: flex-end; gap: 7px; height: 56px; margin-top: 10px; }
.activity .bar {
  flex: 1;
  min-width: 8px;
  border-radius: 5px 5px 3px 3px;
  background: var(--grad-2);
  opacity: .85;
  min-height: 4px;
  transition: opacity .15s ease;
}
.activity .bar.zero { background: var(--line); opacity: 1; }
.activity .bar:hover { opacity: 1; }
.activity-days { display: flex; gap: 7px; margin-top: 5px; }
.activity-days span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }

/* -------------------------------------------------------- toggle cards --- */

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 13px;
  margin-bottom: 16px;
}
.toggle-card {
  position: relative;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.toggle-card:hover { border-color: #b9c6ec; }
.toggle-card input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-card .tg-ic {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.toggle-card .tg-body { min-width: 0; }
.toggle-card .tg-title { font-size: 13.5px; font-weight: 650; color: var(--ink); display: block; }
.toggle-card .tg-sub { font-size: 11.5px; color: var(--muted); display: block; margin-top: 1px; }
.toggle-card .tg-check {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
}
.toggle-card.is-on {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(47, 91, 234, .13);
}
.toggle-card.is-on .tg-ic { background: var(--grad); border-color: transparent; color: #fff; }
.toggle-card.is-on .tg-check { display: inline-flex; }

/* ------------------------------------------------------------- dropzone -- */

.dropzone {
  border: 2px dashed #c7d0e4;
  border-radius: 13px;
  background: var(--card-2);
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.dropzone:hover { border-color: #9fb2e8; }
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 4px rgba(47, 91, 234, .12);
}
.dropzone .dz-ic {
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dropzone strong { font-size: 15.5px; display: block; }
.dropzone p { margin: 5px 0; color: var(--muted); font-size: 13.5px; }
.dropzone .hint { font-size: 12.5px; }
.dropzone input[type="file"] { display: none; }

.filechip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  margin-top: 12px;
  text-align: left;
}
.filechip .fc-ic {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.filechip .fc-meta { flex: 1; min-width: 0; }
.filechip .fc-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.filechip .fc-size { font-size: 11.5px; color: var(--muted); }
.filechip .fc-x {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: inline-flex;
}
.filechip .fc-x:hover { background: var(--error-bg); color: var(--error); }

.progress-bar {
  height: 8px;
  background: var(--line-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 14px;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--grad-2);
  border-radius: 999px;
  transition: width .4s ease;
  animation: indeterminate 1.4s ease-in-out infinite;
}
@keyframes indeterminate {
  0% { margin-left: -40%; width: 40%; }
  100% { margin-left: 100%; width: 55%; }
}

/* ------------------------------------------------------------- pipeline -- */

.pipeline { list-style: none; margin: 4px 0 0; padding: 0; }
.pipeline li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  position: relative;
}
.pipeline li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 32px;
  bottom: -4px;
  width: 2px;
  background: var(--line);
}
.pipeline .p-dot {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  background: var(--card-2);
  border: 2px solid var(--line);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.pipeline li.is-done .p-dot { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.pipeline li.is-active .p-dot {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  animation: pulse 1.3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 91, 234, .35); }
  50% { box-shadow: 0 0 0 7px rgba(47, 91, 234, 0); }
}
.pipeline .p-label { font-size: 14px; font-weight: 600; padding-top: 3px; color: var(--ink); }
.pipeline li:not(.is-done):not(.is-active) .p-label { color: var(--muted); font-weight: 500; }
.pipeline .p-sub { font-size: 12px; color: var(--muted); display: block; font-weight: 400; }

/* ---------------------------------------------------------------- chips -- */

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2.5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2px;
}
.chip-green { background: var(--success-bg); color: var(--success); }
.chip-amber { background: var(--warn-bg); color: var(--warn); }
.chip-red { background: var(--error-bg); color: var(--error); }
.chip-muted { background: var(--line-2); color: var(--muted); }
.chip-blue { background: var(--primary-soft); color: var(--primary); }

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  background: var(--primary-soft);
  color: var(--primary);
  white-space: nowrap;
}
.type-badge.tb-grey { background: var(--line-2); color: var(--muted); }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-red { background: var(--error-bg); color: var(--error); }
.badge-amber { background: var(--warn-bg); color: var(--warn); }
.badge-grey { background: var(--line-2); color: var(--muted); }

/* --------------------------------------------------------------- tables -- */

table.table { width: 100%; border-collapse: collapse; font-size: 13.8px; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table th {
  background: var(--card-2);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.table th:first-child { border-radius: 8px 0 0 8px; }
.table th:last-child { border-radius: 0 8px 8px 0; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--card-2); }
.table-wrap { overflow-x: auto; }
.table .file-cell { display: flex; align-items: center; gap: 9px; min-width: 180px; }
.table .file-cell .fc-ic {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.table .file-cell .fc-title {
  font-weight: 600;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.row-actions { display: inline-flex; gap: 7px; justify-content: flex-end; flex-wrap: wrap; }

/* ------------------------------------------------------------ pagination -- */

.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 16px; }
.pagination a, .pagination span.cur {
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination span.cur { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination span.gap { border: none; background: transparent; }

/* -------------------------------------------------------------- toolbar -- */

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .search-box { position: relative; flex: 1; min-width: 200px; }
.toolbar .search-box .ic {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.toolbar .search-box input { padding-left: 36px; }
.toolbar select { width: auto; min-width: 130px; }

/* --------------------------------------------------------------- ledger -- */

.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line-2);
}
.ledger li:last-child { border-bottom: none; }
.ledger .lg-dot {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
}
.ledger .lg-dot.pos { background: var(--success-bg); color: var(--success); }
.ledger .lg-dot.neg { background: var(--error-bg); color: var(--error); }
.ledger .lg-meta { flex: 1; min-width: 0; }
.ledger .lg-title { font-size: 13.5px; font-weight: 600; }
.ledger .lg-sub { font-size: 11.5px; color: var(--muted); }
.ledger .lg-delta { font-weight: 750; font-size: 14px; }
.ledger .lg-delta.pos { color: var(--success); }
.ledger .lg-delta.neg { color: var(--error); }
.ledger .lg-bal { font-size: 12px; color: var(--muted); min-width: 86px; text-align: right; }

/* ------------------------------------------------------------------ faq -- */

.faq { display: grid; gap: 10px; }
.faq details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}
.faq summary {
  cursor: pointer;
  padding: 13px 16px;
  font-weight: 650;
  font-size: 14px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-size: 18px;
  font-weight: 500;
  color: var(--muted);
  transition: transform .18s ease;
}
.faq details[open] summary::after { content: "\2212"; }
.faq details[open] summary { color: var(--primary); border-bottom: 1px solid var(--line-2); }
.faq .faq-body { padding: 12px 16px 15px; color: var(--ink-2); font-size: 13.8px; }

/* --------------------------------------------------------------- empty --- */

.empty {
  text-align: center;
  padding: 38px 16px;
  color: var(--muted);
}
.empty .empty-ic {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty strong { display: block; color: var(--ink-2); font-size: 14.5px; margin-bottom: 3px; }
.empty p { margin: 0; font-size: 13px; }

/* --------------------------------------------------------------- toasts -- */

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(360px, calc(100vw - 36px));
}
.toast {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 11px;
  padding: 12px 14px;
  box-shadow: var(--shadow-2);
  font-size: 13.5px;
  animation: toast-in .22s ease;
}
.toast.t-success { border-left-color: var(--success); }
.toast.t-error { border-left-color: var(--error); }
.toast .t-close {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0 0 6px;
  font-size: 16px;
  line-height: 1;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------- auth ---- */

.auth-card {
  max-width: 408px;
  margin: 7vh auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 30px;
  box-shadow: var(--shadow-2);
}
.auth-card h1 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.02em; }
.brand { text-align: center; margin-bottom: 18px; }
.brand h1 { font-size: 18.5px; font-weight: 750; margin: 12px 0 4px; letter-spacing: -.02em; }
.brand p { margin: 0; }
.auth-footer { text-align: center; margin: 16px 0 0; }

/* ------------------------------------------------------------- cred box -- */

.cred-box {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  margin-top: 10px;
}
.cred-box code {
  background: var(--card);
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  font-size: 12.5px;
}

/* --------------------------------------------------------------- misc ---- */

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.actions .btn { flex: 1; min-width: 200px; text-align: center; }

.score-big { font-size: 34px; font-weight: 750; letter-spacing: -.02em; }

.site-footer { border-top: 1px solid var(--line); padding: 18px 0; color: var(--muted); font-size: 13px; }
.site-footer p { margin: 0; }

.section-gap { margin-top: 18px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

.contact-card {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 14px;
}
.contact-card .cc-ic {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.contact-card strong { display: block; font-size: 13.5px; }
.contact-card a, .contact-card span.val { font-size: 13px; color: var(--ink-2); }

.ticket-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line-2);
}
.ticket-row:last-child { border-bottom: none; }
.ticket-row .tr-body { flex: 1; min-width: 0; }
.ticket-row .tr-subject { font-weight: 650; font-size: 14px; }
.ticket-row .tr-msg { font-size: 13px; color: var(--ink-2); margin-top: 3px; white-space: pre-wrap; }
.ticket-row .tr-meta { font-size: 11.5px; color: var(--muted); margin-top: 5px; display: flex; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------------- media --- */

@media (max-width: 1024px) {
  .mobilebar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .mb-brand { display: inline-flex; text-decoration: none; }
  .mb-spacer { flex: 1; }
  .mb-credits {
    margin-left: auto;
    font-size: 12px;
    font-weight: 650;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 999px;
    padding: 4px 10px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-2);
    z-index: 60;
  }
  .sidebar.is-open { transform: translateX(0); }
  .sb-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 26, .5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 50;
  }
  .sidebar.is-open ~ .sb-backdrop,
  .sb-backdrop.is-open { opacity: 1; pointer-events: auto; }
}

@media (max-width: 640px) {
  .auth-card { margin: 4vh auto; padding: 24px 20px; }
  .actions .btn { min-width: 100%; }
  .page-head h1 { font-size: 20px; }
  .ledger .lg-bal { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Scan results: sentence-level analysis (scan_result.php) */
.stat-ic.tint-red { background: rgba(224, 49, 49, .12); color: #e03131; }
[data-theme="dark"] .stat-ic.tint-red { color: #ff8787; }
.sentence-list { display: flex; flex-direction: column; gap: 8px; }
.sentence-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--card); }
.sentence-item.is-flagged { border-color: var(--error); background: var(--error-bg); }
[data-theme="dark"] .sentence-item.is-flagged { background: rgba(224, 49, 49, .09); }
.sentence-head { display: flex; align-items: flex-start; gap: 10px; }
.sentence-num { flex: none; font-size: .72rem; font-weight: 700; color: var(--muted); padding-top: 3px; }
.sentence-text { flex: 1; font-size: .9rem; line-height: 1.45; }
.sentence-badge { flex: none; padding-top: 1px; }
.sentence-srcs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.src-pill { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: rgba(47, 91, 234, .09); color: var(--primary); text-decoration: none; }
.src-pill:hover { text-decoration: underline; }
