@font-face { font-family: "Archivo"; font-weight: 400; font-display: swap; src: url("fonts/archivo-400.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 600; font-display: swap; src: url("fonts/archivo-600.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 800; font-display: swap; src: url("fonts/archivo-800.woff2") format("woff2"); }

/* Paleta Arco Logistics */
:root {
  --ink: #24221F;          /* grafit – tekst, pasek górny, przyciski */
  --ink-2: #56504A;
  --muted: #736B61;
  --accent: #8C7C66;       /* taupe – akcenty, znak ✦ */
  --taupe: #9B8C77;
  --taupe-d: #7E6F5B;
  --taupe-l: #D8D0C2;
  --taupe-xl: #E4DDCF;
  --bg: #EDE9E1;           /* krem – tło */
  --paper-2: #F5F2EB;
  --paper: #FFFFFF;
  --line: #D6CFC3;
  --line-soft: #ECE7DE;
  --sat: #E9E4DA;
  --sun: #DCD3C3;
  --alert: #A33B25;
  --alert-soft: #F5DAD1;
  --streak-soft: #F2E2BF;
  --ok: #3F6B45;
  --ok-soft: #E1EBDD;
  --radius: 6px;
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--taupe-d); }
h1 { font-size: 1.65rem; line-height: 1.15; margin: 0; letter-spacing: -0.015em; font-weight: 800; }
h2 { font-size: 1.15rem; margin: 0 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num, .c-date, .c-sum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }

