/* IAnalisis — feuille de style de l’application (sans build). */

:root {
  --brand: #1215a6;
  --brand-900: #0b0d6b;
  --brand-700: #1215a6;
  --brand-600: #1a1fd1;
  --brand-500: #3b40e8;
  --brand-300: #9497f2;
  --brand-100: #e8e9fb;
  --brand-50: #f4f5fd;

  --bg: #f5f6fc;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(59, 64, 232, .07), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(18, 21, 166, .05), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f8f9fe;
  --surface-3: #eef0fb;
  --sidebar: #ffffff;
  --text: #14163a;
  --text-2: #3c4066;
  --muted: #6a6e93;
  --border: #e4e6f3;
  --border-strong: #d2d5ec;
  --link: #1a1fd1;
  --accent-soft: var(--brand-100);
  --accent-text: var(--brand);

  --amber-bg: #fff7e6;
  --amber-border: #f6d58e;
  --amber-text: #8a5300;
  --green-bg: #e9f8ef;
  --green-border: #a6e2bd;
  --green-text: #156a3a;
  --red-bg: #fdecec;
  --red-border: #f3b4b4;
  --red-text: #a12626;

  --chart-bar: #1215a6;
  --chart-bar-top: #3b40e8;
  --chart-grid: #eceef8;
  --chart-axis: #c9cce4;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(17, 20, 80, .06);
  --shadow: 0 1px 2px rgba(17, 20, 80, .05), 0 6px 20px -6px rgba(17, 20, 80, .10);
  --shadow-lg: 0 20px 50px -12px rgba(11, 13, 107, .28);
  --ring: 0 0 0 3px rgba(59, 64, 232, .35);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --sidebar-w: 280px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090a1c;
    --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(59, 64, 232, .16), transparent 60%),
               radial-gradient(900px 500px at -10% 110%, rgba(26, 31, 209, .10), transparent 60%);
    --surface: #121430;
    --surface-2: #171a3a;
    --surface-3: #1e2247;
    --sidebar: #0e1028;
    --text: #e9eaff;
    --text-2: #c3c6ea;
    --muted: #9195c2;
    --border: #252a55;
    --border-strong: #343a72;
    --link: #9ea2ff;
    --accent-soft: rgba(59, 64, 232, .22);
    --accent-text: #b7baff;
    --amber-bg: rgba(245, 166, 35, .12);
    --amber-border: rgba(245, 166, 35, .35);
    --amber-text: #f8c56b;
    --green-bg: rgba(46, 182, 104, .12);
    --green-border: rgba(46, 182, 104, .35);
    --green-text: #7fdca5;
    --red-bg: rgba(229, 72, 72, .12);
    --red-border: rgba(229, 72, 72, .35);
    --red-text: #ff9c9c;
    --chart-bar: #4a4fef;
    --chart-bar-top: #8a8eff;
    --chart-grid: #1f2348;
    --chart-axis: #343a72;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
