/* BurnBar web. Colours and type follow the Flux 2026 tokens (flux.am design/tokens.css). */

@font-face {
  font-family: 'Bricolage Grotesque Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Figtree Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url('fonts/figtree-latin-wght-normal.woff2') format('woff2-variations');
}

:root {
  color-scheme: light;
  --aubergine: #221A34;
  --cloud: #EFEFF3;
  --white: #FFFFFF;
  --iris: #7069AD;
  --iris-deep: #4E4790;
  --iris-light: #A9A3E0;
  --mint: #98CFBB;
  --sun: #FAC142;
  --coral: #E95B5F;
  --mint-light: #C1E2D6;
  --muted: #5A5470;            /* secondary text on cloud and white */
  --muted-on-aubergine: #D8D6E6;
  --field: #F6F6F9;
  --field-border: #8A85A0;     /* 3.5:1 on white, so fields are findable */
  --line: #E2E1EA;             /* decorative dividers only */
  --tint: #F4F3FA;

  --font-display: 'Bricolage Grotesque Variable', 'Bricolage Grotesque', system-ui, sans-serif;
  --font-text: 'Figtree Variable', 'Figtree', system-ui, sans-serif;

  --radius-card: 28px;
  --radius-tile: 18px;
  --radius-pill: 999px;
  --page-max: 1280px;
  --gutter: 32px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cloud);
  color: var(--aubergine);
  font: 400 17px/1.45 var(--font-text);
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

a { color: var(--iris-deep); }
a:hover { color: var(--aubergine); }

:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--aubergine);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--sun);
}
:where(input, select):focus-visible { outline-offset: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 10;
  padding: 10px 18px; border-radius: var(--radius-pill);
  background: var(--sun); color: var(--aubergine); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

.num, .total, .item-dur, .row-dur, .row-time, .day-total, .week-total, .bar-value, .top-total, .day-tile-total, .budget-amount, .stat-value {
  font-variant-numeric: tabular-nums;
}

/* ---- top bar ---------------------------------------------------------------- */

.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--aubergine); color: var(--cloud);
  padding-top: env(safe-area-inset-top);
}
.top-inner {
  max-width: var(--page-max); margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px;
}
.wordmark {
  font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1;
  letter-spacing: -0.05em;
}
.top-status {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  font-size: 15px; font-weight: 500; color: var(--muted-on-aubergine);
}
.top-running {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 0 14px 0 12px; border-radius: var(--radius-pill);
  background: var(--mint); color: var(--aubergine); font-weight: 600;
}
.top-running .dot { background: var(--aubergine); }
.top-link { color: var(--cloud); font-weight: 600; }
.top-link:hover { color: var(--sun); }
.top :where(a, button):focus-visible { outline-color: var(--cloud); }

.dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--mint); flex: none;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---- banner and gate ------------------------------------------------------------- */

.banner {
  max-width: calc(var(--page-max) - 2 * var(--gutter)); margin: 16px auto 0; padding: 12px 18px;
  border-radius: var(--radius-tile); background: var(--sun); color: var(--aubergine); font-weight: 500;
}

.gate { max-width: 560px; margin: 0 auto; padding: 48px 16px; }
.gate-card { display: flex; flex-direction: column; gap: 16px; }
.gate-card p { margin: 0; }
.gate-text { color: var(--muted); }

/* ---- layout ------------------------------------------------------------------ */