/* Pasek górny */
.topbar {
  display: flex; align-items: center; gap: 2rem;
  padding: .65rem 1.5rem; background: var(--ink); color: #F4F1EB;
  border-bottom: 3px solid var(--taupe);
}
.brand { display: flex; align-items: center; gap: .9rem; color: #F4F1EB; text-decoration: none; }
.logo { display: inline-flex; align-items: center; font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; line-height: 1; white-space: nowrap; }
.logo svg { width: .66em; height: .66em; margin: 0 .14em 0 .12em; flex: none; }
.logo svg path { fill: var(--taupe); }
.brand .app-name { padding-left: .9rem; border-left: 1px solid rgba(244, 241, 235, .25); font-size: .85rem; color: var(--taupe-l); line-height: 1.2; }
.logo.big { font-size: 1.9rem; color: var(--ink); }
.logo.big svg path { fill: var(--accent); }
.topbar nav { display: flex; gap: .25rem; flex: 1; }
.topbar nav a { color: var(--taupe-l); text-decoration: none; padding: .45rem .7rem; border-radius: var(--radius); white-space: nowrap; }
.topbar nav a:hover { background: #3A3733; color: #fff; }
.topbar nav a.on { background: var(--bg); color: var(--ink); font-weight: 600; }
.who { display: flex; align-items: center; gap: .9rem; font-size: .9rem; white-space: nowrap; }
@media (max-width: 1450px) { .brand .app-name, .who .role { display: none; } .topbar { gap: 1rem; } }
.who a { color: #F4F1EB; }
.who .role { color: var(--taupe-l); font-size: .78rem; text-decoration: none; }
.who form { margin: 0; }
button.link { background: none; border: 0; color: var(--taupe-l); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

/* Układ strony */
.page { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.page.wide { max-width: none; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 0 0 1rem; }
.head-row .filters { margin: 0; }
.month-nav { display: flex; align-items: center; gap: .6rem; }
.month-nav h1 { min-width: 11ch; text-align: center; }

/* Kontrolki */
input, select, textarea {
  font: inherit; color: inherit; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius); padding: .45rem .6rem;
}
input[type="search"] { min-width: 16rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  padding: .45rem .9rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #F4F1EB; }
.btn.primary:hover { background: var(--taupe-d); border-color: var(--taupe-d); }
.btn.icon { width: 2.2rem; padding: .35rem 0; font-size: 1.3rem; line-height: 1; }

/* Komunikaty */
.flashes { margin-bottom: 1rem; display: grid; gap: .4rem; }
.flash { margin: 0; padding: .6rem .9rem; border-radius: var(--radius); border-left: 4px solid; }
.flash.ok { background: var(--ok-soft); border-color: var(--ok); }
.flash.error { background: var(--alert-soft); border-color: var(--alert); }
.empty { background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem; text-align: center; }
.hint { color: var(--muted); margin: 0 0 .75rem; max-width: 80ch; }
.tag { font-size: .8rem; padding: .1rem .5rem; border-radius: 99px; background: var(--line-soft); color: var(--muted); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }

/* Listy */
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .82rem; color: var(--muted); font-weight: 600; background: var(--paper-2); }
table.list th, table.list td { padding: .55rem .8rem; border-bottom: 1px solid var(--line-soft); }
table.list tbody tr:hover { background: #FBF9F5; }
.present { font-size: 1.05rem; margin: 0 0 1rem; }
table.scans .src.brk { background: #F2E2BF; color: #7A5A12; }
.pres-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-bottom: 1.2rem; }
.pc { display: block; text-decoration: none; color: var(--ink); background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .9rem 1rem; border-top: 5px solid; }
.pc strong { display: block; font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.pc span { color: var(--muted); font-size: .9rem; }
.pc.working { border-top-color: var(--ok); } .pc.break { border-top-color: #C9962B; }
.pc.done { border-top-color: var(--taupe); } .pc.absent { border-top-color: var(--alert); }
.pres-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; align-items: start; }
.pres-col { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; }
.pres-col h2 { font-size: 1rem; display: flex; justify-content: space-between; margin: 0 0 .6rem; padding-bottom: .5rem; border-bottom: 3px solid; }
.pres-col.working h2 { border-color: var(--ok); } .pres-col.break h2 { border-color: #C9962B; }
.pres-col.done h2 { border-color: var(--taupe); } .pres-col.absent h2 { border-color: var(--alert); }
.pres-item { display: flex; justify-content: space-between; gap: .6rem; padding: .45rem .3rem; border-bottom: 1px solid var(--line-soft); font-size: .92rem; }
.pres-item small { display: block; color: var(--muted); font-size: .75rem; }
.pres-item .pi-right { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pres-item.overdue { background: var(--alert-soft); }
.pres-item.overdue .pi-right small { color: var(--alert); font-weight: 600; }
.pres-empty { color: var(--muted); font-size: .88rem; margin: .3rem; }
@media (max-width: 1000px) { .pres-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .pres-grid { grid-template-columns: 1fr; } }
.day-sum { white-space: nowrap; line-height: 1.5; }
.day-sum .to-ledger { margin-top: .2rem; padding-top: .2rem; border-top: 1px solid var(--line-soft); color: var(--ok); }
.present strong { font-size: 1.6rem; font-weight: 800; }
table.scans td { vertical-align: middle; }
table.scans .t { font-weight: 800; font-size: 1.05rem; }
table.scans .src { font-size: .72rem; padding: .05rem .4rem; border-radius: 99px; background: var(--line-soft); color: var(--muted); margin-left: .3rem; }
table.scans .src.man { background: #EFE3CF; color: var(--taupe-d); }
table.scans .flag { color: var(--alert); font-weight: 700; }
table.scans tr.st-missing_out td, table.scans tr.st-missing_in td { background: var(--alert-soft); }
table.scans tr.voided td { color: var(--muted); text-decoration: line-through; background: #FBFAF7; }
table.scans tr.none td { color: var(--muted); }
form.inline { display: inline; margin: 0; }
.activation { background: var(--ok-soft); border: 1px solid var(--ok); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.activation input { width: 100%; font-size: .9rem; }
.qr-box { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; padding: 1rem; margin: 1rem 0; border-radius: var(--radius); }
.qr-box.plain { background: var(--paper); border: 1px solid var(--line); }
.qr-box .qr { width: 170px; height: 170px; background: #fff; padding: 8px; border-radius: 6px; flex: none; }
.qr-box .qr svg { width: 100%; height: 100%; display: block; }
.qr-box > div:last-child { flex: 1; min-width: 16rem; }
.qr-box p { margin: 0 0 .6rem; }
.qr-box input { width: 100%; font-size: .9rem; }
.card-box { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .9rem 1rem; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); }
.card-box > div { flex: 1; min-width: 12rem; }
.import { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }

/* Formularze */
.form { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; max-width: 720px; margin-top: 1rem; display: grid; gap: 1rem; }
.form.narrow { max-width: 420px; }
.form label, .login-card label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
.form label small { font-weight: 400; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.actions { display: flex; gap: .6rem; }

/* Logowanie */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: linear-gradient(var(--ink) 0 38%, var(--bg) 38%); }
.login-card { background: var(--paper); padding: 2rem; border-radius: var(--radius); width: min(360px, 100%);
  display: grid; gap: .9rem; border-top: 5px solid var(--taupe); box-shadow: 0 14px 40px rgba(36, 34, 31, .18); }
.login-card h1 { margin: .4rem 0 0; font-size: 1.25rem; }
.login-card p { margin: -.6rem 0 .4rem; }
.login-page .flashes { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); }

/* Siatka godzin */
.grid-wrap {
  overflow: auto; max-height: calc(100vh - 230px);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
table.grid { border-collapse: separate; border-spacing: 0; font-size: .85rem; }
table.grid th, table.grid td { border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 0; }
table.grid thead th {
  position: sticky; top: 0; z-index: 2; background: var(--ink); color: #F4F1EB;
  font-weight: 600; padding: .35rem .3rem; text-align: center; border-bottom: 3px solid var(--ink);
}
table.grid thead th.c-day span { display: block; font-size: .95rem; }
table.grid thead th.c-day small { display: block; font-weight: 400; opacity: .8; font-size: .7rem; }
table.grid thead th.sat { background: #4A4540; }
table.grid thead th.sun { background: var(--accent); color: #fff; border-bottom-color: var(--taupe-d); }
.c-name {
  position: sticky; left: 0; z-index: 1; background: var(--paper);
  text-align: left !important; min-width: 13rem; max-width: 16rem; padding: .3rem .6rem !important;
  font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 1px 0 0 var(--line);
}
thead .c-name { z-index: 3; }
tbody .c-name a { color: var(--ink); text-decoration: none; }
tbody .c-name a:hover { text-decoration: underline; }
tbody .c-name small { display: block; color: var(--muted); font-size: .72rem; }
.c-date { padding: 0 .5rem !important; color: var(--muted); white-space: nowrap; font-size: .78rem; text-align: center; }
.c-sum { padding: 0 .6rem !important; text-align: right; font-weight: 800; min-width: 3.5rem; background: var(--paper-2); }
thead .c-sum { background: var(--ink) !important; }
table.grid td.sat { background: var(--sat); }
table.grid td.sun { background: var(--sun); }
table.grid td.off { background: repeating-linear-gradient(135deg, #F7F4EE 0 4px, #EAE4D9 4px 8px); }
table.grid td.streak { background: var(--streak-soft); }
table.grid td.over { background: var(--alert-soft); }
table.grid td.over input { color: var(--alert); font-weight: 700; }
table.grid td.err { box-shadow: inset 0 0 0 2px var(--alert); }
table.grid input.h {
  width: 2.9rem; height: 2rem; border: 0; border-radius: 0; background: transparent;
  text-align: center; padding: 0; font-variant-numeric: tabular-nums;
}
table.grid input.h:focus { outline: none; background: var(--paper); box-shadow: inset 0 0 0 2px var(--accent); }
table.grid input.h:disabled { color: var(--ink); -webkit-text-fill-color: var(--ink); opacity: 1; cursor: default; }
table.grid tbody tr:hover > * { filter: brightness(.97); }

.c-conf { padding: 0 .6rem !important; white-space: nowrap; font-size: .8rem; background: var(--paper-2); text-align: left; }
thead .c-conf { background: var(--ink) !important; }
.conf-ok { font-weight: 600; color: var(--ok); }
.conf-ok::before { content: "✓ "; }
.link-btn { background: none; border: 0; padding: 0 .3rem; font: inherit; font-size: .8rem; color: var(--taupe-d); text-decoration: underline; cursor: pointer; }
.btn.tiny { padding: .15rem .5rem; font-size: .78rem; margin-left: .2rem; }
tr.locked td:not(.c-conf):not(.c-sum):not(.c-date):not(.off) { background-image: linear-gradient(rgba(63, 107, 69, .07), rgba(63, 107, 69, .07)); }
tr.locked input.h:disabled { color: var(--ink-2); cursor: not-allowed; }
.sw.lock { background: #E6ECE2; }
table.grid td.manual { background-image: linear-gradient(135deg, var(--accent) 0 5px, transparent 5px); }
table.grid td.sig-signed { box-shadow: inset 0 -3px 0 var(--ok); }
table.grid td.sig-disputed, table.grid td.sig-stale { box-shadow: inset 0 -3px 0 var(--alert); }
.sw.sig-signed { box-shadow: inset 0 -4px 0 var(--ok); background: #fff; }
.sw.sig-bad { box-shadow: inset 0 -4px 0 var(--alert); background: #fff; }
.sig-count { font-size: .75rem; color: var(--alert); margin-right: .4rem; }
.sig-count.all { color: var(--ok); }
.sig { font-size: .8rem; }
.sig.ok { color: var(--ok); font-weight: 600; }
.sig.bad { color: var(--alert); font-weight: 600; }
.sw.manual { background: linear-gradient(135deg, var(--accent) 0 5px, #fff 5px); }
.sign-summary { display: flex; align-items: center; gap: 1rem 2rem; flex-wrap: wrap; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1rem; }
.ss-main { flex: 1; min-width: 16rem; }
.ss-num { font-size: 1rem; color: var(--muted); }
.ss-num strong { font-size: 1.9rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.ss-label { color: var(--muted); font-size: .9rem; }
.ss-bar { height: 8px; background: var(--line-soft); border-radius: 99px; overflow: hidden; margin-top: .5rem; max-width: 26rem; }
.ss-bar i { display: block; height: 100%; background: var(--ok); }
.ss-filters { display: flex; gap: .4rem; flex-wrap: wrap; }
.ss-filters a { text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: .35rem .8rem; font-size: .88rem; background: var(--paper); }
.ss-filters a b { font-weight: 800; margin-left: .25rem; }
.ss-filters a.warn b { color: var(--taupe-d); }
.ss-filters a.bad b { color: var(--alert); }
.ss-filters a.good b { color: var(--ok); }
.ss-filters a:hover { border-color: var(--accent); }
.ss-filters a.on { background: var(--ink); border-color: var(--ink); color: #F4F1EB; }
.ss-filters a.on b { color: inherit; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: center; margin-top: .8rem; font-size: .85rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.sw { width: 14px; height: 14px; border: 1px solid var(--line); display: inline-block; }
.sw.sat { background: var(--sat); }
.sw.sun { background: var(--sun); }
.sw.off { background: repeating-linear-gradient(135deg, #F7F4EE 0 3px, #DDD5C8 3px 6px); }
.sw.over { background: var(--alert-soft); }
.sw.streak { background: var(--streak-soft); }
.status { margin-left: auto; font-weight: 600; }
.status.ok { color: var(--ok); }
.status.error { color: var(--alert); }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: .6rem 1rem; padding: .6rem 1rem; }
  .topbar nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .page { padding: 1rem; }
  .grid2 { grid-template-columns: 1fr; }
  input[type="search"] { min-width: 0; flex: 1; }
  .c-name { min-width: 9rem; }
  .c-date { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
