:root {
  --navy: #14213d;
  --navy-2: #22335a;
  --gold: #b8892b;
  --gold-soft: #f3e6c8;
  --parchment: #f6f1e7;
  --paper: #fffdf8;
  --ink: #1d2433;
  --muted: #6b7184;
  --line: #e4dccb;
  --green: #2f7d4f;
  --green-soft: #e1f1e6;
  --amber: #a8640c;
  --amber-soft: #fbecd2;
  --red: #b33a3a;
  --red-soft: #f8e1e1;
  --grey-soft: #ecebe6;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font: 15px/1.5 "IBM Plex Sans", system-ui, sans-serif;
}
a { color: var(--navy-2); }
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 600; color: var(--navy); margin: 0 0 .6rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; margin-top: 1.4rem; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.hidden { display: none !important; }
.warn { color: var(--red); font-weight: 600; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 48px; }

/* Top bar */
.topbar { background: var(--navy); color: #fff; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 600; }
.seal {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--gold); color: var(--navy); font-family: "Fraunces", serif; font-weight: 600;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.35);
}
.brand-lg { justify-content: center; margin-bottom: 8px; }
.brand-lg .seal { width: 52px; height: 52px; font-size: 1.5rem; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a { color: #dfe4f0; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .9rem; }
.topbar nav a:hover { background: var(--navy-2); color: #fff; }

/* Cards */
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(20,33,61,.04);
}
.card.narrow { max-width: 440px; margin-inline: auto; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.head-row h1, .head-row h2 { margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* Flash */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid transparent; }
.flash-ok { background: var(--green-soft); border-color: #bfe0c9; }
.flash-error { background: var(--red-soft); border-color: #eec2c2; }
.flash-warn { background: var(--amber-soft); border-color: #efd3a4; }

/* Forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 500; color: var(--navy); margin-bottom: 12px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
label.check { flex-direction: row; align-items: center; gap: 8px; }
label.check input { width: auto; }
.grid-2, .grid-3, .grid-5 { display: grid; gap: 0 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-5 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.align-end { align-items: end; }
.align-end .btn { margin-bottom: 12px; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
form.inline { display: flex; gap: 6px; align-items: center; margin: 0; }
form.inline input { max-width: 150px; padding: 6px 8px; }
details summary { cursor: pointer; color: var(--navy-2); font-weight: 500; margin: 6px 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 .95rem "IBM Plex Sans", sans-serif; border-radius: 10px; padding: 10px 18px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: transform .05s, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { filter: brightness(1.2); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { filter: brightness(1.08); }
.btn-outline { background: transparent; border-color: var(--navy); color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; }
.btn-ghost { background: transparent; color: var(--navy-2); border-color: var(--line); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-xl { padding: 16px 30px; font-size: 1.1rem; }
.btn-block { width: 100%; }

/* Pills & tags */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill-working { background: var(--green-soft); color: var(--green); }
.pill-on_break { background: var(--amber-soft); color: var(--amber); }
.pill-not_started { background: var(--grey-soft); color: var(--muted); }
.pill-ended { background: #e3e8f4; color: var(--navy-2); }
.pill-missed_logout, .pill-warn { background: var(--red-soft); color: var(--red); }
.tag { display: inline-block; font-size: .72rem; padding: 1px 6px; border-radius: 6px; background: var(--gold-soft); color: #7a5a14; }
.tag-warn { background: var(--red-soft); color: var(--red); }

/* Login */
.login-shell { min-height: 80vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-card label { text-align: left; }

/* BDE hero */
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--gold); font-weight: 600; }
.clock { font-size: 1.4rem; color: var(--navy); background: var(--parchment); padding: 6px 12px; border-radius: 8px; }
.status-row { display: flex; gap: 8px; margin: 6px 0 16px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat { background: var(--parchment); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.7rem; color: var(--navy); }
.stat .sub { font-size: .8rem; color: var(--muted); }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--gold); transition: width .5s; }
.break-banner { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-weight: 500; }
.break-banner.over { background: var(--red-soft); color: var(--red); }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.actions .muted { width: 100%; margin: 0; }
.break-group { display: flex; gap: 8px; }
.break-group select { width: auto; }
.done { font-family: "Fraunces", serif; font-size: 1.15rem; color: var(--green); margin: 0; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 6px 0 6px 12px; }
.timeline li::before {
  content: ""; position: absolute; left: -20px; top: 13px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--green);
}
.timeline li.tl-break::before { background: var(--gold); }
.timeline li.tl-end::before { background: var(--navy); }
.timeline .t { display: inline-block; min-width: 82px; color: var(--navy); }
.report-mini { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.report-mini div { background: var(--parchment); padding: 8px 12px; border-radius: 8px; font-size: .9rem; }
.report-mini b { color: var(--navy); }
.report-text { background: var(--parchment); padding: 12px; border-radius: 8px; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
td.notes { white-space: normal; min-width: 160px; max-width: 320px; }
td.ua { white-space: normal; max-width: 260px; }
tbody tr:hover { background: #faf6ec; }
tr.inactive { opacity: .55; }

/* Filters */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters label { margin-bottom: 0; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.presets a { font-size: .82rem; padding: 4px 10px; border-radius: 999px; background: var(--parchment); text-decoration: none; color: var(--navy-2); }
.presets a.active { background: var(--navy); color: #fff; }

@media (max-width: 600px) {
  h1 { font-size: 1.35rem; }
  .card { padding: 16px; }
  .stat .value { font-size: 1.45rem; }
  .actions .btn, .break-group { width: 100%; }
  .break-group .btn { flex: 1; }
  .topbar-in { padding: 8px 0; }
}