.layout {
  max-width: var(--page-max); margin: 0 auto; padding: 24px var(--gutter) 0;
  display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 24px;
  align-items: start;
}
.side, .main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.card {
  background: var(--white); border-radius: var(--radius-card); padding: 28px; min-width: 0;
}
.card-title {
  margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.1;
  letter-spacing: -0.03em;
}
.card > .card-title { margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head .card-title { margin-bottom: 0; }
.sub-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.total { font-weight: 600; color: var(--muted); }
.muted { color: var(--muted); }
.empty { margin: 0; color: var(--muted); font-size: 15px; }
.error { margin: 0; color: var(--aubergine); background: #FBDCDD; border-left: 4px solid var(--coral); padding: 10px 14px; border-radius: 10px; font-size: 15px; }
.note { margin: 0; font-size: 15px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1 1 0; min-width: 0; }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- form controls ------------------------------------------------------------ */

input, select {
  font: inherit; color: var(--aubergine);
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1.5px solid var(--field-border); border-radius: 14px; background: var(--field);
  appearance: none; -webkit-appearance: none;
}
input::placeholder { color: var(--muted); opacity: 1; }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--aubergine) 50%), linear-gradient(135deg, var(--aubergine) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
  padding-right: 34px; text-overflow: ellipsis;
}
select:disabled { opacity: 0.6; }
input:focus, select:focus { border-color: var(--aubergine); }
.big-input { font-size: 19px; min-height: 56px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 600; text-decoration: none;
  min-height: 48px; padding: 0 22px; border: 2px solid transparent; border-radius: var(--radius-pill);
  background: var(--cloud); color: var(--aubergine); cursor: pointer;
}
.btn:hover { border-color: var(--aubergine); }
.btn.primary { background: var(--sun); }
.btn.ghost { background: transparent; border-color: var(--aubergine); }
.btn.ghost:hover { background: var(--cloud); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn.stop, .btn.danger { background: var(--coral); }
.btn.danger-outline { background: transparent; border-color: var(--coral); margin-left: auto; }
.btn.danger-outline:hover { background: #FBDCDD; }
.btn:disabled { opacity: 0.45; cursor: default; border-color: transparent; }
.btn:active:not(:disabled) { transform: scale(0.98); }

.icon-btn {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: var(--cloud); color: var(--aubergine); cursor: pointer;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--sun); }
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; stroke: currentColor; stroke-width: 0; }
#entry-close svg, #plan-close svg { fill: none; stroke-width: 2; stroke-linecap: round; }

.seg { display: flex; background: var(--cloud); border-radius: var(--radius-pill); padding: 4px; }
.seg-btn {
  flex: 1; font: inherit; font-size: 15px; font-weight: 500; min-height: 40px; border: 0; border-radius: var(--radius-pill);
  background: transparent; color: var(--muted); cursor: pointer;
}
.seg-btn[aria-pressed="true"] { background: var(--aubergine); color: var(--cloud); font-weight: 600; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 15px; font-weight: 500; min-height: 44px; min-width: 64px; padding: 0 16px;
  border: 1.5px solid var(--field-border); border-radius: var(--radius-pill); background: transparent; color: var(--aubergine); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--sun); border-color: var(--sun); font-weight: 700; }

/* ---- timer, today, recent lists ----------------------------------------------------- */

.running-wrap { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }

.list { list-style: none; margin: 0; padding: 0; }
.list:empty { display: none; }
.item {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--line); padding: 4px 0;
}
.item:first-child { border-top: 0; }
.item-tap {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; min-height: 56px;
  font: inherit; color: inherit; text-align: left; background: none; border: 0; padding: 6px 8px; margin: 0 -8px;
  border-radius: 14px; cursor: pointer;
}
.item-tap:hover { background: var(--tint); }
.item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-dur { color: var(--muted); font-size: 15px; font-weight: 500; white-space: nowrap; }
.item.is-running .item-dur { color: var(--aubergine); font-weight: 600; }

.item.running {
  flex-direction: column; align-items: stretch; gap: 4px;
  background: var(--mint-light); border-radius: var(--radius-tile); border-top: 0;
  padding: 8px 14px 14px; margin-top: 8px;
}
.item.running .item-tap { margin: 0 -6px; padding: 6px; }
.run-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-left: 22px; }
.item.running:first-child { margin-top: 0; }
.item.running .dot { background: var(--aubergine); }
.item.running .item-tap:hover { background: rgba(255, 255, 255, 0.5); }
.item.running .item-sub { color: var(--aubergine); }
.live-dur { font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1; color: var(--aubergine); letter-spacing: -0.02em; }

