:root {
  --brand: #0f6cbd;
  --brand-hover: #115ea3;
  --brand-soft: #ebf3fc;
  --bg: #f0f0f0;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --border: #e0e0e0;
  --border-strong: #d1d1d1;
  --text: #242424;
  --text-2: #616161;
  --text-3: #8a8a8a;
  --good: #0e7a0d;
  --warn: #bc4b09;
  --bad: #c50f1f;
  --spark: #8764b8;

  /* local-time bands */
  --c-work: #e7f4e4;
  --c-edge: #fdf3d8;
  --c-evening: #fde2c2;
  --c-weekend: #e6e1ef;
  --c-late: #f9c8b8;
  --c-sleep: #4a4470;
  --t-work: #0e7a0d;
  --t-edge: #8a6100;
  --t-evening: #bc4b09;
  --t-weekend: #5c2e91;
  --t-late: #c50f1f;
  --t-sleep: #4a4470;

  --radius: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .06);
  font-family: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); font-size: 14px; line-height: 1.4; min-height: 100vh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; }
b { font-weight: 600; }
.muted { color: var(--text-2); font-weight: 400; }

/* ---------- chrome ---------- */
.concept-banner {
  background: #fff4ce; color: #5c4400; font-size: 12px; padding: 5px 16px; text-align: center;
  border-bottom: 1px solid #f2dfa0;
}
.appbar {
  height: 48px; background: var(--brand); color: #fff; display: flex; align-items: center; gap: 10px; padding: 0 12px;
}
.appname { font-weight: 600; font-size: 16px; margin-right: 24px; }
.icon-btn {
  border: 0; background: transparent; border-radius: 4px; width: 32px; height: 32px; display: inline-grid; place-items: center;
  cursor: pointer; color: inherit;
}
.icon-btn:hover:not([disabled]) { background: rgba(0, 0, 0, .06); }
.appbar .icon-btn:hover { background: rgba(255, 255, 255, .15); }
.icon-btn[disabled] { opacity: .35; cursor: default; }
.search {
  flex: 0 1 460px; height: 32px; background: rgba(255, 255, 255, .92); color: var(--text-2); border-radius: 4px;
  display: flex; align-items: center; gap: 8px; padding: 0 10px; margin: 0 auto;
}
.appbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.ribbon {
  background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; padding: 8px 16px; gap: 12px; flex-wrap: wrap;
}
.ribbon-left, .ribbon-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ribbon-meta { color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 0 6px; }
.divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.btn {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 4px; padding: 5px 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; min-height: 32px;
}
.btn:hover { background: #f5f5f5; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #f0f0f0; }
.btn.wide { width: 100%; justify-content: center; margin-top: 8px; }
.tabs { display: flex; gap: 2px; }
.tab { border: 0; background: transparent; padding: 6px 10px; cursor: pointer; color: var(--text-2); border-radius: 4px; position: relative; }
.tab.active { color: var(--text); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 2px; background: var(--brand); }
.tab[disabled] { cursor: default; }

.seg { display: inline-flex; background: #f0f0f0; border-radius: 6px; padding: 3px; }
.seg-btn { border: 0; background: transparent; padding: 5px 12px; border-radius: 4px; cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 13px; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.spark { color: var(--spark); }

/* ---------- layout ---------- */
.layout {
  flex: 1; display: grid; grid-template-columns: 280px minmax(0, 1fr) 360px; gap: 12px; padding: 12px; align-items: start;
}
.mode-classic .layout { grid-template-columns: 280px minmax(0, 1fr) 300px; }
.panel { background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); padding: 16px; min-width: 0; }

/* ---------- details ---------- */
.field { margin-bottom: 14px; }
.field label, .field > label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; font-weight: 600; }
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input {
  width: 100%; height: 32px; border: 1px solid var(--border-strong); border-bottom-color: #8a8a8a; border-radius: 4px; padding: 0 8px;
  font: inherit; background: var(--surface); color: var(--text);
}
.input:focus { outline: none; border-bottom: 2px solid var(--brand); }
.input.static { display: flex; align-items: center; background: var(--surface-2); color: var(--text); font-size: 13px; height: auto; min-height: 32px; padding: 5px 8px; }
.input.inline { width: auto; display: inline-block; height: 28px; margin: 0 4px; }
.title-input { font-size: 16px; font-weight: 600; height: 36px; }
.chips { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.chip { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.chip-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chip-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-local { font-size: 12px; color: var(--text-2); }
.chip-tag { font-size: 11px; color: var(--text-2); background: #f0f0f0; padding: 1px 6px; border-radius: 10px; }
.chip-x { border: 0; background: transparent; cursor: pointer; color: var(--text-3); width: 24px; height: 24px; border-radius: 4px; }
.chip-x:hover { background: #ececec; color: var(--text); }
.avatar {
  --c: #0f6cbd; width: 32px; height: 32px; border-radius: 50%; background: var(--c); color: #fff; display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 600; flex: none;
}
.avatar.small { width: 28px; height: 28px; font-size: 11px; }
.appbar .avatar { border: 2px solid rgba(255, 255, 255, .7); }

.fs-card {
  border: 1px solid #d9cdee; background: linear-gradient(180deg, #f7f3fd, #fff 70%); border-radius: 8px; padding: 12px; margin: 18px 0 14px;
}
.mode-classic .fs-card { display: none; }
.fs-card-head { display: flex; align-items: center; gap: 6px; font-weight: 700; margin-bottom: 8px; }
.new-pill { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; background: var(--spark); color: #fff; padding: 1px 6px; border-radius: 8px; }
.switch-row { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; cursor: pointer; }
.switch-text { display: flex; flex-direction: column; }
.switch-text small { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.switch {
  appearance: none; width: 40px; height: 20px; border-radius: 10px; border: 1px solid #616161; position: relative; cursor: pointer; flex: none; margin-top: 2px;
  background: #fff; transition: background .15s;
}
.switch::after { content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; background: #616161; top: 3px; left: 4px; transition: transform .15s, background .15s; }
.switch:checked { background: var(--brand); border-color: var(--brand); }
.switch:checked::after { background: #fff; transform: translateX(19px); }
.sub-opts { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.sub-opts.disabled { opacity: .45; pointer-events: none; }
.opt { display: flex; align-items: center; color: var(--text); }
.opt.check { align-items: flex-start; gap: 6px; }
.opt.check input { margin-top: 3px; accent-color: var(--brand); }
.scenario { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); }

/* ---------- scheduling grid ---------- */
.g-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.g-title { display: flex; flex-direction: column; }
.g-title b { font-size: 16px; }
.g-title span { color: var(--text-2); font-size: 13px; }
.week-nav { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); }
.week-nav .icon-btn { font-size: 20px; line-height: 1; }
.mode-classic .week-nav { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .08); flex: none; }
.sw.work { background: #fff; }
.sw.off { background: repeating-linear-gradient(135deg, #ececec 0 3px, #f7f7f7 3px 6px); }
.sw.busy-sw { background: #4f6bed; }
.sw.fixed { background: #c8c8c8; }
.sw.rot { background: var(--brand); }
.sw.ledger { background: repeating-linear-gradient(135deg, #b4a7d6 0 3px, #e3dcf3 3px 6px); }

.g-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; }
.grid { min-width: 700px; }
.g-row { display: grid; grid-template-columns: 168px minmax(420px, 1fr) 124px; border-bottom: 1px solid var(--border); align-items: stretch; }
.mode-classic .g-row { grid-template-columns: 168px minmax(420px, 1fr); }
.g-row:last-child { border-bottom: 0; }
.g-name { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-right: 1px solid var(--border); min-width: 0; }
.g-name span { display: flex; flex-direction: column; min-width: 0; }
.g-name b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-name small { color: var(--text-2); font-size: 12px; }
.g-track { position: relative; display: grid; grid-template-columns: repeat(48, 1fr); min-height: 52px; cursor: pointer; }
.g-track.hours { min-height: 28px; display: block; cursor: default; }
.g-track.hours span { position: absolute; top: 7px; font-size: 11px; color: var(--text-2); transform: translateX(3px); white-space: nowrap; }
.g-hours { background: var(--surface-2); }
.g-local { display: flex; flex-direction: column; justify-content: center; padding: 6px 10px; border-left: 1px solid var(--border); font-size: 13px; gap: 2px; }
.g-local b { font-size: 15px; }
.g-local em { font-style: normal; font-size: 11px; color: var(--text-2); }
.g-local.head { font-size: 11px; color: var(--text-2); font-weight: 600; }
.cell { position: relative; border-left: 1px solid transparent; }
.cell.hour { border-left-color: rgba(0, 0, 0, .06); }
.cell.work { background: #fff; }
.cell.off { background: repeating-linear-gradient(135deg, #ececec 0 3px, #f7f7f7 3px 6px); }
.cell .busy { position: absolute; left: 0; right: 0; top: 14px; bottom: 14px; background: #4f6bed; opacity: .9; }
.mode-fairshift .cell .busy { top: 18px; bottom: 18px; opacity: .75; }

.cat-work { background: var(--c-work); }
.cat-edge { background: var(--c-edge); }
.cat-evening { background: var(--c-evening); }
.cat-weekend { background: repeating-linear-gradient(135deg, #ddd5ec 0 4px, #ece7f5 4px 8px); }
.cat-late { background: var(--c-late); }
.cat-sleep { background: var(--c-sleep); color: #fff; }
.cell.cat-sleep { background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .25) 0 1px, transparent 1.5px) 0 0 / 9px 9px, var(--c-sleep); }
.cat-text-work { color: var(--t-work); }
.cat-text-edge { color: var(--t-edge); }
.cat-text-evening { color: var(--t-evening); }
.cat-text-weekend { color: var(--t-weekend); }
.cat-text-late { color: var(--t-late); }
.cat-text-sleep { color: var(--t-sleep); }

.band {
  position: absolute; top: 3px; bottom: 3px; border: 2px solid var(--bc, var(--brand)); border-radius: 4px; pointer-events: none;
  background: color-mix(in srgb, var(--bc, var(--brand)) 14%, transparent); box-shadow: 0 0 0 1px rgba(255, 255, 255, .8) inset; z-index: 2;
}
.band.ghost { border-style: dashed; background: transparent; opacity: .7; box-shadow: none; }
.pill { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; align-self: flex-start; color: var(--text); }
.pill.cat-sleep { color: #fff; }
.g-foot { margin-top: 10px; font-size: 13px; color: var(--text-2); min-height: 22px; }
.rot-key { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text); }
.slot-tag {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; background: var(--bc); color: #fff; font-size: 11px;
  font-weight: 700; font-style: normal; margin-right: 4px;
}

/* ---------- insights ---------- */
.ins-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.ins-head .spark { font-size: 22px; }
.ins-head div { display: flex; flex-direction: column; }
.ins-head b { font-size: 16px; }
.ins-head small { color: var(--text-2); }
.score-row { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.score { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.score svg text { font-size: 20px; font-weight: 700; fill: currentColor; }
.ring-bg { fill: none; stroke: #e6e6e6; stroke-width: 7; }
.ring-fg { fill: none; stroke: currentColor; stroke-width: 7; stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.score.good { color: var(--good); }
.score.warn { color: var(--warn); }
.score.bad { color: var(--bad); }
.score-label { display: flex; flex-direction: column; color: var(--text); min-width: 0; }
.score-label small { color: var(--text-2); font-size: 12px; }
.score-arrow { color: var(--text-3); font-size: 18px; }
.cta {
  flex: 1; border: 1px dashed var(--spark); background: #f7f3fd; border-radius: 8px; padding: 10px; cursor: pointer; text-align: left;
  display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: center;
}
.cta:hover { background: #efe7fb; }
.cta small { grid-column: 2; color: var(--text-2); font-size: 12px; }
.headline { margin: 12px 0 0; font-size: 13.5px; line-height: 1.5; }
.good-text { color: #0b5a0a; background: #f1faf1; padding: 8px 10px; border-radius: 6px; }
.insights h4 { margin: 18px 0 6px; font-size: 13px; }
.bar-legend { display: flex; gap: 12px; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.bar-legend span { display: inline-flex; gap: 5px; align-items: center; }
.loads { display: flex; flex-direction: column; gap: 10px; }
.load { display: flex; gap: 8px; align-items: flex-start; }
.load-main { flex: 1; min-width: 0; }
.load-name { display: flex; align-items: baseline; gap: 6px; font-size: 13px; }
.load-name small { color: var(--text-2); }
.load-name em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--text-2); }
.bar { position: relative; height: 12px; background: #f2f2f2; border-radius: 3px; margin-top: 4px; display: flex; }
.bar i { display: block; height: 100%; transition: width .45s ease; }
.bar-ledger { background: repeating-linear-gradient(135deg, #b4a7d6 0 3px, #e3dcf3 3px 6px); border-radius: 3px 0 0 3px; }
.bar.fixed .bar-fill { background: #c8c8c8; }
.bar.rot .bar-fill { background: var(--brand); }
.bar span { position: absolute; right: 4px; top: -1px; font-size: 10.5px; font-weight: 600; color: var(--text); }
.load-meta { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.series { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.occ {
  display: grid; grid-template-columns: 74px 92px 1fr; align-items: center; gap: 6px; width: 100%; border: 0; border-bottom: 1px solid var(--border);
  background: var(--surface); padding: 6px 8px; cursor: pointer; text-align: left; font-size: 12.5px;
}
.occ:hover { background: #f5f5f5; }
.occ.active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.occ-date { color: var(--text-2); }
.occ-time { font-weight: 600; display: inline-flex; align-items: center; }
.occ-people { display: flex; flex-wrap: wrap; gap: 3px; }
.mini { font-size: 10.5px; padding: 1px 5px; border-radius: 8px; white-space: nowrap; font-weight: 600; }
.mini.cat-sleep { color: #fff; }
.dst-note { font-size: 11.5px; background: #fff8e1; color: #6b4e00; padding: 5px 8px; border-bottom: 1px solid var(--border); }
.how { margin-top: 14px; font-size: 12.5px; color: var(--text-2); }
.how summary { cursor: pointer; font-weight: 600; color: var(--text); }
.how table { border-collapse: collapse; margin: 6px 0; }
.how td { padding: 2px 12px 2px 0; }
.how td .sw { margin-right: 6px; vertical-align: -2px; }

.today-card { padding: 4px; }
.today-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); font-weight: 700; }
.today-card h3 { margin: 6px 0 8px; font-size: 18px; }
.today-card p { margin: 0 0 10px; color: var(--text); font-size: 13.5px; line-height: 1.55; }
.today-card ul { margin: 0 0 8px; padding-left: 18px; color: var(--text-2); font-size: 13px; }

/* ---------- modal + tour ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-backdrop[hidden], .tour[hidden] { display: none; }
.modal { background: var(--surface); border-radius: 8px; width: min(680px, 100%); box-shadow: 0 12px 40px rgba(0, 0, 0, .25); max-height: 90vh; display: flex; flex-direction: column; }
.modal-head, .modal-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 0 18px 8px; overflow: auto; }
.modal-foot { border-top: 1px solid var(--border); font-size: 12.5px; }
.invite { display: grid; grid-template-columns: 80px 1fr; gap: 6px 10px; margin: 0 0 12px; font-size: 13.5px; }
.invite dt { color: var(--text-2); }
.invite dd { margin: 0; font-weight: 600; }
.invite-note { display: flex; gap: 10px; background: #f7f3fd; border: 1px solid #d9cdee; border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.invite-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.invite-table th, .invite-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.invite-table th { color: var(--text-2); font-weight: 600; }
.invite-table td { font-weight: 600; }

.tour { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; width: min(560px, calc(100% - 32px)); }
.tour-card { background: #1b1a2e; color: #fff; border-radius: 10px; padding: 16px 18px; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
.tour-step { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #c7b8ef; font-weight: 700; }
.tour-text { font-size: 15px; line-height: 1.5; margin: 6px 0 12px; }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tour-actions .btn.ghost { color: #fff; }
.tour-actions .btn.ghost:hover { background: rgba(255, 255, 255, .1); }
.tour-focus { position: relative; z-index: 40; outline: 3px solid #8764b8; outline-offset: 3px; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(20, 18, 40, .28); }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .layout, .mode-classic .layout { grid-template-columns: 280px minmax(0, 1fr); }
  .insights { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .layout, .mode-classic .layout { grid-template-columns: minmax(0, 1fr); padding: 8px 16px; }
  .search, .ribbon-meta, .divider { display: none; }
  .ribbon { padding: 8px 16px; }
}

/* ---------- burden trend ---------- */
.trend { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.trend-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-bottom: 4px; }
.trend-head .muted { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.ln { display: inline-block; width: 18px; border-top: 2px solid var(--text-2); }
.ln.dashed { border-top-style: dashed; }
.trend svg { width: 100%; height: auto; display: block; }
.tr-grid { stroke: #ececec; }
.tr-dst { stroke: #d9a400; stroke-dasharray: 2 3; }
.tr-axis { font-size: 10.5px; fill: var(--text-2); }
.tr-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.tr-line.faded { stroke-width: 1.8; opacity: .55; }
.tr-label { font-size: 12px; font-weight: 700; }

/* ---------- preferences + alternatives ---------- */
.chip-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chrono {
  border: 1px dashed var(--border-strong); background: transparent; border-radius: 10px; font-size: 11px; padding: 0 7px; line-height: 18px;
  color: var(--text-2); cursor: pointer;
}
.chrono:hover { border-color: var(--spark); color: var(--spark); }
.chrono.on { border-style: solid; border-color: #d9cdee; background: #f7f3fd; color: #5c2e91; font-weight: 600; }
.alt { margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.link { border: 0; background: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .bar i, .ring-fg, .switch, .switch::after { transition: none !important; } }
