:root {
  --navy: #15427B;
  --navy-deep: #0B1F3A;
  --sky: #00A0DB;
  --sky-soft: #E6F6FC;
  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --text: #122033;
  --muted: #5B6B7C;
  --border: #D9E2EE;
  --border-strong: #C3D0E0;
  --ok: #0B7A4B;
  --ok-bg: #E5F7EE;
  --warn: #B45309;
  --warn-bg: #FEF3C7;
  --err: #B91C1C;
  --err-bg: #FEE2E2;
  --info: #1D4ED8;
  --info-bg: #DBEAFE;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(11, 31, 58, 0.07);
  --shadow-lg: 0 24px 60px rgba(11, 31, 58, 0.14);
  --sidebar-w: 260px;
  --topbar-h: 72px;
  --font: "Pretendard", "Noto Sans KR", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: var(--navy); }
.hidden { display: none !important; }

/* —— Auth gate —— */
.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(0,160,219,.18), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(21,66,123,.22), transparent 50%),
    linear-gradient(180deg, #0B1F3A 0%, #12345f 45%, #1a4a7a 100%);
}
.auth-card {
  width: min(420px, 100%);
  background: rgba(255,255,255,.96);
  border-radius: 22px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,.5);
}
.auth-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.auth-brand h1 { margin: 0; font-size: 1.35rem; color: var(--navy-deep); }
.auth-brand p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--navy), var(--sky));
  color: #fff; font-weight: 800; letter-spacing: .04em;
  flex: 0 0 auto;
}
.logo-lg { width: 56px; height: 56px; border-radius: 16px; font-size: 1.1rem; }

/* —— App shell —— */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-deep) 0%, #123052 100%);
  color: #E8EEF7;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
  border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar-head {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px 16px;
}
.sidebar-titles { display: grid; gap: 2px; min-width: 0; }
.sidebar-titles strong { font-size: .98rem; }
.sidebar-titles span { font-size: .75rem; opacity: .65; }
.sidebar-close { display: none; color: #fff; }
.nav { display: grid; gap: 4px; padding: 8px 12px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; color: rgba(255,255,255,.78);
  text-align: left; padding: 11px 12px; border-radius: 12px;
  cursor: pointer; transition: .18s var(--ease);
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(0,160,219,.28), rgba(255,255,255,.08));
  color: #fff; box-shadow: inset 3px 0 0 var(--sky);
}
.nav-item.subtle { opacity: .85; }
.nav-ico {
  width: 22px; text-align: center; font-size: .95rem; opacity: .9;
}
.sidebar-foot {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: grid; gap: 8px;
}
.health-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 999px;
  background: rgba(255,255,255,.06); font-size: .78rem;
}
.health-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #94a3b8;
}
.health-pill.ok .dot { background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.2); }
.health-pill.degraded .dot { background: #fbbf24; }
.health-pill.down .dot { background: #f87171; }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h2 { margin: 0; font-size: 1.15rem; color: var(--navy-deep); }
.topbar-title p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.global-search {
  position: relative; display: flex; align-items: center;
}
.global-search input {
  width: min(320px, 34vw);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 38px 10px 14px;
  background: var(--surface-2);
  transition: .18s var(--ease);
}
.global-search input:focus {
  outline: none; border-color: var(--sky);
  background: #fff; box-shadow: 0 0 0 4px rgba(0,160,219,.12);
}
.global-search kbd {
  position: absolute; right: 10px;
  font-size: .7rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 1px 6px; background: #fff;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px; background: #fff;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--navy), var(--sky));
  color: #fff; font-weight: 700; font-size: .85rem;
}
.user-chip strong { display: block; font-size: .86rem; line-height: 1.1; }
.user-chip small { color: var(--muted); font-size: .72rem; }

.content { padding: 22px; max-width: 1280px; width: 100%; margin: 0 auto; }
.view { display: none; animation: fade .25s var(--ease); }
.view.active { display: block; }
@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* —— Components —— */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.panel-head h3 { margin: 0; font-size: 1rem; color: var(--navy-deep); }
.badge {
  min-width: 28px; text-align: center;
  background: var(--sky-soft); color: var(--navy);
  border-radius: 999px; padding: 2px 8px; font-size: .78rem; font-weight: 700;
}

.btn {
  border: 0; border-radius: 12px;
  padding: 10px 16px; font-weight: 650;
  cursor: pointer; transition: .15s var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--navy) 0%, #1c5aa8 55%, #1780b8 100%);
  color: #fff; box-shadow: 0 8px 18px rgba(21,66,123,.22);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.btn-secondary {
  background: #fff; color: var(--navy);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--navy); background: rgba(21,66,123,.06); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; border-radius: 10px; font-size: .88rem; }
.link-btn {
  border: 0; background: none; color: var(--sky); font-weight: 650;
  cursor: pointer; padding: 0;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid transparent; background: transparent;
  cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: rgba(0,0,0,.05); color: var(--text); }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.field input, .field-inline select, .search-bar input, .quick-search input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  background: #fff;
  transition: .15s var(--ease);
}
.field input:focus, .search-bar input:focus, .quick-search input:focus, textarea:focus {
  outline: none; border-color: var(--sky);
  box-shadow: 0 0 0 4px rgba(0,160,219,.12);
}
.field-hint { color: var(--muted); font-size: .8rem; margin: 0 0 12px; }
.form-error { color: var(--err); font-size: .88rem; margin: 10px 0 0; }

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.kpi span { display: block; color: var(--muted); font-size: .78rem; margin-bottom: 6px; }
.kpi b { font-size: 1.45rem; color: var(--navy-deep); letter-spacing: -.02em; }
.kpi em { font-style: normal; font-size: .72rem; color: var(--muted); }

.dash-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
}
.dash-grid .span-2 { grid-column: 1 / -1; }
.quick-search { display: flex; gap: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .82rem; cursor: pointer;
}
.chip:hover { border-color: var(--sky); background: var(--sky-soft); }