img { display: block; max-width: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.015em; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
::selection { background: rgba(59, 64, 232, .22); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; transition: top .2s; }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.pad { padding: 12px 16px; }
.icon { flex: none; }

/* ---------- Démarrage */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--brand-100); border-top-color: var(--brand-500); animation: spin .8s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Boutons & champs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; letter-spacing: -.005em; white-space: nowrap;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s, color .2s;
  text-decoration: none !important;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary {
  color: #fff; background: linear-gradient(180deg, var(--brand-600), var(--brand));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 6px 16px -6px rgba(18, 21, 166, .55);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, var(--brand-500), var(--brand-600)); box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 10px 22px -8px rgba(18, 21, 166, .6); }
.btn-primary:disabled { opacity: .6; }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.btn-danger { color: #fff; background: linear-gradient(180deg, #e04848, #c22f2f); box-shadow: 0 6px 16px -6px rgba(194, 47, 47, .55); }
.btn-danger:hover { background: linear-gradient(180deg, #ea5555, #cf3636); }
.btn-block { width: 100%; }
.btn-lg { height: 46px; font-size: 15px; border-radius: 12px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; gap: 6px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn.danger:hover:not(:disabled) { color: var(--red-text); background: var(--red-bg); }
.icon-btn.ok { color: var(--green-text); }
.icon-btn:disabled { opacity: .35; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input, .field select, .field textarea, .input {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border-strong);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; }
.field input:hover, .input:hover { border-color: var(--brand-300); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
.input-sm { min-height: 32px; height: 32px; padding: 4px 8px; font-size: 13px; border-radius: 8px; width: auto; }
select.input, .field select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface); color: var(--text-2); }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge-brand { background: var(--accent-soft); color: var(--accent-text); }
.badge-green { background: var(--green-bg); color: var(--green-text); border-color: var(--green-border); }
.badge-amber { background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber-border); }
.badge-red { background: var(--red-bg); color: var(--red-text); border-color: var(--red-border); }
.badge-muted { background: var(--surface-3); color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }

.avatar {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  font-size: 13px; font-weight: 700; color: var(--brand); background: var(--brand-100);
}
.avatar-admin { color: #fff; background: linear-gradient(135deg, var(--brand-500), var(--brand-900)); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }
@media (prefers-color-scheme: dark) { .avatar:not(.avatar-admin) { background: var(--surface-3); color: var(--accent-text); } }

/* ---------- Skeletons */
.skeleton { border-radius: 8px; background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skeleton-line { height: 14px; margin: 10px 12px; }
.skeleton-title { height: 26px; width: 45%; margin: 4px 0 18px; }
.skeleton-card { height: 120px; margin-bottom: 14px; border-radius: var(--radius-lg); }
.skeleton-card.tall { height: 300px; }
.skeleton-kpi { height: 112px; border-radius: var(--radius-lg); }
.skeleton-bubble { height: 52px; width: 70%; border-radius: 16px; margin: 14px 0; }
.skeleton-bubble.right { margin-left: auto; width: 45%; }
.skeleton-bubble.short { width: 30%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: 10px; justify-items: end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(420px, calc(100vw - 40px));
  padding: 12px 16px; border-radius: 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; cursor: pointer;
  animation: toast-in .28s var(--ease);
}
.toast .icon { color: var(--brand-500); }
.toast-success { border-left: 4px solid #2eb668; }
.toast-success .icon { color: #2eb668; }
.toast-error { border-left: 4px solid #e04848; }
.toast-error .icon { color: #e04848; }
.toast-info { border-left: 4px solid var(--brand-500); }
.toast.leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ---------- Modales */
.overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(9, 10, 40, .45); backdrop-filter: blur(4px); animation: fade .18s ease; }
.overlay.leaving { animation: fade-out .16s ease forwards; }
.modal { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-lg); animation: pop .22s var(--ease); }
.modal-title { margin: 0 0 8px; font-size: 18px; }
.modal-body { margin: 0 0 18px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ---------- Connexion */
.login-page {
  position: relative; min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(360px, 460px); align-items: center;
  gap: 48px; padding: 40px clamp(20px, 6vw, 96px); overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, #0b0d6b 0%, #1215a6 45%, #2a2fd8 100%);
}
.login-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.login-bg::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, rgba(0,0,0,.8), transparent 80%); }
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: float 14s ease-in-out infinite; }
.orb-1 { width: 480px; height: 480px; background: #3b40e8; top: -140px; left: -120px; }
.orb-2 { width: 380px; height: 380px; background: #6d72ff; bottom: -120px; right: 22%; animation-delay: -5s; opacity: .35; }
.orb-3 { width: 260px; height: 260px; background: #0b0d6b; top: 30%; right: -60px; animation-delay: -9s; }
@keyframes float { 50% { transform: translate(30px, -24px) scale(1.06); } }
.login-side { color: #fff; max-width: 520px; }
.login-side-logo { width: 220px; height: auto; margin-bottom: 28px; filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .25)); }
.login-side-title { font-size: clamp(26px, 3.2vw, 40px); font-weight: 800; line-height: 1.15; letter-spacing: -.03em; margin: 0 0 28px; }
.login-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.login-points li { display: flex; align-items: center; gap: 12px; font-size: 16px; color: rgba(255, 255, 255, .88); }
.login-points .icon { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); }

.login-card {
  background: var(--surface); border-radius: var(--radius-xl); padding: 32px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .08);
  animation: pop .4s var(--ease);
}
.login-card.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.login-logo { display: none; justify-content: center; margin-bottom: 8px; }
.login-logo img { width: 150px; height: auto; }
.login-title { font-size: 22px; margin: 0 0 4px; }
.login-sub { margin: 0 0 22px; color: var(--muted); }
.login-sub strong { color: var(--accent-text); }

.tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 20px; background: var(--surface-3); border-radius: 12px; }
.tab { position: relative; z-index: 1; height: 38px; border: 0; background: transparent; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); transition: color .2s; }
.tab[aria-selected="true"] { color: var(--text); }
.tab-indicator { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .28s var(--ease); }
.tabs[data-mode="register"] .tab-indicator { transform: translateX(100%); }
.login-form.busy .btn-primary { opacity: .75; }
.form-error { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 14px; border-radius: 10px; background: var(--red-bg); color: var(--red-text); border: 1px solid var(--red-border); font-size: 14px; font-weight: 500; animation: fade .2s; }
.form-error[hidden] { display: none; }
.login-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 14px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.demo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.demo-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  transition: border-color .2s, transform .15s var(--ease), box-shadow .2s, background .2s;
}
.demo-btn:hover { border-color: var(--brand-300); background: var(--brand-50); box-shadow: var(--shadow); transform: translateY(-1px); }
@media (prefers-color-scheme: dark) { .demo-btn:hover { background: var(--surface-3); } }
.demo-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--brand-500), var(--brand)); flex: none; }
.demo-text { display: grid; line-height: 1.25; min-width: 0; }
.demo-text strong { font-size: 13.5px; }
.demo-text small { font-size: 12px; color: var(--muted); font-family: var(--mono); }

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; justify-items: center; padding: 24px 16px; }
  .login-side { display: none; }
  .login-logo { display: flex; }
  .login-card { width: 100%; max-width: 460px; padding: 24px; }
  .login-title { text-align: center; font-size: 20px; }
  .login-sub { text-align: center; }
}
@media (max-width: 420px) { .demo-row { grid-template-columns: 1fr; } }

