@font-face {
  font-family: 'Archivo';
  src: url('/vendor/archivo/archivo-latin-wdth-normal.woff2') format('woff2-variations');
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  src: url('/vendor/archivo/archivo-latin-ext-wdth-normal.woff2') format('woff2-variations');
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #F4F5F6;
  --surface: #FFFFFF;
  --graphite: #2B2E33;
  --graphite-2: #3A3E44;
  --ink: #000000;
  --line: #D5D8DC;
  --muted: #6B6F76;
  --go: #1E8E3E;
  --go-dark: #166E30;
  --stop: #C62828;
  --stop-dark: #9E1F1F;
  --alert-bg: #FDECEC;
  --weekend: #F7EEF1;
  --ok-bg: #E8F4EC;
  --r: 6px;
  --font: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-stretch: 100%; color: var(--ink); background: var(--paper);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--graphite); }
:focus-visible { outline: 3px solid #5B8DEF; outline-offset: 2px; }
.tabnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.red { color: var(--stop); }
.green { color: var(--go); }
.hidden { display: none !important; }

/* ---------- przyciski / pola ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px solid var(--graphite); background: var(--surface); color: var(--graphite);
  padding: 8px 14px; border-radius: var(--r); cursor: pointer; font-weight: 600; font-size: 14px;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #ECEEF0; }
.btn.primary { background: var(--graphite); color: #fff; }
.btn.primary:hover { background: var(--ink); }
.btn.danger { border-color: var(--stop); color: var(--stop); }
.btn.danger:hover { background: var(--alert-bg); }
.btn.small { padding: 4px 9px; font-size: 13px; border-width: 1px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--graphite); text-decoration: underline; cursor: pointer; font-size: 13px; }

label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--graphite); }
.f input, .f select, .f textarea, .input {
  border: 1.5px solid var(--line); background: var(--surface); padding: 9px 10px; border-radius: var(--r); font-weight: 400; font-size: 15px; min-width: 0;
}
.f input:focus, .f select:focus, .f textarea:focus { border-color: var(--graphite); outline: none; }
.f small { font-weight: 400; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------- logowanie ---------- */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(180deg, var(--paper) 0 62%, var(--graphite) 62% 100%);
}
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1.5px solid var(--graphite); border-radius: 10px; padding: 28px 24px; }
.brand { font-weight: 800; font-stretch: 125%; letter-spacing: .02em; font-size: 22px; line-height: 1; }
.brand-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.login-card form { margin-top: 24px; }
.pin-input { letter-spacing: .4em; font-size: 22px !important; text-align: center; font-variant-numeric: tabular-nums; }
.err { background: var(--alert-bg); color: var(--stop-dark); border-left: 4px solid var(--stop); padding: 10px 12px; border-radius: 4px; font-size: 14px; }
.okmsg { background: var(--ok-bg); color: var(--go-dark); border-left: 4px solid var(--go); padding: 10px 12px; border-radius: 4px; font-size: 14px; }