.action-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
}
.action-card {
  text-align: left;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, var(--surface-2));
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: .18s var(--ease);
}
.action-card:hover {
  border-color: rgba(0,160,219,.45);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.ac-ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--sky-soft); color: var(--navy);
  font-weight: 700; margin-bottom: 10px;
}
.action-card strong { display: block; margin-bottom: 4px; color: var(--navy-deep); }
.action-card p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.4; }

/* Search */
.search-hero { margin-bottom: 14px; }
.search-bar { display: flex; gap: 8px; }
.search-bar.large input { padding: 14px 16px; font-size: 1.02rem; }
.search-bar.small { max-width: 360px; }
.search-options {
  display: flex; flex-wrap: wrap; gap: 12px 18px;
  margin-top: 14px; align-items: center;
}
.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: .9rem; cursor: pointer;
}
.toggle input { accent-color: var(--navy); width: 16px; height: 16px; }
.field-inline {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: .88rem; margin-left: auto;
}
.field-inline select {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 6px 10px; background: #fff;
}
.results-meta {
  color: var(--muted); font-size: .88rem; margin: 0 0 12px;
}
.result-list { display: grid; gap: 12px; }
.result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: .15s var(--ease);
}
.result-card:hover { border-color: rgba(0,160,219,.4); }
.result-card h4 { margin: 0 0 6px; font-size: 1rem; color: var(--navy-deep); }
.result-meta {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  color: var(--muted); font-size: .8rem; margin-bottom: 10px;
}
.source-pills { display: inline-flex; gap: 4px; }
.pill-src {
  font-size: .72rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.pill-src.bm25 { background: #EEF2FF; color: #3730A3; }
.pill-src.dense { background: #ECFDF5; color: #065F46; }
.pill-src.graph { background: #FFF7ED; color: #9A3412; }
.snippet {
  font-size: .92rem; line-height: 1.55; color: #243447;
  white-space: pre-wrap; word-break: break-word;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: .74rem; padding: 3px 9px; border-radius: 999px;
  background: var(--sky-soft); color: #0B6D93; font-weight: 600;
}

/* Empty */
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.empty-state.compact { padding: 32px 16px; }
.empty-ico {
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 16px; display: grid; place-items: center;
  background: var(--sky-soft); color: var(--navy); font-size: 1.4rem;
}
.empty-state h3 { margin: 0 0 6px; color: var(--navy-deep); }
.empty-state p { margin: 0 auto 14px; max-width: 420px; line-height: 1.5; }

/* Q&A */
.qa-layout {
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: 14px;
  min-height: calc(100vh - 160px);
}
.qa-chat-panel { display: flex; flex-direction: column; min-height: 560px; }
.qa-messages {
  flex: 1; overflow: auto; display: grid; gap: 12px;
  padding: 4px 2px 16px; align-content: start;
}
.qa-bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: .94rem;
  white-space: pre-wrap;
}
.qa-bubble.system {
  background: var(--surface-2); color: var(--muted);
  border: 1px dashed var(--border);
}
.qa-bubble.user {
  margin-left: auto;
  background: linear-gradient(135deg, var(--navy), #1c5aa8);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.qa-bubble.assistant {
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}
.qa-bubble .meta { margin-top: 8px; font-size: .78rem; opacity: .75; }
.qa-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.qa-composer textarea { resize: vertical; min-height: 56px; max-height: 160px; }
.source-list { display: grid; gap: 10px; }
.source-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-2);
}
.source-item h5 { margin: 0 0 4px; font-size: .9rem; color: var(--navy-deep); }
.source-item p { margin: 0; font-size: .82rem; color: var(--muted); line-height: 1.45; }
.muted-block {
  color: var(--muted); font-size: .9rem; line-height: 1.5;
  background: var(--surface-2); border-radius: 12px; padding: 14px;
  border: 1px dashed var(--border);
}

/* Documents table */
.toolbar {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 12px; flex-wrap: wrap;
}
.toolbar .search-bar { flex: 1; min-width: 220px; }
.toolbar-right { display: flex; gap: 8px; margin-left: auto; }
.table-panel { padding: 0; overflow: hidden; }
.table-wrap { overflow: auto; }
.data-table {
  width: 100%; border-collapse: collapse; min-width: 760px;
}
.data-table th {
  text-align: left; font-size: .78rem; letter-spacing: .02em;
  text-transform: uppercase; color: var(--muted);
  background: var(--surface-2);
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.data-table td {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-size: .9rem; vertical-align: middle;
}
.data-table tbody tr {
  cursor: pointer; transition: background .12s;
}
.data-table tbody tr:hover { background: #F7FBFF; }
.doc-title { font-weight: 650; color: var(--navy-deep); }
.doc-sub { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.status {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 4px 10px;
  font-size: .75rem; font-weight: 700;
}
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.status.err { background: var(--err-bg); color: var(--err); }
.status.info { background: var(--info-bg); color: var(--info); }
.status.muted { background: #EEF2F7; color: var(--muted); }
.format-badge {
  display: inline-block;
  padding: 3px 8px; border-radius: 8px;
  background: #EEF2FF; color: #3730A3;
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
}

/* Upload */
.upload-grid {
  display: grid;
  grid-template-columns: 1.25fr .9fr;
  gap: 14px;
}
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: 18px;
  background:
    linear-gradient(180deg, #FBFDFF, #F4F8FC);
  padding: 36px 20px;
  text-align: center;
  transition: .18s var(--ease);
  cursor: pointer;
}
.dropzone:hover, .dropzone:focus, .dropzone.dragover {
  border-color: var(--sky);
  background: #F0FAFF;
  box-shadow: 0 0 0 4px rgba(0,160,219,.1);
}
.dz-ico {
  width: 54px; height: 54px; margin: 0 auto 12px;
  border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--navy), var(--sky));
  color: #fff; font-size: 1.4rem; font-weight: 700;
}
.dropzone h3 { margin: 0 0 6px; color: var(--navy-deep); }
.dropzone p { margin: 0 0 14px; color: var(--muted); font-size: .9rem; }
.upload-queue { display: grid; gap: 8px; margin-top: 14px; }
.upload-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.upload-item .name { font-weight: 650; font-size: .9rem; }
.upload-item .meta { color: var(--muted); font-size: .78rem; }
.upload-item .bar {
  grid-column: 1 / -1;
  height: 6px; border-radius: 999px; background: #E8EEF5; overflow: hidden;
}
.upload-item .bar > i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--navy), var(--sky));
  transition: width .3s var(--ease);
}
.upload-actions { display: flex; gap: 8px; margin-top: 14px; }
.pipeline {
  margin: 0; padding-left: 18px;
  display: grid; gap: 12px; color: var(--muted); font-size: .9rem;
}
.pipeline li strong { display: block; color: var(--navy-deep); margin-bottom: 2px; }

/* Knowledge */
.knowledge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.knowledge-grid .span-2 { grid-column: 1 / -1; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.class-chip {
  border-radius: 12px; padding: 8px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .86rem;
}
.class-chip small { color: var(--muted); margin-left: 6px; }
.rel-list { display: grid; gap: 8px; }
.rel-item {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .88rem;
}
.rel-item code {
  background: #EEF2FF; color: #3730A3;
  padding: 2px 6px; border-radius: 6px; font-size: .8rem;
}
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.entity-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}
.entity-card h4 { margin: 0 0 4px; font-size: .92rem; }
.entity-card .meta { color: var(--muted); font-size: .78rem; }

/* Drawer */
.drawer-backdrop, .modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(11, 31, 58, .42);
  backdrop-filter: blur(2px);
  z-index: 60;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(460px, 100%);
  background: #fff;
  z-index: 70;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: slideIn .22s var(--ease);
}
@keyframes slideIn {
  from { transform: translateX(16px); opacity: .6; }
  to { transform: none; opacity: 1; }
}
.drawer-head, .modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  margin: 0 0 4px; font-size: .75rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.drawer-head h3, .modal-head h3 { margin: 0; color: var(--navy-deep); }
.drawer-body { padding: 16px 18px 28px; overflow: auto; }
.detail-section { margin-bottom: 18px; }
.detail-section h4 {
  margin: 0 0 10px; font-size: .82rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.kv {
  display: grid; grid-template-columns: 110px 1fr;
  gap: 8px; font-size: .9rem; margin-bottom: 6px;
}
.kv span { color: var(--muted); }
.attach-list { display: grid; gap: 8px; }
.attach-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
}
.attach-item a { font-weight: 650; text-decoration: none; }
.attach-item a:hover { text-decoration: underline; }