/* ---------- Coquille */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; height: 100dvh; }
.sidebar {
  display: flex; flex-direction: column; min-height: 0; padding: 16px 12px 12px; gap: 6px;
  background: var(--sidebar); border-right: 1px solid var(--border);
}
.sidebar-head { padding: 2px 6px 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; }
.brand-mark { width: 34px; height: auto; }
@media (prefers-color-scheme: dark) { .brand-mark { filter: brightness(0) invert(1); opacity: .95; } }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -.03em; color: var(--brand); }
.brand-name span { color: var(--text); }
@media (prefers-color-scheme: dark) { .brand-name { color: #a7aaff; } }
.brand-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 2px 6px; border-radius: 6px; background: var(--surface-3); }
.new-chat { margin: 0 2px 10px; }
.sidebar-section-title, .chat-group-title { padding: 8px 10px 4px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.chat-group-title { padding-top: 10px; font-size: 11px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.chat-empty { margin: 8px 10px; font-size: 13px; color: var(--muted); }
.chat-item { position: relative; display: flex; align-items: center; border-radius: 10px; transition: background .15s; }
.chat-item:hover { background: var(--surface-3); }
.chat-item.active { background: var(--accent-soft); }
.chat-item.active .chat-title { color: var(--accent-text); font-weight: 600; }
.chat-link { flex: 1; min-width: 0; display: grid; padding: 8px 10px; color: var(--text); text-decoration: none !important; border-radius: 10px; }
.chat-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.chat-date { font-size: 11.5px; color: var(--muted); }
.chat-actions { position: absolute; right: 6px; display: flex; gap: 2px; opacity: 0; transform: translateX(4px); transition: opacity .15s, transform .15s; background: inherit; border-radius: 8px; }
.chat-item:hover .chat-actions, .chat-item:focus-within .chat-actions { opacity: 1; transform: none; }
.chat-item:hover .chat-link, .chat-item:focus-within .chat-link { padding-right: 70px; }
@media (hover: none) { .chat-actions { opacity: 1; transform: none; } .chat-link { padding-right: 70px; } }
.sidebar-spacer { flex: 1; }
.sidebar-foot { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.nav-group { display: grid; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; font-size: 14px; text-decoration: none !important; transition: background .15s, color .15s;
}
.nav-link .icon { color: var(--muted); transition: color .15s; }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-link[aria-current="page"] .icon, .nav-link-accent .icon { color: var(--brand-500); }
.nav-link-accent { color: var(--accent-text); font-weight: 600; }
.profile { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.profile-meta { flex: 1; min-width: 0; line-height: 1.25; }
.profile-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-role { font-size: 12px; color: var(--muted); }

.main-wrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: none; align-items: center; gap: 8px; height: 56px; padding: 0 12px; border-bottom: 1px solid var(--border); background: var(--sidebar); }
.main { flex: 1; min-height: 0; overflow-y: auto; outline: none; }
.scrim { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: min(var(--sidebar-w), 86vw); transform: translateX(-102%); transition: transform .28s var(--ease); box-shadow: var(--shadow-lg); }
  .shell.sidebar-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(9, 10, 40, .4); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .shell.sidebar-open .scrim { opacity: 1; pointer-events: auto; }
  .topbar { display: flex; }
  .hide-sm { display: none; }
}

/* ---------- Pages */
.page { max-width: 1240px; margin: 0 auto; padding: 32px clamp(16px, 3vw, 40px) 48px; animation: page-in .3s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-title { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.page-sub { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel { padding: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 15.5px; font-weight: 700; }
.panel-meta { font-size: 13px; color: var(--muted); font-weight: 500; }
.empty-state { display: grid; justify-items: center; text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state.small { padding: 32px 16px; }
.empty-state h3 { margin: 10px 0 4px; color: var(--text); font-size: 16px; }
.empty-state p { margin: 0; max-width: 420px; }
.empty-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 14px; }
.banner-info { background: var(--accent-soft); color: var(--accent-text); border: 1px solid rgba(59, 64, 232, .25); }

/* ---------- Chat */
.chat-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px clamp(16px, 3vw, 32px); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(8px); }
.chat-title-head { margin: 0; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.25em; }
.thread-scroll { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: auto; }
.thread { max-width: 820px; margin: 0 auto; padding: 28px clamp(16px, 3vw, 32px) 24px; display: flex; flex-direction: column; gap: 22px; }

.chat-empty-state { display: grid; justify-items: center; text-align: center; padding: 6vh 0 12px; animation: page-in .4s var(--ease); }
.hero-mark { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 22px; background: linear-gradient(135deg, var(--brand-500), var(--brand) 55%, var(--brand-900)); box-shadow: 0 18px 40px -14px rgba(18, 21, 166, .7), 0 0 0 6px var(--accent-soft); margin-bottom: 20px; }
.hero-mark img { width: 44px; height: auto; }
.hero-title { margin: 0; font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -.03em; background: linear-gradient(90deg, var(--brand-900), var(--brand-500)); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (prefers-color-scheme: dark) { .hero-title { background: linear-gradient(90deg, #fff, #a7aaff); -webkit-background-clip: text; background-clip: text; } }
.hero-sub { margin: 8px 0 28px; color: var(--muted); max-width: 520px; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 680px; }
.suggestion {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-align: left; font-size: 14px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); color: var(--text);
  transition: transform .18s var(--ease), border-color .2s, box-shadow .2s;
}
.suggestion:hover { transform: translateY(-2px); border-color: var(--brand-300); box-shadow: var(--shadow); }
.suggestion-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.suggestion-alt { grid-column: 1 / -1; border-style: dashed; background: var(--surface-2); }
.suggestion-alt small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 600px) { .suggestions { grid-template-columns: 1fr; } }

.msg { display: flex; gap: 12px; animation: msg-in .28s var(--ease); }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.msg-user { flex-direction: column; align-items: flex-end; gap: 4px; }
.msg-user .bubble {
  max-width: min(82%, 620px); padding: 11px 16px; border-radius: 18px 18px 6px 18px; white-space: pre-wrap; overflow-wrap: anywhere;
  color: #fff; background: linear-gradient(135deg, var(--brand-600), var(--brand)); box-shadow: 0 8px 20px -10px rgba(18, 21, 166, .6);
}
.msg-time { font-size: 11.5px; color: var(--muted); padding-right: 4px; }
.msg-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 11px; background: linear-gradient(135deg, var(--brand-500), var(--brand-900)); box-shadow: var(--shadow-sm); margin-top: 2px; }
.msg-avatar img { width: 20px; height: auto; }
.msg-content { flex: 1; min-width: 0; }
.msg-body { overflow-wrap: anywhere; }
.msg-assistant.is-error .msg-body { color: var(--red-text); }
.msg-banner:empty { display: none; }
.kind-banner { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; margin-bottom: 10px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; border: 1px solid; animation: fade .3s; }
.kind-banner .icon { margin-top: 1px; }
.kind-refused { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber-text); }
.kind-added { background: var(--green-bg); border-color: var(--green-border); color: var(--green-text); }
.kind-error { background: var(--red-bg); border-color: var(--red-border); color: var(--red-text); }
.msg-assistant.is-refused .msg-avatar { background: linear-gradient(135deg, #f0a92e, #b86e00); }
.msg-assistant.is-added .msg-avatar { background: linear-gradient(135deg, #34c47a, #12814a); }
.msg-foot:empty { display: none; }
.msg-foot { display: grid; gap: 8px; margin-top: 10px; }
.msg-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta-text { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sources { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.sources-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-right: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; max-width: 260px;
  font-size: 12.5px; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); border: 1px solid transparent;
  transition: border-color .15s, transform .15s var(--ease), background .15s;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { border-color: var(--brand-300); transform: translateY(-1px); }

.thinking { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 13.5px; box-shadow: var(--shadow-sm); }
.thinking-time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); opacity: .8; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-500); animation: bounce 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-4px); opacity: 1; } }
.cursor { display: inline-block; width: 8px; height: 1.05em; margin-left: 2px; vertical-align: -2px; border-radius: 2px; background: var(--brand-500); animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

.composer-wrap { padding: 8px clamp(16px, 3vw, 32px) 14px; background: linear-gradient(180deg, transparent, var(--bg) 40%); }
.composer {
  max-width: 820px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 16px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: var(--brand-500); box-shadow: var(--ring), var(--shadow); }
.composer-input { flex: 1; min-height: 40px; max-height: 220px; padding: 9px 0; border: 0; outline: none; resize: none; background: transparent; line-height: 1.45; }
.composer-input:focus-visible { box-shadow: none; }
.send-btn {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: 12px; color: #fff;
  background: linear-gradient(135deg, var(--brand-500), var(--brand)); box-shadow: 0 6px 16px -6px rgba(18, 21, 166, .6);
  transition: transform .15s var(--ease), opacity .2s, background .2s;
}
.send-btn:hover:not(:disabled) { transform: translateY(-1px); }
.send-btn:disabled { opacity: .35; box-shadow: none; }
.composer.is-streaming .send-btn { background: var(--text-2); }
.composer-hint { max-width: 820px; margin: 8px auto 0; text-align: center; font-size: 11.5px; color: var(--muted); }
@media (max-width: 600px) { .composer-hint { display: none; } }

/* ---------- Markdown */
.markdown { line-height: 1.65; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p { margin: 0 0 .8em; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 { margin: 1.3em 0 .5em; font-weight: 700; }
.markdown h1 { font-size: 1.6em; } .markdown h2 { font-size: 1.35em; } .markdown h3 { font-size: 1.15em; } .markdown h4, .markdown h5, .markdown h6 { font-size: 1em; }
.markdown ul, .markdown ol { margin: 0 0 .8em; padding-left: 1.4em; }
.markdown li { margin: .2em 0; }
.markdown li::marker { color: var(--brand-500); }
.markdown strong { font-weight: 650; color: var(--text); }
.markdown code { font-family: var(--mono); font-size: .88em; padding: .12em .4em; border-radius: 6px; background: var(--surface-3); color: var(--accent-text); }
.markdown pre { margin: 0 0 1em; padding: 14px 16px; border-radius: 12px; background: #0e1030; color: #e5e7ff; overflow-x: auto; font-size: 13px; }
.markdown pre code { background: none; color: inherit; padding: 0; }
.markdown blockquote { margin: 0 0 1em; padding: 8px 14px; border-left: 3px solid var(--brand-500); background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--text-2); }
.markdown hr { border: 0; height: 1px; background: var(--border); margin: 1.4em 0; }
.markdown a { text-decoration: underline; text-underline-offset: 2px; }
.markdown .table-wrap { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--border); border-radius: 12px; }
.markdown table { width: 100%; border-collapse: collapse; font-size: 14px; }
.markdown th, .markdown td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.markdown th { background: var(--surface-2); font-weight: 650; font-size: 13px; color: var(--text-2); }
.markdown tr:last-child td { border-bottom: 0; }

/* ---------- Documentation */
.page-docs { max-width: 1320px; }
.segmented { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface-3); border-radius: 12px; }
.seg { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13.5px; text-decoration: none !important; transition: background .2s, color .2s; }
.seg:hover { color: var(--text); }
.seg[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.docs-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.docs-side { position: sticky; top: 16px; padding: 12px; max-height: calc(100vh - 160px); overflow-y: auto; }
.search-wrap { position: relative; display: flex; align-items: center; margin-bottom: 6px; }
.search-wrap .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search-input { padding-left: 36px !important; }
.doc-group { margin-top: 10px; }
.doc-group-title { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.count { font-size: 11px; padding: 0 7px; border-radius: 999px; background: var(--surface-3); }
.doc-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); text-decoration: none !important; transition: background .15s; }
.doc-item .icon { color: var(--muted); margin-top: 3px; }
.doc-item:hover { background: var(--surface-3); }
.doc-item.active { background: var(--accent-soft); }
.doc-item.active .icon, .doc-item.active .doc-item-title { color: var(--accent-text); }
.doc-item-text { display: grid; min-width: 0; }
.doc-item-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-item-meta { font-size: 11.5px; color: var(--muted); }
.docs-main { padding: clamp(20px, 3vw, 40px); min-height: 60vh; }
.back-link { display: none; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.doc-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 14px; margin-bottom: 22px; border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.doc-path, .doc-updated { display: inline-flex; align-items: center; gap: 6px; }
.doc-path span { font-family: var(--mono); font-size: 12px; }
.doc-body { max-width: 760px; font-size: 15px; }
.doc-body h2:first-child { margin-top: 0; font-size: 1.8em; font-weight: 800; letter-spacing: -.025em; }
.doc-reader:focus { outline: none; }
@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-side { position: static; max-height: none; }
  .docs-layout:not(.has-doc) .docs-main { display: none; }
  .docs-layout.has-doc .docs-side { display: none; }
  .back-link { display: inline-flex; }
}

.timeline { list-style: none; margin: 0; padding: 0 0 0 26px; position: relative; max-width: 860px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: linear-gradient(180deg, var(--brand-500), var(--border) 70%); }
.timeline-item { position: relative; margin-bottom: 14px; animation: page-in .35s var(--ease) both; }
.timeline-dot { position: absolute; left: -24px; top: 18px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand-300); }
.timeline-item.latest .timeline-dot { border-color: var(--brand-500); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline-dot.green { border-color: #2eb668; }
.timeline-card { padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); }
.timeline-head { display: flex; align-items: center; gap: 10px; }
.timeline-date { font-weight: 700; font-size: 14px; }
.timeline-title { font-size: 12.5px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.timeline-items { margin: 10px 0 0; padding-left: 18px; font-size: 14px; color: var(--text-2); }
.timeline-items li { margin: 3px 0; }
.timeline-items li::marker { color: var(--brand-300); }
.timeline-items code { font-family: var(--mono); font-size: .86em; padding: .1em .35em; border-radius: 5px; background: var(--surface-3); color: var(--accent-text); }

/* Drawer */
.drawer-root { position: fixed; inset: 0; z-index: 70; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(9, 10, 40, .35); animation: fade .2s; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: slide-in .28s var(--ease);
}
.drawer-root.leaving .drawer { animation: slide-out .22s ease forwards; }
.drawer-root.leaving .drawer-scrim { animation: fade-out .22s ease forwards; }
@keyframes slide-in { from { transform: translateX(100%); } }
@keyframes slide-out { to { transform: translateX(100%); } }
.drawer-head { display: flex; align-items: center; gap: 4px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--border); }
.drawer-title { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.drawer-title .icon { color: var(--brand-500); }
.drawer-picker { padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 40px; }
.drawer-body .doc-body { font-size: 14.5px; }

/* ---------- Admin */
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: #f0a92e; position: relative; flex: none; }
.pulse-dot.green { background: #2eb668; }
.pulse-dot::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor; color: inherit; opacity: 0; animation: pulse 1.8s infinite; }
.pulse-dot.green::after { color: #2eb668; }
@keyframes pulse { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { position: relative; padding: 18px 18px 16px; overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow), 0 14px 30px -16px rgba(18, 21, 166, .35); }
.kpi::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--brand-500), var(--brand)); opacity: .9; }
.kpi.tone-amber::before { background: linear-gradient(90deg, #f6c35a, #e0901a); }
.kpi.tone-green::before { background: linear-gradient(90deg, #5fd497, #1f9d5a); }
.kpi.tone-dark { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-900) 100%); border-color: transparent; color: #fff; }
.kpi.tone-dark::before { display: none; }
.kpi.tone-dark .kpi-label, .kpi.tone-dark .kpi-sub { color: rgba(255, 255, 255, .75); }
.kpi.tone-dark .kpi-icon { background: rgba(255, 255, 255, .14); color: #fff; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.tone-amber .kpi-icon { background: var(--amber-bg); color: var(--amber-text); }
.tone-green .kpi-icon { background: var(--green-bg); color: var(--green-text); }
.kpi-value { margin-top: 6px; font-size: 28px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { margin-top: 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }
@media (max-width: 480px) { .kpi-grid { grid-template-columns: 1fr; } }

.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-axis { stroke: var(--chart-axis); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.bar { fill: url(#barGrad); transition: opacity .15s; }
.bar-hit { fill: transparent; }
.bar-group { cursor: default; outline: none; }
.bar-group.hover .bar-hit { fill: var(--accent-soft); opacity: .6; }
.bar-group:focus-visible .bar-hit { stroke: var(--brand-500); stroke-width: 2; }
.chart-tip {
  position: absolute; transform: translate(-50%, calc(-100% - 10px)); pointer-events: none; z-index: 2;
  display: grid; gap: 1px; padding: 8px 12px; border-radius: 10px; white-space: nowrap; font-size: 12px;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg);
}
.chart-tip strong { font-size: 14px; }
.chart-tip span { opacity: .75; text-transform: capitalize; }
.chart-tip[hidden] { display: none; }

.top-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.top-list li { display: grid; grid-template-columns: 18px 28px minmax(0, 1fr) 70px auto; align-items: center; gap: 10px; }
.rank { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; }
.top-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.top-bar span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand-500), var(--brand)); transition: width .6s var(--ease); }
.top-count { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; min-width: 24px; text-align: right; }

.feed { list-style: none; padding: 0; margin: 0; display: grid; max-height: 420px; overflow-y: auto; }
.feed-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-main { flex: 1; min-width: 0; }
.feed-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.feed-time { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.feed-content { margin: 2px 0 0; font-size: 13.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.mini-knowledge { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.mini-knowledge h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.mini-knowledge ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.mini-knowledge p { margin: 0; font-size: 13.5px; }
.mini-knowledge small { color: var(--muted); font-size: 12px; }

.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { font-variant-numeric: tabular-nums; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-name { font-weight: 600; }
.row-actions { text-align: right; }
.row-actions .icon-btn { margin-left: 2px; }

.knowledge-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.knowledge-form { position: sticky; top: 16px; }
.knowledge-form > .muted { margin: -6px 0 16px; font-size: 13.5px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.knowledge-list .timeline { padding-left: 24px; }
.kn-content { margin: 0 0 8px; }
.kn-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 1000px) { .knowledge-layout { grid-template-columns: 1fr; } .knowledge-form { position: static; } }

.settings { display: grid; gap: 20px; max-width: 880px; }
.provider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
@media (max-width: 640px) { .provider-grid { grid-template-columns: 1fr; } }
.provider-card {
  position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 18px; text-align: left;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 16px; transition: border-color .2s, box-shadow .2s, transform .15s var(--ease);
}
.provider-card:hover:not(:disabled) { border-color: var(--brand-300); transform: translateY(-1px); box-shadow: var(--shadow); }
.provider-card.active { border-color: var(--brand-500); background: linear-gradient(180deg, var(--brand-50), var(--surface)); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (prefers-color-scheme: dark) { .provider-card.active { background: linear-gradient(180deg, var(--surface-3), var(--surface)); } }
.provider-card:disabled { opacity: .55; filter: grayscale(.6); }
.provider-logo { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; font-weight: 800; font-size: 20px; color: #fff; }
.provider-gemini { background: linear-gradient(135deg, #4c8df6, #8b5cf6 60%, #d667b8); }
.provider-claude { background: linear-gradient(135deg, #e3895f, #c15f3c); }
.provider-text { display: grid; gap: 4px; justify-items: start; }
.provider-text strong { font-size: 16px; }
.provider-text small { color: var(--muted); font-size: 13px; }
.provider-check { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-strong); color: #fff; }
.provider-card.active .provider-check { background: var(--brand-500); border-color: var(--brand-500); }
.model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .model-grid { grid-template-columns: 1fr; } }
.model-grid .field { margin: 0; }
.settings .panel > .muted { margin: -6px 0 14px; font-size: 13.5px; }
.test-out { margin-top: 14px; }
.test-out:empty { display: none; }
.test-result { padding: 14px 16px; border-radius: 12px; border: 1px solid; animation: fade .25s; }
.test-result.ok { background: var(--green-bg); border-color: var(--green-border); }
.test-result.ko { background: var(--red-bg); border-color: var(--red-border); color: var(--red-text); }
.test-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.test-result.ok .test-line > .icon, .test-result.ok .test-line > strong { color: var(--green-text); }
.test-sample { margin: 10px 0 0; padding: 10px 14px; border-left: 3px solid var(--brand-500); background: var(--surface); border-radius: 0 10px 10px 0; font-size: 14px; color: var(--text-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .cursor { animation: none; }
}
