/* FIELDWORK / HVAC operations design system. Framework-independent.
   Import AFTER any framework reset. All application UI lives in .app-shell.
   Change tokens here; preserve the component contracts in DESIGN-HANDOFF.md. */
:root {
  color-scheme: light;
  --canvas: #f6f7f9; --surface: #fff; --surface-subtle: #fafbfc;
  --ink: #202631; --ink-secondary: #4f5b6c; --ink-muted: #667386;
  --line: #e3e7ed; --line-strong: #c5ceda;
  --brand: #2458d3; --brand-hover: #1944ab; --brand-soft: #edf2ff;
  --success: #21664d; --success-soft: #edf7f1;
  --warning: #875009; --warning-soft: #fff5e5;
  --danger: #a83235; --danger-soft: #fff0f0;
  --rail: #1b2432; --rail-muted: #aab6c7; --rail-active: #2c394c;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --text-xs: .75rem; --text-sm: .8125rem; --text-base: .875rem;
  --text-lg: 1rem; --text-xl: 1.25rem; --text-2xl: 1.75rem;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --radius-sm: 4px; --radius: 8px; --radius-lg: 12px;
  --shadow-popover: 0 12px 40px rgb(20 30 45 / .14);
  --sidebar-width: 224px; --topbar-height: 64px; --content-max: 1440px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: var(--text-base)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button, input, select, textarea { border-radius: var(--radius-sm); }
button { color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #7099ff; outline-offset: 3px; }
input, select, textarea { min-height: 40px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); padding: 9px 12px; }
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
textarea { width: 100%; min-height: 100px; resize: vertical; }
label { display: block; font-weight: 600; font-size: var(--text-sm); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--text-2xl); letter-spacing: -.035em; font-weight: 650; line-height: 1.2; }
h2 { font-size: var(--text-lg); letter-spacing: -.015em; font-weight: 650; }
h3 { font-size: var(--text-base); font-weight: 650; }
svg.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; background: white; padding: 12px; }
.skip-link:focus { top: 12px; }
.app-shell { min-height: 100vh; padding-left: var(--sidebar-width); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); background: var(--rail); color: #fff; display: flex; flex-direction: column; padding: 28px 16px 16px; z-index: 40; }
@font-face {
  font-family: 'Stack Sans Notch';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/StackSansNotch-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Stack Sans Notch';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/StackSansNotch-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

.brand { display: flex; gap: 10px; align-items: center; padding: 0 12px; font-family: 'Stack Sans Notch', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 31px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #8595ac; border-radius: 5px; }
.workspace-label { margin: 8px 12px 32px; color: var(--rail-muted); font-size: var(--text-xs); }
.nav-label { margin: 0 12px 10px; color: var(--rail-muted); text-transform: uppercase; font-size: 10px; letter-spacing: .13em; font-weight: 600; }
.nav { display: grid; gap: 5px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; min-height: 44px; border-radius: 6px; color: #bec8d7; text-decoration: none; font-size: var(--text-sm); }
.nav-link:hover { background: #243043; color: white; text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--rail-active); color: #fff; box-shadow: inset 3px 0 #8baeff; }
.nav-count { margin-left: auto; font: 11px var(--mono); padding: 2px 6px; background: #46546a; color: #fff; border-radius: 4px; }
.sidebar-bottom { margin-top: auto; padding-top: 36px; }
.demo-label { color: var(--rail-muted); font-size: 11px; margin: 16px 12px; }
.account { border-top: 1px solid #394457; padding: 18px 8px 0; display: flex; align-items: center; gap: 10px; }
.account small { display: block; color: var(--rail-muted); font-size: 11px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #eaf0f8; color: #415574; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; font-size: 10px; font-weight: 700; }
.avatar--large { width: 44px; height: 44px; font-size: 14px; }
.topbar { height: var(--topbar-height); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 36px; }
.topbar > .inline { min-width: 0; }
.breadcrumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); color: var(--ink-muted); }
.breadcrumb span { margin: 0 10px; color: #b5bdca; }
.topbar-right, .inline, .actions { display: flex; align-items: center; gap: 10px; }
.muted { color: var(--ink-muted); }
.small { font-size: var(--text-xs); }
.mono { font-family: var(--mono); font-size: 11px; }
.content { padding: 32px 36px 48px; max-width: var(--content-max); margin: 0 auto; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-heading p { margin-top: 8px; color: var(--ink-muted); font-size: var(--text-sm); }
.eyebrow { font: 10px var(--mono); color: var(--ink-muted); text-transform: uppercase; letter-spacing: .11em; margin-bottom: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 13px; border: 1px solid var(--line-strong); background: white; font-size: var(--text-sm); font-weight: 550; white-space: nowrap; text-decoration: none; transition: background 120ms; }
.btn:hover { background: #f0f3f7; text-decoration: none; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-hover); }
.btn--quiet { background: transparent; border-color: transparent; color: var(--ink-secondary); }
.btn--danger { color: var(--danger); background: var(--danger-soft); border-color: #f1c8c8; }
.btn--small { min-height: 32px; padding: 5px 10px; font-size: var(--text-xs); }
.icon-btn { width: 38px; padding: 8px; }
.link-button { border: 0; background: none; color: var(--brand); padding: 0; text-align: left; font-size: inherit; font-weight: 550; }
.link-button:hover { text-decoration: underline; }
.stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 28px; }
.stat { padding: 20px 24px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-label { color: var(--ink-secondary); font-size: var(--text-xs); }
.stat-value { display: block; font-size: 31px; line-height: 1.25; letter-spacing: -.055em; font-weight: 600; font-variant-numeric: tabular-nums; margin: 7px 0; }
.stat-note { font-size: 11px; color: var(--ink-muted); }
.text-warning { color: var(--warning); } .text-success { color: var(--success); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head p { font-size: var(--text-xs); color: var(--ink-muted); margin-top: 3px; }
.panel-body { padding: 20px; }
.section-gap { margin-top: 24px; }
.split { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(280px,1fr); gap: 24px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar input { width: 240px; min-height: 34px; font-size: var(--text-xs); }
.toolbar select { min-height: 34px; font-size: var(--text-xs); padding: 6px 10px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 12px 0; background: transparent; color: var(--ink-muted); font-size: var(--text-sm); white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.data-table { min-width: 740px; width: 100%; border-collapse: collapse; text-align: left; font-size: var(--text-sm); }
.data-table th { height: 40px; background: var(--surface-subtle); color: var(--ink-muted); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.data-table th, .data-table td { padding: 13px 20px; border-bottom: 1px solid var(--line); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafcff; }
.data-table td { height: 66px; }
.cell-title { display: block; font-weight: 600; color: var(--ink); }
.cell-sub { display: block; font-size: 11px; color: var(--ink-muted); margin-top: 3px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 7px; border-radius: 4px; background: #f0f2f5; color: #536071; font-size: 11px; font-weight: 550; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge--progress { color: var(--brand); background: var(--brand-soft); }
.badge--completed { color: var(--success); background: var(--success-soft); }
.badge--blocked, .badge--review { color: var(--warning); background: var(--warning-soft); }
.badge--overdue { color: var(--danger); background: var(--danger-soft); }
.progress-cell { min-width: 114px; }
.progress-label { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--ink-secondary); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
progress { display: block; appearance: none; width: 100%; height: 5px; border: none; border-radius: 2px; overflow: hidden; background: #e9edf3; color: var(--brand); }
progress::-webkit-progress-bar { background: #e9edf3; }
progress::-webkit-progress-value { background: var(--brand); border-radius: 2px; }
progress::-moz-progress-bar { background: var(--brand); }
.task-row { display: flex; gap: 12px; align-items: flex-start; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row-main { flex: 1; min-width: 0; }
.check { width: 17px; height: 17px; min-height: 0; margin: 3px 0 0; padding: 0; accent-color: var(--brand); flex: 0 0 auto; cursor: pointer; }
.feed-item { position: relative; display: flex; align-items: flex-start; gap: 12px; padding-bottom: 23px; }
.feed-item:not(:last-child)::after { content: ""; position: absolute; top: 35px; bottom: 5px; left: 14px; width: 1px; background: var(--line); }
.feed-item:last-child { padding-bottom: 0; }
.feed-item p { font-size: var(--text-xs); }
.feed-item time { font-size: 10px; color: var(--ink-muted); display: block; margin-top: 4px; }
.notice { padding: 12px 16px; border-left: 3px solid #c79234; background: var(--warning-soft); color: #714815; font-size: var(--text-xs); border-radius: 0 4px 4px 0; margin-bottom: 24px; }
.project-layout { display: grid; grid-template-columns: minmax(0,1fr) 290px; gap: 24px; }
.tree { padding: 8px 20px 18px; }
.tree details { border-bottom: 1px solid var(--line); }
.tree details:last-child { border-bottom: 0; }
.tree summary { cursor: pointer; padding: 16px 0; font-weight: 600; font-size: var(--text-sm); }
.tree summary .badge { margin-left: 10px; font-weight: 500; }
.tree-children { margin: 0 0 12px 7px; border-left: 1px solid var(--line-strong); padding-left: 22px; }
.tree-leaf { display: flex; align-items: center; gap: 10px; padding: 11px 0; font-size: var(--text-xs); }
.tree-leaf .badge { margin-left: auto; }
.definition { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; font-size: var(--text-xs); margin: 0; }
.definition dt { color: var(--ink-muted); } .definition dd { margin: 0; text-align: right; }
.template-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; }
.template-card { padding: 24px; }
.template-glyph { width: 40px; height: 40px; display: grid; place-items: center; background: #f0f3f8; border: 1px solid var(--line); border-radius: 6px; color: var(--ink-secondary); margin-bottom: 24px; }
.template-card p { color: var(--ink-muted); font-size: var(--text-xs); margin: 10px 0 22px; min-height: 40px; }
.template-card footer { border-top: 1px solid var(--line); padding-top: 16px; display: flex; align-items: center; justify-content: space-between; }
.empty { padding: 48px 24px; text-align: center; color: var(--ink-muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.board { display: grid; grid-template-columns: repeat(4,minmax(220px,1fr)); gap: 16px; overflow-x: auto; padding-bottom: 12px; }
.board-column { background: #edf0f4; border-radius: var(--radius); padding: 12px; }
.board-title { display: flex; justify-content: space-between; align-items: center; padding: 0 0 12px; font-size: var(--text-xs); font-weight: 600; }
.board-card { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: white; border-radius: 6px; padding: 14px; margin-bottom: 10px; }
.board-card:hover { border-color: #9eb5e5; }
.board-card p { margin: 9px 0 14px; font-weight: 550; font-size: var(--text-sm); }
.chat-layout { max-width: 860px; margin: 0 auto; }
.chat-intro { padding: 36px 0 28px; }
.chat-intro h2 { font-size: 24px; margin-bottom: 8px; }
.suggestions { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin: 24px 0; }
.suggestion { text-align: left; padding: 17px; border: 1px solid var(--line); background: white; border-radius: 6px; font-size: var(--text-sm); }
.suggestion:hover { border-color: var(--brand); }
.chat-message { padding: 20px; background: white; border: 1px solid var(--line); border-radius: 8px; margin: 12px 0; line-height: 1.8; }
.chat-message--user { background: #edf2fc; margin-left: 40px; }
.chat-compose { display: flex; gap: 12px; margin-top: 20px; }
.chat-compose input { flex: 1; min-width: 0; }
.dialog { border: 1px solid var(--line); box-shadow: var(--shadow-popover); padding: 0; color: var(--ink); background: white; }
.dialog::backdrop { background: rgb(17 26 40 / .32); }
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: 490px; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; border-width: 0 0 0 1px; }
.modal { width: 500px; max-width: calc(100% - 32px); border-radius: 10px; }
.dialog-head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.dialog-body { padding: 24px; }
.dialog-body > h2 { font-size: 22px; margin: 8px 0 24px; line-height: 1.35; }
.dialog-footer { padding: 16px 24px; background: var(--surface-subtle); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.comment { margin: 18px 0; font-size: var(--text-xs); }
.comment p { background: var(--surface-subtle); border: 1px solid var(--line); padding: 12px; margin: 8px 0; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.audio-preview { width: 100%; margin-top: 10px; }
.toast { position: fixed; bottom: 24px; left: calc(50% + 80px); transform: translateX(-50%); z-index: 100; background: var(--rail); color: white; border-radius: 6px; padding: 12px 20px; box-shadow: var(--shadow-popover); max-width: calc(100vw - 32px); font-size: var(--text-sm); }
.mobile-menu { display: none; }
.skeleton { height: 16px; background: #e9edf3; border-radius: 4px; animation: breathe 1.5s ease-in-out infinite alternate; }
.error-box { border: 1px solid #edc5c6; padding: 16px; color: var(--danger); background: var(--danger-soft); border-radius: 6px; }
@keyframes breathe { to { opacity: .45; } }
@media (min-width: 1600px) { .content { padding-top: 40px; } }
@media (max-width: 1150px) {
  :root { --sidebar-width: 196px; }
  .content { padding: 28px 24px; } .topbar { padding: 0 24px; }
  .split { grid-template-columns: 1fr 1fr; } .project-layout { grid-template-columns: minmax(0,1fr) 250px; }
  .stat { padding: 18px; } .data-table th, .data-table td { padding-left: 14px; padding-right: 14px; }
}
@media (max-width: 900px) {
  .split, .project-layout { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: 1fr; } .template-card p { min-height: 0; }
  .page-heading { align-items: flex-start; } .page-heading .actions { flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 700px) {
  :root { --sidebar-width: 0px; }
  .sidebar { display: none; width: 240px; top: 64px; padding-top: 20px; box-shadow: var(--shadow-popover); }
  .sidebar.is-open { display: flex; } .mobile-menu { display: inline-flex; }
  .topbar { padding: 0 16px; position: sticky; top: 0; z-index: 30; }
  .topbar-right .date-label { display: none; }
  .content { padding: 24px 16px; } h1 { font-size: 25px; }
  .page-heading { flex-direction: column; gap: 16px; } .page-heading .actions { justify-content: flex-start; }
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stat:nth-child(3) { border-left: 0; } .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stat-value { font-size: 27px; } .stat-note { font-size: 10px; }
  .toolbar { padding: 12px; } .toolbar input { width: 100%; }
  .toolbar > .inline { flex-wrap: wrap; width: 100%; }
  .btn { min-height: 42px; } .suggestions { grid-template-columns: 1fr; }
  .toast { left: 50%; } .tree { padding-left: 14px; padding-right: 14px; }
  .tree-children { padding-left: 12px; } .tree-leaf { flex-wrap: wrap; }
  .tree summary .badge { margin-left: 4px; } .dialog-body { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print { .sidebar, .topbar, .actions, .toolbar, .toast, dialog { display: none !important; } .app-shell { padding: 0; } .content { padding: 0; max-width: none; } .panel { break-inside: avoid; } }

/* ---- Chatroom (WhatsApp-style) ---- */
.content--chats { padding: 0 !important; max-width: none !important; margin: 0 !important; height: calc(100vh - var(--topbar-height)) !important; overflow: hidden !important; display: flex !important; flex-direction: column !important; }
.chat-shell { display: flex; flex: 1; min-height: 0; height: 100%; background: var(--surface); }
.chat-list { width: 340px; flex-shrink: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: #fff; min-height: 0; }
.chat-list-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.chat-list-head-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.chat-list-head-top h2 { font-size: 17px; }
.chat-search { position: relative; }
.chat-search input { width: 100%; min-height: 36px; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 18px; padding: 7px 12px 7px 34px; font-size: 13px; }
.chat-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-muted); }
.chat-filters { display: flex; gap: 6px; margin-top: 10px; }
.chat-filter { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 4px 11px; font-size: 12px; color: var(--ink-secondary); }
.chat-filter.is-active { background: #e7f0e7; border-color: #b9d4b9; color: #1c5c1c; font-weight: 600; }
.chat-threads { flex: 1; overflow-y: auto; min-height: 0; }
.chat-thread { display: flex; gap: 11px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; align-items: center; }
.chat-thread:hover { background: #f6f8fa; }
.chat-thread.is-active { background: #edf2ff; }
.chat-thread-main { flex: 1; min-width: 0; }
.chat-thread-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-thread-name { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread-time { font-size: 11px; color: var(--ink-muted); flex-shrink: 0; }
.chat-thread-preview { font-size: 12.5px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-group-icon { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #efeae2; }
.chat-header { display: flex; align-items: center; gap: 12px; background: #f0f2f5; border-bottom: 1px solid var(--line); padding: 10px 16px; }
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-name { font-weight: 700; font-size: 14.5px; }
.chat-header-sub { font-size: 12px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-btn { border: 1px solid var(--line); background: #fff; border-radius: 50%; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-secondary); }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px 7%; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.chat-date-pill { align-self: center; background: #f0f2f5; border: 1px solid var(--line); color: var(--ink-secondary); font-size: 11px; border-radius: 8px; padding: 4px 12px; margin: 8px 0; box-shadow: 0 1px 1px rgb(0 0 0 / .08); }
.chat-system { align-self: center; background: #fff3cd; border: 1px solid #f0df9a; color: #6b5900; font-size: 12px; border-radius: 8px; padding: 5px 14px; margin: 4px 0; max-width: 90%; text-align: center; box-shadow: 0 1px 1px rgb(0 0 0 / .08); }
.chat-bubble { position: relative; max-width: 65%; background: #fff; border-radius: 8px; padding: 7px 9px 5px; box-shadow: 0 1px 1px rgb(0 0 0 / .12); align-self: flex-start; }
.chat-bubble.is-mine { align-self: flex-end; background: #d9fdd3; }
.chat-bubble-author { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.chat-bubble-text { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-bubble-meta { display: flex; justify-content: flex-end; gap: 4px; font-size: 10.5px; color: #667781; margin-top: 3px; }
.chat-quote { border-left: 3px solid #00a884; background: rgb(0 0 0 / .05); border-radius: 4px; padding: 5px 8px; margin-bottom: 5px; font-size: 12px; cursor: pointer; }
.chat-bubble.is-mine .chat-quote { border-left-color: #008f71; }
.chat-quote-author { font-weight: 700; font-size: 11.5px; margin-bottom: 1px; }
.chat-quote-text { color: var(--ink-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-file-card { display: flex; align-items: center; gap: 10px; background: rgb(0 0 0 / .04); border-radius: 6px; padding: 8px 10px; margin-bottom: 5px; text-decoration: none; color: inherit; min-width: 200px; }
.chat-file-card:hover { background: rgb(0 0 0 / .07); text-decoration: none; }
.chat-file-icon { width: 36px; height: 36px; border-radius: 50%; background: #e2e8f0; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-file-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.chat-file-sub { font-size: 11px; color: var(--ink-muted); }
.chat-voice { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; min-width: 210px; }
.chat-voice audio { width: 200px; height: 32px; }
.chat-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chat-reaction { border: 1px solid var(--line); background: #fff; border-radius: 12px; font-size: 12px; padding: 1px 8px; line-height: 1.6; }
.chat-reaction.is-mine { border-color: #00a884; background: #e6fff6; }
.chat-deleted { font-style: italic; color: var(--ink-muted); font-size: 13px; }
.chat-bubble-actions { position: absolute; top: -14px; right: 8px; display: inline-flex; opacity: 0; gap: 2px; background: #fff; border: 1px solid #e9edef; border-radius: 16px; padding: 2px 4px; box-shadow: 0 2px 8px rgb(11 20 26 / .18); z-index: 5; transition: opacity 120ms; pointer-events: none; }
.chat-bubble:hover .chat-bubble-actions, .chat-bubble:focus-within .chat-bubble-actions { display: inline-flex; opacity: 1; pointer-events: auto; }
@media (hover: none) { .chat-bubble-actions { display: inline-flex; opacity: 1; pointer-events: auto; } }
.chat-bubble-actions button { border: 0; background: none; font-size: 14px; padding: 3px 6px; border-radius: 12px; line-height: 1; color: #54656f; display: inline-flex; align-items: center; }
.chat-bubble-actions button:hover { background: #f0f2f5; }
/* Styled file picker (replaces native Choose File box) */
.wa-file-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.wa-file-btn { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line-strong); border-radius: 20px; padding: 7px 16px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; white-space: nowrap; }
.wa-file-btn:hover { background: var(--surface-subtle); }
.wa-file-name { font-size: 12.5px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.chat-menu { position: fixed; z-index: 200; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-popover); padding: 6px; min-width: 190px; }
.chat-menu-emoji { display: flex; gap: 2px; padding: 4px 6px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.chat-menu-emoji button { border: 0; background: none; font-size: 19px; padding: 4px 5px; border-radius: 8px; }
.chat-menu-emoji button:hover { background: #f0f2f5; transform: scale(1.15); }
.chat-menu button.chat-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left; font-size: 13px; padding: 8px 10px; border-radius: 6px; color: var(--ink); }
.chat-menu button.chat-menu-item:hover { background: #f0f2f5; }
.chat-menu button.chat-menu-item.danger { color: var(--danger); }
.chat-reply-bar { display: flex; align-items: center; gap: 8px; background: #f0f2f5; border-top: 1px solid var(--line); padding: 8px 14px; font-size: 12.5px; }
.chat-reply-bar .chat-quote { flex: 1; margin: 0; }
.chat-reply-close { border: 0; background: none; font-size: 16px; color: var(--ink-muted); padding: 4px 8px; }
.chat-attach-chip { display: flex; align-items: center; gap: 8px; background: #f0f2f5; border-top: 1px solid var(--line); padding: 8px 14px; font-size: 12.5px; }
.chat-attach-chip .file-chip { margin: 0; }
.chat-rec-bar { display: flex; align-items: center; gap: 10px; background: #f0f2f5; border-top: 1px solid var(--line); padding: 10px 14px; font-size: 13px; }
.chat-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #e04444; animation: pulse 1s infinite alternate; }
.chat-composer { background: #f0f2f5; border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 8px; align-items: center; }
.chat-composer input { flex: 1; min-height: 42px; border-radius: 22px; border: 1px solid var(--line); padding: 9px 16px; font-size: 14px; background: #fff; }
.chat-tool-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; color: #54656f; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-tool-btn:hover { background: #e2e6ea; }
.chat-send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: #00a884; color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-send:hover { background: #008f71; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--ink-muted); background: #f8f9fb; text-align: center; padding: 30px; }
.chat-member-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.chat-member-row:last-child { border-bottom: 0; }
.chat-checkbox-list { max-height: 240px; overflow-y: auto; overflow-x: hidden; border: 1px solid var(--line); border-radius: 6px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.chat-checkbox-list label, .chat-checkbox-list .chat-pick { display: grid !important; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 10px; font-weight: 500; padding: 7px 8px; font-size: 13px; border-radius: 6px; cursor: pointer; margin: 0; width: 100%; box-sizing: border-box; text-align: left; justify-content: stretch; justify-items: start; }
.chat-checkbox-list label:hover, .chat-checkbox-list .chat-pick:hover { background: var(--surface-subtle); }
.chat-checkbox-list .chat-pick input[type="checkbox"], .chat-checkbox-list label input[type="checkbox"] { width: 17px; height: 17px; min-height: 0; margin: 0; flex-shrink: 0; accent-color: var(--brand); grid-column: 1; }
.chat-checkbox-list .chat-pick .avatar, .chat-checkbox-list label .avatar { flex-shrink: 0; grid-column: 2; }
.chat-checkbox-list .chat-pick-text, .chat-checkbox-list label > span:last-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; grid-column: 3; color: var(--ink); }
.chat-checkbox-list .chat-pick-text small, .chat-checkbox-list label > span:last-child small { display: block; font-weight: 400; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .chat-shell { flex-direction: column; } .chat-list { width: 100%; max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); } .chat-bubble { max-width: 88%; } .chat-messages { padding: 14px 12px; } .chat-bubble-actions { display: inline-flex; } }

/* ---- Chatroom: WhatsApp Web light theme (pixel-match overrides) ---- */
.wa-icon { flex: 0 0 auto; vertical-align: middle; }
.content--chats { background: #eae6df !important; position: relative; }
.content--chats::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 127px; background: #00a884; }
.chat-shell { position: relative; z-index: 1; background: #fff; box-shadow: 0 6px 18px rgb(11 20 26 / .12); }

/* Left pane */
.chat-list { width: 380px; background: #fff; border-right: 1px solid #d1d7db; }
.chat-list-head { padding: 10px 16px 8px; border-bottom: 0; background: #fff; }
.chat-list-head-top { margin-bottom: 8px; min-height: 40px; }
.chat-list-head-top h2 { font-size: 20px; font-weight: 600; color: #111b21; letter-spacing: -0.01em; }
.chat-head-tools { display: flex; align-items: center; gap: 2px; }
.chat-icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: #54656f; display: inline-flex; align-items: center; justify-content: center; }
.chat-icon-btn:hover { background: #f0f2f5; }
.chat-search input { background: #f0f2f5; border: 0; border-radius: 8px; min-height: 35px; font-size: 14px; color: #111b21; padding-left: 40px; }
.chat-search input:focus { outline: none; }
.chat-search svg { left: 14px; width: 18px; height: 18px; color: #54656f; }
.chat-filters { margin-top: 8px; gap: 8px; }
.chat-filter { border: 1px solid #e9edef; color: #54656f; border-radius: 16px; padding: 5px 12px; font-size: 13px; background: #fff; }
.chat-filter:hover { background: #f0f2f5; }
.chat-filter.is-active { background: #d1f4cc; border-color: #d1f4cc; color: #111b21; font-weight: 500; }
.chat-notif-banner { display: flex; align-items: center; gap: 12px; background: #e7fce3; border-radius: 8px; padding: 12px 14px; margin: 10px 14px 2px; font-size: 14px; color: #111b21; }
.chat-notif-banner a { color: #008069; font-weight: 600; cursor: pointer; }
.chat-notif-banner .chat-icon-btn { width: 32px; height: 32px; margin-left: auto; }
.chat-notif-banner.is-warn { background: #fef3c7; }

/* Threads */
.chat-threads { padding: 4px 0 12px; }
.chat-thread { gap: 15px; padding: 0 14px 0 13px; min-height: 72px; border-bottom: 0; position: relative; }
.chat-thread:hover { background: #f5f6f6; }
.chat-thread.is-active { background: #f0f2f5; }
.chat-thread-main { border-bottom: 1px solid #e9edef; padding: 11px 0 10px; }
.chat-thread-name { font-weight: 400; font-size: 17px; color: #111b21; }
.chat-thread-time { font-size: 12px; color: #667781; }
.chat-thread-preview { font-size: 14px; color: #667781; display: flex; align-items: center; gap: 3px; }
.chat-thread-preview .wa-ticks { display: inline-flex; }
.chat-thread-chevron { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: 0; background: #fff; color: #8696a0; box-shadow: 0 1px 3px rgb(11 20 26 / .25); display: none; align-items: center; justify-content: center; }
.chat-thread:hover .chat-thread-chevron { display: inline-flex; }
.wa-avatar { border-radius: 50%; overflow: hidden; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: #dfe5e7; color: #fff; }
.wa-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wa-avatar .wa-avatar-glyph { display: inline-flex; }
.chat-group-icon { border-radius: 50%; overflow: hidden; }

/* Conversation pane */
.chat-main { background-color: #efeae2; position: relative; }
.chat-header { background: #f0f2f5; border-bottom: 0; padding: 10px 16px; gap: 15px; min-height: 59px; }
.chat-header-name { font-weight: 400; font-size: 16px; color: #111b21; }
.chat-header-sub { font-size: 13px; color: #667781; }
.chat-header-btn { border: 0; background: transparent; width: 40px; height: 40px; color: #54656f; border-radius: 50%; }
.chat-header-btn:hover { background: #e2e6ea; }
.chat-header-div { width: 1px; height: 24px; background: #d1d7db; }
.chat-messages {
  padding: 12px 60px 16px;
  gap: 0;
  background-image: url("images/bg-chat-tile-distinct.png");
  background-repeat: repeat;
  background-color: #efeae2;
  background-size: 600px auto;
}
.chat-msg-row, .chat-messages > .chat-bubble.is-mine { margin-top: 2px; }
.chat-msg-row.chat-group-start, .chat-messages > .chat-bubble.is-mine.chat-group-start { margin-top: 10px; }
.chat-msg-row:first-child, .chat-messages > .chat-bubble.is-mine:first-child { margin-top: 0; }
.chat-msg-spacer { visibility: hidden; }
.chat-date-pill { background: #fff; border: 0; color: #54656f; font-size: 12.5px; border-radius: 7.5px; padding: 5px 12px; box-shadow: 0 1px 1px rgb(11 20 26 / .12); }
.chat-encrypt { align-self: center; background: #fef3c7; color: #54656f; font-size: 12.5px; border-radius: 7.5px; padding: 6px 12px; margin: 6px 0; max-width: 85%; text-align: center; box-shadow: 0 1px 1px rgb(11 20 26 / .12); }
.chat-system { background: #fff; border: 0; color: #54656f; box-shadow: 0 1px 1px rgb(11 20 26 / .12); border-radius: 7.5px; }

/* Bubbles: one sharp corner instead of fragile tail triangles */
.chat-bubble { border-radius: 7.5px; padding: 6px 7px 6px 9px; box-shadow: 0 1px 1px rgb(11 20 26 / .15); max-width: 65%; }
.chat-bubble::before { content: none; }
.chat-bubble:not(.is-mine) { border-top-left-radius: 0; }
.chat-bubble.is-mine { border-top-right-radius: 0; }
/* Sender avatar beside incoming messages */
.chat-msg-row { display: flex; align-items: flex-end; gap: 8px; align-self: flex-start; max-width: 72%; }
.chat-msg-row .chat-bubble { max-width: 100%; flex: 1; min-width: 0; }
.chat-msg-row.is-mine { align-self: flex-end; }
.chat-msg-avatar { width: 28px; height: 28px; flex-shrink: 0; margin-bottom: 2px; }
.chat-msg-avatar .avatar { width: 28px; height: 28px; }
.chat-bubble-author { font-size: 13.5px; }
.chat-bubble-text { font-size: 14.2px; color: #111b21; line-height: 1.45; }
.chat-time { float: right; font-size: 11px; color: #667781; margin: 9px 0 0 8px; display: inline-flex; align-items: center; gap: 3px; }
.wa-ticks { display: inline-flex; color: #8696a0; }
.wa-ticks.is-read { color: #53bdeb; }
.chat-bubble-meta { display: none; }
.chat-quote { border-left-width: 4px; background: rgb(0 0 0 / .06); border-radius: 6px; }
.chat-quote-text { color: #667781; }

/* Hover actions + menus */
.chat-bubble-actions { top: 2px; right: 6px; border-radius: 8px; border: 1px solid #e9edef; box-shadow: 0 2px 8px rgb(11 20 26 / .18); }
.chat-menu { border: 0; border-radius: 8px; box-shadow: 0 6px 24px rgb(11 20 26 / .25); padding: 6px 0; min-width: 220px; }
.chat-menu-emoji { padding: 6px 12px 10px; border-bottom: 0; gap: 4px; }
.chat-menu button.chat-menu-item { font-size: 14.5px; color: #3b4a54; padding: 9px 20px; border-radius: 0; gap: 12px; }
.chat-menu button.chat-menu-item:hover { background: #f0f2f5; }
.chat-menu button.chat-menu-item.danger { color: #ea0038; }
.chat-reactions { gap: 6px; }
.chat-reaction { border: 1px solid #e9edef; box-shadow: 0 1px 1px rgb(11 20 26 / .1); }
.chat-file-card { background: rgb(0 0 0 / .05); }
.chat-voice audio { accent-color: #00a884; }

/* Composer */
.chat-composer { background: #f0f2f5; padding: 5px 16px; gap: 4px; min-height: 62px; }
.chat-tool-btn { color: #54656f; width: 44px; height: 44px; }
.chat-tool-btn:hover { background: transparent; opacity: .75; }
.chat-composer input { border-radius: 8px; min-height: 42px; font-size: 15px; color: #111b21; }
.chat-send { background: #00a884; width: 44px; height: 44px; }
.chat-send:hover { background: #06cf9c; }
.chat-reply-bar, .chat-attach-chip, .chat-rec-bar { background: #f0f2f5; }
.chat-rec-bar { min-height: 62px; }
.chat-attach-pop { position: absolute; bottom: 70px; left: 16px; z-index: 60; background: #fff; border-radius: 12px; box-shadow: 0 6px 24px rgb(11 20 26 / .25); padding: 8px; min-width: 250px; }
.chat-attach-pop button { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; background: none; padding: 9px 12px; border-radius: 8px; font-size: 14.5px; color: #3b4a54; }
.chat-attach-pop button:hover { background: #f0f2f5; }
.chat-attach-ic { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.chat-emoji-pop { position: absolute; bottom: 70px; left: 60px; z-index: 60; background: #fff; border-radius: 12px; box-shadow: 0 6px 24px rgb(11 20 26 / .25); padding: 12px; width: 320px; }
.chat-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 220px; overflow-y: auto; }
.chat-emoji-grid button { border: 0; background: none; font-size: 22px; padding: 4px; border-radius: 8px; line-height: 1.2; }
.chat-emoji-grid button:hover { background: #f0f2f5; }

/* Group info card (WhatsApp style) */
.wa-info-card { text-align: center; padding: 8px 6px 0; }
.wa-info-avatar { position: relative; display: inline-block; margin: 6px 0 12px; }
.wa-info-avatar .wa-avatar { width: 120px; height: 120px; }
.wa-info-cam { position: absolute; right: 2px; bottom: 6px; width: 40px; height: 40px; border-radius: 50%; background: #00a884; color: #fff; border: 3px solid #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.wa-info-name { font-size: 22px; color: #111b21; margin-bottom: 4px; overflow-wrap: anywhere; }
.wa-info-meta { font-size: 14px; color: #667781; margin-bottom: 10px; }
.wa-info-desc-btn { background: none; border: 0; color: #008069; font-size: 14.5px; padding: 6px; }
.wa-info-desc { font-size: 14px; color: #111b21; background: #f0f2f5; border-radius: 8px; padding: 8px 12px; margin: 6px 0 4px; }
.wa-info-action { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 1px solid #e9edef; background: #fff; color: #008069; font-size: 14.5px; font-weight: 500; border-radius: 24px; padding: 9px; margin-top: 8px; cursor: pointer; }
.wa-info-action:hover { background: #f0f2f5; }
.wa-info-members { text-align: left; margin-top: 14px; max-height: 260px; overflow-y: auto; }
/* Photo galleries, video tiles, lightbox, pending strip */
.chat-gallery { display: grid; gap: 3px; border-radius: 6px; overflow: hidden; margin: 2px 0 4px; }
.chat-gallery-1 { grid-template-columns: 1fr; }
.chat-gallery-2 { grid-template-columns: 1fr 1fr; }
.chat-gallery-3 { grid-template-columns: 1fr 1fr; }
.chat-gallery-3 .chat-photo:first-child { grid-column: 1 / -1; }
.chat-gallery-4 { grid-template-columns: 1fr 1fr; }
.chat-photo { position: relative; border: 0; padding: 0; background: #dfe5e7; cursor: zoom-in; min-height: 90px; overflow: hidden; display: block; width: 100%; }
.chat-gallery-1 .chat-photo img { width: 100%; max-width: 330px; max-height: 330px; object-fit: cover; display: block; }
.chat-gallery-2 .chat-photo img, .chat-gallery-3 .chat-photo img, .chat-gallery-4 .chat-photo img { width: 100%; height: 150px; object-fit: cover; display: block; }
.chat-gallery-3 .chat-photo:first-child img { height: 190px; }
.chat-photo-time { position: absolute; right: 6px; bottom: 6px; background: rgb(0 0 0 / .55); color: #fff; font-size: 11px; border-radius: 8px; padding: 1px 7px; display: inline-flex; align-items: center; gap: 3px; }
.chat-photo-time .wa-ticks { color: #fff; }
.chat-photo-more { position: absolute; inset: 0; background: rgb(0 0 0 / .55); color: #fff; font-size: 30px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.chat-video { position: relative; border-radius: 6px; overflow: hidden; margin: 2px 0 4px; background: #000; }
.chat-video video { width: 100%; max-width: 330px; max-height: 300px; display: block; background: #000; }
.chat-video .chat-photo-time { z-index: 2; }
.chat-lightbox { position: fixed; inset: 0; z-index: 400; background: rgb(17 27 33 / .96); display: flex; flex-direction: column; }
.chat-lightbox-top { display: flex; align-items: center; gap: 8px; padding: 12px 20px; color: #e9edef; }
.chat-lightbox-who { font-size: 14px; }
.chat-lightbox-who .small { color: #8696a0; }
.chat-lightbox-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: #e9edef; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; }
.chat-lightbox-btn:hover { background: rgb(255 255 255 / .12); }
.chat-lightbox-stage { flex: 1; border: 0; background: none; padding: 0 70px 70px; cursor: zoom-out; min-height: 0; display: flex; align-items: center; justify-content: center; }
.chat-lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.chat-lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .14); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.chat-lightbox-nav:hover { background: rgb(255 255 255 / .25); }
.chat-lightbox-prev { left: 16px; }
.chat-lightbox-next { right: 16px; }
.chat-lightbox-cap { text-align: center; color: #e9edef; font-size: 14px; padding: 0 20px 22px; }
.chat-pending-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.chat-pending-item { position: relative; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: #dfe5e7; flex-shrink: 0; }
.chat-pending-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-pending-doc { width: 100%; height: 100%; display: inline-flex; align-items: center; justify-content: center; color: #54656f; }
.chat-pending-x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgb(0 0 0 / .6); color: #fff; font-size: 11px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 900px) { .chat-list { width: 100%; } .chat-messages { padding: 12px 16px; } .content--chats::before { height: 80px; } .chat-gallery-1 .chat-photo img { max-width: 100%; } }

/* ---- Preferences: wallpaper + density ---- */
html[data-wallpaper="solid"] .chat-main::before { display: none; }
html[data-wallpaper="solid"][data-theme="dark"] .chat-main::before { display: none; }
html[data-compact="true"] .chat-thread { min-height: 60px; }
html[data-compact="true"] .chat-thread-main { padding: 7px 0 6px; }
html[data-compact="true"] .chat-messages { padding-top: 8px; padding-bottom: 10px; }
html[data-compact="true"] .content { padding-top: 20px; }

/* ---- Dark theme ---- */
html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0e141b; --surface: #161e29; --surface-subtle: #1d2634;
  --ink: #e9edef; --ink-secondary: #b6c1cd; --ink-muted: #8696a0;
  --line: #2a3546; --line-strong: #3b4a5e;
  --brand: #53bdeb; --brand-hover: #7cd3f7; --brand-soft: #1c2f3d;
  --success: #4fce8f; --success-soft: #16352a;
  --warning: #e2a63d; --warning-soft: #3a2f16;
  --danger: #f06a6e; --danger-soft: #3d2126;
  --rail: #0b1017; --rail-muted: #8696a0; --rail-active: #1d2634;
  --shadow-popover: 0 12px 40px rgb(0 0 0 / .5);
}
html[data-theme="dark"] body { background: var(--canvas); color: var(--ink); }
html[data-theme="dark"] .btn { background: #1d2634; border-color: var(--line-strong); color: var(--ink); }
html[data-theme="dark"] .btn:hover { background: #263042; }
html[data-theme="dark"] .btn--primary { background: #00a884; border-color: #00a884; color: #fff; }
html[data-theme="dark"] .btn--primary:hover { background: #06cf9c; }
html[data-theme="dark"] .btn--danger { background: var(--danger-soft); border-color: #5a2b30; color: var(--danger); }
html[data-theme="dark"] .link-button { color: var(--brand); }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: #1d2634; border-color: var(--line-strong); color: var(--ink); }
html[data-theme="dark"] .badge { background: #263042; color: #b6c1cd; }
html[data-theme="dark"] .board-card, html[data-theme="dark"] .suggestion, html[data-theme="dark"] .chat-message { background: var(--surface); }
html[data-theme="dark"] .dialog { background: var(--surface); }
html[data-theme="dark"] .data-table tbody tr:hover { background: #1d2634; }
html[data-theme="dark"] .skip-link { background: #1d2634; color: var(--ink); }
html[data-theme="dark"] .file-chip { background: #263042; border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .leaflet-tile-pane { filter: invert(0.92) hue-rotate(180deg) brightness(0.9) contrast(0.9); }
/* account dock (index.html inline styles) */
html[data-theme="dark"] .account-pill-wrap, html[data-theme="dark"] .account-dock-btn { background: #1d2634; border-color: var(--line); color: var(--ink-secondary); box-shadow: none; }
html[data-theme="dark"] .account-pill-wrap:hover, html[data-theme="dark"] .account-dock-btn:hover { background: #263042; border-color: var(--line-strong); color: var(--ink); }
html[data-theme="dark"] .account-pill-user { color: #fff; }
html[data-theme="dark"] .account-pill-tenant { color: var(--ink-muted); }
/* ---- Dark chat (WhatsApp dark palette) ---- */
html[data-theme="dark"] .content--chats { background: #0b141a !important; }
html[data-theme="dark"] .content--chats::before { background: #111b21; }
html[data-theme="dark"] .chat-shell { background: #111b21; }
html[data-theme="dark"] .chat-list { background: #111b21; border-right-color: #222d34; }
html[data-theme="dark"] .chat-list-head { background: #111b21; }
html[data-theme="dark"] .chat-list-head-top h2 { color: #e9edef; }
html[data-theme="dark"] .chat-icon-btn { color: #8696a0; }
html[data-theme="dark"] .chat-icon-btn:hover { background: #1f2c34; }
html[data-theme="dark"] .chat-search input { background: #1f2c34; color: #e9edef; }
html[data-theme="dark"] .chat-search svg { color: #8696a0; }
html[data-theme="dark"] .chat-filter { background: transparent; border-color: #2a3942; color: #8696a0; }
html[data-theme="dark"] .chat-filter:hover { background: #1f2c34; }
html[data-theme="dark"] .chat-filter.is-active { background: #0b3b32; border-color: #0b3b32; color: #4fce8f; }
html[data-theme="dark"] .chat-notif-banner { background: #0b3b32; color: #e9edef; }
html[data-theme="dark"] .chat-notif-banner a { color: #4fce8f; }
html[data-theme="dark"] .chat-notif-banner.is-warn { background: #3a2f16; color: #e9edef; }
html[data-theme="dark"] .chat-thread:hover { background: #1f2c34; }
html[data-theme="dark"] .chat-thread.is-active { background: #1f2c34; }
html[data-theme="dark"] .chat-thread-main { border-bottom-color: #222d34; }
html[data-theme="dark"] .chat-thread-name { color: #e9edef; }
html[data-theme="dark"] .chat-thread-time, html[data-theme="dark"] .chat-thread-preview { color: #8696a0; }
html[data-theme="dark"] .chat-thread-chevron { background: #1f2c34; color: #8696a0; }
html[data-theme="dark"] .wa-avatar { background: #2a3942; }
html[data-theme="dark"] .chat-main { background-color: #0b141a; position: relative; }
html[data-theme="dark"] .chat-main::before { filter: invert(0.88) hue-rotate(180deg); opacity: 0.35; }
html[data-theme="dark"] .chat-main > * { position: relative; z-index: 1; }
html[data-theme="dark"] .chat-header, html[data-theme="dark"] .chat-composer, html[data-theme="dark"] .chat-reply-bar, html[data-theme="dark"] .chat-attach-chip, html[data-theme="dark"] .chat-rec-bar { background: #1f2c34; border-color: #1f2c34; }
html[data-theme="dark"] .chat-header-name { color: #e9edef; }
html[data-theme="dark"] .chat-header-sub { color: #8696a0; }
html[data-theme="dark"] .chat-header-btn { color: #8696a0; }
html[data-theme="dark"] .chat-header-btn:hover { background: #2a3942; }
html[data-theme="dark"] .chat-header-div { background: #2a3942; }
html[data-theme="dark"] .chat-composer input { background: #2a3942; border-color: #2a3942; color: #e9edef; }
html[data-theme="dark"] .chat-tool-btn { color: #8696a0; }
html[data-theme="dark"] .chat-date-pill, html[data-theme="dark"] .chat-system { background: #1f2c34; color: #8696a0; box-shadow: 0 1px 1px rgb(0 0 0 / .4); }
html[data-theme="dark"] .chat-encrypt { background: #1f2c34; color: #ffd279; box-shadow: 0 1px 1px rgb(0 0 0 / .4); }
html[data-theme="dark"] .chat-bubble { background: #1f2c34; box-shadow: 0 1px 1px rgb(0 0 0 / .4); }
html[data-theme="dark"] .chat-bubble:not(.is-mine)::before { background: #1f2c34; }
html[data-theme="dark"] .chat-bubble.is-mine { background: #005c4b; }
html[data-theme="dark"] .chat-bubble.is-mine::before { background: #005c4b; }
html[data-theme="dark"] .chat-bubble-text { color: #e9edef; }
html[data-theme="dark"] .chat-time { color: #8696a0; }
html[data-theme="dark"] .chat-quote { background: rgb(255 255 255 / .06); }
html[data-theme="dark"] .chat-quote-text { color: #8696a0; }
html[data-theme="dark"] .chat-deleted { color: #8696a0; }
html[data-theme="dark"] .chat-bubble-actions { background: #1f2c34; border-color: #2a3942; }
html[data-theme="dark"] .chat-bubble-actions button { color: #8696a0; }
html[data-theme="dark"] .chat-bubble-actions button:hover { background: #2a3942; }
html[data-theme="dark"] .chat-menu { background: #233138; box-shadow: 0 6px 24px rgb(0 0 0 / .5); }
html[data-theme="dark"] .chat-menu button.chat-menu-item { color: #d1d7db; }
html[data-theme="dark"] .chat-menu button.chat-menu-item:hover { background: #2a3942; }
html[data-theme="dark"] .chat-menu button.chat-menu-item.danger { color: #f06a6e; }
html[data-theme="dark"] .chat-menu-emoji button:hover { background: #2a3942; }
html[data-theme="dark"] .chat-reaction { background: #1f2c34; border-color: #2a3942; color: #e9edef; }
html[data-theme="dark"] .chat-reaction.is-mine { border-color: #00a884; background: #0b3b32; }
html[data-theme="dark"] .chat-file-card { background: rgb(255 255 255 / .06); color: #e9edef; }
html[data-theme="dark"] .chat-file-card:hover { background: rgb(255 255 255 / .1); }
html[data-theme="dark"] .chat-file-icon { background: #2a3942; color: #8696a0; }
html[data-theme="dark"] .chat-file-sub { color: #8696a0; }
html[data-theme="dark"] .chat-attach-pop, html[data-theme="dark"] .chat-emoji-pop { background: #233138; }
html[data-theme="dark"] .chat-attach-pop button { color: #d1d7db; }
html[data-theme="dark"] .chat-attach-pop button:hover { background: #2a3942; }
html[data-theme="dark"] .chat-emoji-grid button:hover { background: #2a3942; }
html[data-theme="dark"] .chat-pending-item { background: #2a3942; }
html[data-theme="dark"] .chat-pending-doc { color: #8696a0; }
html[data-theme="dark"] .chat-empty { background: #111b21; color: #8696a0; }
html[data-theme="dark"] .wa-info-name { color: #e9edef; }
html[data-theme="dark"] .wa-info-meta { color: #8696a0; }
html[data-theme="dark"] .wa-info-desc { background: #1f2c34; color: #e9edef; }
html[data-theme="dark"] .wa-info-action { background: transparent; border-color: #2a3942; }
html[data-theme="dark"] .wa-info-action:hover { background: #1f2c34; }
html[data-theme="dark"] .wa-info-cam { border-color: #1f2c34; }
html[data-theme="dark"] .wa-file-btn { background: #1d2634; border-color: var(--line-strong); color: var(--ink); }
html[data-theme="dark"] .wa-file-btn:hover { background: #263042; }

/* Shared service, stock, and attendance surfaces */
.feature-page { max-width: 1440px; margin: 0 auto; padding: 24px 28px 48px; }
.feature-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 4px 0 2px; }
.feature-page-head h1 { margin: 4px 0 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.04em; line-height: 1.05; }
.feature-page-head p { max-width: 720px; margin: 8px 0 0; color: var(--muted, #64748b); font-size: 13px; line-height: 1.55; }
.feature-eyebrow { color: var(--accent, #315b9d); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.feature-page-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.feature-page-tools { min-height: 0; padding: 0 0 12px; }
.feature-panel { background: var(--surface, #fff); border: 1px solid var(--line, #e2e8f0); border-radius: 14px; margin-top: 18px; overflow: hidden; box-shadow: 0 8px 30px rgba(15, 23, 42, .04); }
.feature-panel--archive { background: var(--surface-subtle, #f8fafc); }
.feature-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line, #e2e8f0); }
.feature-panel-heading h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.feature-panel-heading p { margin: 4px 0 0; color: var(--muted, #64748b); font-size: 12px; }
.feature-chip, .feature-status { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 8px; background: #e8f1ff; color: #315b9d; font-size: 11px; font-style: normal; font-weight: 700; white-space: nowrap; }
.feature-chip--muted { background: #eef2f7; color: #66758a; }
.feature-status--active, .feature-status--approved, .feature-status--received { background: #e8f6ee; color: #26734d; }
.feature-status--warn { background: #fff5dc; color: #9a6a16; }
.feature-status--archived, .feature-status--cancelled { background: #edf0f4; color: #64748b; }
.feature-grid-table { width: 100%; overflow-x: auto; }
.feature-grid-row { display: grid; grid-template-columns: minmax(190px, 1.5fr) repeat(4, minmax(110px, 1fr)); gap: 14px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line, #e2e8f0); min-width: 800px; font-size: 12px; }
.feature-grid-row:last-child { border-bottom: 0; }
.feature-grid-row > span { min-width: 0; }
.feature-grid-row small, .feature-archive-list small, .feature-request-list small { display: block; margin-top: 4px; color: var(--muted, #64748b); font-size: 11px; }
.feature-grid-head { padding-top: 11px; padding-bottom: 11px; background: var(--surface-subtle, #f8fafc); color: var(--muted, #64748b); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.feature-grid-row.is-low-stock { background: rgba(255, 245, 220, .5); }
.stock-balance-head, .stock-balance-row { grid-template-columns: minmax(190px, 1.5fr) repeat(6, minmax(96px, 1fr)); }
.stock-balance-detail-btn { white-space: nowrap; }
.stock-detail-history { max-height: calc(100vh - 190px); overflow-y: auto; }
.feature-link { color: var(--accent, #315b9d); font-weight: 750; text-decoration: none; }
.feature-link:hover { text-decoration: underline; }
.feature-empty { padding: 34px 20px; color: var(--muted, #64748b); font-size: 13px; text-align: center; }
.feature-empty--compact { padding: 14px 20px; text-align: left; }
.challan-format-preview { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(135deg, #f8fbff, #fff); display: grid; gap: 6px; color: var(--ink); }
.challan-format-preview__brand { color: var(--accent, #315b9d); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.challan-format-preview__line { padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); }
.feature-filter-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted, #64748b); font-size: 11px; font-weight: 700; }
.feature-filter-label select { min-height: 32px; padding: 5px 8px; border: 1px solid var(--line, #d7dce4); border-radius: 6px; background: var(--surface, #fff); color: var(--ink, #172033); font-size: 11px; }
.attendance-filter-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line, #e2e8f0); background: var(--surface-subtle, #f8fafc); }
.attendance-filter-row label { display: grid; gap: 4px; color: var(--muted, #64748b); font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.attendance-filter-row input, .attendance-filter-row select { min-height: 32px; padding: 5px 8px; border: 1px solid var(--line, #d7dce4); border-radius: 6px; background: var(--surface, #fff); color: var(--ink, #172033); font-size: 12px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; margin: 10px 0; color: var(--ink, #172033); font-size: 12px; }
.checkbox-field input { accent-color: var(--accent, #315b9d); }
.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; }
.feature-archive-list, .feature-request-list { display: grid; }
.feature-archive-list > div, .feature-request-list > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 20px; border-bottom: 1px solid var(--line, #e2e8f0); font-size: 12px; }
.feature-archive-list > div:last-child, .feature-request-list > div:last-child { border-bottom: 0; }
.feature-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.feature-metrics > div { padding: 16px 18px; background: var(--surface, #fff); border: 1px solid var(--line, #e2e8f0); border-radius: 12px; }
.feature-metrics span { display: block; color: var(--muted, #64748b); font-size: 11px; }
.feature-metrics strong { display: block; margin-top: 7px; font-size: 21px; letter-spacing: -.03em; }
.feature-metrics .is-warn strong { color: #9a6a16; }
.stock-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 18px; align-items: start; }
.stock-layout .feature-panel { min-width: 0; }
.stock-request-card { padding: 14px 16px; border-bottom: 1px solid var(--line, #e2e8f0); font-size: 12px; }
.stock-request-card:last-child { border-bottom: 0; }
.stock-request-card > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stock-request-card p { margin: 8px 0 5px; color: var(--muted, #64748b); }
.stock-request-card small { display: block; color: var(--ink, #1f2937); line-height: 1.5; }
.stock-request-card .btn { margin-top: 12px; }
.feature-action-row { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
.project-stock-disclosure { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 4px 7px; border: 1px solid var(--line, #d7dce4); border-radius: 6px; background: var(--surface, #fff); color: var(--accent, #315b9d); font-size: 10px; font-weight: 750; cursor: pointer; }
.project-stock-disclosure:hover { background: var(--surface-subtle, #f8fafc); border-color: var(--accent, #315b9d); }
.project-stock-disclosure svg { width: 12px; height: 12px; }
@media (max-width: 900px) { .feature-page { padding: 18px 14px 34px; } .feature-page-head { align-items: flex-start; flex-direction: column; gap: 14px; } .feature-page-actions { justify-content: flex-start; } .stock-layout { grid-template-columns: 1fr; } .feature-metrics { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .feature-panel-heading { align-items: flex-start; flex-direction: column; } .feature-metrics { gap: 8px; } .feature-metrics > div { padding: 12px; } .feature-metrics strong { font-size: 18px; } .feature-archive-list > div, .feature-request-list > div { align-items: flex-start; flex-direction: column; gap: 6px; } }

/* =============================================================
   Enterprise Operations Layouts (Stock & Delivery Challans)
   Layout 1: Master-Detail Workbench
   Layout 2: Operations Command Center
   Layout 3: Operations Split View (Modern Retool / Airtable)
   ============================================================= */

/* Page Header & Switcher */
.op-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line, #e2e8f0);
}
.op-layout-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--surface-subtle, #f1f5f9);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}
.op-layout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--ink-muted, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.op-layout-btn:hover {
  color: var(--ink, #0f172a);
  background: rgba(255, 255, 255, 0.6);
}
.op-layout-btn.is-active {
  background: #ffffff;
  color: var(--brand, #2563eb);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.op-layout-tag {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #eff6ff;
  color: var(--brand, #2563eb);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Compact KPI Ribbon (Replaces 4 Giant Boxes) */
.op-kpi-ribbon {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.op-kpi-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 20px;
  font-size: 12px;
  color: var(--ink, #1e293b);
  cursor: pointer;
  transition: all 0.14s ease;
  user-select: none;
}
.op-kpi-chip:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.op-kpi-chip.is-active {
  border-color: var(--brand, #2563eb);
  background: #eff6ff;
  color: var(--brand, #1d4ed8);
}
.op-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.op-kpi-chip.is-warn .op-chip-dot { background: #f59e0b; }
.op-kpi-chip.is-alert .op-chip-dot { background: #ef4444; }
.op-kpi-chip.is-success .op-chip-dot { background: #10b981; }
.op-kpi-chip strong {
  font-weight: 700;
}

/* Layout 1: Master-Detail Workbench */
.op-workbench-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 16px;
  align-items: start;
}
.op-sidebar-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 14px;
}
.op-card {
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.op-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink, #0f172a);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
}
.op-card-sub {
  font-size: 11px;
  color: var(--ink-muted, #64748b);
  margin: 0;
}
.op-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.op-action-grid .btn {
  justify-content: center;
  font-size: 11px;
}

/* Layout 2: Operations Command Center */
.op-command-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  margin-bottom: 14px;
}
.op-command-tab {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--ink-muted, #64748b);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.op-command-tab:hover {
  color: var(--ink, #0f172a);
}
.op-command-tab.is-active {
  color: var(--brand, #2563eb);
  border-bottom-color: var(--brand, #2563eb);
}
.op-command-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #475569;
}
.op-command-tab.is-active .op-command-count {
  background: #eff6ff;
  color: var(--brand, #2563eb);
}

/* Layout 3: Split View (Modern Retool / Airtable) */
.op-split-view {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.op-split-master {
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 170px);
}
.op-split-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  background: var(--surface-subtle, #f8fafc);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.op-split-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.op-split-list {
  overflow-y: auto;
  flex: 1;
}
.op-split-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line, #f1f5f9);
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.op-split-item:last-child {
  border-bottom: 0;
}
.op-split-item:hover {
  background: #f8fafc;
}
.op-split-item.is-selected {
  background: #eff6ff;
  border-left: 4px solid var(--brand, #2563eb);
}
.op-split-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.op-split-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink, #0f172a);
}
.op-split-item-sub {
  font-size: 11px;
  color: var(--ink-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 6px;
}
.op-split-detail {
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 480px;
}
.op-doc-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line, #e2e8f0);
}
.op-doc-code {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink, #0f172a);
  font-family: var(--mono, monospace);
  margin: 0;
}
.op-doc-sub {
  font-size: 12px;
  color: var(--ink-muted, #64748b);
  margin: 3px 0 0;
}
.op-pipeline-tracker {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-subtle, #f8fafc);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--line, #e2e8f0);
  overflow-x: auto;
}
.op-pipeline-step {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-muted, #94a3b8);
  font-weight: 500;
  text-transform: capitalize;
  white-space: nowrap;
}
.op-pipeline-step.is-done {
  color: #15803d;
  font-weight: 600;
}
.op-pipeline-step.is-current {
  color: var(--brand, #2563eb);
  font-weight: 700;
}
.op-pipeline-arrow {
  color: #cbd5e1;
  font-size: 11px;
}
.op-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  background: var(--surface-subtle, #f8fafc);
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line, #e2e8f0);
}
.op-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.op-meta-item span {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.op-meta-item strong {
  font-size: 13px;
  color: var(--ink, #0f172a);
}

/* High-density line table */
.op-line-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.op-line-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--surface-subtle, #f8fafc);
  border-bottom: 1px solid var(--line, #e2e8f0);
  color: var(--ink-muted, #64748b);
  font-size: 11px;
  font-weight: 700;
}
.op-line-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line, #f1f5f9);
  color: var(--ink, #0f172a);
}
.op-line-table tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 980px) {
  .op-workbench-layout,
  .op-split-view {
    grid-template-columns: 1fr;
  }
  .op-sidebar-rail {
    position: static;
  }
}
