:root {
  --ink: #10231f;
  --ink-soft: #53635f;
  --navy: #102925;
  --navy-2: #173a33;
  --paper: #f4f5ef;
  --surface: #ffffff;
  --line: #dce1d8;
  --green: #0c775a;
  --green-soft: #dff1e9;
  --lime: #c8ef78;
  --amber: #9f6109;
  --amber-soft: #fff1ce;
  --red: #9a342d;
  --red-soft: #fbe6e2;
  --shadow: 0 18px 50px rgba(23, 50, 42, 0.08);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); }

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.58; }

a { color: inherit; }

.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--surface); border-radius: 8px; }
.skip-link:focus { top: 16px; }

.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 22px;
  color: #edf8f2;
  background:
    radial-gradient(circle at 10% 90%, rgba(200, 239, 120, 0.12), transparent 30%),
    var(--navy);
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 0 10px 28px; }
.brand strong { display: block; font-size: 18px; letter-spacing: -0.02em; }
.brand small { display: block; color: var(--lime); font-size: 9px; font-weight: 800; letter-spacing: 0.24em; margin-top: 2px; }

.brand-mark { display: flex; align-items: flex-end; gap: 5px; width: 52px; height: 42px; }
.brand-mark span { display: block; width: 11px; border-radius: 8px 8px 2px 2px; background: var(--lime); transform: skewX(-13deg); }
.brand-mark span:nth-child(1) { height: 20px; opacity: 0.58; }
.brand-mark span:nth-child(2) { height: 31px; opacity: 0.78; }
.brand-mark span:nth-child(3) { height: 41px; }
.brand-mark.small { width: 35px; height: 30px; gap: 3px; }
.brand-mark.small span { width: 7px; }
.brand-mark.small span:nth-child(1) { height: 14px; }
.brand-mark.small span:nth-child(2) { height: 22px; }
.brand-mark.small span:nth-child(3) { height: 29px; }

