/* TALA. Dark navy by default (the logo's night sky), light on request. Gold = the one main action on a screen.
   Red = warnings only (blank logs, conflicts, delete). Record-type colours are muted and always carry their label. */
:root {
  --bg: #0b1530; --panel: #10224f; --panel2: #162b60; --line: rgba(143,176,217,.28); --text: #f0f4fa; --muted: #9db3d1;
  --gold: #ffc000; --gold-ink: #1a1400; --navy: #002060; --warn: #c00000; --warn-text: #ff9a9a; --ok: #7bd389;
  --c-oo: #4f93bf; --c-to: #3f9a82; --c-leave: #b87aa3; --c-ls: #d9822b; --c-me: #8f86d6; --c-wfh: #8fa3b8; --c-hol: #6b7a90;
  --chip-ink: #07122c; --radius: 10px; --shadow: 0 6px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f0f4fa; --panel: #ffffff; --panel2: #e6edf8; --line: rgba(0,32,96,.18); --text: #0b1530; --muted: #46597a;
  --warn-text: #b00000; --ok: #1b7a31; --shadow: 0 6px 24px rgba(0,32,96,.15); color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, "Segoe UI", Roboto, Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; } h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: .25rem 0 .75rem; } .muted { color: var(--muted); } .small { font-size: .85rem; } .right { margin-left: auto; }
.boot { padding: 2rem; color: var(--muted); }

/* shell */
.top { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--navy); color: #f0f4fa; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.top .brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; letter-spacing: .04em; }
.top .brand img { width: 28px; height: 28px; border-radius: 7px; }
.top select, .top .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #f0f4fa; }
.tabs { display: flex; gap: .25rem; padding: .4rem 1rem 0; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: var(--top-h, 48px); z-index: 19; }
/* the person and month strip under the tabs stays in view while the page scrolls */
.sticky-strip > .cal-head:last-child { margin-bottom: 0; }
.sticky-strip { position: sticky; top: calc(var(--top-h, 48px) + var(--tabs-h, 42px) - 1px); z-index: 18; box-shadow: 0 6px 10px -6px rgba(0,0,0,.5); }
.tab { padding: .55rem .9rem; border: 0; background: none; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--gold); font-weight: 600; }
.tab .dot { display: inline-block; min-width: 1.2em; padding: 0 .35em; margin-left: .35em; border-radius: 99px; background: var(--warn); color: #fff; font-size: .75rem; text-align: center; }
main { padding: 1rem; max-width: 1280px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; } .row.tight { gap: .4rem; } .stack > * + * { margin-top: .6rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; }

/* buttons: one gold main action per screen */
.btn { border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; padding: .5rem .9rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; }
.btn:hover { filter: brightness(1.12); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.main { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 700; }
.btn.danger { border-color: var(--warn); color: var(--warn-text); }
.btn.link { background: none; border: 0; padding: .2rem .4rem; color: var(--muted); text-decoration: underline; }
.btn.sm { padding: .25rem .6rem; font-size: .85rem; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* forms */
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .15rem; }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=time], input[type=number], select, textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; }
textarea { min-height: 4.2rem; resize: vertical; }
.field { margin-bottom: .55rem; } .field.err input, .field.err select, .field.err textarea { border-color: var(--warn); } .field .msg { color: var(--warn-text); font-size: .8rem; }
.radios { display: flex; gap: 1rem; flex-wrap: wrap; } .radios label { display: inline-flex; gap: .35rem; align-items: center; color: var(--text); font-size: .95rem; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; margin: 0 0 .7rem; } legend { color: var(--muted); font-size: .85rem; padding: 0 .3rem; }
details > summary { cursor: pointer; color: var(--muted); margin: .3rem 0; }