/* Modal */
.modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100% - 32px));
  background: #fff; border-radius: 18px;
  box-shadow: var(--shadow-lg); z-index: 80;
  border: 1px solid rgba(255,255,255,.6);
}
.modal-body { padding: 16px 18px 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.settings-meta {
  background: var(--surface-2); border-radius: 12px;
  padding: 12px; font-size: .85rem; color: var(--muted);
  margin-bottom: 12px; line-height: 1.5;
}

/* Toasts */
.toasts {
  position: fixed; right: 18px; bottom: 18px;
  display: grid; gap: 8px; z-index: 100;
  width: min(360px, calc(100% - 24px));
}
.toast {
  background: #0F1B2D; color: #F8FAFC;
  border-radius: 12px; padding: 12px 14px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .22s var(--ease);
  font-size: .9rem;
}
.toast.ok { border-left: 4px solid #34d399; }
.toast.err { border-left: 4px solid #f87171; }
.toast.info { border-left: 4px solid var(--sky); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Skeletons */
.skeleton {
  background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease infinite;
  border-radius: 8px; height: 14px;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.doc-list.compact { display: grid; gap: 8px; }
.doc-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: #fff;
  cursor: pointer;
}
.doc-row:hover { border-color: rgba(0,160,219,.4); }
.doc-row strong { display: block; font-size: .9rem; }
.doc-row small { color: var(--muted); }

.only-mobile { display: none; }

/* Responsive */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .action-cards { grid-template-columns: repeat(2, 1fr); }
  .dash-grid, .qa-layout, .upload-grid, .knowledge-grid {
    grid-template-columns: 1fr;
  }
  .field-inline { margin-left: 0; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-105%);
    transition: transform .22s var(--ease);
  }
  .sidebar.open { transform: none; }
  .sidebar-close { display: grid; margin-left: auto; }
  .only-mobile { display: inline-grid; }
  .global-search { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 16px; }
  .user-chip div { display: none; }
}
