:root {
  color-scheme: light;
  font-family: "Fira Sans", "Segoe UI", system-ui, sans-serif;
  --ink: #15283e;
  --muted: #4e6177;
  --line: #ccd7e2;
  --subtle: #edf3f9;
  --paper: #fff;
  --background: #f5f8fc;
  --navy: #18385b;
  --blue: #215aa1;
  --positive: #126748;
  --danger: #9a2835;
  background: var(--background);
  color: var(--ink);
  font-size: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.5; }
h1, h2, h3, p { margin-block: 0; }
h1 { letter-spacing: -.025em; font-size: clamp(1.7rem, 3vw, 2.25rem); line-height: 1.15; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
button, input, textarea, select { font: inherit; }
button, input:not([type=checkbox]), textarea, select { border: 1px solid var(--line); border-radius: .55rem; }
button, summary, select, input[type=checkbox] { cursor: pointer; }
input:not([type=checkbox]), textarea, select { width: 100%; min-width: 0; padding: .55rem .65rem; color: var(--ink); background: var(--paper); }
textarea { display: block; min-height: 4.25rem; resize: vertical; }
button, summary { min-height: 44px; }
button { color: var(--ink); background: var(--paper); padding: .45rem .8rem; font-weight: 600; }
button:hover:not(:disabled) { border-color: var(--blue); background: var(--subtle); }
button:disabled, input:disabled, select:disabled, textarea:disabled { color: var(--muted); background: var(--subtle); }
button:disabled { cursor: default; opacity: .72; }
button.primary { color: #fff; border-color: var(--navy); background: var(--navy); }
button.primary:hover:not(:disabled) { background: var(--blue); border-color: var(--blue); }
button.danger { color: var(--danger); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
input[type=checkbox] { width: 1.15em; height: 1.15em; accent-color: var(--blue); flex: none; }

.site-header { min-height: 4.5rem; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .7rem clamp(1rem, 4vw, 3rem); }
.brand { display: flex; align-items: center; gap: .72rem; font-weight: 700; font-size: 1.3rem; }
.brand > span:last-child { font-weight: 500; font-size: .88rem; color: #d2e1ef; padding-left: .65rem; border-left: 1px solid #7392ae; }
.brand-mark { flex: 0 0 1.7rem; width: 1.7rem; height: 1.7rem; border: 2px solid #adf0dc; border-radius: .5rem; background:
  linear-gradient(145deg, transparent 43%, #adf0dc 44% 56%, transparent 57%) center / 70% 70% no-repeat; transform: rotate(-12deg); }
#session-actions { display: flex; align-items: center; gap: .8rem; overflow-wrap: anywhere; }
#session-actions button { color: #fff; border-color: #7392ae; background: transparent; }
#session-actions button:hover { background: #284d70; }
.skip { position: absolute; z-index: 20; left: 1rem; top: .5rem; transform: translateY(-150%); background: #fff; color: var(--ink); padding: .6rem; }
.skip:focus { transform: translateY(0); }
main { width: min(100%, 100rem); padding: 1.1rem clamp(.8rem, 3vw, 2.5rem) 3rem; margin-inline: auto; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: .8rem; padding: 1.15rem; }
.sign-in { max-width: 27rem; margin: clamp(1.25rem, 8vh, 5rem) auto 1rem; padding: clamp(1rem, 4vw, 2rem); }
.sign-in form { display: grid; gap: .95rem; margin-top: 1.35rem; }
.sign-in > p { margin-top: .8rem; }
.text-button { border-color: transparent; margin-top: .65rem; color: var(--blue); }
.feedback { margin: 0 auto .8rem; max-width: 75rem; padding: .65rem .9rem; background: #edf5ff; border-left: 4px solid var(--blue); border-radius: .3rem; overflow-wrap: anywhere; }
.feedback[data-kind=error], .conflict { color: #771e29; background: #fff0f1; border-color: var(--danger); }
.feedback[data-kind=success] { color: #135a42; background: #e9f7ef; border-color: var(--positive); }
.status-strip { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .85rem; background: #e9f6ef; border: 1px solid #afd7c4; border-radius: .65rem; padding: .6rem .9rem; color: #165941; }
.status-strip[data-state=offline] { background: #ffebee; border-color: #eac1c6; color: #7e2430; }
.status-strip[data-state=never] { background: var(--subtle); border-color: var(--line); color: var(--ink); }
.bot-state::before { content: ""; display: inline-block; width: .55em; height: .55em; margin-right: .55rem; background: currentColor; border-radius: 50%; vertical-align: .09em; }
.status-tag { font-size: .88rem; padding: .18rem .5rem; border: 1px solid currentColor; border-radius: .3rem; }
.status-tag.warning { color: #864a18; background: #fff5e6; }
.control-strip { margin-block: .75rem; display: grid; grid-template-columns: 1.25fr 1fr; gap: 1rem; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--paper); }
.control-strip > details { border-left: 1px solid var(--line); padding-left: 1rem; }
summary { display: list-item; font-weight: 600; padding-block: .65rem; }
.switch-row { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; min-height: 2.75rem; overflow-wrap: anywhere; }
.switch-row button { margin-left: auto; }
.switch-group + .switch-group { border-top: 1px solid var(--line); margin-top: .55rem; padding-top: .6rem; }
.switch-group > h3 { color: var(--muted); }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: .35rem; background: var(--subtle); color: var(--navy); font-size: .8rem; font-weight: 650; width: max-content; max-width: 100%; }
.badge.on, .entry-label { color: #135e43; background: #e7f6ef; }
.badge.off { color: #872f39; background: #fbe9ec; }
.workbar, .page-intro, .actions, .canvas-header, .canvas-tools, .inline-form {
  display: flex; align-items: center; flex-wrap: wrap; gap: .55rem;
}
.workbar { justify-content: space-between; border-block: 1px solid var(--line); margin: 1rem 0; padding: .45rem 0; }
.workbar nav { display: flex; gap: .35rem; }
.workbar nav button { background: transparent; border-color: transparent; }
.workbar nav [aria-current=page] { background: #e6edf6; color: var(--navy); border-color: #bdcee0; }
#draft-state { color: var(--muted); font-size: .9rem; }
.conflict { padding: .75rem 1rem; border-left: 4px solid var(--danger); margin-bottom: 1rem; border-radius: .35rem; }
.conflict p { margin-bottom: .5rem; }
.conflict button + button { margin-left: .5rem; }
.page-intro { justify-content: space-between; align-items: end; margin-bottom: .7rem; }
.page-intro .field { min-width: min(18rem, 100%); }
.field { display: grid; gap: .24rem; font-weight: 550; min-width: 0; }
.field input, .field select, .field textarea { font-weight: 400; }
.check { display: flex; gap: .45rem; align-items: center; width: fit-content; min-height: 44px; }
.hint { font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; }
.notice { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; padding: .65rem .8rem; background: #eaf1f9; border: 1px solid #c6d7e9; border-radius: .6rem; margin-bottom: .75rem; }
.graph-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 23rem); align-items: start; gap: .8rem; }
.canvas-card { min-width: 0; padding: .7rem; }
.canvas-card > .hint { margin: .45rem .3rem 0; }
.canvas-header { justify-content: space-between; margin-bottom: .6rem; }
.inline-form select { width: auto; max-width: 100%; }
.graph-canvas { height: min(69vh, 48rem); min-height: 28rem; border: 1px solid #dbe5ef; border-radius: .6rem; background: radial-gradient(#bccbd9 .9px, transparent 1px) 0 0 / 20px 20px #f7f9fc; touch-action: none; }
.graph-canvas .drawflow-node { width: 204px; min-height: 106px; color: var(--ink); border: 1px solid #91a8be; border-left: 4px solid #537fa7; border-radius: .6rem; background: #fff; padding: .7rem; box-shadow: 0 3px 10px #122d4620; }
.graph-canvas .drawflow-node.type-question { border-left-color: #b87321; }
.graph-canvas .drawflow-node.type-assign { border-left-color: #197754; }
.graph-canvas .drawflow-node.type-stop { border-left-color: #8e4757; }
.graph-canvas .drawflow-node.panel-selected { outline: 3px solid #477cb9; }
.graph-canvas .drawflow-node.selected { background: #fff; }
.graph-canvas .drawflow-node .input, .graph-canvas .drawflow-node .output { width: 13px; height: 13px; border: 2px solid #6686a6; background: #fff; }
.graph-canvas .drawflow-node .input { left: -20px; }
.graph-canvas .drawflow-node .output { right: -17px; }
.graph-canvas .connection .main-path { stroke: #6385a7; stroke-width: 3px; }
.graph-canvas .connection .main-path:hover { stroke: var(--blue); }
.node-kicker { color: #3e5f7d; font-size: .68rem; line-height: 1.2; }
.node-title { display: block; line-height: 1.22; margin-block: .18rem; font-size: .9rem; }
.node-preview { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; color: var(--muted); font-size: .8rem; }
.inspector, .settings-card { display: grid; gap: .7rem; min-width: 0; }
.step-type { font-weight: 650; }
.entry-label { width: fit-content; font-size: .85rem; padding: .2rem .55rem; border-radius: .35rem; }
.port-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .35rem; }
.step-delete { justify-self: start; margin-top: .55rem; }
.settings-layout { display: grid; align-items: start; grid-template-columns: minmax(0, 1.45fr) minmax(17rem, 1fr); gap: .8rem; }
.settings-column { display: grid; align-items: start; gap: .8rem; min-width: 0; }
.settings-column > .page-intro, .settings-column > .notice { margin-bottom: 0; }
.settings-card h3 { margin-top: .35rem; }
.schedule-grid { display: grid; }
.schedule-day { display: grid; grid-template-columns: minmax(7rem, 1fr) 5.5rem minmax(0, 1.6fr); align-items: end; gap: .5rem .7rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.schedule-day > strong, .schedule-day > .check { align-self: center; }
.schedule-hours { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.schedule-hours .field span { font-size: .8rem; }
.override-body { display: grid; gap: .45rem; margin-left: .3rem; padding-left: .7rem; border-left: 2px solid var(--line); }
.night-message { border-bottom: 1px solid var(--line); padding-bottom: .65rem; }
.department-window { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: .6rem; }
.department-window legend { font-weight: 600; padding: 0 .35rem; }
.data-list { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.data-row { display: flex; gap: .55rem; justify-content: space-between; align-items: center; flex-wrap: wrap; min-width: 0; padding: .45rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.data-row .badge { margin-top: .25rem; }
#empty-draft { margin-block: .7rem; }
#empty-draft p { margin: .4rem 0; }
#import-error { color: var(--danger); }
dialog { width: min(30rem, calc(100% - 2rem)); border: 1px solid var(--line); border-radius: .8rem; padding: 1.25rem; color: var(--ink); box-shadow: 0 .7rem 2rem #182d4a30; }
dialog::backdrop { background: #15283e75; }
dialog p { margin: .65rem 0 1rem; }
dialog .actions { justify-content: end; }

@media (max-width: 1020px) {
  .schedule-day { grid-template-columns: 1fr 1fr; }
  .schedule-hours { grid-column: 1 / -1; }
}
@media (max-width: 790px) {
  .graph-layout, .settings-layout, .control-strip { grid-template-columns: 1fr; }
  .control-strip > details { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
  .graph-canvas { height: 52vh; min-height: 22rem; }
}
@media (max-width: 430px) {
  .brand > span:last-child, #session-name { display: none; }
  .canvas-header .inline-form select { width: 100%; }
  .canvas-header { align-items: flex-start; }
  .page-intro .field { width: 100%; }
  .graph-canvas { min-height: 18rem; }
}
