/* Pneuhotel – vlastné CSS bez frameworku, podľa návrhu obrazoviek. Tablet (1024 px) a mobil (390 px),
   ovládacie prvky aspoň 48 px. CSP zakazuje inline štýly, všetko je tu. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --accent: #C2410C;
  --accent-dark: #9A3412;
  --accent-soft: #FFF1E6;
  --accent-line: #FDBA8C;
  --accent-light: #FB923C;
  --ink: #1C1917;
  --ink-2: #44403C;
  --muted: #78716C;
  --line: #E7E5E4;
  --bg: #F5F5F4;
  --card: #FFFFFF;
  --side: #1C1917;
  --side-ink: #D6D3D1;
  --ok: #15803D;
  --ok-soft: #DCFCE7;
  --err: #B91C1C;
  --err-soft: #FEE2E2;
  --info: #1D4ED8;
  --info-soft: #DBEAFE;
  --radius: 12px;
  --tap: 48px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-size: 15px; line-height: 1.45; background: var(--bg); }
a { color: var(--accent-dark); }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -.015em; line-height: 1.2; }
h2 { font-size: 1.02rem; margin: 0 0 .75rem; }
code { font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
[hidden] { display: none !important; }

/* Logo: Pneu + hotel v akcente */
.logo { font-weight: 800; letter-spacing: -.02em; color: #fff; font-size: 1.15rem; }
.logo span { color: var(--accent-light); }
.logo-dark { color: var(--ink); }
.logo-dark span { color: var(--accent); }

/* Rozloženie */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: 0 0 216px; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 22px 12px 16px; position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { padding: 0 10px 22px; }
.nav-link {
  display: flex; align-items: center; min-height: var(--tap); padding: 0 12px; border-radius: 8px; margin-bottom: 2px;
  color: var(--side-ink); text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: #292524; color: #fff; }
.nav-link.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-link.disabled { opacity: .45; cursor: default; }
.nav-link.disabled:hover { background: none; color: var(--side-ink); }
.sidebar-footer { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #3A3532; font-size: .82rem; color: #A8A29E; }
.sidebar-footer strong { display: block; color: var(--side-ink); font-weight: 500; }
.btn-link { background: none; border: 0; color: var(--side-ink); padding: 0; min-height: 40px; cursor: pointer; font: inherit; text-decoration: underline; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.content { padding: 26px 28px 40px; max-width: 1280px; width: 100%; }

/* Hlavička stránky: nadpis vľavo, vyhľadávanie a akcie vpravo */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; font-size: .9rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.crumbs a { color: var(--accent); }
.head-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Vyhľadávanie */
.search { position: relative; width: 280px; max-width: 100%; }
.search input { width: 100%; }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); z-index: 20;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 28px rgba(0,0,0,.1); overflow: hidden; min-width: 300px;
}
.search-results:empty { display: none; }
.search-results a { display: block; padding: 10px 14px; min-height: var(--tap); text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a:focus { background: var(--accent-soft); }
.search-results .meta { display: block; color: var(--muted); font-size: .85rem; }
.search-results p { margin: 0; padding: 12px 14px; color: var(--muted); }

/* Karty */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card + .card, .stack > * + * { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.detail-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 16px; align-items: start; }
.empty-state { background: var(--card); border: 1px dashed #D6D3D1; border-radius: var(--radius); padding: 32px; text-align: center; }
.empty-state p { margin: .25rem 0; }
dl.facts { margin: 0; }
dl.facts dt { color: var(--muted); font-size: .8rem; margin-top: 10px; }
dl.facts dt:first-child { margin-top: 0; }
dl.facts dd { margin: 1px 0 0; overflow-wrap: anywhere; font-weight: 500; }
dl.facts dd.strong { font-weight: 700; }
.note { white-space: pre-line; color: var(--ink-2); margin: 0; }

/* Formuláre */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .label { font-weight: 600; font-size: .85rem; }
.hint { color: var(--muted); font-size: .82rem; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=number], input[type=time], select, textarea {
  font: inherit; min-height: var(--tap); padding: 10px 12px; border: 1px solid #D6D3D1; border-radius: 8px;
  background: #fff; color: var(--ink); width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--err); }
.field-error { color: var(--err); font-size: .85rem; margin: 2px 0 0; }
.field-error a { margin-left: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: var(--tap); padding-top: 12px; }
.check input, .check-inline input, .toggle input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.check label { font-weight: 500; }
.check-inline { display: inline-flex; gap: 8px; align-items: center; min-height: var(--tap); margin-right: 14px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); }
.toggle + .hint { margin-top: -6px; margin-bottom: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px;
  border-radius: 8px; border: 1px solid #D6D3D1; background: #fff; color: var(--ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #FAFAF9; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-block { width: 100%; }
.btn-small { min-height: 40px; padding: 0 14px; font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Filtre (čipy) */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .search { width: 260px; }
.nowrap { white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid #D6D3D1;
  background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip:disabled { opacity: .5; cursor: default; }

/* Otváracie hodiny */
.hours { width: 100%; border-collapse: collapse; }
.hours th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 600; padding: 4px; }
.hours td { padding: 4px; }
.hours td:first-child { font-weight: 600; white-space: nowrap; padding-right: 10px; }

/* Tabuľky */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: .78rem; color: var(--muted); font-weight: 600; background: #FAFAF9; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.name a { font-weight: 700; color: var(--ink); text-decoration: none; }
table.data td.name a:hover { text-decoration: underline; }
table.data .sub { display: block; color: var(--muted); font-size: .8rem; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

/* Zoznam riadkov v karte */
.rows { list-style: none; margin: 0 -20px; padding: 0; }
.rows > li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line); }
.rows .sub { display: block; color: var(--muted); font-size: .82rem; }

/* Štítky stavov */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #F0EFEE; color: var(--ink-2); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--accent-soft); color: var(--accent-dark); }
.badge-err { background: var(--err-soft); color: var(--err); }
.badge-info { background: var(--info-soft); color: var(--info); }
.plate { white-space: nowrap; font-weight: 700; letter-spacing: .02em; }

/* Vozidlá v detaile zákazníka */
.vehicle { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.vehicle + .vehicle { margin-top: 12px; }
.vehicle-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.vehicle-head .plate { font-size: 1.15rem; letter-spacing: .05em; }
.vehicle-head .vin { color: var(--muted); font-size: .78rem; }
.vehicle-sets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.set-box { border-radius: 8px; padding: 10px 12px; background: #F5F5F4; font-size: .85rem; color: var(--muted); }
.vehicle .actions { margin-top: 4px; }

/* Správy */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.flash p { margin: 0; }
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--err-soft); color: var(--err); }
.offline-bar { position: sticky; top: 0; z-index: 40; background: var(--err); color: #fff; padding: 10px 16px; text-align: center; font-weight: 600; }

/* História */
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history .when { color: var(--muted); font-size: .85rem; }
.history .diff { font-size: .88rem; color: var(--ink-2); overflow-wrap: anywhere; margin: 4px 0 0; padding-left: 18px; }
.history .diff s { color: var(--muted); }

/* Nastavenia */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.settings-grid + .settings-grid { margin-top: 16px; }
.settings-grid .span-2 { grid-column: 1 / -1; }
.invite { background: #FAFAF9; border-radius: 10px; padding: 14px; margin-top: 12px; }
.user-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.user-controls select { min-height: 40px; padding: 6px 10px; width: auto; }

/* Prihlásenie */
body.public { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.public-wrap { width: 100%; max-width: 400px; }
.public-wrap .logo { display: block; text-align: center; font-size: 1.9rem; margin-bottom: 22px; }
.public-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px 28px 24px; }
.public-card h1 { font-size: 1.35rem; margin-bottom: 18px; }
.public-card .center { text-align: center; margin: 14px 0 0; }
.tip-card { display: flex; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 16px; font-size: .85rem; color: var(--ink-2); }
.tip-card::before { content: ""; flex: 0 0 10px; height: 14px; margin-top: 3px; border: 2px solid var(--accent); border-radius: 3px; }

/* Nastavenia: dva stĺpce až na širokej obrazovke (otváracie hodiny majú 4 časy) */
@media (max-width: 1240px) {
  .settings-grid { grid-template-columns: 1fr; }
}

/* Úzka obrazovka: menu sa zbalí */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .mobilebar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px;
    background: var(--side); position: sticky; top: 0; z-index: 25;
  }
  .menu-toggle { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 8px; border: 1px solid #44403C; background: transparent; color: #fff; font: inherit; font-weight: 600; }
  .content { padding: 18px 16px 32px; }
  .grid-2, .detail-grid, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .head-tools, .search, .toolbar .search { width: 100%; }
  .head-tools .btn { flex: 1; }
  .hours thead { display: none; }
  .hours, .hours tbody, .hours tr, .hours td { display: block; width: 100%; }
  .hours tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .hours td:first-child { grid-column: 1 / -1; }
  table.data .hide-sm { display: none; }
  .vehicle-sets { grid-template-columns: 1fr; }
  .rows > li { flex-wrap: wrap; }
  h1 { font-size: 1.35rem; }
}

/* Sklad */
table.data.compact td { padding: 9px 12px; }
table.data td.num { text-align: right; white-space: nowrap; }
.locations { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.location { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.location.off { background: #FAFAF9; }
.location.off strong { color: var(--muted); }

/* Príjem sady (T08) */
.center { text-align: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-radio { position: relative; }
.chip-radio input { position: absolute; opacity: 0; pointer-events: none; }
.chip-radio:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-radio:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.has-error .chips .chip { border-color: var(--err); }
.receive-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.receive-side { position: sticky; top: 16px; }
.tread { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tread input { text-align: center; font-size: 1.15rem; font-weight: 700; }
.photo-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.photo-slot { aspect-ratio: 4 / 3; border: 1px dashed #D6D3D1; border-radius: 10px; display: grid; place-items: center; overflow: hidden; position: relative; background: #FAFAF9; }
.photo-slot.add { cursor: pointer; text-align: center; font-weight: 600; font-size: .85rem; color: var(--ink-2); background: #fff; }
.photo-slot.add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-slot.filled { border-style: solid; }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot.filled .btn { position: absolute; bottom: 6px; right: 6px; min-height: 32px; padding: 0 10px; font-size: .78rem; }
.vehicle-pick { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; }
.vehicle-pick .sub { display: block; color: var(--muted); font-size: .8rem; }
.plate.big { font-size: 1.15rem; letter-spacing: .05em; }
.location-card { border: 2px solid var(--accent); }
.loc-code { font-size: 2.4rem; font-weight: 800; color: var(--accent-dark); letter-spacing: .02em; line-height: 1.1; margin: 4px 0; }
#loc-picker select { margin: 10px 0 0; }
.location-card .btn { margin-top: 12px; }
#summary h2 { font-size: .95rem; margin-bottom: 6px; }
#summary div { margin-top: 2px; }
.flash.draft { background: var(--info-soft); color: var(--info); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Sady pri vozidle */
.set-box.stored { background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--ink-2); }
.set-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 2px; color: var(--ink); }
.thumbs { display: flex; gap: 6px; margin-top: 8px; }
.thumbs img { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; display: block; }

@media (max-width: 900px) {
  .receive-grid { grid-template-columns: 1fr; }
  .receive-side { position: static; }
}
@media (max-width: 600px) {
  .tread, .photo-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Prehľad skladu a detail sady (T09, T10) */
.tread-low, .tread-low strong { color: var(--err); }
a.set-box { display: block; text-decoration: none; color: inherit; }
a.set-box:hover { border-color: var(--accent); }
a.set-box:not(.stored) { border: 1px solid transparent; }
.rack-badge { background: var(--accent-soft); color: var(--accent-dark); border-radius: 10px; padding: 6px 14px; font-weight: 800; font-size: 1.5rem; letter-spacing: .02em; }
.rack-badge span { font-size: .8rem; font-weight: 600; }
dl.facts.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
dl.facts.grid-3 dt { margin-top: 0; }
.tread-box { background: #F5F5F4; border-radius: 10px; padding: 10px; text-align: center; }
.tread-box span { display: block; font-size: .78rem; color: var(--muted); }
.tread-box strong { font-size: 1.3rem; }
.table-wrap.flat { border: 0; margin: 0 -20px -18px; border-radius: 0 0 var(--radius) var(--radius); }
.btn-danger { color: var(--err); border-color: #FCA5A5; }
.btn-danger:hover { background: var(--err-soft); }
.confirm { background: #FAFAF9; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.confirm p { margin: 0 0 10px; font-weight: 600; }
@media (max-width: 600px) {
  dl.facts.grid-3 { grid-template-columns: 1fr 1fr; }
}