.sidebar nav { display: grid; gap: 5px; }
.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  color: #c9d6d1;
  background: transparent;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { color: #fff; background: rgba(255,255,255,0.1); box-shadow: inset 3px 0 var(--lime); }
.nav-item span { font-weight: 700; font-size: 14px; }
.nav-item small { margin-top: 3px; color: #8ea39b; font-size: 11px; }
.nav-item b { position: absolute; right: 12px; top: 16px; min-width: 21px; height: 21px; padding: 2px 6px; border-radius: 99px; background: var(--lime); color: var(--navy); text-align: center; font-size: 11px; }

.sidebar-footer { margin-top: auto; padding: 18px 12px 0; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-footer div { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.sidebar-footer small { display: block; color: #82988f; margin: 7px 0 0 18px; font-size: 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(200, 239, 120, 0.12); }

.main-content { min-width: 0; padding: 0 42px 72px; }
.topbar { height: 104px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 3px 0 0; font-size: 26px; letter-spacing: -0.04em; }
.eyebrow { margin: 0; color: var(--green); font-size: 10px; font-weight: 850; letter-spacing: 0.16em; text-transform: uppercase; }
.owner-menu { display: flex; align-items: center; gap: 13px; }
.owner-menu > div { text-align: right; }
.owner-menu strong, .owner-menu small { display: block; }
.owner-menu strong { font-size: 12px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.owner-menu small { color: var(--ink-soft); font-size: 10px; margin-top: 3px; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); }
.icon-button:hover { border-color: var(--ink); }

.view { display: none; padding-top: 34px; }
.view.active { display: block; animation: enter 180ms ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 26px; }
.section-heading h2 { margin: 0; font-size: clamp(26px, 3vw, 38px); letter-spacing: -0.055em; }
.section-heading p { margin: 7px 0 0; color: var(--ink-soft); max-width: 660px; }

.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-height: 142px; display: flex; flex-direction: column; justify-content: flex-end; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 5px 20px rgba(23,50,42,0.03); }
.metric-card.accent { background: var(--navy-2); color: white; border-color: var(--navy-2); }
.metric-label { margin-bottom: auto; color: var(--ink-soft); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.1em; }
.metric-card.accent .metric-label, .metric-card.accent small { color: #b8c9c3; }
.metric-card strong { font-size: 29px; letter-spacing: -0.05em; }
.metric-card strong.good { color: var(--green); }
.metric-card strong.bad { color: var(--red); }
.metric-card small { margin-top: 5px; color: var(--ink-soft); }

.dashboard-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 14px; margin-top: 14px; }
.dashboard-grid.lower { grid-template-columns: 1fr 1fr; }
.panel { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel h3 { margin: 4px 0 0; font-size: 21px; letter-spacing: -0.035em; }
.panel h4 { margin: 24px 0 8px; }
.command-preview { color: white; background: linear-gradient(145deg, var(--navy-2), var(--navy)); border-color: transparent; }
.command-preview .eyebrow { color: var(--lime); }
.command-preview p:not(.eyebrow) { color: #b8c9c3; line-height: 1.6; max-width: 440px; }
.language-note { display: flex; align-items: center; gap: 8px; margin-top: 26px; }
.language-note span { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid rgba(255,255,255,0.2); border-radius: 50%; font-size: 9px; font-weight: 800; }
.language-note small { color: #9eb1aa; margin-left: 4px; }

.status-list { margin: 20px 0 0; }
.status-list > div { display: flex; justify-content: space-between; gap: 24px; padding: 12px 0; border-top: 1px solid var(--line); }
.status-list dt { color: var(--ink-soft); }
.status-list dd { margin: 0; font-weight: 720; text-align: right; }

.task-counts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-top: 20px; }
.task-counts div { padding: 15px 8px; background: var(--paper); border-radius: 12px; text-align: center; }
.task-counts strong, .task-counts span { display: block; }
.task-counts strong { font-size: 24px; }
.task-counts span { color: var(--ink-soft); font-size: 9px; margin-top: 3px; }

.primary-button, .secondary-button, .text-button, .tool-button, .chip {
  border-radius: 10px;
  font-weight: 750;
}
.primary-button { padding: 11px 18px; border: 1px solid var(--lime); background: var(--lime); color: var(--navy); }
.primary-button:hover { background: #d6fa8e; }
.primary-button.large { padding: 15px 23px; }
.primary-button.full { width: 100%; padding: 14px 18px; }
.secondary-button { padding: 10px 16px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.secondary-button:hover { border-color: var(--ink); }
.text-button { padding: 7px 3px; border: 0; background: transparent; color: var(--green); }

.pill { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 9px; border-radius: 99px; font-size: 9px; font-weight: 850; letter-spacing: 0.055em; white-space: nowrap; }
.pill.safe, .pill.risk-green { background: var(--green-soft); color: var(--green); }
.pill.warning, .pill.risk-yellow { background: var(--amber-soft); color: var(--amber); }
.pill.danger, .pill.risk-red { background: var(--red-soft); color: var(--red); }
.pill.neutral { background: #edf0eb; color: #54625e; }
.pill-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.command-workspace { max-width: 980px; }
.command-editor { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.command-editor:focus-within { border-color: #6cae98; box-shadow: 0 0 0 4px rgba(12,119,90,0.08), var(--shadow); }
.command-editor textarea { display: block; width: 100%; min-height: 260px; resize: vertical; padding: 28px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 21px; line-height: 1.55; }
.command-editor textarea::placeholder { color: #9aa6a1; }
.command-tools { display: flex; align-items: center; gap: 9px; padding: 13px 16px; border-top: 1px solid var(--line); background: #fafbf8; }
.command-tools .muted { margin-left: auto; font-size: 11px; }
.tool-button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; border: 1px solid var(--line); background: white; color: var(--ink); font-size: 12px; }
.tool-button.recording { color: var(--red); border-color: #d99b95; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.attachment-preview { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 14px; margin-top: 13px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.attachment-preview img { width: 70px; height: 52px; object-fit: cover; border-radius: 9px; }
.attachment-preview strong, .attachment-preview small { display: block; }
.attachment-preview small { color: var(--ink-soft); margin-top: 4px; }
.url-field { display: block; margin-top: 18px; font-weight: 750; }
.url-field span { color: var(--ink-soft); font-weight: 500; font-size: 11px; }
.url-field input { display: block; width: 100%; margin-top: 7px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.command-submit { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; }
.command-submit p { color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.command-submit p strong { color: var(--ink); }
.classification-result { max-width: 980px; margin-top: 22px; padding: 24px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: var(--radius); background: var(--surface); }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { padding: 8px 13px; border: 1px solid var(--line); background: transparent; color: var(--ink-soft); font-size: 11px; }
.chip.active { background: var(--navy); color: white; border-color: var(--navy); }
.stack-list { display: grid; gap: 12px; }
.task-card, .approval-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.task-card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.task-card h3, .approval-card h3 { margin: 5px 0 0; font-size: 18px; letter-spacing: -0.025em; max-width: 760px; }
.task-id { color: var(--green); font-size: 9px; font-weight: 850; letter-spacing: 0.1em; }
.task-interpretation { color: var(--ink-soft); line-height: 1.55; }
.task-details { display: flex; flex-wrap: wrap; gap: 28px; margin: 18px 0; }
.task-details div { min-width: 140px; }
.task-details dt { color: var(--ink-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.task-details dd { margin: 4px 0 0; font-size: 12px; font-weight: 700; }
.risk-reason { margin: 13px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--paper); color: var(--ink-soft); font-size: 12px; }
.task-result { padding: 12px 14px; background: var(--green-soft); border-radius: 10px; color: var(--green); font-size: 12px; }
.context-link { display: inline-block; margin: 14px 16px 0 0; color: var(--green); font-size: 12px; font-weight: 750; }
.approval-note { width: 100%; min-height: 78px; resize: vertical; margin-top: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
.approval-actions { display: flex; gap: 12px; align-items: center; margin-top: 12px; }

.support-layout { display: grid; grid-template-columns: minmax(300px, 0.75fr) minmax(420px, 1.25fr); gap: 14px; align-items: start; }
.support-card { width: 100%; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); text-align: left; }
.support-card:hover { border-color: #6cae98; }
.support-card > div:first-child { display: flex; justify-content: space-between; gap: 14px; }
.support-card > div:first-child span { color: var(--ink-soft); font-size: 10px; }
.support-card p { margin: 9px 0; }
.support-card .pill-row { justify-content: flex-start; }
.detail-panel { position: sticky; top: 20px; min-height: 300px; }
.support-meta { font-size: 12px; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 15px; border-radius: 11px; background: var(--paper); line-height: 1.55; }
.message-body.draft { background: var(--green-soft); }

.history-callout { display: flex; align-items: center; gap: 16px; padding: 17px 20px; margin-bottom: 20px; border: 1px solid #ead8ab; border-radius: 14px; background: var(--amber-soft); color: var(--amber); }
.history-callout span { color: #715629; }
.timeline { position: relative; display: grid; gap: 0; max-width: 900px; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 1px; background: var(--line); }
.timeline-item { position: relative; padding: 0 0 26px 20px; }
.timeline-dot { position: absolute; left: -22px; top: 5px; width: 11px; height: 11px; border: 3px solid var(--paper); border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.timeline-item h3 { margin: 5px 0; font-size: 15px; }
.timeline-item > p:last-child { margin: 0; color: var(--ink-soft); }

.global-message { position: fixed; z-index: 80; right: 24px; top: 22px; max-width: 460px; margin: 0; padding: 13px 18px; border-radius: 12px; background: var(--navy); color: white; box-shadow: var(--shadow); }
.global-message.error { background: var(--red); }
.empty-state, .loading { padding: 34px; color: var(--ink-soft); text-align: center; border: 1px dashed var(--line); border-radius: 14px; }
.empty-state.compact { padding: 17px; margin-top: 16px; }
.error-text, .form-error { color: var(--red); }
.mini-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; margin: 0; border-top: 1px solid var(--line); font-size: 12px; }
.muted { color: var(--ink-soft); font-weight: 500; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.login-page { display: grid; place-items: center; padding: 32px; color: white; background: var(--navy); }
.login-shell { width: min(1050px, 100%); min-height: 650px; display: grid; grid-template-columns: 1.05fr 0.95fr; overflow: hidden; border-radius: 26px; background: var(--surface); box-shadow: 0 30px 100px rgba(0,0,0,0.25); }
.login-brand { display: flex; flex-direction: column; justify-content: center; padding: clamp(42px, 7vw, 78px); color: white; background: radial-gradient(circle at 90% 15%, rgba(200,239,120,0.17), transparent 32%), var(--navy-2); }
.login-brand .eyebrow { margin-top: 42px; color: var(--lime); }
.login-brand h1 { margin: 10px 0 0; font-size: clamp(50px, 6vw, 76px); line-height: 0.9; letter-spacing: -0.07em; }
.login-brand h1 span { color: var(--lime); }
.login-intro { max-width: 430px; margin-top: 28px; color: #bdd0c9; font-size: 16px; line-height: 1.65; }
.login-assurance { display: flex; align-items: center; gap: 10px; margin-top: auto; color: #b6cac3; font-size: 11px; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(38px, 6vw, 68px); color: var(--ink); }
.login-panel h2 { margin: 7px 0; font-size: 36px; letter-spacing: -0.05em; }
.login-panel > div > p:last-child { color: var(--ink-soft); line-height: 1.5; }
.login-panel form { display: grid; gap: 17px; margin-top: 30px; }
.login-panel label { color: var(--ink-soft); font-size: 11px; font-weight: 750; }
.login-panel input { width: 100%; margin-top: 7px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fafbf8; }
.login-panel input:focus { outline: 3px solid rgba(12,119,90,0.11); border-color: var(--green); }
.form-error { margin: 0; padding: 11px; border-radius: 9px; background: var(--red-soft); font-size: 12px; }
.security-footnote { margin: 22px 0 0; color: #89948f; font-size: 10px; text-align: center; }

@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 190px 1fr; }
  .main-content { padding-inline: 26px; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .dashboard-grid.lower { grid-template-columns: 1fr; }
  .support-layout { grid-template-columns: 1fr; }
  .detail-panel { position: static; }
}

@media (max-width: 720px) {
  .app-shell { display: block; padding-bottom: 76px; }
  .sidebar { position: fixed; z-index: 50; inset: auto 0 0; width: 100%; height: auto; padding: 8px; }
  .sidebar .brand, .sidebar-footer { display: none; }
  .sidebar nav { grid-template-columns: repeat(6, 1fr); gap: 2px; }
  .nav-item { align-items: center; padding: 9px 3px; text-align: center; }
  .nav-item span { font-size: 10px; }
  .nav-item small { display: none; }
  .nav-item.active { box-shadow: inset 0 -3px var(--lime); }
  .nav-item b { right: 3px; top: 2px; min-width: 17px; height: 17px; padding: 1px 4px; }
  .main-content { padding: 0 17px 35px; }
  .topbar { height: 82px; }
  .topbar h1 { font-size: 20px; }
  .owner-menu > div { display: none; }
  .view { padding-top: 24px; }
  .section-heading { align-items: flex-start; }
  .section-heading h2 { font-size: 28px; }
  .section-heading > .pill { display: none; }
  .status-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 122px; padding: 16px; }
  .metric-card strong { font-size: 23px; }
  .task-counts { grid-template-columns: repeat(3, 1fr); }
  .command-editor textarea { min-height: 220px; padding: 20px; font-size: 18px; }
  .command-tools { flex-wrap: wrap; }
  .command-tools .muted { flex-basis: 100%; margin: 0; }
  .command-submit { align-items: stretch; flex-direction: column; }
  .task-card-heading { flex-direction: column; }
  .pill-row { justify-content: flex-start; }
  .approval-actions { align-items: stretch; flex-direction: column; }
  .login-page { padding: 0; }
  .login-shell { min-height: 100vh; grid-template-columns: 1fr; border-radius: 0; }
  .login-brand { min-height: 270px; padding: 34px; }
  .login-brand .brand-mark, .login-brand .eyebrow, .login-brand .login-assurance { display: none; }
  .login-brand h1 { font-size: 54px; }
  .login-intro { margin-bottom: 0; }
  .login-panel { padding: 34px; }
}

/* Hidden attachment preview must stay hidden */
.attachment-preview[hidden] { display: none !important; }
