:root {
  --navy-900: #0a1b31;
  --navy-800: #0e2440;
  --navy-700: #16335a;
  --navy-600: #224a7a;
  --gold: #c9a45c;
  --gold-soft: #f6efe1;
  --ink: #16202e;
  --ink-2: #4a5567;
  --ink-3: #7b8597;
  --line: #e3e7ee;
  --line-2: #eef1f5;
  --bg: #f5f7fa;
  --card: #ffffff;
  --ok: #1f7a4d;
  --ok-bg: #e7f4ec;
  --warn: #9a6408;
  --warn-bg: #fdf3e1;
  --err: #b4322f;
  --err-bg: #fbeaea;
  --info: #22558f;
  --info-bg: #e9f0f9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 56, .05), 0 4px 16px rgba(16, 32, 56, .05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy-600); }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

/* sidebar */
.sidebar { background: var(--navy-800); color: #cfd8e6; display: flex; flex-direction: column; padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 26px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 18px; }
.mark { width: 38px; height: 38px; border-radius: 9px; background: var(--navy-900); border: 1px solid rgba(201,164,92,.45); display: grid; place-items: center; }
.mark svg { width: 24px; height: 24px; fill: none; stroke: var(--gold); stroke-width: 3.2; stroke-linecap: round; }
.brand-name { font-family: "Source Serif 4", Georgia, serif; font-size: 19px; color: #fff; letter-spacing: .2px; }
.brand-sub { font-size: 11px; text-transform: uppercase; letter-spacing: 1.6px; color: var(--gold); margin-top: 2px; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px; color: #c3cedf; text-decoration: none; font-weight: 500; }
nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
nav a.active { background: rgba(201,164,92,.14); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.badge { margin-left: auto; background: var(--gold); color: var(--navy-900); font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.side-foot { margin-top: auto; font-size: 12px; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); line-height: 1.6; }
.dot-row { display: flex; gap: 8px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #7b8597; flex: none; }
.dot.ok { background: #3ec482; } .dot.warn { background: #e9a83b; } .dot.err { background: #e2554f; }

/* main */
.main { padding: 34px 44px 60px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
h1 { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: 28px; margin: 0; color: var(--navy-800); letter-spacing: -.2px; }
.lede { color: var(--ink-2); margin: 8px 0 0; max-width: 640px; line-height: 1.55; }
h2 { font-size: 15px; margin: 0 0 4px; color: var(--navy-800); }
h3 { font-size: 13px; margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 24px 26px; }
.section-label { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 1px; margin: 0 0 12px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }

/* report-type choice */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.choice { position: relative; cursor: pointer; padding: 20px 22px 20px 58px; border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff; transition: border-color .15s, box-shadow .15s; }
.choice:hover { border-color: #c7d0dd; }
.choice input { position: absolute; opacity: 0; }
.choice .radio { position: absolute; left: 22px; top: 22px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #b9c3d1; }
.choice.sel { border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(22,51,90,.08); }
.choice.sel .radio { border-color: var(--navy-700); }
.choice.sel .radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--navy-700); }
.choice .tag { display: inline-block; font-size: 11px; font-weight: 600; color: var(--navy-600); background: var(--info-bg); padding: 2px 8px; border-radius: 4px; margin-bottom: 8px; }
.choice p { margin: 6px 0 0; color: var(--ink-2); line-height: 1.5; font-size: 13px; }
.choice code { font-size: 11px; color: var(--ink-3); background: var(--line-2); padding: 1px 5px; border-radius: 3px; display: inline-block; margin-top: 10px; word-break: break-all; }

/* forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--ink); }
.field .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; margin-left: 6px; }
.input-wrap { position: relative; }
.input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--ink-3); fill: none; stroke-width: 1.8; }
input[type=text], input[type=url], input[type=password], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfd6e1; border-radius: 8px; padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input-wrap input { padding-left: 36px; }
input:focus, select:focus, textarea:focus { border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(34,74,122,.12); }
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.span-2 { grid-column: span 2; }
.formats { display: flex; gap: 12px; flex-wrap: wrap; }
.fmt { display: flex; gap: 12px; align-items: center; border: 1.5px solid var(--line); border-radius: 9px; padding: 12px 16px 12px 12px; cursor: pointer; min-width: 230px; background: #fff; }
.fmt input { display: none; }
.fmt .ico { width: 36px; height: 36px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.fmt .ico.w { background: #2b5797; } .fmt .ico.p { background: #c4532d; }
.fmt .check { margin-left: auto; width: 18px; height: 18px; border-radius: 4px; border: 2px solid #b9c3d1; }
.fmt.sel { border-color: var(--navy-700); }
.fmt.sel .check { background: var(--navy-700); border-color: var(--navy-700); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.fmt b { display: block; font-size: 13.5px; } .fmt span.s { font-size: 12px; color: var(--ink-3); }
.actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line-2); }

.btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 600; border-radius: 8px; padding: 10px 18px; cursor: pointer; border: 1px solid transparent; text-decoration: none; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--ink); border-color: #cfd6e1; }
.btn-ghost:hover { background: var(--line-2); }
.btn-danger { background: #fff; color: var(--err); border-color: #ecc4c3; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-gold { background: var(--gold); color: var(--navy-900); }

/* pipeline strip */
.pipeline { display: flex; gap: 0; margin-top: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.pipeline .st { flex: 1; padding: 14px 16px; border-right: 1px solid var(--line-2); }
.pipeline .st:last-child { border-right: 0; }
.pipeline .n { font-size: 11px; font-weight: 700; color: var(--gold); letter-spacing: 1px; }
.pipeline .t { font-weight: 600; font-size: 13px; margin-top: 3px; }
.pipeline .d { font-size: 12px; color: var(--ink-3); margin-top: 2px; line-height: 1.4; }

/* tables / lists */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-3); font-weight: 600; padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fafbfd; }
.table td { padding: 14px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #fafbfd; }
.co { font-weight: 600; color: var(--navy-800); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.running, .chip.queued { color: var(--info); background: var(--info-bg); }
.chip.done { color: var(--ok); background: var(--ok-bg); }
.chip.failed { color: var(--err); background: var(--err-bg); }
.chip.cancelled { color: var(--ink-3); background: var(--line-2); }
.chip.running::before { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.type-pill { font-size: 12px; color: var(--ink-2); }
.file-pills { display: flex; gap: 6px; }
.fp { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; color: #fff; }
.fp.docx { background: #2b5797; } .fp.pptx { background: #c4532d; }
.empty { text-align: center; padding: 60px 20px; color: var(--ink-3); }
.empty svg { width: 42px; height: 42px; stroke: #b9c3d1; fill: none; stroke-width: 1.4; margin-bottom: 10px; }

/* report detail */
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.progress { height: 6px; border-radius: 4px; background: var(--line-2); overflow: hidden; margin-top: 14px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--navy-600), var(--gold)); transition: width .6s; }
.stages { display: flex; justify-content: space-between; margin-top: 10px; font-size: 11.5px; color: var(--ink-3); }
.stages span.on { color: var(--navy-700); font-weight: 600; }
.timeline { max-height: 560px; overflow: auto; padding: 6px 0; }
.ev { display: grid; grid-template-columns: 70px 86px 1fr; gap: 10px; padding: 7px 22px; font-size: 12.8px; line-height: 1.45; border-bottom: 1px dashed var(--line-2); }
.ev .tm { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ev .k { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--ink-3); padding-top: 2px; }
.ev.sub .tx { color: var(--ink-2); }
.ev .k.Search, .ev .k.Read { color: #2d6aa3; } .ev .k.Portal, .ev .k.Browser { color: #8a5a12; }
.ev .k.Skill { color: #6b3fa0; } .ev .k.Agent { color: #1f7a4d; } .ev .k.File { color: #c4532d; }
.ev .k.Note { color: var(--navy-700); }
.ev.Note .tx { white-space: pre-wrap; color: var(--ink); }
.dl { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; color: var(--ink); margin-bottom: 10px; }
.dl:hover { border-color: var(--navy-600); background: #fafbfd; }
.dl .ico { width: 38px; height: 38px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; }
.dl .ico.docx { background: #2b5797; } .dl .ico.pptx { background: #c4532d; } .dl .ico.pdf { background: #a33; } .dl .ico.xlsx { background: #1f7a4d; }
.dl .nm { font-weight: 600; font-size: 13px; word-break: break-word; }
.dl svg { margin-left: auto; width: 18px; height: 18px; stroke: var(--ink-3); fill: none; stroke-width: 2; flex: none; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; font-size: 13px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; word-break: break-word; }
.summary { line-height: 1.65; color: var(--ink); white-space: pre-wrap; }
.alert { padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.5; }
.alert.err { background: var(--err-bg); color: #7d1f1d; }
.alert.warn { background: var(--warn-bg); color: #6d4706; }
.alert.info { background: var(--info-bg); color: #173e69; }

/* portals */
.portal-groups { display: grid; gap: 22px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.portal { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.portal .top { display: flex; align-items: center; gap: 12px; }
.portal .logo { width: 36px; height: 36px; border-radius: 8px; background: var(--navy-800); color: var(--gold); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.portal .nm { font-weight: 600; } .portal .cat { font-size: 12px; color: var(--ink-3); }
.portal .st { font-size: 12px; display: flex; gap: 7px; align-items: flex-start; color: var(--ink-2); line-height: 1.4; }
.portal .st .dot { margin-top: 4px; }
.portal .row { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 6px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd6e1; border-radius: 22px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--navy-700); }
.switch input:checked + span::before { transform: translateX(16px); }
.kind-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--ink-3); }

/* modal & toast */
.modal { position: fixed; inset: 0; background: rgba(10,27,49,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal .box { background: #fff; border-radius: 12px; width: 520px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal .hd { padding: 20px 24px 0; } .modal .bd { padding: 16px 24px; display: grid; gap: 14px; }
.modal .ft { padding: 16px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--navy-800); color: #fff; padding: 12px 18px; border-radius: 8px; box-shadow: var(--shadow); z-index: 60; font-size: 13px; max-width: 420px; }
.toast.err { background: var(--err); }
pre.code { background: var(--navy-900); color: #e5ebf3; padding: 12px 14px; border-radius: 8px; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; margin: 8px 0 0; }
.setup-list { display: grid; gap: 12px; }
.setup-item { display: flex; gap: 12px; align-items: flex-start; }
.setup-item .dot { margin-top: 5px; }
.setup-item > div { min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; }
  .brand { border: 0; padding: 0; margin: 0 12px 0 0; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 4px 0; }
  .side-foot .dot-row, .side-foot > .muted { display: none; }
  .side-foot > div { margin: 0 !important; padding: 0 !important; border: 0 !important; display: flex; gap: 10px; align-items: center; }
  .main { padding: 22px 16px 40px; }
  .choice-grid, .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .pipeline { flex-direction: column; }
  .pipeline .st { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .table .hide-sm { display: none; }
}

/* feedback & revisions */
.thread { margin-top: 16px; display: grid; gap: 14px; }
.thread:empty { display: none; }
.titem { display: grid; grid-template-columns: 34px 1fr; gap: 12px; }
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--gold-soft); color: #7a5a1c; font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.tbody { min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; background: #fcfcfd; }
.thead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.thead b { font-size: 13px; margin-right: 6px; }
.ttext { white-space: pre-wrap; line-height: 1.55; overflow-wrap: anywhere; }
.reply { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.reply .dl { margin: 10px 0 0; background: #fff; }
.composer { margin-top: 18px; border-top: 1px solid var(--line-2); padding-top: 16px; }
.composer textarea { min-height: 96px; }
.sugg { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.sg { font: inherit; font-size: 12px; color: var(--navy-600); background: var(--info-bg); border: 0; border-radius: 14px; padding: 5px 11px; cursor: pointer; }
.sg:hover { background: #dce7f5; }
.fb-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
details.older { margin-top: 6px; }
details.older summary { cursor: pointer; font-size: 12.5px; color: var(--navy-600); font-weight: 600; padding: 6px 0; }
