/* CodeDao portal — Gemini light + Claude (Anthropic) fonts · make all simple
 *
 * Fonts: local copies from ~/Library/Application Support/ClaudeFonts/fonts/
 * (Anthropic Sans / Mono / Serif — same faces as Claude.app). Proprietary;
 * used only because Bruce already has the files on this machine.
 */

@font-face {
  font-family: "Anthropic Sans";
  src: url("/static/fonts/anthropic-sans.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Anthropic Sans";
  src: url("/static/fonts/anthropic-sans-italic.woff2") format("woff2");
  font-weight: 300 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Anthropic Serif";
  src: url("/static/fonts/anthropic-serif.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Anthropic Serif";
  src: url("/static/fonts/anthropic-serif-italic.woff2") format("woff2");
  font-weight: 300 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Anthropic Mono";
  src: url("/static/fonts/anthropic-mono.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Anthropic Mono";
  src: url("/static/fonts/anthropic-mono-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root,
html[data-theme="light"] {
  /* Surfaces — soft blue → white (no #000 / near-black panels) */
  --color-brand-50: #eef5fc;
  --color-brand-100: #d6e8f8;
  --color-brand-200: #a8c8e8;
  --color-brand-300: #7ab0e0;
  --color-brand-400: #5a9ad6;
  --color-brand-500: #4A90E2;
  --color-brand-600: #3a7bc8;
  --color-primary: #4A90E2;
  --color-primary-hover: #3a7bc8;
  --color-bg: #ffffff;
  --color-bg-alt: #F5F8FC;
  --color-bg-bot: #c8dff5;
  --color-surface: #ffffff;
  --color-surface-2: #f3f7fb;
  --color-sidebar: rgba(247, 249, 252, 0.96);
  --color-border: rgba(61, 61, 61, 0.12);
  --color-border-subtle: rgba(61, 61, 61, 0.08);
  --color-text: #3D3D3D;
  --color-text-muted: #5C5C5C;
  --color-text-subtle: #8a8f98;
  --color-danger: #c0392b;
  --color-success: #10B981;
  --radius-brand: 12px;
  --radius-brand-lg: 16px;
  --radius-pill: 999px;
  --shadow-soft: 0 1px 3px rgba(60, 90, 130, 0.06);
  --shadow-warm: 0 2px 12px -2px rgba(74, 144, 226, 0.18);
  --shadow-elevated: 0 8px 28px -4px rgba(60, 90, 130, 0.12);
  --shadow-pill: 0 2px 16px rgba(60, 90, 130, 0.14);
  --shadow-focus: 0 0 0 3px rgba(74, 144, 226, 0.18);
  /* soft slate — not near-black (monaco/xterm only) */
  --editor-bg: #3D4450;
  --editor-fg: #F5F8FC;
  --font: "Anthropic Sans", system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "Anthropic Mono", ui-monospace, Menlo, Consolas, monospace;
  --serif: "Anthropic Serif", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* aliases */
  --ink: var(--color-text);
  --ink-soft: #5C5C5C;
  --muted: var(--color-text-muted);
  --line: var(--color-border);
  --line-strong: #c5cad3;
  --paper: var(--color-bg);
  --paper-2: var(--color-bg-alt);
  --surface: var(--color-surface);
  --accent: var(--color-primary);
  --accent-ink: var(--color-primary-hover);
  --danger: var(--color-danger);
  --ok: var(--color-success);
  --display: var(--font);
  --radius: var(--radius-brand);
  color-scheme: light;
}

html[data-theme="dark"],
html.dark {
  /* Dark = soft slate panels, never #000–#1a */
  --color-primary: #6ea8fe;
  --color-primary-hover: #8bbcff;
  --color-bg: #2F3A48;
  --color-bg-alt: #3D4450;
  --color-bg-bot: #3A4A5C;
  --color-surface: #3D4450;
  --color-surface-2: #465266;
  --color-sidebar: rgba(47, 58, 72, 0.96);
  --color-border: rgba(245, 248, 252, 0.14);
  --color-border-subtle: rgba(245, 248, 252, 0.08);
  --color-text: #F5F8FC;
  --color-text-muted: #c5cad3;
  --color-text-subtle: #9aa3b0;
  --color-danger: #ef4444;
  --color-success: #22c55e;
  --shadow-soft: 0 1px 3px rgba(30, 40, 55, 0.25);
  --shadow-warm: 0 2px 12px -2px rgba(74, 144, 226, 0.25);
  --shadow-elevated: 0 12px 28px -4px rgba(30, 40, 55, 0.35);
  --shadow-pill: 0 2px 16px rgba(30, 40, 55, 0.3);
  --shadow-focus: 0 0 0 3px rgba(74, 144, 226, 0.22);
  --editor-bg: #3D4450;
  --editor-fg: #F5F8FC;
  --ink: var(--color-text);
  --ink-soft: #c5cad3;
  --muted: var(--color-text-muted);
  --line: var(--color-border);
  --line-strong: #6b7380;
  --paper: var(--color-bg);
  --paper-2: var(--color-bg-alt);
  --surface: var(--color-surface);
  --accent: var(--color-primary);
  --accent-ink: #8bbcff;
  --danger: var(--color-danger);
  --ok: var(--color-success);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--color-text);
  font: 14px/1.5 var(--font);
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg) 45%, var(--color-bg-bot) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea, label, a, .btn, .chip, .card, .sidebar, .topbar {
  font-family: var(--font);
}
code, pre, kbd, samp, .mono, .logpane, .oc-watch-log, .oc-term {
  font-family: var(--mono);
}
body.sidebar-drawer-open { overflow: hidden; }
::selection {
  background-color: rgba(74, 144, 226, 0.22);
  color: var(--color-text);
}

a { color: var(--color-primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Shell (9Router dashboard) ── */
.shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: var(--color-bg);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(61, 68, 80, 0.45);
  -webkit-tap-highlight-color: transparent;
}
.sidebar-backdrop.on { display: block; }
.sidebar {
  width: var(--sidebar-w, 240px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-sidebar);
  border-right: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
  z-index: 30;
  position: relative;
}
.sidebar-resizer {
  position: absolute;
  top: 0; right: -3px; bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 40;
}
.sidebar-resizer:hover,
.sidebar-resizer.dragging {
  background: rgba(196, 120, 74, 0.55);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.1rem 1rem 0.85rem;
  text-decoration: none;
  color: var(--color-text);
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-logo {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4A90E2 0%, #5BB8A8 50%, #E8A87C 100%);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: var(--shadow-soft);
  border: 2px solid rgba(255,255,255,0.85);
}
.sidebar-title {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}
.sidebar-title span {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.sidebar-nav {
  flex: 1;
  overflow: auto;
  padding: 0.35rem 0.65rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.sidebar-section {
  margin: 0.85rem 0.5rem 0.35rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
}
.sidebar-nav a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover {
  background: rgba(74, 144, 226, 0.1);
  color: var(--color-text);
  text-decoration: none;
}
.sidebar-nav a.on {
  background: rgba(74, 144, 226, 0.14);
  color: #1a3a5c;
  font-weight: 600;
}
.sidebar-foot {
  padding: 0.85rem 1rem 1.1rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.75rem;
}
.shell-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-bottom: none;
  background: transparent;
  z-index: 20;
  flex-shrink: 0;
}
.topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}
.topbar-pill {
  font-size: 0.95rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-text);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: #fff;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  box-shadow: var(--shadow-soft);
}
.sidebar-toggle:hover { border-color: var(--color-primary); color: var(--color-primary); }
/* Desktop hide sidebar */
html.sidebar-collapsed .sidebar,
.shell.sidebar-collapsed .sidebar {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border-right: none;
  opacity: 0;
  pointer-events: none;
}
html.sidebar-collapsed .sidebar-resizer,
.shell.sidebar-collapsed .sidebar-resizer {
  display: none;
}
@media (max-width: 768px) {
  /* Mobile: collapsed class không ẩn drawer — chỉ .open / transform */
  html.sidebar-collapsed .sidebar,
  .shell.sidebar-collapsed .sidebar {
    width: min(var(--sidebar-w, 280px), 86vw) !important;
    max-width: 320px;
    opacity: 1;
    pointer-events: auto;
    overflow: auto;
    border-right: 1px solid var(--color-border);
  }
}
.shell-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
  isolation: isolate;
}
.shell-inner {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}
.shell-content.chat-main {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.shell-content.chat-main .shell-inner {
  max-width: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.shell-content.chat-main .pw-box { display: none; }
.shell-content.chat-main .landing-grid { display: none; }
.shell-content.chat-main .page-head {
  padding: .75rem 1.25rem .25rem;
  flex-shrink: 0;
}
.shell-content.chat-main .page-head h1 { font-size: 1.15rem; margin: 0; }
/* OpenCode chat: hide landing chrome, full bleed */
.shell-content.chat-main ~ * { }
body.has-shell:has(.oc-root) .topbar {
  /* ponytail: chat có oc-titlebar — ẩn shell topbar tránh double header */
  display: none;
}

.landing-grid {
  display: none;
}

.theme-btn {
  appearance: none;
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font: 500 0.78rem/1.2 var(--font);
  cursor: pointer;
  text-align: left;
}
.theme-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: var(--shadow-warm);
}

/* legacy main (login) */
main {
  position: relative;
  z-index: 1;
  padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1rem, 3vw, 1.75rem) 3.5rem;
  max-width: 1120px;
  margin: 0 auto;
}

.page-head {
  margin-bottom: 1.5rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--color-border);
}
.page-head h1 {
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  font-weight: 650;
  letter-spacing: -0.025em;
  margin: 0 0 0.3rem;
}
.page-head .lede {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  max-width: 44rem;
}

h1 {
  font-size: clamp(1.3rem, 2.2vw, 1.65rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}
h2 {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 1.75rem 0 0.75rem;
}

.muted { color: var(--color-text-muted); }
.err { color: var(--color-danger); font-size: 0.9rem; }

.grid4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 0 0 1.5rem;
}
@media (max-width: 800px) {
  .grid4 { grid-template-columns: 1fr 1fr; }
}
.stat {
  padding: 1rem 1.1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-brand);
  box-shadow: var(--shadow-soft);
}
.stat .k {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.3rem;
}
.stat .v {
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--color-text);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-brand);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-soft);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1.5rem;
  font-size: 0.86rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-brand);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.table th, .table td {
  padding: 0.6rem 0.7rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border-subtle);
}
.table th {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
}
.table tbody tr:hover { background: color-mix(in srgb, var(--color-primary) 7%, transparent); }
.wrap { word-break: break-all; max-width: 420px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.85rem 0;
}
.toolbar label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

