/* Singulio Legal dashboard: sober light theme, single accent, no gradients. */
:root {
  --ink: #1c1917;
  --ink-dim: #57534e;
  --line: #e7e5e4;
  --bg: #fafaf9;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --ok: #15803d;
  --warn: #b45309;
  --err: #b91c1c;
  --info: #1d4ed8;
  --radius: 6px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}
.boot { padding: 3rem; text-align: center; color: var(--ink-dim); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em; }
.strong { font-weight: 600; }
.dim { color: var(--ink-dim); }
.small { font-size: 0.8em; }
.sub { color: var(--ink-dim); margin: 0.1rem 0 0; }

/* shell */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 228px; flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 1rem 0.75rem;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 0.6rem; align-items: center; padding: 0 0.5rem 1rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem;
}
.brand-name { font-weight: 700; }
.brand-sub { color: var(--ink-dim); font-size: 0.78rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  padding: 0.5rem 0.7rem; border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.nav-item:hover { background: #f5f5f4; }
.nav-on { background: #f5f5f4; font-weight: 600; }
.side-foot { margin-top: auto; padding: 0.5rem; border-top: 1px solid var(--line); }
.who { font-weight: 600; margin-bottom: 0.5rem; }
.main { flex: 1; min-width: 0; padding: 1.5rem 2rem 4rem; max-width: 1180px; }

/* page head */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; }
.page-head h1 { margin: 0; font-size: 1.4rem; }
.head-actions { display: flex; gap: 0.6rem; align-items: center; }
.crumbs { font-size: 0.85rem; margin-bottom: 0.2rem; }
.crumbs a { color: var(--accent); }

/* controls */
.input, select.input, textarea.input {
  border: 1px solid #d6d3d1; border-radius: var(--radius);
  padding: 0.5rem 0.65rem; font-size: 0.9rem; width: 100%;
  background: var(--panel); color: var(--ink);
}
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.search { width: 260px; }
.search-big { width: 100%; max-width: 640px; margin-bottom: 1rem; }
.btn {
  border: 1px solid #d6d3d1; border-radius: var(--radius);
  background: var(--panel); color: var(--ink);
  padding: 0.5rem 0.9rem; font-size: 0.88rem; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #f5f5f4; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #0d655e; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.icon-btn { border: none; background: none; font-size: 1.3rem; cursor: pointer; color: var(--ink-dim); }
.fld { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.7rem; }
.fld-label { font-size: 0.78rem; font-weight: 600; color: var(--ink-dim); }
.form-row { display: flex; gap: 0.8rem; }
.form-row > * { flex: 1; }
.form-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 0.6rem; }
.check { display: flex; gap: 0.5rem; align-items: center; padding: 0.25rem 0; }
.roles { margin-bottom: 0.7rem; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.tbl th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-dim); padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); background: #fafaf9; }
.tbl td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; }
.rowlink { cursor: pointer; }
.rowlink:hover td { background: #f5f5f4; }
.rowlink:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.rowbtns { white-space: nowrap; text-align: right; }
.rowbtns .btn { margin-left: 0.4rem; }

/* pills + alerts */
.pill { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.12rem 0.55rem; border-radius: 999px; border: 1px solid var(--line); }
.pill-ok { color: var(--ok); border-color: #bbf7d0; background: #f0fdf4; }
.pill-warn { color: var(--warn); border-color: #fde68a; background: #fffbeb; }
.pill-err { color: var(--err); border-color: #fecaca; background: #fef2f2; }
.pill-info { color: var(--info); border-color: #bfdbfe; background: #eff6ff; }
.pill-mute { color: var(--ink-dim); }
.alert { padding: 0.7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.alert-ok { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.alert-err { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--ink-dim); }

/* panels + tabs */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.panel h3 { margin: 0 0 0.7rem; font-size: 0.95rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 0.3rem 0.8rem; margin: 0; }
.kv dt { color: var(--ink-dim); }
.kv dd { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 0.3rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.tabs { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; }
.tab { border: none; background: none; padding: 0.6rem 1rem; cursor: pointer; font-size: 0.9rem; color: var(--ink-dim); border-bottom: 2px solid transparent; }
.tab-on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.sect { margin: 1.4rem 0 0.6rem; font-size: 1rem; }
.toolbar { margin-bottom: 0.8rem; display: flex; gap: 0.6rem; }
.dl-row { display: flex; justify-content: space-between; padding: 0.3rem 0; border-bottom: 1px solid var(--line); }
.upload { margin-bottom: 1.2rem; }

/* modal */
.modal-ov { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal { background: var(--panel); border-radius: 8px; width: 100%; max-width: 640px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-body { padding: 1.2rem; overflow-y: auto; }

/* drafts + docs */
.draft-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.draft-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.draft-area { min-height: 320px; font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; resize: vertical; }
.draft-preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1rem; min-height: 320px; background: #fff; }
.draft-preview h2, .draft-preview h3, .draft-preview h4 { margin: 0.7em 0 0.4em; }
.draft-preview p { margin: 0.4em 0; }
.doc-meta { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.8rem; }
.doc-text { white-space: pre-wrap; font-size: 0.88rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; max-height: 55vh; overflow-y: auto; background: #fff; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1.8rem; }
.login-card .brand { padding: 0 0 1.2rem; justify-content: center; }

/* calendar */
.cal-nav strong { min-width: 150px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-dow { background: #fafaf9; padding: 0.5rem; font-size: 0.75rem; font-weight: 600; color: var(--ink-dim); text-align: center; }
.cal-day { background: #fff; min-height: 96px; padding: 0.35rem; }
.cal-pad { background: #fafaf9; }
.cal-today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-num { font-size: 0.78rem; font-weight: 600; color: var(--ink-dim); }
.cal-ev { font-size: 0.72rem; padding: 0.1rem 0.35rem; border-radius: 4px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-deadline { background: #fef3c7; color: #92400e; }
.cal-docket { background: #f1f5f9; color: #334155; }
.cal-legend { display: flex; gap: 0.6rem; margin-bottom: 0.6rem; }
.cal-more { font-size: 0.72rem; }

/* search results */
.result { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1rem; margin-bottom: 0.6rem; }
.result-head a { color: var(--accent); text-decoration: none; }
.result-snip { margin: 0.3rem 0 0; font-size: 0.88rem; color: var(--ink-dim); }

/* chat */
.chat-page { display: flex; flex-direction: column; height: calc(100vh - 3rem); }
.chat-box { flex: 1; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 1rem; margin-bottom: 0.8rem; }
.msg { margin-bottom: 0.9rem; max-width: 75%; }
.msg-user { margin-left: auto; }
.msg-body { padding: 0.6rem 0.85rem; border-radius: var(--radius); white-space: pre-wrap; font-size: 0.9rem; }
.msg-user .msg-body { background: #f5f5f4; border: 1px solid var(--line); }
.msg-assistant .msg-body { background: #fff; border: 1px solid var(--line); }
.msg-src { margin-top: 0.4rem; font-size: 0.78rem; }
.src-chip { display: inline-block; background: #f5f5f4; border: 1px solid var(--line); border-radius: 4px; padding: 0.1rem 0.4rem; margin: 0.1rem 0.2rem 0 0; }
.chat-in-row { display: flex; gap: 0.6rem; }

@media (max-width: 860px) {
  .side { display: none; }
  .main { padding: 1rem; }
  .grid2, .draft-split { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