/* sign-in */
.center { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.hero { max-width: 420px; text-align: center; } .hero img { width: 96px; height: 96px; border-radius: 22px; margin-bottom: .5rem; }
.hero h1 { font-size: 2rem; letter-spacing: .08em; }

/* progress (setup wizard) */
.steps { display: flex; gap: .4rem; margin: 0 0 1rem; padding: 0; list-style: none; flex-wrap: wrap; }
.steps li { flex: 1; min-width: 90px; padding: .4rem .5rem; border-radius: 8px; background: var(--panel2); color: var(--muted); font-size: .85rem; text-align: center; border: 1px solid transparent; }
.steps li.on { border-color: var(--gold); color: var(--text); font-weight: 600; } .steps li.done { color: var(--ok); }

/* calendar */
.cal-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.people { display: flex; gap: .35rem; flex-wrap: wrap; } .person { border: 1px solid var(--line); background: var(--panel2); border-radius: 99px; padding: .3rem .8rem; cursor: pointer; }
.person[aria-pressed="true"] { background: var(--navy); border-color: var(--gold); color: #fff; font-weight: 600; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal .dow { text-align: center; color: var(--muted); font-size: .8rem; padding: .2rem 0; }
.day { min-height: 92px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .25rem; cursor: pointer; text-align: left; overflow: hidden; display: flex; flex-direction: column; gap: 2px; }
.day:hover { border-color: var(--gold); } .day.off { background: transparent; opacity: .5; } .day.weekend { background: var(--panel2); } .day.today .n { background: var(--gold); color: var(--gold-ink); border-radius: 99px; padding: 0 .4em; }
.day .n { font-size: .8rem; color: var(--muted); align-self: flex-start; }
.chip { display: block; font-size: .72rem; line-height: 1.25; padding: 1px 5px; border-radius: 4px; color: var(--chip-ink); background: var(--c-wfh); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 0; text-align: left; cursor: pointer; width: 100%; }
.chip.OO { background: var(--c-oo); } .chip.TO { background: var(--c-to); } .chip.LEAVE { background: var(--c-leave); } .chip.LS { background: var(--c-ls); } .chip.ME { background: var(--c-me); } .chip.WFH { background: var(--c-wfh); }
.chip.HOL { background: var(--c-hol); color: #fff; }
.chip.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -7px; width: calc(100% + 7px); } .chip.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: -7px; width: calc(100% + 7px); }
.legend { display: flex; gap: .6rem; flex-wrap: wrap; font-size: .8rem; } .legend .chip { width: auto; cursor: default; }

/* team overview */
.ov { overflow-x: auto; } .ov table { border-collapse: collapse; min-width: 100%; font-size: .75rem; }
.ov th, .ov td { border: 1px solid var(--line); padding: 2px; text-align: center; min-width: 26px; } .ov th.name, .ov td.name { text-align: left; position: sticky; left: 0; background: var(--panel); padding: .3rem .5rem; min-width: 150px; }
.ov td.c { font-weight: 700; color: var(--chip-ink); }
/* Saturdays and Sundays: hatched columns, gold day names; a record on a weekend keeps its color and gets a gold frame */
.ov th.w, .ov td.w { background-image: repeating-linear-gradient(135deg, rgba(255, 192, 0, .22) 0 4px, transparent 4px 8px); background-color: var(--panel2); }
.ov th.w { color: var(--gold); font-weight: 700; }
.ov td.w.c { background-image: none; box-shadow: inset 0 0 0 2px var(--gold); }
.ov tr.dow th { font-size: .65rem; font-weight: 400; opacity: .9; } .ov tr.dow th.w { opacity: 1; font-weight: 700; }

/* DTR */
.dtr { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; } @media (max-width: 960px) { .dtr { grid-template-columns: 1fr; } }
.page-wrap { position: relative; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; max-height: 80vh; }
.page-wrap canvas { display: block; } .mk { position: absolute; font: 700 10px/1 "Courier New", monospace; color: #c00000; cursor: grab; padding: 0 1px; white-space: pre; transform-origin: 0 0; border: 1px dashed transparent; user-select: none; touch-action: none; }
.mk:hover, .mk.sel { border-color: #c00000; background: rgba(255,192,0,.25); } .mk.hand { color: #0050c0; }
.alert { border: 1px solid var(--warn); border-radius: 8px; padding: .5rem .7rem; background: rgba(192,0,0,.12); } .alert h3 { color: var(--warn-text); margin-bottom: .3rem; }
.warn-line { padding: .35rem 0; border-bottom: 1px solid var(--line); } .warn-line:last-child { border: 0; }
.ok-line { color: var(--ok); }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.5rem; text-align: center; color: var(--muted); } .drop.over { border-color: var(--gold); color: var(--text); }

/* tables & lists */
table.list { width: 100%; border-collapse: collapse; } table.list th, table.list td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; } table.list th { color: var(--muted); font-weight: 500; font-size: .85rem; }
.pill { display: inline-block; padding: 0 .55em; border-radius: 99px; font-size: .78rem; font-weight: 600; color: var(--chip-ink); background: var(--c-wfh); } .pill.OO { background: var(--c-oo); } .pill.TO { background: var(--c-to); } .pill.LEAVE { background: var(--c-leave); } .pill.LS { background: var(--c-ls); } .pill.ME { background: var(--c-me); }
.status { display: flex; gap: .4rem; flex-wrap: wrap; } .status span { font-size: .8rem; padding: .1rem .5rem; border-radius: 99px; background: var(--panel2); } .status .y { color: var(--ok); } .status .n { color: var(--warn-text); }

/* dialogs, toast */
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); padding: 1.1rem; width: min(560px, calc(100vw - 24px)); box-shadow: var(--shadow); max-height: 92vh; overflow: auto; } dialog::backdrop { background: rgba(3,8,22,.65); }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: .6rem 1rem; border-radius: 10px; box-shadow: var(--shadow); z-index: 50; max-width: 90vw; }
.toast.err { border-color: var(--warn); } .done-card { border: 1px solid var(--ok); } .done-card h3 { color: var(--ok); }
.menu { display: grid; gap: .4rem; } .menu .btn { justify-content: flex-start; }
@media (max-width: 640px) { main { padding: .6rem; } .day { min-height: 70px; } .chip { font-size: .65rem; } }