/* ---- week ----------------------------------------------------------------------- */

.week-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px;
  margin-bottom: 20px;
}
.week-range { margin: 4px 0 0; font-weight: 500; }
.week-sum { margin: 0; display: flex; flex-direction: column; align-items: flex-end; font-size: 14px; font-weight: 600; }
.week-total { font-family: var(--font-display); font-weight: 800; font-size: 34px; line-height: 1.05; letter-spacing: -0.03em; }
.week-nav { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; order: 3; }
@media (min-width: 1180px) {
  .week-head { flex-wrap: nowrap; align-items: center; }
  .week-head > div:first-child { flex: 1; }
  .week-nav { width: auto; order: 0; }
}

.day-strip {
  list-style: none; margin: 0 0 24px; padding: 0;
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px;
}
.day-tile {
  width: 100%; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: left;
  font: inherit; color: var(--aubergine); cursor: pointer;
  padding: 12px 10px; border: 2px solid transparent; border-radius: var(--radius-tile); background: var(--cloud);
}
.day-tile:hover { border-color: var(--aubergine); }
.day-tile.is-today { background: var(--sun); }
.day-tile-top { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; font-size: 14px; font-weight: 600; }
.day-tile-date { color: var(--muted); font-weight: 500; }
.is-today .day-tile-date { color: var(--aubergine); }
.day-tile-total { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; min-height: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.day-tile-meter { height: 6px; border-radius: 3px; background: var(--white); overflow: hidden; }
.day-tile-fill { display: block; height: 100%; width: 0; background: var(--iris); border-radius: 3px; }
.is-today .day-tile-fill { background: var(--aubergine); }

.week-days { display: flex; flex-direction: column; }
.day { border-top: 1px solid var(--line); padding: 16px 0; scroll-margin-top: 90px; }
.day:first-child { border-top: 0; padding-top: 0; }
.day:last-child { padding-bottom: 0; }
.day-head { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.day-title {
  margin: 0; flex: 1; display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.02em;
}
.day-total { font-weight: 600; }
.day.is-empty .day-title { color: var(--muted); }
.day .empty { margin-top: 2px; font-size: 14px; }

.tag {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: var(--radius-pill);
  background: var(--sun); color: var(--aubergine); font-family: var(--font-text); font-size: 13px; font-weight: 600; letter-spacing: 0;
}
.running-tag { background: var(--mint); }

.rows { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.entry-row {
  width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 128px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 10px 14px; border: 0; border-radius: 14px; background: transparent;
}
.rows li:nth-child(odd) .entry-row { background: var(--tint); }
.entry-row:hover { background: var(--cloud) !important; }
.entry-row.is-running { background: var(--mint-light) !important; }
.row-time { color: var(--muted); font-size: 15px; font-weight: 500; white-space: nowrap; }
.row-what { display: flex; flex-direction: column; min-width: 0; }
.row-desc { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-client { color: var(--iris-deep); font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-dur { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.entry-row.is-running .row-time { color: var(--aubergine); }

/* ---- client totals ------------------------------------------------------------------ */

.totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: flex; flex-direction: column; gap: 6px; }
.bar-label { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.bar-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { font-weight: 600; color: var(--muted); white-space: nowrap; }
.bar-track { height: 10px; border-radius: 5px; background: var(--cloud); overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; background: var(--iris); border-radius: 5px; }

/* ---- budgets ------------------------------------------------------------------------ */

.budgets-head { align-items: flex-start; flex-wrap: wrap; }
.budgets-sub { margin: 4px 0 0; font-weight: 500; }
.budgets-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.budgets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.budgets:empty { display: none; }
.budget {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 20px; border-radius: var(--radius-tile); background: var(--tint);
  border-left: 6px solid var(--mint);
}
.budget.is-warn { border-left-color: var(--sun); }
.budget.is-over { border-left-color: var(--coral); }
.budget-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; }
.budget-name {
  margin: 0; min-width: 0; font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.budget-amount { font-weight: 700; white-space: nowrap; }

.meter { position: relative; height: 12px; border-radius: 6px; background: var(--white); }
.meter-fill { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--mint); }
.is-warn .meter-fill { background: var(--sun); }
.is-over .meter-fill { background: var(--coral); }
.meter-tick {
  position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px;
  border-radius: 2px; background: var(--aubergine);
}

.stats {
  margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px;
}
.stat { min-width: 0; padding: 10px 12px; border-radius: 14px; background: var(--white); }
.stat.is-warn { background: #FDECC5; }
.stat.is-over { background: #FBDCDD; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-body { margin: 0; display: flex; flex-direction: column; }
.stat-value { font-weight: 700; font-size: 18px; line-height: 1.3; }
.stat-sub { font-size: 14px; color: var(--muted); }
.stat.is-warn .stat-sub, .stat.is-over .stat-sub { color: var(--aubergine); }

.budget-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 15px; color: var(--muted); }
.budgets-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.budgets-untracked { margin-top: 14px; }
#budgets-error { margin-bottom: 12px; }

/* ---- dialog ------------------------------------------------------------------------ */

.dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: var(--radius-card);
  background: var(--white); color: var(--aubergine);
}
.dialog::backdrop { background: rgba(34, 26, 52, 0.6); }
.dialog form { padding: 28px; }
.dialog .card-head { margin-bottom: 0; align-items: center; }
.confirm {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 14px 12px 18px; border-radius: var(--radius-tile); background: #FBDCDD; font-weight: 600;
}
.confirm span { margin-right: auto; }
.dialog-body { padding: 28px; }
.dialog .dialog-body form { padding: 0; }
.form-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.saved { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--mint-light); font-size: 15px; font-weight: 500; }
.group { margin: 0; padding: 18px 0 0; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.group > legend { padding: 0; float: left; width: 100%; }
.group > legend + * { clear: both; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 500; cursor: pointer; }
.check input {
  width: 22px; height: 22px; min-height: 0; padding: 0; flex: none;
  appearance: auto; -webkit-appearance: checkbox; accent-color: var(--iris-deep);
}
.dialog .item > .btn { flex: none; }
#plan-tabs .seg-btn { padding: 0 8px; }

/* ---- motion ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---- smaller screens ------------------------------------------------------------- */

@media (max-width: 1000px) {
  /* One column: timer, budgets and today first, then the week, with recent last. */
  .layout { display: flex; flex-direction: column; align-items: stretch; max-width: 720px; }
  .side, .main { display: contents; }
  .o-timer { order: 1; }
  .o-budgets { order: 2; }
  .o-today { order: 3; }
  .o-week { order: 4; }
  .o-totals { order: 5; }
  .o-recent { order: 6; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .layout { padding-top: 16px; gap: 16px; }
  .side, .main { gap: 16px; }
  .card { padding: 20px; border-radius: 24px; }
  .card-title { font-size: 24px; }
  .wordmark { font-size: 26px; }
  .top-inner { padding-top: 12px; padding-bottom: 12px; }
  .top-status { gap: 6px 14px; font-size: 14px; }
  .day-strip { display: none; }
  .week-sum { align-items: flex-start; }
  .week-nav .btn { flex: 1; padding: 0 10px; }
  .entry-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "what dur" "time dur";
    gap: 2px 12px; padding: 10px 12px;
  }
  .row-what { grid-area: what; }
  .row-time { grid-area: time; font-size: 14px; }
  .row-dur { grid-area: dur; }
  .totals { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .buttons .btn { flex: 1 1 auto; }
  .btn.danger-outline { margin-left: 0; }
  .dialog form, .dialog-body { padding: 22px; }
  .budget { padding: 14px 14px 14px 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 8px 10px; }
  .stat-value { font-size: 16px; }
}
