/* Legal Assistant dashboard. Playfair Display for headings, Poppins for everything else. */
:root {
  --ink: #15171C;
  --ink-2: #2A2D34;
  --text: #24262B;
  --muted: #6F6B64;
  --faint: #9A958C;
  --line: #E6E1D8;
  --line-2: #EFEBE4;
  --paper: #F6F4EF;
  --card: #FFFFFF;
  --blue: #0047FF;
  --blue-dark: #0037C7;
  --blue-soft: #EBF0FF;
  --green: #1D7148;
  --green-soft: #E6F3EB;
  --amber: #8F5B00;
  --amber-soft: #FBF0DC;
  --red: #AE2318;
  --red-soft: #FCEBE9;
  --radius: 10px;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 30px; line-height: 1.2; }
h2 { font-size: 20px; line-height: 1.3; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--ink); color: #C9C5BD;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 26px 24px 22px; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-name { font-family: var(--serif); font-size: 21px; color: #fff; line-height: 1.1; }
.brand-by { font-size: 11.5px; color: #8E8A82; margin-top: 4px; letter-spacing: .02em; }
.firm-chip { margin: 16px 16px 6px; padding: 10px 12px; background: rgba(255,255,255,.05); border-radius: 8px; }
.firm-chip .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #8E8A82; }
.firm-chip .name { color: #fff; font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { padding: 10px 12px; flex: 1; overflow-y: auto; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #77736B; padding: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 7px;
  color: #CFCBC3; font-size: 13.5px; position: relative;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; background: var(--blue); border-radius: 2px; }
.nav svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.6; flex-shrink: 0; opacity: .85; }
.nav .count { margin-left: auto; background: var(--blue); color: #fff; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 10px; line-height: 18px; }
.sidebar-foot { padding: 14px 20px 18px; border-top: 1px solid rgba(255,255,255,.07); font-size: 12.5px; }
.sidebar-foot .who { color: #fff; font-weight: 500; }
.sidebar-foot a, .sidebar-foot .linkbtn { color: #9E9A92; font-size: 12.5px; }
.sidebar-foot .linkbtn:hover { color: #fff; }

.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.content { padding: 34px 44px 60px; max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 6px 0 0; max-width: 620px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }

/* ---------- Cards / grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line-2); gap: 12px; }
.card-head h2 { font-size: 17px; }
.card-head .hint { font-size: 12.5px; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
.stack > * + * { margin-top: 18px; }

.stat { padding: 18px 20px; }
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-family: var(--serif); font-size: 32px; color: var(--ink); line-height: 1.15; margin-top: 4px; }
.stat .note { font-size: 12px; color: var(--faint); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 11px 22px; border-bottom: 1px solid var(--line); background: #FBFAF7; white-space: nowrap; }
.table td { padding: 13px 22px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.rowlink:hover td { background: #FBFAF7; cursor: pointer; }
.table .strong { font-weight: 500; color: var(--ink); }
.table .small { font-size: 12.5px; color: var(--muted); }
.truncate { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: 11.5px; font-weight: 500; padding: 2px 9px; border-radius: 20px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.blue { background: var(--blue-soft); color: var(--blue-dark); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label, .label-row { display: block; font-weight: 500; font-size: 13px; color: var(--ink); margin-bottom: 6px; }
.field .help { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff;
  border: 1px solid #DAD4C9; border-radius: 8px; padding: 10px 12px; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.textarea.tall { min-height: 240px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,71,255,.12); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.check input { margin-top: 4px; accent-color: var(--blue); }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] { width: 46px; height: 40px; border: 1px solid #DAD4C9; border-radius: 8px; padding: 3px; background: #fff; }
.form-foot { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.charcount { font-size: 12px; color: var(--faint); text-align: right; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 500; font-size: 13.5px; line-height: 1;
  padding: 11px 18px; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  background: var(--blue); color: #fff; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--blue-dark); text-decoration: none; }
.btn.dark { background: var(--ink); }
.btn.dark:hover { background: #000; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #D8D2C7; }
.btn.ghost:hover { border-color: #B9B2A6; background: #FDFCFA; }
.btn.danger { background: #fff; color: var(--red); border-color: #EBC9C5; }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { padding: 7px 12px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; }
.linkbtn.red { color: var(--red); }
.inline-form { display: inline; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 13.5px; border: 1px solid; }
.alert.success { background: var(--green-soft); border-color: #C4E2D0; color: #13512F; }
.alert.error { background: var(--red-soft); border-color: #F1C9C4; color: #861A11; }
.alert.info { background: var(--blue-soft); border-color: #CFDBFF; color: #0B2C8F; }
.note-box { background: #FBFAF7; border: 1px dashed #DAD4C9; border-radius: 8px; padding: 14px 16px; font-size: 13px; color: var(--muted); }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty h3 { font-family: var(--serif); font-size: 19px; margin-bottom: 6px; }

/* ---------- Setup checklist ---------- */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.steps li:last-child { border-bottom: 0; }
.steps .dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #CFC8BC; flex-shrink: 0; margin-top: 1px; display: grid; place-items: center; }
.steps li.done .dot { background: var(--green); border-color: var(--green); }
.steps li.done .dot::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.steps .t { font-weight: 500; color: var(--ink); }
.steps .d { font-size: 12.5px; color: var(--muted); }
.steps li.done .t { color: var(--muted); }

/* ---------- Transcript ---------- */
.transcript { padding: 20px 24px; }
.msg { margin-bottom: 16px; max-width: 78%; }
.msg .who { font-size: 11.5px; color: var(--faint); margin-bottom: 3px; }
.msg .bubble { padding: 10px 14px; border-radius: 10px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { margin-left: auto; }
.msg.user .who { text-align: right; }
.msg.user .bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 3px; }
.msg.assistant .bubble { background: #F3F0EA; border-bottom-left-radius: 3px; }

/* ---------- Detail list ---------- */
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 0; }
.dl dt { color: var(--muted); font-size: 13px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.dl dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line-2); word-break: break-word; }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 6px 24px 18px; }
.timeline li { position: relative; padding: 14px 0 14px 26px; border-left: 1.5px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -6.5px; top: 19px; width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); }
.timeline li:first-child::before { background: var(--blue); border-color: var(--blue); }
.timeline .stage { font-weight: 500; color: var(--ink); }
.timeline .meta { font-size: 12px; color: var(--faint); }
.timeline .note { margin-top: 4px; white-space: pre-wrap; }

/* ---------- Code / embed ---------- */
.codebox { position: relative; background: var(--ink); color: #E9E5DD; border-radius: 8px; padding: 16px 18px; padding-right: 92px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.codebox .copy { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.1); color: #fff; border: 0; border-radius: 6px; padding: 6px 10px; font: 500 12px var(--sans); cursor: pointer; }
.codebox .copy:hover { background: rgba(255,255,255,.18); }
ol.howto { margin: 0; padding-left: 20px; }
ol.howto li { margin-bottom: 8px; }

/* ---------- Progress ---------- */
.progress { height: 6px; background: var(--line-2); border-radius: 4px; overflow: hidden; margin: 10px 0 6px; }
.progress span { display: block; height: 100%; width: 0; background: var(--blue); transition: width .3s; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters a { padding: 6px 12px; border-radius: 20px; font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--line); background: #fff; }
.filters a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.filters a:hover { text-decoration: none; border-color: #C9C2B6; }
.searchbar { display: flex; gap: 8px; }
.searchbar .input { max-width: 280px; }

/* ---------- Auth pages ---------- */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-side { background: var(--ink); color: #D7D3CB; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .brand-name { font-size: 24px; }
.auth-side h1 { color: #fff; font-size: 40px; line-height: 1.15; max-width: 460px; }
.auth-side .lede { color: #AEA99F; margin-top: 16px; max-width: 420px; font-size: 15px; }
.auth-side ul { list-style: none; padding: 0; margin: 28px 0 0; }
.auth-side li { padding: 9px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 13.5px; display: flex; gap: 10px; }
.auth-side li span { color: #fff; font-family: var(--serif); min-width: 22px; }
.auth-side .foot { font-size: 12px; color: #7D796F; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h2 { font-size: 28px; margin-bottom: 6px; }
.auth-box .sub { color: var(--muted); margin-bottom: 26px; }
.auth-alt { margin-top: 20px; font-size: 13.5px; color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 16px; }
.right { text-align: right; }
.flex { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.preview-frame { width: 100%; height: 680px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 30; }
  .topbar .brand-name { font-size: 18px; }
  .topbar button { background: none; border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 6px; padding: 6px 10px; font: inherit; font-size: 13px; }
  .content { padding: 22px 16px 48px; }
  .grid-2, .grid-3, .row-2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 32px 24px; }
  .auth-side h1 { font-size: 30px; }
  .auth-side ul, .auth-side .foot { display: none; }
  h1 { font-size: 25px; }
  .table th, .table td { padding: 11px 14px; }
  .msg { max-width: 92%; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { border-bottom: 0; padding-bottom: 0; }
}