.demo-bar { background: var(--gold); color: var(--gold-ink); text-align: center; font-size: .85rem; font-weight: 600; padding: .35rem .8rem; }
.meter { height: 10px; border-radius: 99px; background: var(--panel2); overflow: hidden; margin: .3rem 0 .8rem; } .meter span { display: block; height: 100%; background: var(--ok); } .meter span.hot { background: var(--warn); }
.about-bar { text-align: center; font-size: .8rem; color: var(--muted); padding: 1rem .5rem 1.5rem; }

/* colour picker for the DTR marks */
.colorpick { width: 3.2rem; height: 2.4rem; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; }
.swatch { width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 2px solid var(--line); padding: 0; cursor: pointer; }
.swatch[aria-pressed=true] { outline: 2px solid #FFC000; outline-offset: 2px; }
.marksample { font: 700 1rem 'Courier New', monospace; background: #fff; padding: .2rem .6rem; border-radius: 6px; }

/* demo intro cards */
dialog.intro { width: min(520px, calc(100vw - 24px)); background: var(--navy); border-color: rgba(143,176,217,.4); color: #f0f4fa; } dialog.intro .muted { color: #b9c9e3; }
.intro-top { display: flex; justify-content: space-between; align-items: center; } .intro-count { color: #9db3d1; }
.intro-art { width: 100%; height: auto; display: block; margin: .4rem 0 1rem; }
.intro-rule { width: 56px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, #e0342b, #ffc000); margin-bottom: .8rem; }
.intro-card h2 { font-size: 1.6rem; line-height: 1.15; margin: 0 0 .6rem; } .intro-sub { font-size: 1.05rem; color: #c9d6ec; }
.intro-big { justify-content: center; width: 100%; font-size: 1.1rem; padding: .8rem 1rem; box-sizing: border-box; }
.intro-link { text-align: center; color: var(--gold); font-weight: 700; font-size: 1.2rem; margin: .5rem 0; }
dialog.intro .btn:not(.main):not(.link) { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); color: #f0f4fa; } dialog.intro .btn.link { color: #c9d6ec; } dialog.intro a:not(.btn) { color: var(--gold); }
.intro-nav { justify-content: space-between; margin-top: 1rem; } .intro-foot { text-align: center; margin: .8rem 0 0; }
.demo-bar .btn.link { color: var(--gold-ink); font-size: .85rem; font-weight: 600; }
@media (prefers-reduced-motion: no-preference) { dialog.intro[open] { animation: introIn .2s ease-out; } @keyframes introIn { from { opacity: 0; transform: translateY(8px); } } }
