:root {
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  color: #18343c;
  background: #f4f7f5;
  font-synthesis: none;
  --ink: #18343c;
  --muted: #546c73;
  --deep: #12333b;
  --accent: #167b73;
  --accent-dark: #0e655e;
  --line: #d9e3df;
  --surface: #fff;
  --wash: #f4f7f5;
  --danger: #9b3d38;
  --success: #176b4d;
  --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 3px solid #e6a855; outline-offset: 2px; }
::selection { background: #bee5dd; color: #12333b; }
a { color: var(--accent-dark); text-underline-offset: 3px; }
.screen-reader { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(330px, 1fr) minmax(360px, 1fr); }
.login-story { background: var(--deep); color: #eaf4ef; padding: clamp(32px, 7vw, 100px); display: flex; flex-direction: column; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 750; letter-spacing: -.025em; font-size: 1.04rem; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; color: var(--deep); background: #bce4d4; border-radius: 9px; font-weight: 800; }
.login-story h1 { max-width: 620px; font-size: clamp(2.7rem, 5vw, 4.7rem); line-height: 1.06; letter-spacing: -.035em; margin: 0 0 26px; font-weight: 680; }
.login-story p { font-size: 1.08rem; line-height: 1.6; max-width: 55ch; color: #bdd3cf; }
.story-foot { font-size: .8rem; color: #9fbdb8; }
.login-area { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(100%, 420px); }
.login-card h2 { font-size: 1.8rem; letter-spacing: -.025em; margin: 0 0 8px; }
.login-card p { color: var(--muted); line-height: 1.55; margin: 0 0 28px; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-weight: 650; font-size: .9rem; }
.field input { border: 1px solid #b8cbc5; background: white; border-radius: 9px; padding: 13px 14px; color: var(--ink); width: 100%; }
.field input::placeholder { color: #6b8587; }
.primary, .secondary, .quiet { border-radius: 9px; min-height: 42px; padding: 10px 16px; font-weight: 700; border: 1px solid transparent; transition: background .16s ease, box-shadow .16s ease, color .16s ease; }
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.secondary { background: #e4f1ec; color: #145b57; }
.secondary:hover { background: #d4e9e1; }
.quiet { background: transparent; color: var(--muted); border-color: var(--line); }
.quiet:hover { background: #e9f0ed; color: var(--ink); }
.full { width: 100%; }
.error { color: var(--danger); background: #f9ebe8; border-radius: 9px; padding: 12px 14px; margin: 12px 0; font-size: .9rem; }
.help { color: var(--muted); font-size: .84rem; line-height: 1.5; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.sidebar { background: var(--deep); color: #d8e8e4; display: flex; flex-direction: column; padding: 26px 14px; gap: 34px; }
.sidebar .brand { padding: 0 12px; color: white; }
.nav { display: grid; gap: 4px; }
.nav button { text-align: left; border: 0; background: transparent; color: #c8dfd9; border-radius: 9px; padding: 12px 14px; font-weight: 580; }
.nav button:hover { background: #234c51; color: white; }
.nav button.active { color: #102f37; background: #bfe6d7; font-weight: 750; }
.nav-divider { height: 1px; background: #30565b; margin: 12px 10px; }
.sidebar-bottom { margin-top: auto; padding: 0 12px; color: #9ebfba; font-size: .78rem; line-height: 1.45; }
.workspace { min-width: 0; }
.topbar { height: 76px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(20px, 3.3vw, 48px); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.org-tag { display: inline-flex; align-items: center; gap: 8px; background: #eef5f1; border: 1px solid #d9e6df; color: #235e57; border-radius: 999px; padding: 8px 12px; font-size: .83rem; font-weight: 700; white-space: nowrap; }
.org-tag::before { content: ""; width: 7px; height: 7px; background: #2b9a7d; border-radius: 50%; }
.top-user { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.content { max-width: 1400px; margin: 0 auto; padding: 34px clamp(20px, 3.3vw, 48px) 70px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-head h1 { margin: 0; font-size: 2rem; letter-spacing: -.028em; line-height: 1.2; }
.page-head p { color: var(--muted); margin: 9px 0 0; line-height: 1.5; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 36px 0 14px; }
.section-head h2 { font-size: 1.1rem; margin: 0; letter-spacing: -.015em; }
.section-head span { color: var(--muted); font-size: .85rem; }
.metrics { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.metric { padding: 20px 18px; min-height: 108px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric strong { display: block; font-size: 1.9rem; line-height: 1.1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.metric span { display: block; color: var(--muted); margin-top: 10px; font-size: .82rem; line-height: 1.3; }
.metric.alert strong { color: var(--danger); }
.overview-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 24px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-pad { padding: 20px; }
.panel-title { font-size: .94rem; font-weight: 750; margin: 0 0 16px; }
.activity { display: grid; }
.activity-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 15px 0; border-top: 1px solid var(--line); }
.activity-item:first-child { border-top: 0; padding-top: 0; }
.activity-item strong { display: block; font-size: .91rem; }
.activity-item p { margin: 5px 0 0; font-size: .83rem; color: var(--muted); line-height: 1.45; }
.activity-item time { color: var(--muted); font-size: .77rem; white-space: nowrap; }
.data-badge { display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: .68rem; font-weight: 800; letter-spacing: .03em; background: #f7e8c6; color: #725314; white-space: nowrap; margin-left: 6px; }
.live-badge { background: #d7eee2; color: #175b3e; }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: .73rem; font-weight: 750; background: #e3f0ea; color: #176349; }
.status-pill.off { background: #f2eae6; color: #87564a; }
.status-pill.wait { background: #f6efdc; color: #7a5d1f; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { text-align: left; color: var(--muted); font-size: .74rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; background: #f9fbf9; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td { line-height: 1.45; }
td small { display: block; color: var(--muted); margin-top: 2px; }
.empty { padding: 28px; color: var(--muted); line-height: 1.5; }
.empty strong { color: var(--ink); display: block; margin-bottom: 4px; }
.system-list { display: grid; }
.system-row { display: grid; grid-template-columns: 190px 1fr; gap: 16px; align-items: center; padding: 15px 0; border-top: 1px solid var(--line); }
.system-row:first-child { border-top: 0; }
.system-row strong { font-size: .9rem; }
.system-row span { color: var(--muted); font-size: .86rem; }
.notice { padding: 16px 18px; background: #eaf2ef; color: #315d57; border-radius: 11px; line-height: 1.5; font-size: .86rem; }
.danger-zone { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 24px; }
.danger-zone p { color: var(--muted); font-size: .86rem; line-height: 1.5; }
.conversation-list { display: grid; gap: 10px; }
.conversation-button { display: flex; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: white; text-align: left; color: var(--ink); width: 100%; }
.conversation-button:hover { background: #f6faf7; border-color: #a7cbbd; }
.conversation-button strong { display: block; margin-bottom: 4px; }
.conversation-button small { color: var(--muted); }
.detail-panel { margin-top: 18px; }
.transcript-line { padding: 12px 14px; margin: 10px 0; border-radius: 10px; background: #f1f6f2; max-width: 78%; line-height: 1.48; white-space: pre-wrap; overflow-wrap: anywhere; }
.transcript-line.user { margin-left: auto; background: #e2f1ec; }
.transcript-line small { display: block; color: var(--muted); margin-bottom: 4px; font-size: .7rem; font-weight: 750; text-transform: uppercase; }
.try-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(250px, .75fr); gap: 24px; align-items: start; }
.chat-card { display: flex; flex-direction: column; min-height: 620px; background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chat-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.chat-head strong { display: block; }
.chat-head small { display: block; color: var(--muted); margin-top: 3px; }
.chat-messages { flex: 1; padding: 22px; max-height: 540px; overflow-y: auto; }
.bubble { max-width: 82%; padding: 12px 15px; border-radius: 14px; margin: 0 0 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; background: #eff5f1; }
.bubble.user { margin-left: auto; background: #d9eee5; }
.bubble-label { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .035em; color: var(--muted); margin-bottom: 5px; }
.slot-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 22px 16px; }
.slot-options button { border: 1px solid #a4cbbd; background: #f1f9f5; color: #165b4c; border-radius: 9px; padding: 9px 11px; font-weight: 650; font-size: .8rem; }
.slot-options button:hover { background: #ddf0e6; }
.chat-form { display: flex; gap: 9px; padding: 16px; border-top: 1px solid var(--line); }
.voice-controls { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); background: #f4faf7; }
.voice-controls span { font-size: .78rem; line-height: 1.4; color: var(--muted); }
.scenario-tabs { display: flex; gap: 8px; margin: 20px 0; flex-wrap: wrap; }
.scenario-tabs button.active { background: var(--accent); color: white; }
.impact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.impact-input { display: flex; gap: 6px; }
.impact-input input { min-width: 0; flex: 1; }
.impact-input select { max-width: 145px; border: 1px solid var(--line); border-radius: 8px; padding: 9px; }
.impact-results { margin-top: 20px; }
.chat-form input { flex: 1; min-width: 0; border: 1px solid #b8cbc5; border-radius: 9px; padding: 12px 14px; color: var(--ink); }
.try-aside { display: grid; gap: 16px; }
.try-aside .panel-pad p { color: var(--muted); font-size: .86rem; line-height: 1.55; margin: 0; }
.try-aside ul { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: .86rem; line-height: 1.7; }
.toast { position: fixed; right: 22px; bottom: 22px; background: var(--deep); color: white; padding: 13px 17px; border-radius: 10px; box-shadow: 0 10px 28px rgba(10, 39, 39, .2); z-index: 5; max-width: min(420px, calc(100vw - 44px)); }
.toast.error-toast { background: #8d3732; }

@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .metric:nth-child(3) { border-right: 0; }
  .metric:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .overview-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .impact-grid { grid-template-columns: 1fr; }
  .shell { display: block; }
  .sidebar { position: sticky; top: 0; z-index: 3; padding: 12px 16px; display: block; }
  .sidebar .brand { padding: 0 0 10px; font-size: .9rem; }
  .sidebar-bottom, .nav-divider { display: none; }
  .nav { display: flex; overflow-x: auto; gap: 5px; scrollbar-width: thin; }
  .nav button { white-space: nowrap; padding: 9px 10px; font-size: .78rem; }
  .topbar { height: 60px; }
  .content { padding-top: 24px; }
  .try-layout { grid-template-columns: 1fr; }
  .try-aside { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .login-shell { display: block; }
  .login-story { min-height: 260px; padding: 25px; }
  .login-story h1 { font-size: 2.2rem; margin-top: 34px; }
  .login-story p, .story-foot { display: none; }
  .login-area { padding: 32px 24px; }
  .topbar { padding: 0 18px; }
  .top-user { display: none; }
  .topbar-right .primary { padding: 8px 10px; min-height: 36px; font-size: .78rem; }
  .org-tag { font-size: .73rem; padding: 6px 9px; }
  .content { padding: 22px 16px 56px; }
  .page-head { align-items: start; }
  .page-head h1 { font-size: 1.6rem; }
  .page-head .secondary { font-size: .78rem; padding: 8px 10px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric { padding: 16px; min-height: 94px; }
  .metric:nth-child(3) { border-right: 1px solid var(--line); }
  .metric:nth-child(even) { border-right: 0; }
  .metric:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .try-aside { grid-template-columns: 1fr; }
  .chat-card { min-height: 510px; }
  .chat-messages { max-height: 400px; padding: 16px; }
  .chat-form { padding: 12px; }
  .bubble { max-width: 95%; }
  .system-row { grid-template-columns: 1fr; gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
