:root {
  color-scheme: light dark;
  --navy-900: #0b1b33; --navy-700: #16305a; --teal-700: #0b6f70; --teal-300: #5fd4cf;
  --bg: #f6f8fb; --card: #fff; --ink: #13233c; --muted: #55647a; --line: #dde3ec;
  --ok: #17693f; --ok-bg: #e3f4ea; --warn: #8a5200; --warn-bg: #fdf0d9; --bad: #a62626; --bad-bg: #fbe6e6; --info-bg: #e2f3f3;
  --shadow: 0 1px 2px rgba(11, 27, 51, .06), 0 4px 14px rgba(11, 27, 51, .05);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1829; --card: #14233a; --ink: #e8eef7; --muted: #a3b2c7; --line: #26384f; --teal-700: #5fd4cf;
    --ok: #7fdca6; --ok-bg: #14382a; --warn: #f3c779; --warn-bg: #3d2e12; --bad: #f59a9a; --bad-bg: #421e22; --info-bg: #12363b; }
  .btn.primary { color: #06202a !important; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 Inter, "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg); display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal-300); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }

.demo { color-scheme: light; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 8px 14px; background: #fff3c9; color: #4a3a00; font-size: 13px; }
.demo select, .demo input, .demo button { padding: 4px 8px; border: 1px solid #cdb45a; border-radius: 6px; background: #fffdf3; color: #332800; max-width: 100%; }
.demo button { cursor: pointer; }
.demo-note { opacity: .85; }

.stage { flex: 1; display: flex; min-height: 0; }
.mail { flex: 1; display: flex; min-width: 0; background: var(--card); color: var(--muted); }
.mail-list { width: 230px; border-right: 1px solid var(--line); padding: 10px; flex: none; }
.mail-item { padding: 10px; border-radius: 8px; display: grid; gap: 2px; }
.mail-item.on { background: var(--bg); }
.mail-item b { color: var(--ink); font-weight: 600; }
.mail-item i, .line { display: block; height: 8px; border-radius: 4px; background: var(--line); margin-top: 4px; }
.mail-read { flex: 1; padding: 26px; min-width: 0; }
.mail-read h2 { color: var(--ink); font-size: 20px; }
.mail-from { margin: 4px 0 22px; }
.line { height: 10px; margin: 12px 0; max-width: 560px; } .line.short { max-width: 320px; }
.mail-hint { margin-top: 34px; font-style: italic; }

.panel { width: 380px; flex: none; display: flex; flex-direction: column; min-height: 0; background: var(--bg); border-left: 1px solid var(--line); position: relative; }
body.wide .mail { display: none; } body.wide .panel { width: 100%; border: 0; }
body.wide .view > * { max-width: 960px; margin-inline: auto; width: 100%; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--navy-900); color: #fff; }
.brand { display: flex; gap: 8px; align-items: center; font-weight: 700; letter-spacing: .16em; } .brand svg { color: var(--teal-300); }
.bell { position: relative; min-width: 44px; min-height: 36px; background: none; border: 1px solid rgba(255, 255, 255, .25); border-radius: 8px; color: #fff; cursor: pointer; }
.bell em { position: absolute; top: -6px; right: -6px; background: var(--teal-300); color: var(--navy-900); font: 700 11px/18px inherit; font-style: normal; min-width: 18px; border-radius: 9px; padding: 0 4px; }
.view { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; outline: none; }
.view h1 { font-size: 19px; } .sub { color: var(--muted); }
.tabs { display: flex; background: var(--card); border-top: 1px solid var(--line); }
.tabs button { flex: 1; min-height: 52px; padding: 6px 2px; background: none; border: 0; border-top: 2px solid transparent; color: var(--muted); cursor: pointer; font-size: 12px; min-width: 0; }
.tabs button[aria-current] { color: var(--teal-700); border-top-color: var(--teal-700); font-weight: 600; }
.tabs em { font-style: normal; background: var(--teal-700); color: var(--card); border-radius: 8px; padding: 0 5px; font-size: 11px; margin-left: 3px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); display: grid; gap: 10px; }
.card h2 { font-size: 14px; }
.hero { background: linear-gradient(140deg, var(--navy-900), var(--navy-700)); color: #fff; border: 0; }
.hero .big { font-size: 40px; font-weight: 700; line-height: 1; } .hero .big small { font-size: 15px; font-weight: 500; color: var(--teal-300); margin-left: 6px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stats div { display: grid; font-size: 11.5px; color: #c4d1e4; } .stats b { font-size: 17px; color: #fff; }
.bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .16); display: flex; overflow: hidden; }
.bar svg { width: 100%; height: 100%; display: block; }
.hero .link { color: var(--teal-300); }
.link { background: none; border: 0; padding: 4px 0; color: var(--teal-700); cursor: pointer; text-decoration: underline; justify-self: start; text-align: left; }
.row { display: flex; gap: 8px; flex-wrap: wrap; } .row > .btn { flex: 1; }
.between { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.btn { min-height: 40px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.btn.danger { color: var(--bad); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: grid; gap: 4px; min-width: 0; } .field > span { font-size: 12.5px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 8px; align-items: center; min-height: 28px; font-size: 13px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--line); }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.bad { background: var(--bad-bg); color: var(--bad); }
.note { padding: 10px 12px; border-radius: 8px; background: var(--info-bg); display: grid; gap: 3px; } .note.bad { background: var(--bad-bg); color: var(--bad); }
.item { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); } .item:first-of-type { border-top: 0; padding-top: 0; }
.empty { color: var(--muted); padding: 6px 0; }
table { border-collapse: collapse; width: 100%; font-size: 13px; } th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; } td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; margin-inline: -4px; }
.cal td, .cal th { text-align: center; padding: 5px 3px; min-width: 24px; } .cal td:first-child, .cal th:first-child { text-align: left; position: sticky; left: 0; background: var(--card); padding-right: 8px; }
.cal .off { background: var(--bg); } .cal .away { background: var(--teal-700); color: var(--card); font-weight: 700; } .cal .hol { background: var(--warn-bg); } .cal .now { text-decoration: underline; color: var(--ink); }
.toast { position: absolute; left: 16px; right: 16px; bottom: 66px; padding: 11px 14px; border-radius: 10px; background: var(--navy-900); color: #fff; border: 1px solid var(--teal-300); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; }
.toast.on { opacity: 1; transform: none; } .toast.bad { border-color: #f59a9a; background: #5a1a1f; }
@media (max-width: 820px) { .mail { display: none; } .panel { width: 100%; border: 0; } #demo-wide { display: none; } }
@media (max-width: 820px) and (min-width: 1px) { .mail-list { display: none; } }
@media (max-width: 1080px) { .mail-list { display: none; } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.topbtns { display: flex; gap: 8px; }
.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 8px; } .weeknav .btn { min-width: 44px; font-size: 18px; line-height: 1; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg button { min-height: 40px; border: 0; background: none; cursor: pointer; } .seg button[aria-pressed="true"] { background: var(--teal-700); color: var(--card); font-weight: 600; }
.shift { display: inline-grid; place-items: center; min-width: 28px; height: 26px; padding: 0 4px; border-radius: 6px; font-weight: 700; font-size: 13px; border: 1px solid transparent; }
.s-M { background: #d7efff; color: #0b4468; } .s-A { background: #dcf3e4; color: #14532f; } .s-L { background: #ffe7c7; color: #6f3d00; } .s-N { background: #2b3768; color: #fff; }
.s-off { background: var(--bg); color: var(--muted); } .s-away { background: var(--line); color: var(--muted); font-size: 11px; }
.dayrow { display: grid; grid-template-columns: 72px 34px 1fr auto; gap: 8px; align-items: center; min-height: 36px; } .dayrow.today .dn { font-weight: 700; color: var(--teal-700); } .dl { min-width: 0; }
.plan th, .plan td { text-align: center; padding: 4px 3px; } .plan td:first-child, .plan th:first-child { text-align: left; position: sticky; left: 0; background: var(--card); padding-right: 8px; z-index: 1; }
.plan select.shift { appearance: none; -webkit-appearance: none; width: 36px; height: 36px; text-align: center; text-align-last: center; cursor: pointer; color-scheme: light; }
.plan select.s-off { color-scheme: inherit; border-color: var(--line); }
.plan select:disabled { opacity: .55; cursor: default; }
.plan select.changed { border: 2px dashed var(--teal-700); } .plan select.warn { box-shadow: 0 0 0 2px #e0a030; } .plan select.block { box-shadow: 0 0 0 2px #d24545; }
.issue { padding: 8px 10px; border-radius: 8px; font-size: 13px; background: var(--warn-bg); color: var(--warn); } .issue.block { background: var(--bad-bg); color: var(--bad); }
.view > * { flex-shrink: 0; }
.plan th, .plan td { padding: 4px 2px; } .plan select.shift { width: 29px; min-width: 0; padding: 0; } .plan td:first-child, .plan th:first-child { padding-right: 5px; max-width: 62px; overflow: hidden; text-overflow: ellipsis; }
body.wide .plan select.shift { width: 44px; } body.wide .plan td:first-child { max-width: none; }
@media (max-width: 400px) { .plan th, .plan td { padding: 4px 1px; } .plan select.shift { width: 27px; } }

/* ---------- Narrow panel (Outlook side pane, phones) ---------- */
.demo-extra { display: contents; }
#demo-more { display: none; }
.between { flex-wrap: wrap; } .between > :first-child { flex: 1 1 190px; min-width: 0; }
.tabs button { position: relative; }
.tabs em { position: absolute; top: 5px; right: 4px; margin: 0; min-width: 16px; line-height: 16px; padding: 0 4px; }
@media (max-width: 520px) {
  .demo { flex-wrap: nowrap; gap: 6px; padding: 6px 10px; }
  .demo strong { font-size: 11px; letter-spacing: .04em; }
  .demo-label { display: none; }
  .demo-who { flex: 1; min-width: 0; display: flex; } .demo-who select { width: 100%; min-height: 32px; }
  #demo-more { display: block; min-width: 36px; min-height: 32px; font-weight: 700; }
  .demo-extra { display: none; }
  body.demo-open .demo { flex-wrap: wrap; }
  body.demo-open .demo-extra { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; width: 100%; }
  .top { padding: 8px 12px; } .bell { min-height: 32px; min-width: 40px; }
  .view { padding: 12px; gap: 12px; } .card { padding: 12px; }
  .hero .big { font-size: 34px; }
  .tabs button { font-size: 11.5px; min-height: 48px; }
}
@media (max-width: 360px) {
  .stats { grid-template-columns: repeat(2, 1fr); row-gap: 8px; }
  .two { grid-template-columns: 1fr; }
  .tabs button { font-size: 10.5px; }
}

/* ---------- Polish pass 1: tab icons, people, approvals ---------- */
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; line-height: 1.1; }
.tabs button svg { flex: none; }
.tabs button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs em { top: 4px; left: calc(50% + 6px); right: auto; }
.who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.who > div { min-width: 0; }
.av { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--info-bg); color: var(--teal-700); font-weight: 700; font-size: 12.5px; letter-spacing: .02em; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.facts b { color: var(--ink); font-weight: 600; }
.quote { padding: 8px 10px; border-left: 3px solid var(--teal-300); background: var(--bg); border-radius: 0 6px 6px 0; font-size: 13px; }
.dl .chip { margin-left: 4px; font-size: 11px; padding: 1px 7px; }

/* Inside Outlook: Outlook already shows the add-in name, so our bar becomes a slim strip. */
body.addin .top { padding: 4px 10px; }
body.addin .brand span { font-size: 12px; letter-spacing: .14em; }
body.addin .brand svg { width: 16px; height: 16px; }
body.addin .bell { min-height: 30px; min-width: 36px; }

/* ---------- Polish pass 2: type scale, empty states, leave form ---------- */
.view h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.card h2 { font-size: 15px; font-weight: 650; }
.sub { font-size: 13px; }
.card { gap: 12px; }
.item { padding: 12px 0; gap: 8px; }
.empty { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--muted); }
.empty svg { color: var(--teal-700); opacity: .75; flex: none; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { min-height: 36px; padding: 6px 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 500; }
.pill[aria-pressed="true"] { background: var(--teal-700); border-color: var(--teal-700); color: var(--card); font-weight: 600; }
.preview { display: grid; gap: 4px; padding: 12px 14px; border-radius: 10px; background: var(--info-bg); font-size: 13px; }
.preview.bad { background: var(--bad-bg); }
.pv-main { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.pv-num { font-size: 26px; line-height: 1; }
.pv-bal b { font-size: 15px; }
.pv-problem { color: var(--bad); font-weight: 600; }

/* ---------- Accountant data ---------- */
.card h3 { font-size: 13.5px; font-weight: 650; margin: 4px 0 0; }
.notes { display: grid; gap: 8px; padding-top: 4px; border-top: 1px solid var(--line); }
.pill-select { min-height: 36px; padding: 6px 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); max-width: 100%; }
.pill-select.on { background: var(--teal-700); border-color: var(--teal-700); color: var(--card); font-weight: 600; }
td .chip { font-size: 10.5px; padding: 0 6px; margin-left: 2px; }
.closebox { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.closebox > div { flex: 1 1 200px; min-width: 0; }
.closebox.ok { background: var(--ok-bg); border-color: transparent; } .closebox.warn { background: var(--warn-bg); border-color: transparent; }