button, .btn {
  appearance: none;
  background: var(--color-primary);
  color: #fff;
  border: 1px solid var(--color-primary);
  padding: 0.42rem 0.9rem;
  border-radius: 8px;
  font: 500 0.8rem/1.2 var(--font);
  cursor: pointer;
  box-shadow: var(--shadow-warm);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
button:hover, .btn:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}
button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
button.danger {
  background: transparent;
  color: var(--color-danger);
  border-color: color-mix(in srgb, var(--color-danger) 45%, transparent);
  box-shadow: none;
}
button.danger:hover {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

input, select, textarea {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.42rem 0.6rem;
  font: inherit;
  accent-color: var(--color-primary);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}
html[data-theme="dark"] select option,
html.dark select option {
  background: var(--color-surface);
  color: var(--color-text);
}

.rowform {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 1.5rem;
}
.rowform input, .rowform select { min-width: 140px; flex: 1; }

.logpane {
  background: var(--editor-bg);
  color: var(--editor-fg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-brand);
  padding: 1rem 1.1rem;
  max-height: 70vh;
  overflow: auto;
  font: 12px/1.45 var(--mono);
  white-space: pre-wrap;
}
/* Logs full-bleed monitor */
.shell-content.logs-main .shell-inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.logs-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 0.5rem 0.85rem 0.75rem;
  gap: 0.5rem;
}
.logs-page .page-head {
  padding: 0.35rem 0.15rem 0 !important;
  flex-shrink: 0;
}
.logs-page .page-head h1 { font-size: 1.05rem; margin: 0; }
.logs-page .lede { margin: 0.15rem 0 0; font-size: 0.8rem; }
.logs-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  flex-shrink: 0;
}
.logs-toolbar input[type="search"],
.logs-toolbar input[type="text"],
.logs-toolbar input[type="number"] {
  font: 12px/1.3 var(--mono);
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
}
.logs-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.logs-chip {
  font: 11px/1 var(--mono);
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}
.logs-chip.on {
  border-color: var(--color-primary, #E56A4A);
  color: var(--color-primary, #E56A4A);
  background: color-mix(in srgb, var(--color-primary, #E56A4A) 12%, transparent);
}
.logs-chip.chip-in.on { border-color: #3d9a6a; color: #3d9a6a; background: rgba(61,154,106,.12); }
.logs-chip.chip-out.on { border-color: #3b82f6; color: #3b82f6; background: rgba(59,130,246,.12); }
.logs-chip.chip-err.on { border-color: #e11d48; color: #e11d48; background: rgba(225,29,72,.12); }
.logs-meta {
  font: 11px/1.3 var(--mono);
  color: var(--color-text-muted);
  margin-left: auto;
}
.logs-page .logpane {
  flex: 1;
  min-height: 0;
  max-height: none;
  height: auto;
  margin: 0;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}
.logs-page .logpane .ll {
  display: block;
  padding: 0.12rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 55%, transparent);
}
.logs-page .logpane .ll:hover { background: color-mix(in srgb, var(--color-primary) 6%, transparent); }
.logs-page .logpane .ll.ll-vao .ll-tag { color: #3d9a6a; }
.logs-page .logpane .ll.ll-ra .ll-tag { color: #3b82f6; }
.logs-page .logpane .ll.ll-hong .ll-tag,
.logs-page .logpane .ll.ll-err .ll-tag { color: #e11d48; }
.logs-page .logpane .ll-tag { font-weight: 600; min-width: 3.2rem; display: inline-block; }
.logs-page .logpane .ll-gio { color: var(--color-text-muted); }
.logs-page .logpane .ll-agent { color: #c4a35a; }
.logs-page .logpane mark {
  background: color-mix(in srgb, #eab308 45%, transparent);
  color: inherit;
  padding: 0;
  border-radius: 2px;
}
/* Odoo manager full-bleed */
.shell-content.odoo-main .shell-inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}
.odoo-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 0.45rem 0.75rem 0.6rem;
  gap: 0.4rem;
  width: 100%;
  box-sizing: border-box;
}
.odoo-page .page-head { padding: 0.2rem 0.1rem 0 !important; flex-shrink: 0; }
.odoo-page .page-head h1 { font-size: 1.05rem; margin: 0; }
.odoo-page .lede { margin: 0.1rem 0 0; font-size: 0.78rem; }
.odoo-debug-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.4rem 0.55rem;
  background: #F5F8FC;
  border: 1px solid #5a3a22;
  border-radius: 8px;
  flex-shrink: 0;
}
.odoo-debug-bar span { font-size: 0.75rem; color: #E56A4A; margin-right: 0.5rem; }
.odoo-grid {
  display: grid;
  grid-template-columns: 200px minmax(280px, 0.95fr) minmax(360px, 1.25fr);
  gap: 0.55rem;
  flex: 1;
  min-height: 0;
  width: 100%;
}
@media (max-width: 1100px) {
  .odoo-grid { grid-template-columns: 180px 1fr; }
  .odoo-logs { grid-column: 1 / -1; min-height: 280px; }
}
@media (max-width: 700px) {
  .odoo-grid { grid-template-columns: 1fr; }
}
.odoo-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-surface);
}
.odoo-side .toolbar { padding: 0.4rem; gap: 0.3rem; margin: 0; border-bottom: 1px solid var(--color-border); }
.odoo-list { flex: 1; overflow: auto; min-height: 0; }
.odoo-list button.inst {
  display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--color-border);
  background: transparent; color: inherit; padding: 0.55rem 0.65rem; cursor: pointer; font: inherit;
}
.odoo-list button.inst:hover, .odoo-list button.inst.on {
  background: color-mix(in srgb, var(--color-primary, #E56A4A) 12%, transparent);
}
.odoo-list .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.4rem; background: #666; }
.odoo-list .dot.on { background: #3ecf8e; box-shadow: 0 0 6px #3ecf8e88; }
.odoo-cfg, .odoo-logs {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  overflow: hidden;
}
.odoo-cfg { overflow: auto; padding: 0.55rem 0.7rem 0.75rem; }
.odoo-cfg label { display: block; font-size: 0.72rem; color: var(--color-text-muted); margin: 0.4rem 0 0.15rem; }
.odoo-cfg input, .odoo-cfg textarea, .odoo-cfg select {
  width: 100%; box-sizing: border-box; background: var(--editor-bg, #3D4450); color: var(--editor-fg, #e5e5e5);
  border: 1px solid var(--color-border); border-radius: 6px; padding: 0.35rem 0.45rem; font: inherit; font-size: 0.78rem;
}
.odoo-cfg textarea { min-height: 88px; font-family: var(--mono); font-size: 0.7rem; resize: vertical; }
.odoo-cfg .odoo-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.45rem; }
/* MCP: nhấn mạnh tên binding (chat gọi binding_name) */
.mcp-page .mcp-name-label { font-size: 0.8rem; color: var(--editor-fg, #e5e5e5); font-weight: 600; }
.mcp-page .mcp-name-hint { font-weight: 400; color: var(--color-text-muted); font-size: 0.68rem; margin-left: 0.35rem; }
.mcp-page .mcp-req { color: #e56a4a; }
.mcp-page .mcp-name-input {
  font-size: 1rem !important; font-weight: 600; padding: 0.5rem 0.55rem !important;
  border-color: color-mix(in srgb, var(--color-primary, #E56A4A) 45%, var(--color-border)) !important;
}
.mcp-page .mcp-list-name { font-size: 0.82rem; }
.odoo-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.55rem 0 0.35rem; align-items: center; }
.odoo-actions button, .odoo-actions a { font-size: 0.78rem; }
.odoo-hint { font-size: 0.72rem; color: var(--color-text-muted); margin: 0.25rem 0; }
#odoo-out { max-height: 100px; overflow: auto; font-size: 0.68rem; margin: 0.25rem 0 0; flex-shrink: 0; }
.odoo-logs-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.odoo-logs-head .logs-meta { margin-left: auto; font: 11px/1.2 var(--mono); color: var(--color-text-muted); }
.odoo-logs-head input[type="search"] {
  flex: 1; min-width: 140px; font: 12px/1.2 var(--mono);
  padding: 0.3rem 0.45rem; border: 1px solid var(--color-border); border-radius: 6px;
  background: var(--editor-bg); color: var(--editor-fg);
}
.odoo-logs #odoo-log {
  flex: 1;
  min-height: 0;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  font-size: 0.68rem;
  line-height: 1.4;
}
.odoo-logs #odoo-log .ol {
  display: block;
  padding: 0.08rem 0.2rem;
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 40%, transparent);
  white-space: pre-wrap;
  word-break: break-word;
}
.odoo-logs #odoo-log .ol:hover { background: color-mix(in srgb, var(--color-primary) 6%, transparent); }
.odoo-logs #odoo-log .ol-ERROR, .odoo-logs #odoo-log .ol-CRITICAL { color: #f87171; }
.odoo-logs #odoo-log .ol-WARNING { color: #fbbf24; }
.odoo-logs #odoo-log .ol-INFO { color: #93c5fd; }
.odoo-logs #odoo-log .ol-DEBUG { color: #a3a3a3; }
.odoo-logs #odoo-log mark {
  background: color-mix(in srgb, #eab308 45%, transparent);
  color: inherit;
  padding: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

#chart {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-brand);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-soft);
}

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 42%, #c8dff5 100%);
}
.login {
  width: min(340px, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  padding: 1.5rem 0.25rem;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  text-align: center;
}
.login .cd-mark { line-height: 0; margin: 0 auto 0.25rem; }
.login .brand-mark {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--color-text);
}
.login .tag {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  color: var(--color-text-muted);
}
.login label,
.login .challenge-q {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-text);
  text-align: left;
}
.login .pill-field,
.login input.pill-field,
.login input:not([type="hidden"]) {
  font-size: 16px;
  min-height: 48px;
  padding: 0.85rem 1.15rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  color: var(--color-text);
  font-family: inherit;
  width: 100%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  outline: none;
}
.login .pill-field:focus,
.login input:not([type="hidden"]):focus {
  border-color: rgba(74, 144, 226, 0.45);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.12);
}
.login .btn-pill,
.login button {
  margin-top: 0.35rem;
  width: 100%;
  min-height: 48px;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  background: #a8c8e8;
  color: #1a3a5c;
  cursor: pointer;
  font-family: inherit;
}
.login .btn-pill:hover,
.login button:hover {
  background: #4A90E2;
  color: #fff;
}

.chat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: transparent;
}
.chat-side {
  border-right: 1px solid var(--color-border);
  padding: 1rem;
  overflow: auto;
  min-height: 0;
  background: color-mix(in srgb, var(--color-surface) 90%, transparent);
}
.chat-side ul { list-style: none; padding: 0; margin: 0.85rem 0 0; }
.chat-side li {
  padding: 0.5rem 0.55rem;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 0.84rem;
  border-radius: 8px;
}
.chat-side li:hover, .chat-side li.on {
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
}
.chat-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: color-mix(in srgb, var(--color-surface) 70%, transparent);
}
.chat-toolbar {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.messages {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1.15rem 1.35rem;
  scroll-behavior: auto;
}
.msg { margin: 0 0 1rem; max-width: 720px; }
.msg .role {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.15rem;
  font-family: var(--mono);
}
.msg .body { white-space: pre-wrap; font-size: 0.92rem; word-break: break-word; }
.chat-footer {
  flex-shrink: 0;
  position: relative;
  z-index: 6;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}
.chat-jump {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.5rem);
  transform: translateX(-50%);
  z-index: 7;
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  box-shadow: var(--shadow-elevated);
  display: none;
}
.chat-jump.on { display: inline-flex; }
.img-preview { flex-shrink: 0; }
.composer {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--color-surface);
  align-items: flex-end;
}
.composer textarea {
  flex: 1;
  resize: none;
  min-height: 2.75rem;
  max-height: 8rem;
  overflow-y: auto;
  line-height: 1.4;
}

.pw-box {
  max-width: 420px;
  margin: 2rem 0 0;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-brand);
}
.pw-box summary {
  cursor: pointer;
  padding: 0.7rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  list-style: none;
}
.pw-box summary::-webkit-details-marker { display: none; }
.pw-box[open] summary { border-bottom: 1px solid var(--color-border); color: var(--color-text); }
.pw-box .rowform { margin: 0.85rem 1rem 1rem; }

ul { padding-left: 1.1rem; }
li { margin: 0.2rem 0; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(var(--sidebar-w, 280px), 86vw) !important;
    max-width: 320px;
    transform: translateX(-105%);
    transition: transform 0.25s var(--ease);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 40;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-elevated); }
  .sidebar-resizer { display: none; }
  .sidebar-toggle {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
  }
  .sidebar-nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0.65rem 0.75rem;
    font-size: 0.95rem;
  }
  .sidebar-foot .theme-btn {
    min-height: 44px;
  }
  .topbar {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
    padding-top: max(0.35rem, env(safe-area-inset-top));
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .shell-inner {
    padding: 1rem 1rem 2rem;
    max-width: 100%;
  }
  .shell-content.chat-main .shell-inner { padding: 0; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .wrap { max-width: 100%; }
  .toolbar button,
  .toolbar .btn,
  button.btn {
    min-height: 44px;
  }
  .login .brand-mark { font-size: 1.7rem; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-side { display: none; }
}

@media (max-width: 390px) {
  .grid4 { grid-template-columns: 1fr; }
  .login { padding: 1.5rem 1.15rem; }
  .topbar-pill { font-size: 0.65rem; }
}

/* Desktop collapsed sidebar — giữ behavior cũ ≥769 */
@media (min-width: 769px) {
  html.sidebar-collapsed .sidebar,
  .shell.sidebar-collapsed .sidebar {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border-right: none;
    opacity: 0;
    pointer-events: none;
  }
}
