:root {
  --bg: #f6f6fa;
  --surface: #fff;
  --ink: #192036;
  --muted: #5a6479;
  --line: #dfe2ed;
  --accent: #543ac7;
  --accent-strong: #452db3;
  --accent-soft: #eeebfb;
  --positive: #146448;
  --positive-soft: #e8f6ef;
  --warning: #8e4a16;
  --warning-soft: #fff2e2;
  --danger: #9d2337;
  --radius: 16px;
  font-family: "Avenir Next", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
a { color: var(--accent-strong); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid #9c8bec; outline-offset: 3px; }
button, input, select, textarea { border-radius: 9px; }
button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: .65rem .88rem; font-weight: 650; }
button:hover { background: var(--bg); }
button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
button.primary:hover { background: var(--accent-strong); }
button.quiet { color: var(--accent-strong); border-color: transparent; background: transparent; }
button.danger { color: var(--danger); }
button.active { color: var(--accent-strong); background: var(--accent-soft); border-color: #d8cff9; }
input, select, textarea { width: 100%; border: 1px solid #cdd3e1; padding: .62rem .72rem; background: var(--surface); color: var(--ink); }
textarea { min-height: 76px; resize: vertical; }
input[type=checkbox] { width: auto; margin-right: .35rem; }
p { margin: .4rem 0 .7rem; line-height: 1.54; }
h1, h2, h3 { line-height: 1.14; margin: 0 0 .5rem; }
h1 { letter-spacing: -.04em; font-size: clamp(1.85rem, 4vw, 2.55rem); }
h2 { letter-spacing: -.024em; font-size: 1.25rem; }
h3 { font-size: 1rem; }
small, .muted { color: var(--muted); }
strong { font-weight: 700; }
.skip { position: absolute; left: -500px; top: 1rem; z-index: 5; }
.skip:focus { left: 1rem; background: var(--surface); padding: .8rem; }
.shell { display: grid; min-height: 100vh; grid-template-columns: 220px minmax(0,1fr); }
.sidebar { display: flex; flex-direction: column; gap: 1.35rem; padding: 1.5rem 1.05rem; background: #fcfcfe; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .68rem; font-size: 1.25rem; font-weight: 780; color: var(--ink); letter-spacing: -.04em; }
.brand-mark { display: grid; width: 34px; height: 34px; border-radius: 11px; place-items: center; background: var(--accent); color: #fff; }
.brand-mark::after { content: ""; width: 14px; height: 11px; background: white; border-radius: 6px 6px 2px 6px; transform: rotate(-13deg); }
.sidebar nav { display: grid; gap: .3rem; }
.sidebar nav button { text-align: left; width: 100%; border-color: transparent; background: transparent; color: var(--muted); }
.sidebar nav button.active, .sidebar nav button:hover { background: var(--accent-soft); color: var(--accent-strong); }
.sidebar footer { border-top: 1px solid var(--line); margin-top: auto; padding-top: 1rem; overflow-wrap: anywhere; }
.sidebar footer p { font-size: .84rem; }
.surface { min-width: 0; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--surface); border-bottom: 1px solid var(--line); padding: .9rem clamp(1rem, 3vw, 2.4rem); min-height: 61px; }
main.content { padding: clamp(1rem, 3vw, 2.4rem); max-width: 1430px; margin: 0 auto; }
.heading { margin-bottom: 1.25rem; }
.heading p { margin-bottom: 0; max-width: 68ch; }
.row, .toolbar { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.toolbar { margin: .7rem 0; }
.stack { display: grid; gap: 1rem; }
.metrics, .columns { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(min(175px, 100%), 1fr)); }
.columns.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.panel { min-width: 0; padding: 1.1rem 1.22rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 8px #191e3310; }
.panel.feature { background: #f3efff; border-color: #e0d7fa; }
.panel.feature > p { max-width: 68ch; }
.metric { font-size: 1.85rem; font-weight: 730; letter-spacing: -.045em; margin: .15rem 0 .05rem; }
.pill { display: inline-block; border-radius: 999px; padding: .23rem .55rem; background: #edf0f5; color: #414a63; font-size: .78rem; font-weight: 670; white-space: nowrap; }
.pill.good { background: var(--positive-soft); color: var(--positive); }
.pill.warning { background: var(--warning-soft); color: var(--warning); }
.empty { background: var(--bg); border-radius: 10px; padding: 1.1rem; color: var(--muted); }
.gridform { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .85rem; margin: .8rem 0; }
.field { display: grid; gap: .3rem; font-size: .91rem; align-content: start; }
.field > span { font-weight: 650; }
.form-row { display: grid; grid-template-columns: minmax(130px,1fr) minmax(96px,1fr) minmax(96px,1fr) auto; align-items: end; gap: .5rem; margin: .6rem 0; }
.record { display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .72rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.record:first-of-type { margin-top: .6rem; }
.record p { margin: .1rem 0; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .89rem; }
th { color: var(--muted); font-weight: 650; }
td, th { padding: .72rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td p { margin: 0; }
td { max-width: 38ch; overflow-wrap: anywhere; }
.calendar { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); margin: .65rem 0; gap: .35rem; }
.calendar button { min-width: 0; padding-inline: .2rem; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(265px, 320px); gap: 1rem; align-items: start; }
.editor .panel { min-width: 0; }
.tabbar { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1rem; }
.graph { overflow: auto; height: 480px; position: relative; border: 1px solid var(--line); border-radius: 12px; background-color: #f9f9fc; background-image: radial-gradient(#d9d8e6 1px, transparent 1px); background-size: 16px 16px; }
.graph-space { position: relative; width: var(--graph-width); height: var(--graph-height); }
.graph canvas { position: absolute; top: 0; left: 0; }
.node { position: absolute; left: var(--left); top: var(--top); width: var(--node-width); min-height: 53px; text-align: left; border-left: 4px solid var(--accent); padding: .38rem .6rem; }
.node span { display: block; font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node[data-kind=action] { border-left-color: #487ea1; }
.node[data-kind=end] { border-left-color: #45836a; }
.node[data-kind=input] { border-left-color: #bb7833; }
.node-list { display: grid; gap: .38rem; max-height: 420px; overflow: auto; padding: .15rem; }
.node-list button { text-align: left; }
.chat { display: flex; flex-direction: column; gap: .6rem; max-height: 415px; overflow: auto; padding: .5rem .15rem; }
.bubble { width: fit-content; max-width: min(86%, 65ch); background: var(--accent-soft); border-radius: 11px 11px 11px 2px; padding: .6rem .8rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.customer { align-self: flex-end; background: #eef1f7; border-radius: 11px 11px 2px 11px; }
.bubble.staff { background: var(--positive-soft); }
.bubble small { display: block; margin-top: .35rem; }
.compose { display: flex; gap: .5rem; align-items: end; margin-top: .65rem; }
.compose label { flex: 1; min-width: 0; }
.issue { color: var(--danger); padding-left: 1.3rem; line-height: 1.45; }
.login { display: grid; grid-template-columns: minmax(0, 420px); place-content: center; gap: 1.25rem; min-height: 95vh; padding: 1rem; }
.login .panel { padding: clamp(1rem, 5vw, 2rem); }
.notice { position: fixed; z-index: 10; inset: auto 1rem 1rem auto; max-width: min(440px, calc(100vw - 2rem)); background: #292242; color: #fff; border-radius: 12px; padding: .85rem 1rem; box-shadow: 0 6px 30px #211b4033; }
.notice.error { background: #781f31; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 178px minmax(0,1fr); }
  .editor { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 650px) {
  .shell { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: .8rem 1rem; gap: .6rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: .12rem; }
  .sidebar nav button { width: auto; padding: .45rem .55rem; }
  .sidebar footer { display: none; }
  .masthead { min-height: 48px; }
  .columns.two, .gridform { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .graph { height: 320px; }
  .panel { padding: .84rem .9rem; }
}