/* ---------- ekran pracownika ---------- */
.emp { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; background: var(--surface); }
.emp-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1.5px solid var(--graphite); }
.emp-top .brand { font-size: 16px; }
.emp-main { flex: 1; padding: 24px 20px 32px; display: flex; flex-direction: column; }
.hello { font-size: 17px; color: var(--graphite); }
.hello strong { display: block; font-size: 26px; font-weight: 700; color: var(--ink); line-height: 1.15; }
.today { margin-top: 14px; font-size: 15px; color: var(--muted); }
.clock {
  font-weight: 700; font-stretch: 112%; font-size: clamp(64px, 22vw, 108px); line-height: .95; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; margin: 6px 0 22px; color: var(--ink);
}
.state-label { font-weight: 800; font-stretch: 125%; font-size: 20px; letter-spacing: .03em; color: var(--go); }
.state-meta { font-size: 16px; color: var(--graphite); margin-top: 6px; }
.timer {
  font-weight: 700; font-stretch: 112%; font-size: clamp(56px, 19vw, 96px); line-height: 1; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; margin: 4px 0 22px;
}
.slab {
  width: 100%; border: 0; border-radius: 10px; color: #fff; cursor: pointer;
  font-weight: 800; font-stretch: 125%; letter-spacing: .06em; font-size: clamp(26px, 8vw, 34px);
  padding: 30px 16px; box-shadow: inset 0 -6px 0 rgba(0,0,0,.22); touch-action: manipulation;
  transition: transform .06s ease;
}
.slab:active { transform: translateY(2px); box-shadow: inset 0 -3px 0 rgba(0,0,0,.22); }
.slab.go { background: var(--go); }
.slab.stop { background: var(--stop); }
.slab[disabled] { background: #9CA0A6; box-shadow: none; cursor: progress; }
.loc { margin-top: 22px; border-top: 1.5px solid var(--line); padding-top: 14px; font-size: 15px; }
.loc h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.loc .li { display: flex; gap: 8px; align-items: baseline; margin: 3px 0; }
.loc .ic { width: 18px; font-weight: 800; flex: none; }
.loc .ic.ok { color: var(--go); }
.loc .ic.bad { color: var(--stop); }
.loc .ic.wait { color: var(--muted); }
.emp-foot { display: flex; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 13px; }
.consent { border: 1.5px solid var(--graphite); border-radius: 10px; padding: 18px; background: var(--paper); }
.consent h2 { margin: 0 0 8px; font-size: 19px; }
.consent p { margin: 0 0 10px; font-size: 14px; }
.today-list { margin-top: 18px; font-size: 14px; }
.today-list div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }

/* ---------- panel administratora ---------- */
.adm { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.rail { background: var(--graphite); color: #fff; padding: 20px 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.rail .brand { padding: 0 20px; color: #fff; font-size: 18px; }
.rail .brand-sub { padding: 0 20px; color: #A9ADB3; }
.rail nav { margin-top: 26px; display: flex; flex-direction: column; }
.rail nav a { color: #D9DBDE; text-decoration: none; padding: 10px 20px; font-weight: 600; border-left: 4px solid transparent; }
.rail nav a:hover { background: var(--graphite-2); color: #fff; }
.rail nav a.on { border-left-color: #fff; color: #fff; background: var(--graphite-2); }
.rail .who { margin-top: auto; padding: 16px 20px 0; font-size: 13px; color: #A9ADB3; border-top: 1px solid var(--graphite-2); }
.rail .who button { color: #fff; }
.content { padding: 24px 28px 60px; min-width: 0; }
.page-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-h h1 { margin: 0; font-size: 28px; font-stretch: 108%; font-weight: 750; letter-spacing: -.01em; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 18px; }
.panel h2 { font-size: 16px; margin: 0 0 12px; }

@media (max-width: 900px) {
  .adm { grid-template-columns: 1fr; }
  .rail { position: sticky; height: auto; flex-direction: row; align-items: center; padding: 10px 0; z-index: 900; flex-wrap: wrap; }
  .rail .brand-sub { display: none; }
  .rail .brand { padding: 0 14px; font-size: 15px; }
  .rail nav { margin: 0; flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; padding-top: 6px; }
  .rail nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 12px; white-space: nowrap; font-size: 14px; }
  .rail nav a.on { border-bottom-color: #fff; background: none; }
  .rail .who { margin: 0 0 0 auto; padding: 0 14px; border: 0; }
  .content { padding: 16px 12px 60px; }
  .page-h h1 { font-size: 22px; }
}

/* liczniki dashboardu */
.counters { display: grid; grid-template-columns: repeat(4, 1fr); border: 1.5px solid var(--graphite); border-radius: 8px; background: var(--surface); margin-bottom: 18px; overflow: hidden; }
.counters > div { padding: 14px 16px; border-right: 1px solid var(--line); }
.counters > div:last-child { border-right: 0; }
.counters b { display: block; font-size: 34px; font-stretch: 112%; line-height: 1.05; font-variant-numeric: tabular-nums; }
.counters span { font-size: 13px; color: var(--muted); }
.counters .go b { color: var(--go); }
.counters .al b { color: var(--stop); }
@media (max-width: 640px) { .counters { grid-template-columns: 1fr 1fr; } .counters > div:nth-child(2) { border-right: 0; } .counters > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }

/* tabele */
.tw { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; background: var(--graphite); color: #fff; font-weight: 600; padding: 9px 10px; white-space: nowrap; font-size: 13px; position: sticky; top: 0; }
.t td { padding: 8px 10px; border-bottom: 1px solid #ECEEF0; vertical-align: top; }
.t tr.we td { background: var(--weekend); }
.t tr.hol td:first-child::after { content: attr(data-hol); display: block; font-size: 11px; color: var(--stop-dark); }
.t tr.sep td { border-top: 1.5px solid var(--line); }
.t td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t tfoot td { background: #ECEEF0; font-weight: 700; border-top: 2px solid var(--graphite); }
.t .acts { white-space: nowrap; text-align: right; }
.t .nowrap { white-space: nowrap; }

.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 3px; margin: 1px 2px 1px 0; background: #ECEEF0; color: var(--graphite); white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--go-dark); }
.tag.bad { background: var(--alert-bg); color: var(--stop); }
.tag.work { background: var(--go); color: #fff; }
.tag.warn { background: #FFF4D6; color: #7A5A00; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.go { background: var(--go); box-shadow: 0 0 0 3px rgba(30,142,62,.18); }
.dot.idle { background: #B9BDC2; }
.dot.done { background: var(--graphite); }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(20,22,25,.55); display: grid; place-items: center; z-index: 2000; padding: 16px; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; border: 1.5px solid var(--graphite); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal header h3 { margin: 0; font-size: 18px; }
.modal .body { padding: 18px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--paper); }
.modal.wide { max-width: 860px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--graphite); color: #fff; padding: 11px 18px; border-radius: 6px; z-index: 3000; font-size: 14px; max-width: calc(100% - 32px); }
.toast.bad { background: var(--stop); }

#map, .mapbox { height: 560px; border-radius: 8px; border: 1px solid var(--line); z-index: 1; }
.mapbox.small { height: 340px; }
@media (max-width: 640px) { #map { height: 440px; } }
.leaflet-popup-content { font-family: var(--font); font-size: 14px; line-height: 1.4; }
.pop b { display: block; font-size: 15px; }
.pop .k { font-weight: 800; font-stretch: 120%; letter-spacing: .03em; }

.hist { border-left: 3px solid var(--graphite); padding: 4px 0 4px 12px; margin-bottom: 14px; font-size: 14px; }
.hist .when { font-size: 12px; color: var(--muted); }
.radio-card { display: flex; gap: 10px; border: 1.5px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer; align-items: flex-start; }
.radio-card:has(input:checked) { border-color: var(--graphite); background: var(--paper); }
.radio-card input { margin-top: 3px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- pracownik: nawigacja i moje godziny ---------- */
.emp-nav { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-top: 1.5px solid var(--graphite); padding-bottom: env(safe-area-inset-bottom); }
.emp-nav button { background: none; border: 0; padding: 14px 4px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; border-top: 3px solid transparent; margin-top: -1.5px; }
.emp-nav button.on { color: var(--ink); border-top-color: var(--graphite); }
.esum { display: grid; grid-template-columns: repeat(4, 1fr); border: 1.5px solid var(--graphite); border-radius: 8px; margin: 14px 0; }
.esum > div { padding: 10px 8px; border-right: 1px solid var(--line); text-align: center; }
.esum > div:last-child { border-right: 0; }
.esum b { display: block; font-size: 18px; font-stretch: 108%; }
.esum span { font-size: 12px; color: var(--muted); }
.dcard { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: var(--surface); }
.dcard.we { background: var(--weekend); }
.dhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.dentry { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line); }
.dentry:first-of-type { border-top: 0; }
.dright { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.emp .panel { margin-bottom: 14px; }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: #F2B705; color: #000; font-size: 12px; font-weight: 800; text-align: center; margin-left: 4px; }
.loc-hint { margin-top: 14px; padding: 10px 12px; border-radius: 6px; background: #EEF3FB; color: #1F3F73; font-size: 14px; border-left: 4px solid #1F5FBF; }
