:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #edf0f3;
  --border: #dce1e6;
  --text: #17212b;
  --secondary: #68727e;
  --accent: #b81522;          /* Sevim Hukuk brand red (sevim.av.tr) */
  --accent-light: #fff0f1;
  --accent-text: #ffffff;
  --accent-ink: #a80f1b;      /* accent used as text or icon colour */
  --info: #2d668d;
  --success: #287044;
  --warning: #9a620f;
  --error: #b4232b;
  --yellow: #ffe55c;
  --shadow: 0 8px 20px rgba(18, 30, 43, .10);
  --sidebar-bg: #f8f9fa;
  --sidebar-text: #46515d;
  --sidebar-muted: #7d8995;
  --sidebar-hover: #edf0f3;
  --sidebar-active: #fff0f1;
  --sidebar-active-text: #a80f1b;
  --sidebar-border: #dce1e6;
  --radius: 14px;
  --sidebar-width: 252px;
  --middle-width: 454px;
  font-family: "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #111821;
    --surface: #18212b;
    --surface-2: #222d38;
    --border: #303c48;
    --text: #eef2f5;
    --secondary: #a7b0ba;
    --accent: #d12a37;
    --accent-light: #3c1d24;
    --accent-text: #ffffff;
    --accent-ink: #ff7b84;    /* lighter shade so small text stays readable on the dark background */
    --info: #76b3db;
    --success: #6cc07a;
    --warning: #e3a54b;
    --error: #f2726a;
    --yellow: #d4b106;
    --shadow: 0 8px 22px rgba(0,0,0,.28);
    --sidebar-bg: #171f29;
    --sidebar-text: #c6d0da;
    --sidebar-muted: #8493a1;
    --sidebar-hover: #222d38;
    --sidebar-active: #2a252c;
    --sidebar-active-text: #ff7b84;
    --sidebar-border: #303a45;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111821;
  --surface: #18212b;
  --surface-2: #222d38;
  --border: #303c48;
  --text: #eef2f5;
  --secondary: #a7b0ba;
  --accent: #d12a37;
  --accent-light: #3c1d24;
  --accent-text: #ffffff;
  --accent-ink: #ff7b84;
  --info: #76b3db;
  --success: #6cc07a;
  --warning: #e3a54b;
  --error: #f2726a;
  --yellow: #d4b106;
  --shadow: 0 8px 22px rgba(0,0,0,.28);
  --sidebar-bg: #171f29;
  --sidebar-text: #c6d0da;
  --sidebar-muted: #8493a1;
  --sidebar-hover: #222d38;
  --sidebar-active: #2a252c;
  --sidebar-active-text: #ff7b84;
  --sidebar-border: #303a45;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--info); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; }
mark { background: var(--yellow); color: #000; border-radius: 2px; padding: 0 1px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- form elements ---------- */
.input, select.input, textarea.input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); outline: none; min-height: 38px;
}
textarea.input { resize: vertical; min-height: 120px; line-height: 1.45; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.label { display: block; font-size: 13px; color: var(--secondary); margin: 10px 0 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .flex { flex: 1 1 140px; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--text); min-height: 36px;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--error); }
.btn.small { padding: 4px 9px; min-height: 28px; font-size: 13px; }
.btn.plain { border-color: transparent; background: transparent; }
.btn.plain:hover { background: var(--surface-2); }
.btn.icon { padding: 6px; min-width: 34px; }
.btn.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent-ink); }
.btn svg { width: 16px; height: 16px; flex: none; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.alert { padding: 10px 12px; border-radius: 8px; font-size: 14px; background: var(--surface-2); }
.alert.error { background: color-mix(in srgb, var(--error) 12%, transparent); color: var(--error); }
.alert.success { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.alert.info { background: color-mix(in srgb, var(--info) 10%, transparent); }
.muted { color: var(--secondary); }
.small-text { font-size: 12.5px; }

/* ---------- login page ---------- */
.login-bg { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; padding: 28px 26px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand-icon { width: 38px; height: 38px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: var(--accent-text); }
.brand-icon svg { width: 22px; height: 22px; }
.login-card .btn.primary { width: 100%; margin-top: 16px; min-height: 42px; }
.qr { display: grid; place-items: center; margin: 12px 0; }
.qr svg { width: 200px; height: 200px; border-radius: 8px; background: #fff; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; text-align: center; word-break: break-all; background: var(--surface-2); padding: 8px; border-radius: 6px; user-select: all; }
.code-input { font-size: 24px; letter-spacing: 8px; text-align: center; font-family: ui-monospace, Menlo, monospace; }
.steps { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }
.steps li { margin: 4px 0; }

/* ---------- application layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.sidebar { min-width: 0; background: var(--surface-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.sidebar .brand { padding: 14px 14px 6px; margin: 0; }
.sidebar .brand b { font-size: 15px; }
.sidebar nav { flex: 1; overflow: auto; padding: 6px 8px; }
.sidebar-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0;
  background: transparent; cursor: pointer; text-align: left; font-size: 14.5px; color: var(--text);
}
.sidebar-item:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.sidebar-item.selected { background: var(--accent); color: var(--accent-text); }
.sidebar-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 6px; }
.sidebar-bottom { border-top: 1px solid var(--border); padding: 10px 12px; font-size: 13px; }
.sidebar-bottom .menu-wrap { min-width: 0; }
.account-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  color: var(--sidebar-text);
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.account-trigger:hover { color: var(--text); background: var(--sidebar-hover); }
.account-trigger svg { width: 17px; height: 17px; flex: none; }
.account-trigger span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

.column { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.medium { border-right: 1px solid var(--border); background: var(--surface); }
.right { background: var(--bg); }
.column-header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); min-height: 52px; background: var(--surface); }
.column-header h2 { font-size: 16px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column-body { flex: 1; overflow: auto; min-height: 0; }
.padded { padding: 12px 14px; }
.back-row { display: flex; align-items: center; padding: 5px 8px; border-bottom: 1px solid var(--border); background: var(--surface); }
.back-row .btn { min-width: 0; max-width: 100%; color: var(--secondary); }
.back-row .btn:hover { color: var(--text); }
.back-row .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 861px) { .back-row.phone-only { display: none; } }

.search-form { padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.search-box { display: flex; gap: 8px; }
.search-box .input { flex: 1; }
.filter-toggle { margin-top: 8px; font-size: 13px; }
.filters { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.options { display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 8px; }
.section-segment { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-top: 8px; }
.section-segment button { border: 0; background: var(--surface); padding: 6px 12px; cursor: pointer; font-size: 13.5px; border-right: 1px solid var(--border); }
.section-segment button:last-child { border-right: 0; }
.section-segment button.selected { background: var(--accent); color: var(--accent-text); }

.result-summary { padding: 8px 14px; font-size: 13px; color: var(--secondary); border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.list { list-style: none; margin: 0; padding: 0; }
.list-item { border-bottom: 1px solid var(--border); }
.list-item > button, .list-item > .list-inner {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 11px 14px; cursor: pointer; color: var(--text);
}
.list-item > button:hover { background: var(--surface-2); }
.list-item.selected > button { background: var(--accent-light); box-shadow: inset 3px 0 0 var(--accent); }
.item-title { font-weight: 600; font-size: 14.5px; }
.item-sub { font-size: 12.5px; color: var(--secondary); margin-top: 3px; }
.item-note { font-size: 13px; color: var(--info); margin-top: 4px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--secondary); border: 1px solid var(--border); vertical-align: 1px; }
.badge.highlight { background: var(--accent-light); color: var(--accent-ink); border-color: transparent; }
.empty { padding: 36px 20px; text-align: center; color: var(--secondary); }
.empty svg { width: 40px; height: 40px; opacity: .5; display: block; margin: 0 auto 10px; }
.loading { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 22px; color: var(--secondary); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: don .8s linear infinite; }
@keyframes don { to { transform: rotate(360deg); } }
.more { padding: 12px; text-align: center; }

/* section headings (search everywhere) */
.source-section { border-bottom: 6px solid var(--bg); }
.source-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px 6px; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .3px; color: var(--secondary); }
.source-title .flex { flex: 1; }
.source-title > * { white-space: nowrap; }
.source-title .number { font-weight: 500; text-transform: none; }

/* ---------- document view ---------- */
.doc-toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.doc-toolbar .find { display: flex; align-items: center; gap: 4px; flex: 1 1 220px; min-width: 180px; }
.doc-toolbar .find .input { min-height: 32px; padding: 5px 9px; }
.doc-toolbar .counter { font-size: 12.5px; color: var(--secondary); min-width: 48px; text-align: center; }
.doc-body { flex: 1; display: flex; min-height: 0; position: relative; }
.doc-frame { flex: 1; border: 0; width: 100%; height: 100%; background: #fff; }
:root[data-theme="dark"] .doc-frame { background: #1c1c1e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .doc-frame { background: #1c1c1e; } }
.doc-meta { padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.doc-meta .citation { font-size: 13px; color: var(--secondary); user-select: text; }
.doc-meta .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.claude-panel { width: 400px; max-width: 100%; border-left: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.claude-messages { flex: 1; overflow: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.message { padding: 9px 12px; border-radius: 10px; font-size: 14px; line-height: 1.5; }
.message.user { background: var(--accent-light); align-self: flex-end; max-width: 90%; }
.message.assistant { background: var(--surface-2); }
.message.assistant h3, .message.assistant h4 { font-size: 14.5px; margin: 10px 0 4px; }
.message.assistant ul, .message.assistant ol { padding-left: 20px; margin: 4px 0; }
.message.assistant p { margin: 0 0 6px; }
.claude-input { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border); align-items: flex-end; }
.claude-input textarea { min-height: 40px; max-height: 160px; }

/* article list */
.article-item > button { padding: 8px 14px; }
.article-section { padding: 10px 14px 4px; font-weight: 700; font-size: 13.5px; }
.article-section .muted { font-weight: 400; font-size: 12.5px; }

/* ---------- dropdown menu, dialog ---------- */
.menu-wrap { position: relative; display: inline-block; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 230px; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.menu.left { left: 0; right: auto; }
.menu button, .menu a { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--text); text-decoration: none; font-size: 14px; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu svg { width: 16px; height: 16px; flex: none; opacity: .8; }
.menu .divider { height: 1px; background: var(--border); margin: 4px 2px; }
.menu .menu-title { font-size: 11.5px; color: var(--secondary); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .3px; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 50; display: grid; place-items: center; padding: 16px; }
.dialog { width: 100%; max-width: 560px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
.dialog-header { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.dialog-header h3 { margin: 0; flex: 1; font-size: 16px; }
.dialog-body { padding: 14px 18px; overflow: auto; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 99px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px); }

/* table (admin) */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-weight: 600; color: var(--secondary); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
.table-wrap { overflow-x: auto; }
.tab-bar { display: flex; gap: 4px; padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.temp-password { font-family: ui-monospace, Menlo, monospace; font-size: 20px; letter-spacing: 1px; text-align: center; padding: 12px; background: var(--surface-2); border-radius: 8px; user-select: all; }

/* ---------- tabs: several searches and documents open at once, as in a browser ---------- */
.tab-area { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tab-pane { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--middle-width) minmax(0, 1fr); }
.tab-pane[hidden] { display: none; }
.tab-pane.full-width { grid-template-columns: minmax(0, 1fr); }
.tab-pane.full-width > .medium { border-right: 0; }
.app-tabs { flex: none; display: flex; align-items: flex-end; gap: 2px; padding: 6px 8px 0; background: var(--surface-2);
  border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.app-tabs::-webkit-scrollbar { display: none; }
.app-tab { position: relative; display: flex; align-items: center; gap: 7px; flex: 0 1 220px; min-width: 110px; height: 34px; margin-bottom: -1px;
  padding: 0 5px 0 11px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; color: var(--secondary);
  font-size: 13px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.app-tab:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); }
.app-tab.active { background: var(--surface); border-color: var(--border); color: var(--text); font-weight: 600; }
.app-tab.active::before { content: ""; position: absolute; top: -1px; left: -1px; right: -1px; height: 2px; border-radius: 8px 8px 0 0; background: var(--accent); }
.app-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.app-tab > svg { width: 15px; height: 15px; flex: none; opacity: .75; }
.app-tab.active > svg { color: var(--accent-ink); opacity: 1; }
.app-tab-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-tab-close { display: grid; place-items: center; flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: inherit; cursor: pointer; opacity: .55; }
.app-tab-close:hover { opacity: 1; background: color-mix(in srgb, var(--text) 10%, transparent); }
.app-tab-close svg { width: 13px; height: 13px; }
.app-tab-add { flex: none; align-self: center; width: 30px; min-width: 30px; height: 30px; min-height: 30px; padding: 0; margin: 0 0 2px 2px; }

/* ---------- search page: choose where to search, then that source's filters ---------- */
.source-picker { padding: 12px 14px 2px; background: var(--surface); }
.source-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--secondary); margin-bottom: 7px; }
.source-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.source-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 9px; border: 1px solid var(--border); border-radius: 99px;
  background: var(--surface); color: var(--text); font-size: 13px; line-height: 1.3; white-space: nowrap; cursor: pointer; }
.source-chip:hover { background: var(--surface-2); }
.source-chip svg { width: 15px; height: 15px; flex: none; color: var(--secondary); }
.source-chip.selected { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.source-chip.selected svg { color: var(--accent-text); }
.source-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.source-picker + .search-form { padding-top: 10px; }

/* ---------- narrow screen (phone) ---------- */
@media (max-width: 1100px) {
  :root { --middle-width: 360px; --sidebar-width: 190px; }
  .claude-panel { position: absolute; inset: 0 0 0 auto; z-index: 20; box-shadow: var(--shadow); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .sidebar { order: 2; border-right: 0; border-top: 1px solid var(--border); }
  .sidebar .brand, .sidebar-bottom, .sidebar-divider { display: none; }
  .sidebar nav { display: flex; overflow: visible; padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); gap: 1px; }
  .sidebar-item { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 1px; text-align: center; justify-content: center; letter-spacing: -.1px; }
  .sidebar-item span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .sidebar-item span { white-space: nowrap; }
  .tab-pane.detail-open .medium { display: none; }
  .tab-pane:not(.detail-open) .right { display: none; }
  .medium { border-right: 0; }
  .tab-pane { grid-template-columns: minmax(0, 1fr); }
  .app-tabs { padding: calc(4px + env(safe-area-inset-top)) 6px 0; }
  .app-tab { flex-basis: 160px; min-width: 92px; height: 32px; padding-left: 9px; }
  .app-tab:not(.active) .app-tab-close { display: none; }
  .source-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px 2px; }
  .source-chips::-webkit-scrollbar { display: none; }
  .source-chip { flex: none; }
  .claude-panel { width: 100%; }
  .doc-toolbar .find { flex-basis: 100%; order: 3; }
}

/* ---------- additional adjustments ---------- */
.short-name, .mobile-logout { display: none; }
.flex-full { flex: 1; }
.doc-body > .padded { flex: 1; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.dialog .list-inner { padding: 8px 4px; cursor: pointer; }
.dialog .list { max-height: 40vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; margin-top: 6px; }
@media (max-width: 860px) {
  .short-name, .mobile-logout { display: inline; }
  .mobile-logout { display: inline-flex; }
  .long-name { display: none; }
  .tab-pane.full-width .medium { display: flex; }
}
.column-header > svg { width: 18px; height: 18px; flex: none; color: var(--accent-ink); }

/* ---------- cases and projects, chat ---------- */
.count-badge { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 700; }
.icon-wrap { position: relative; display: inline-flex; }
.dot-badge { position: absolute; top: -6px; right: -9px; background: var(--error); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px; line-height: 1; }
.sidebar-item.selected .dot-badge { background: #fff; color: var(--accent); }
.list-btn { border: 0; background: transparent; text-align: left; padding: 11px 4px 11px 14px; cursor: pointer; color: inherit; }
.list-btn:hover { background: var(--surface-2); }
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.chat-stream { flex: 1; overflow: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: min(720px, 92%); padding: 8px 12px; border-radius: 12px; background: var(--surface-2); align-self: flex-start; }
.msg.mine { align-self: flex-end; background: var(--accent-light); }
.msg.claude { background: color-mix(in srgb, var(--info) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--info) 25%, transparent); max-width: min(820px, 96%); }
.msg-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.msg-head .msg-delete { margin-left: auto; opacity: 0; min-height: 22px; padding: 2px 4px; }
.msg:hover .msg-delete { opacity: 1; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; margin-top: 2px; }
.msg-system { align-self: center; font-size: 12.5px; color: var(--secondary); text-align: center; max-width: 90%; }
.day-divider { align-self: center; font-size: 12px; color: var(--secondary); margin: 8px 0 2px; }
.day-divider span { background: var(--surface-2); padding: 2px 10px; border-radius: 99px; }
.chat-input { display: flex; gap: 6px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); align-items: flex-end; background: var(--surface); }
.chat-input textarea { min-height: 40px; max-height: 180px; resize: none; }
.chat-hint { font-size: 12px; color: var(--secondary); padding: 0 14px 8px; background: var(--surface); }
.attachment-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 3px 9px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip svg { width: 13px; height: 13px; flex: none; }
.attachment-chip .btn { min-height: 18px; padding: 0 2px; }
.message-md h4 { font-size: 14.5px; margin: 10px 0 4px; }
.message-md p { margin: 0 0 6px; }
.message-md ul, .message-md ol { padding-left: 20px; margin: 4px 0 8px; }
.report .message-md { font-size: 15px; line-height: 1.6; }
.report .message-md h4 { font-size: 16px; margin-top: 18px; }
.citation-code { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 5px; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); vertical-align: 1px; font-family: inherit; }
.upload-area { display: flex; gap: 12px; align-items: center; padding: 18px; border: 2px dashed var(--border); border-radius: var(--radius);
  cursor: pointer; background: var(--surface); }
.upload-area.active, .upload-area:hover { border-color: var(--accent); background: var(--accent-light); }
.upload-area svg { width: 26px; height: 26px; color: var(--accent-ink); flex: none; }
.preview-text { white-space: pre-wrap; font-size: 12px; max-height: 240px; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: 6px; }
.step-list { margin: 8px 0 0; padding-left: 20px; font-size: 13px; }
.step-list li { margin: 2px 0; }
.menu.up { top: auto; bottom: calc(100% + 4px); }
.mobile-only { display: none; }
@media (max-width: 860px) {
  .mobile-hidden { display: none !important; }
  .mobile-only { display: flex; flex: 1 1 0; min-width: 0; }
  .more-wrap .menu-wrap { width: 100%; }
  .more-wrap .menu-wrap > button { width: 100%; }
  .more-wrap .menu { right: 0; }
  .tab-bar { overflow-x: auto; flex-wrap: nowrap; }
  .tab-bar .btn { flex: none; }
}
.item-title svg, .list-item .row > svg { width: 16px; height: 16px; flex: none; vertical-align: -3px; }

/* ---- Markdown tables */
.md-table { overflow-x: auto; margin: 8px 0; }
.md-table table { border-collapse: collapse; font-size: .92em; min-width: 100%; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.md-table th { background: var(--surface-2); }

/* ---- shared form and result cards */
.form-vertical { display: flex; flex-direction: column; gap: 8px; }
.form-vertical .label { margin-bottom: -4px; }
.subheading { padding: 14px 14px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--secondary); }
.result-card { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.big-result { font-size: 22px; font-weight: 700; color: var(--accent-ink); }
.step-list { margin: 6px 0; padding-left: 20px; color: var(--secondary); }
.step-list li { margin: 2px 0; }
.options.vertical { flex-direction: column; align-items: flex-start; }
.alert.info { border-color: var(--info); }

/* ---- notification bell */
.brand { position: relative; }
.brand .bell { margin-left: auto; position: relative; }
.brand .bell .dot-badge { top: -2px; right: -4px; }
.notification-list .unread { background: var(--accent-light); }
.notification-list .item-title svg { width: 15px; height: 15px; vertical-align: -2px; }
.notification-text { white-space: pre-wrap; }

/* ---- calendar and tasks */
.event.urgent .item-sub b { color: var(--error); }
.event.near .item-sub b { color: var(--warning); }
.event.past .item-sub b { color: var(--error); }
.list-item.done { opacity: .6; }
.list-item.done .item-title { text-decoration: line-through; }
.badge.kind-hearing { background: var(--accent-light); color: var(--accent-ink); }
.badge.kind-deadline { background: #fde8e6; color: var(--error); }
.task .confirm-box { margin: 8px 0 0 6px; border: 1px solid var(--border); width: 30px; height: 30px; }
.task.done .confirm-box { color: var(--success); }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; padding: 0 10px; }
.month-day-name { font-size: 11px; color: var(--secondary); text-align: center; padding: 4px 0; }
.month-day { min-height: 74px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); padding: 3px; text-align: left;
  display: flex; flex-direction: column; gap: 2px; cursor: pointer; overflow: hidden; color: inherit; }
.month-day:hover { border-color: var(--accent); }
.month-day.other-month { opacity: .45; }
.month-day.weekend, .month-day.holiday { background: var(--surface-2); }
.month-day.judicial-recess { box-shadow: inset 0 -3px 0 var(--warning); }
.month-day.today .month-no { background: var(--accent); color: var(--accent-text); border-radius: 10px; padding: 0 6px; }
.month-day.selected { outline: 2px solid var(--accent); }
.month-no { font-size: 12px; font-weight: 600; align-self: flex-start; }
.month-label { font-size: 10.5px; line-height: 1.25; background: var(--accent-light); color: var(--accent-ink); border-radius: 3px; padding: 0 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-label.kind-deadline { background: #fde8e6; color: var(--error); }
.month-label.task { background: var(--surface-2); color: var(--secondary); }
.month-label.done { text-decoration: line-through; opacity: .6; }
.color-sample { display: inline-block; width: 12px; height: 10px; border-radius: 2px; vertical-align: -1px; border: 1px solid var(--border); }
.color-sample.judicial-recess { box-shadow: inset 0 -3px 0 var(--warning); }
.color-sample.holiday { background: var(--surface-2); }
.table-edit .input { min-height: 30px; padding: 4px 6px; min-width: 90px; }
.table-edit td { padding: 3px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .badge.kind-deadline, :root:not([data-theme]) .month-label.kind-deadline { background: #3d1d1b; }
}
:root[data-theme="dark"] .badge.kind-deadline, :root[data-theme="dark"] .month-label.kind-deadline { background: #3d1d1b; }
@media (max-width: 860px) {
  .month-day { min-height: 52px; }
  .month-label { font-size: 9px; }
  .brand .bell { display: none; }
}
.menu.up { max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); overflow-y: auto; }
.sidebar .brand b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.more-wrap { position: relative; }
.more-badge { position: absolute; z-index: 2; top: 6px; right: 22px; pointer-events: none; width: 9px; height: 9px; border-radius: 50%; background: var(--error); }
.recovery-codes { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; line-height: 1.7; background: var(--surface-2);
  border-radius: 8px; padding: 10px 14px; column-count: 2; user-select: all; }
.login-card .btn.plain.small { width: 100%; margin-top: 10px; justify-content: center; }
.login-card .check { margin-top: 12px; }
.status-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.status-icon svg { width: 16px; height: 16px; }
.status-ok .status-icon { background: #e3f3e6; color: var(--success); }
.status-warning .status-icon { background: #fdf0dc; color: var(--warning); }
.status-error .status-icon { background: #fde8e6; color: var(--error); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .status-ok .status-icon { background: #1d3322; } :root:not([data-theme]) .status-warning .status-icon { background: #3a2d14; } :root:not([data-theme]) .status-error .status-icon { background: #3d1d1b; }
}
:root[data-theme="dark"] .status-ok .status-icon { background: #1d3322; }
:root[data-theme="dark"] .status-warning .status-icon { background: #3a2d14; }
:root[data-theme="dark"] .status-error .status-icon { background: #3d1d1b; }

/* ---- sidebar: fits on one screen on desktop without scrolling (item spacing shrinks with the screen height) */
@media (min-width: 861px) {
  .sidebar { height: 100vh; height: 100dvh; }
  .sidebar .brand { padding: clamp(6px, 1.2vh, 14px) 14px clamp(2px, .5vh, 6px); }
  .sidebar .brand-icon { width: clamp(28px, 4vh, 38px); height: clamp(28px, 4vh, 38px); }
  .sidebar nav { display: flex; flex-direction: column; overflow: hidden; padding: 2px 8px; }
  .sidebar-item { flex: none; padding: clamp(3px, calc(.9vh - 2px), 8px) 10px; font-size: clamp(13px, 1.75vh, 14.5px); line-height: 1.25; }
  .sidebar-item .long-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .sidebar-item svg { width: clamp(15px, 2.1vh, 18px); height: clamp(15px, 2.1vh, 18px); }
  .sidebar-divider { margin: clamp(2px, .6vh, 8px) 6px; }
  .sidebar-bottom { display: flex; align-items: center; gap: 4px; padding: clamp(5px, .8vh, 10px) 8px; }
  .sidebar-bottom .menu-wrap { flex: 1; min-width: 0; }
  .sidebar-bottom .btn.icon { width: 28px; height: 28px; min-height: 28px; padding: 0; flex: none; }
}
/* on very short screens (e.g. a small window) no item should be cut off either */
@media (min-width: 861px) and (max-height: 640px) {
  .sidebar nav { overflow-y: auto; }
}

/* AI model selection */
.model-select { width: auto; max-width: 100%; min-height: 32px; padding: 4px 28px 4px 10px; font-size: 13px; }
.model-row { padding: 8px 14px; border-bottom: 1px solid var(--border); }
.model-row .model-select { width: 100%; }
.message-model { font-size: 11.5px; color: var(--secondary); margin-bottom: 4px; }
.ai-card { margin-bottom: 14px; }
.model-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }

/* UYAP suggestions and inbox */
.suggestion-box { border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 4px; background: var(--accent-light); }
.suggestion-box .list { background: transparent; }
.suggestion-card { list-style: none; margin: 6px 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.suggestion-fields { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: flex-end; }
.suggestion-fields label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--secondary); }
.suggestion-fields .input { min-height: 32px; padding: 4px 8px; font-size: 13.5px; width: auto; }
.suggestion-quote { margin-top: 4px; padding: 6px 10px; border-left: 3px solid var(--border); color: var(--secondary); font-size: 13px; white-space: pre-wrap; }
.badge.kind-service, .badge.kind-site_visit { background: var(--accent-light); color: var(--accent-ink); }
.inbox-item { padding: 10px 14px; }

/* user guide */
.guide-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.guide-toc .attachment-chip { cursor: pointer; }
.guide { max-width: 820px; line-height: 1.6; }
.guide section { padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 16px; scroll-margin-top: 8px; }
.guide section:last-child { border-bottom: 0; }
.guide h3 { font-size: 18px; margin: 8px 0 10px; }
.guide h4 { font-size: 15px; margin: 14px 0 6px; }
.guide p, .guide li { font-size: 14.5px; }
.guide ul, .guide ol { padding-left: 22px; }
.guide li { margin: 3px 0; }
.guide code { font-size: 13px; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }
.guide mark { background: #fff1a8; color: inherit; border-radius: 2px; }
.guide-diagram { margin: 12px 0; }
.guide-diagram img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 12px; }
@media print {
  .sidebar, .app-tabs, .column.medium, .search-form, .column-header { display: none !important; }
  .guide { max-width: none; }
}

/* ---------- 2026 workspace redesign ---------- */
body { font-size: 14.5px; letter-spacing: -.005em; }
button, input, select, textarea { letter-spacing: inherit; }
button, a, input, select, textarea { transition: border-color .14s ease, background-color .14s ease, color .14s ease; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 58%, transparent);
  outline-offset: 2px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

.input, select.input, textarea.input {
  min-height: 42px;
  padding: 10px 12px;
  border-color: color-mix(in srgb, var(--border) 88%, var(--text));
  border-radius: 10px;
  box-shadow: none;
}
.input:hover { border-color: color-mix(in srgb, var(--secondary) 55%, var(--border)); }
.input:focus { border-color: var(--accent); box-shadow: none; }
.label { margin: 14px 0 5px; color: var(--text); font-size: 12.5px; font-weight: 600; }
.btn {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  border-color: color-mix(in srgb, var(--border) 88%, var(--text));
  box-shadow: none;
}
.btn:hover:not(:disabled) { transform: none; }
.btn.primary { box-shadow: none; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); filter: none; }
.btn.plain, .btn.small { box-shadow: none; }
.card { border-color: color-mix(in srgb, var(--border) 92%, var(--text)); box-shadow: none; }
.badge { padding: 2px 8px; font-weight: 600; }

/* Login: a quiet, secure threshold into the workspace. */
.login-bg {
  position: relative;
  min-height: 100%;
  padding: 0;
  overflow: hidden;
  background: #111923;
}
.login-bg::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--accent);
}
.login-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(600px, 58%) minmax(420px, 42%);
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  height: 100dvh;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.login-intro {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: clamp(48px, 6vw, 96px);
  overflow: hidden;
  color: #fff;
  background-color: #18212b;
  background-image: url('/static/login-hero-themis-focus.jpg');
  background-position: center center;
  background-size: cover;
}
.login-intro::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 15, 22, .54) 0%, rgba(8, 15, 22, .08) 42%, rgba(8, 15, 22, .78) 100%);
}
.login-intro .brand { z-index: 1; margin: 0; }
.login-intro .brand-icon { width: 44px; height: 44px; border-radius: 12px; box-shadow: none; }
.brand-copy { display: flex; min-width: 0; flex-direction: column; line-height: 1.2; }
.brand-copy b { font-size: 17px; letter-spacing: -.02em; }
.brand-copy span { margin-top: 3px; color: rgba(255,255,255,.7); font-size: 11.5px; }
.login-intro-copy { z-index: 1; max-width: 470px; margin: auto 0 22px; }
.login-intro-copy h2 {
  max-width: 12ch;
  margin: 0 0 14px;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(42px, 4.4vw, 66px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.login-intro-copy p { max-width: 42ch; margin: 0; color: rgba(255,255,255,.78); font-size: 15px; line-height: 1.65; }
.login-trust { z-index: 1; display: flex; align-items: center; gap: 9px; color: rgba(255,255,255,.72); font-size: 12px; }
.login-trust span { width: 8px; height: 8px; border-radius: 50%; background: #55b47b; box-shadow: none; }
.login-panel { display: flex; flex-direction: column; justify-content: center; min-width: 0; min-height: 100dvh; padding: clamp(48px, 6vw, 96px); overflow-y: auto; background: var(--surface); }
.login-panel form, .login-panel > div { width: 100%; max-width: 390px; margin-right: auto; margin-left: auto; }
.login-card h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -.03em; }
.login-card form > p { margin: 0 0 24px; line-height: 1.55; }
.login-card .btn.primary { min-height: 46px; margin-top: 22px; }
.login-card #message { margin-top: 16px; }
.code-input { min-height: 54px; border-radius: 12px; font-size: 25px; }

/* Application shell */
.app { background: var(--bg); }
.tab-area { background: var(--bg); }
.app-tabs {
  min-height: 46px;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 12px 0;
  background: var(--sidebar-bg);
  border-bottom-color: var(--border);
}
.app-tab {
  flex-basis: 230px;
  height: 38px;
  padding: 0 7px 0 12px;
  border-radius: 9px 9px 0 0;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
}
.app-tab:hover { color: var(--text); background: var(--sidebar-hover); }
.app-tab.active { color: var(--text); background: var(--surface); border-color: var(--border); font-weight: 600; }
.app-tab.active::before {
  top: auto;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 2px;
  border-radius: 2px 2px 0 0;
}
.app-tab.active > svg { color: var(--accent-ink); }
.app-tab-add { margin-bottom: 4px; color: var(--secondary); }
.app-tab-add:hover { color: var(--text); }
.sidebar {
  position: relative;
  z-index: 3;
  color: var(--sidebar-text);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: none;
}
.sidebar .brand { min-height: 72px; padding: 14px 16px 10px; gap: 11px; }
.sidebar .brand-icon { width: 40px; height: 40px; border-radius: 12px; box-shadow: none; }
.sidebar .brand-copy { flex: 1; }
.sidebar .brand-copy b { color: var(--text); font-size: 16px; }
.sidebar .brand-copy span { color: var(--sidebar-muted); font-size: 10.5px; }
.sidebar nav { padding: 6px 10px 10px; }
.sidebar-item {
  position: relative;
  gap: 11px;
  min-height: 38px;
  padding: 8px 11px;
  border-radius: 9px;
  color: var(--sidebar-text);
  font-weight: 500;
}
.sidebar-item::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: -10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
}
.sidebar-item:hover { color: var(--text); background: var(--sidebar-hover); }
.sidebar-item.selected { color: var(--sidebar-active-text); background: var(--sidebar-active); box-shadow: none; }
.sidebar-item.selected::before { background: var(--accent); }
.sidebar-item svg { opacity: .78; }
.sidebar-item.selected svg { color: var(--sidebar-active-text); opacity: 1; }
.sidebar-divider { background: var(--sidebar-border); }
.sidebar-bottom { color: var(--sidebar-text); background: var(--sidebar-bg); border-top-color: var(--sidebar-border); }
.sidebar-bottom .name { color: var(--text); }
.sidebar .btn.plain { color: var(--sidebar-muted); }
.sidebar .btn.plain:hover { color: var(--text); background: var(--sidebar-hover); }
.sidebar-item.selected .dot-badge { color: #fff; background: var(--accent); }

.medium { position: relative; z-index: 2; background: var(--surface); border-right-color: var(--border); box-shadow: none; }
.right { background: var(--bg); }
.column-header {
  min-height: 64px;
  padding: 12px 18px;
  border-bottom-color: var(--border);
  background: color-mix(in srgb, var(--surface) 96%, var(--bg));
}
.column-header h2 { font-size: 16.5px; font-weight: 650; letter-spacing: -.02em; }
.section-header { gap: 10px; }
.section-header > svg { width: 19px; height: 19px; color: var(--accent-ink); }
.padded { padding: 16px 18px; }

.source-picker { padding: 15px 18px 6px; }
.source-label {
  margin-bottom: 9px;
  color: var(--secondary);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.source-chips { gap: 6px; }
.source-chip {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--border) 88%, var(--text));
  background: var(--surface);
  font-size: 12.5px;
}
.source-chip:hover { border-color: color-mix(in srgb, var(--secondary) 45%, var(--border)); background: var(--surface-2); }
.source-chip.selected {
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--accent-light);
  font-weight: 650;
}
.source-chip.selected svg { color: var(--accent-ink); }
.source-picker + .search-form { padding-top: 12px; }

.search-form { padding: 18px; background: var(--surface); border-bottom-color: var(--border); }
.search-box { gap: 10px; }
.search-box .input { min-height: 46px; padding-left: 14px; font-size: 15px; }
.search-box .btn { min-width: 82px; min-height: 46px; }
.search-form > p { margin: 14px 0 0; line-height: 1.55; }
.filter-toggle { margin-top: 10px; }
.filters { margin-top: 10px; padding-top: 12px; border-top-style: solid; }
.section-segment { border-radius: 10px; }
.section-segment button { min-height: 34px; }

.result-summary { min-height: 42px; padding: 9px 18px; background: color-mix(in srgb, var(--surface-2) 46%, var(--surface)); }
.list-item { border-bottom-color: color-mix(in srgb, var(--border) 78%, transparent); }
.list-item > button, .list-item > .list-inner { padding: 14px 18px; }
.list-item > button:hover { background: color-mix(in srgb, var(--surface-2) 72%, var(--surface)); }
.list-item.selected > button { background: var(--accent-light); box-shadow: inset 4px 0 0 var(--accent); }
.item-title { color: var(--text); font-size: 14.5px; line-height: 1.4; }
.item-sub { margin-top: 5px; line-height: 1.45; }
.item-note { margin-top: 6px; }
.empty { padding: 54px 26px; line-height: 1.55; }
.empty svg { width: 34px; height: 34px; margin-bottom: 14px; opacity: .36; }
.source-section { border-bottom-width: 8px; }
.source-title { padding: 13px 18px 9px; color: var(--text); font-size: 13.5px; text-transform: none; letter-spacing: 0; }
.source-title .number { color: var(--secondary); }

.workspace-empty {
  width: min(480px, calc(100% - 48px));
  margin: clamp(72px, 14vh, 140px) auto auto;
  padding: 0;
  text-align: left;
  color: var(--secondary);
}
.workspace-empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 0 20px;
  color: var(--accent-ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: none;
}
.workspace-empty-icon svg { width: 21px; height: 21px; }
.workspace-empty h3 { margin: 0 0 8px; color: var(--text); font-size: 22px; font-weight: 650; letter-spacing: -.025em; }
.workspace-empty p { max-width: 46ch; margin: 0; line-height: 1.6; }
.workspace-empty > span { display: block; margin-top: 18px; font-size: 12px; }

.doc-toolbar { gap: 8px; padding: 9px 12px; }
.doc-meta { padding: 16px 20px; }
.doc-meta .citation { line-height: 1.55; }
.claude-panel { width: 430px; box-shadow: none; }
.menu { padding: 7px; border-radius: 12px; box-shadow: var(--shadow); }
.menu button, .menu a { padding: 9px 10px; border-radius: 8px; }
.overlay { background: rgba(10, 17, 25, .58); backdrop-filter: none; }
.dialog { border-radius: 16px; box-shadow: var(--shadow); }
.dialog-header { padding: 17px 20px; }
.dialog-body { padding: 18px 20px; }
.dialog-footer { padding: 14px 20px; }
.table th { text-transform: none; letter-spacing: 0; }
.tab-bar { gap: 6px; padding: 10px 16px; }
.subheading { padding: 18px 18px 7px; color: var(--text); font-size: 12.5px; text-transform: none; letter-spacing: 0; }
.upload-area { border-width: 1.5px; }
.month-grid { gap: 5px; padding: 4px 14px 14px; }
.month-day { border-radius: 9px; padding: 5px; }

@media (max-width: 1100px) and (min-width: 861px) {
  :root { --middle-width: 390px; --sidebar-width: 220px; }
  .sidebar .brand-copy span { display: none; }
  .login-card { grid-template-columns: minmax(480px, 54%) minmax(400px, 46%); }
  .login-intro { padding: 54px; }
  .login-panel { padding: 48px; }
}
@media (max-width: 860px) {
  .app { background: var(--surface); }
  .app-tabs { min-height: 41px; padding: calc(5px + env(safe-area-inset-top)) 6px 0; }
  .app-tab { height: 35px; }
  .sidebar { background: var(--sidebar-bg); border-top: 1px solid var(--sidebar-border); box-shadow: none; }
  .sidebar nav { padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); }
  .sidebar-item { min-height: 52px; color: var(--sidebar-text); border-radius: 9px; }
  .sidebar-item::before { inset: auto 22% -5px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .sidebar-item.selected { background: var(--sidebar-active); }
  .column-header { min-height: 58px; padding: 10px 14px; }
  .search-form { padding: 14px; }
  .source-picker { padding: 12px 14px 5px; }
  .search-box .btn { min-width: 50px; padding-inline: 12px; }
  .search-box .btn span { display: none; }
  .list-item > button, .list-item > .list-inner { padding: 13px 14px; }
  .workspace-empty { display: none; }
}
@media (max-width: 760px) {
  .login-bg { align-items: start; padding: 0; background: var(--surface); }
  .login-bg::before { width: 100%; height: 5px; }
  .login-card { display: block; height: auto; min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  .login-intro { min-height: 290px; padding: 28px 24px 24px; background-position: center 43%; }
  .login-intro-copy { margin: auto 0 0; }
  .login-intro-copy h2 { max-width: 14ch; margin-bottom: 0; font-size: 31px; }
  .login-intro-copy p, .login-trust { display: none; }
  .login-panel { min-height: calc(100dvh - 290px); padding: 38px 24px 46px; }
  .login-card h1 { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- error page (404 / 500), served without the app's scripts ---------- */
.error-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.error-card { width: 100%; max-width: 420px; padding: 28px 26px; }
.error-brand { display: flex; align-items: center; gap: 12px; }
.error-brand b { display: block; font-size: 16px; }
.error-brand span { display: block; margin-top: 2px; font-size: 12px; color: var(--secondary); }
.error-code { margin: 24px 0 6px; font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -1px; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.error-card h1 { margin: 0 0 4px; font-size: 22px; }
.error-card p { margin: 6px 0 0; line-height: 1.5; color: var(--secondary); }
.error-card .btn.primary { width: 100%; margin-top: 20px; min-height: 42px; }

/* ---------- search page: several sources at once ---------- */
.source-label span { margin-left: 8px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--secondary); opacity: .85; }
.multi-source .source-title { align-items: center; }
.multi-source .source-title .btn { font-weight: 500; }
.multi-filters { padding: 2px 18px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.multi-filters .tab-bar { padding: 0 0 8px; border-bottom: 0; background: transparent; }
.multi-filters > .row:first-child, .multi-filters > .options:first-child { margin-top: 0; }
@media (max-width: 860px) {
  .source-label span { display: block; margin: 2px 0 0; }
}

