/* WDS | Trikopick.Eu – styly přihlášení a systému */
:root {
  --ink: #26282B;
  --deep: #1C1D20;
  --steel: #3A3D42;
  --mid: #55585E;
  --line: #8A8D93;
  --mist: #B9BBBF;
  --paper: #E9E8E6;
  --white: #FFFFFF;
  --orange: #F26A1B;
  --orange-ink: #A63F05;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-head: 'Space Grotesk', system-ui, sans-serif;
  --gutter: clamp(20px, 4vw, 48px);
}

* { box-sizing: border-box; }
/* Skryté prvky zůstanou skryté i u tříd, které nastavují display (např. .btn). */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }
a:focus-visible, input:focus-visible, button:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; text-wrap: balance; }
p { margin: 0; }

.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); }

/* Tlačítka */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 28px; border-radius: 6px; border: 1px solid transparent;
  font-weight: 600; font-size: 16px;
}
.btn-main { background: var(--orange); color: var(--deep); border: 0; }
.btn-main:hover { filter: brightness(1.08); }
.btn-small { min-height: 44px; padding: 0 20px; }

/* Značka */
.brand { font-family: var(--font-head); font-weight: 700; font-size: 26px; letter-spacing: -0.01em; color: var(--white); }
.brand span { color: var(--orange); }
.brand .sep { color: var(--line); font-weight: 500; margin: 0 .35em; }

/* Přihlášení */
.auth { display: flex; flex-wrap: wrap; min-height: 100vh; }
.auth-side { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 48px; padding: clamp(28px, 5vw, 64px); background: var(--ink); color: var(--white); border-bottom: 6px solid var(--orange); }
.auth-side h1 { font-weight: 700; font-size: clamp(34px, 4.5vw, 52px); line-height: 1.06; letter-spacing: -0.025em; }
.auth-side .copy { display: flex; flex-direction: column; gap: 20px; max-width: 480px; }
.auth-side .back { font-size: 15px; color: var(--mist); }
.auth-main { flex: 1 1 420px; min-width: 0; display: flex; align-items: center; justify-content: center; padding: clamp(28px, 5vw, 64px); }
.auth-box { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 28px; }
.auth-box h2 { font-weight: 700; font-size: 34px; line-height: 1.1; letter-spacing: -0.02em; }
.muted { font-size: 16px; line-height: 1.5; color: var(--mid); }
.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 600; }
.field input {
  width: 100%; min-height: 48px; padding: 0 14px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 6px;
}
.message { font-size: 15px; line-height: 1.5; min-height: 22px; }
.message.error { color: #9C2B00; font-weight: 500; }
.message.ok { color: var(--ink); }

/* Dashboard */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 40px; padding: 28px 20px; background: var(--ink); color: var(--white); }
.sidebar .brand { font-size: 24px; padding: 0 8px; }
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.side-nav button {
  display: flex; align-items: center; width: 100%; min-height: 48px; padding: 0 14px;
  border: 0; border-radius: 6px; background: transparent; color: var(--mist);
  font-size: 16px; font-weight: 600; text-align: left;
}
.side-nav button.active { background: var(--orange); color: var(--deep); }
.side-user { display: flex; flex-direction: column; gap: 12px; margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--steel); }
.side-user .name { font-size: 15px; font-weight: 600; word-break: break-word; }
.side-user button { align-self: flex-start; padding: 0; border: 0; background: none; color: var(--mist); font-size: 15px; font-weight: 500; }
.side-user button:hover { color: var(--white); }
.content { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 32px; padding: clamp(20px, 3.5vw, 48px); }
.content-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.content h1 { font-weight: 700; font-size: clamp(28px, 3.5vw, 38px); line-height: 1.1; letter-spacing: -0.02em; }
.status { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 20px; background: var(--white); font-size: 14px; font-weight: 600; }
.status i { width: 10px; height: 10px; border-radius: 5px; background: var(--line); }
.status.ok i { background: var(--orange); }
.stats { display: flex; flex-wrap: wrap; gap: 16px; }
.stat { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 20px 22px; background: var(--white); border-radius: 8px; }
.stat .k { font-size: 14px; color: var(--mid); }
.stat .v { font-family: var(--font-head); font-weight: 700; font-size: 30px; line-height: 1.1; word-break: break-word; }
.panel[hidden] { display: none; }
.table-box { overflow-x: auto; background: var(--white); border-radius: 8px; }
table { width: 100%; min-width: 560px; border-collapse: collapse; }
th { padding: 14px 22px; background: var(--ink); color: var(--white); font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; text-align: left; }
td { padding: 14px 22px; border-bottom: 1px solid var(--paper); font-size: 15px; }
.note { padding: 20px 22px; background: var(--white); border-radius: 8px; font-size: 15px; line-height: 1.6; color: var(--mid); }

/* Upozornění na ukázkový režim */
.banner { padding: 14px 18px; background: #FFE3D1; color: #5C2200; border-radius: 8px; font-size: 15px; line-height: 1.5; }
.banner[hidden] { display: none; }

/* Přidání záznamu */
.add-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-top: 24px; }
.add-form[hidden] { display: none; }
.add-form .field { flex: 1 1 260px; min-width: 0; }

/* Dashboard: tlačítka v tabulce a na světlém podkladu */
.btn-ghost-dark { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-ghost-dark:hover { background: var(--white); }
.row-action { min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--orange-ink); font-weight: 600; font-size: 15px; }
.row-action:hover { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Logo: znak před nápisem */
.brand { display: inline-flex; align-items: center; }
.brand img { width: 1.15em; height: 1.15em; flex: none; margin-right: 0.4em; }

/* ===== Systém WDS ===== */
.side-nav button { gap: 12px; transition: background .2s ease, color .2s ease; }
.side-nav button:hover:not(.active) { background: var(--steel); color: var(--white); }
.side-nav button[hidden] { display: none; }
.side-nav svg { flex: none; }
.side-role { font-size: 13px; color: var(--mist); }
.side-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }

.stat .sub { font-size: 13px; color: var(--mid); }
.stat.accent { background: var(--ink); color: var(--white); }
.stat.accent .k, .stat.accent .sub { color: var(--mist); }
.stat.accent .v { color: var(--orange); }

.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.toolbar .field { flex: 0 1 180px; min-width: 140px; }
.toolbar .grow { flex: 1 1 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); font-size: 15px; font-weight: 500; }
.chip:hover { background: var(--white); }

.field select, .field textarea { width: 100%; padding: 0 14px; font: inherit; font-size: 16px; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 6px; }
.field select { min-height: 48px; }
.field textarea { min-height: 96px; padding: 12px 14px; resize: vertical; }
.field.check { flex-direction: row; align-items: center; gap: 12px; min-height: 48px; }
.field.check input { width: 22px; min-height: 0; height: 22px; accent-color: var(--orange); }
.field.check label { font-size: 16px; }

/* Upozornění na STK */
.alerts { display: grid; gap: 8px; }
.alert { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 18px; border-radius: 8px; background: #FFE3D1; color: #5C2200; font-size: 15px; line-height: 1.5; }
.alert.expired { background: #9C2B00; color: var(--white); }
.alert b { font-weight: 700; }

/* Objednávky pod sebou */
.day-head { margin-top: 8px; font-family: var(--font-head); font-weight: 600; font-size: 18px; color: var(--mid); }
.orders { display: grid; gap: 12px; }
.ord { display: flex; flex-wrap: wrap; gap: 16px 24px; padding: 20px 22px; border-radius: 12px; background: var(--white); border-left: 6px solid var(--orange); }
.ord.paid { border-left-color: var(--line); }
.ord-main { flex: 1 1 320px; min-width: 0; display: grid; gap: 6px; align-content: start; }
.ord-main h3 { font-weight: 600; font-size: 20px; line-height: 1.25; }
.ord-main .addr { font-size: 16px; }
.ord-main .what { font-size: 15px; line-height: 1.5; white-space: pre-wrap; }
.ord-main .meta { font-size: 14px; color: var(--mid); }
.ord-main a { color: var(--orange-ink); font-weight: 600; }
.ord-side { flex: 0 1 220px; min-width: 0; display: grid; gap: 10px; align-content: start; justify-items: start; }
.price { font-family: var(--font-head); font-weight: 700; font-size: 28px; line-height: 1.1; white-space: nowrap; }
.paid-box { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; font-weight: 600; cursor: pointer; }
.paid-box input { width: 24px; height: 24px; accent-color: var(--orange); }
.ord-actions { display: flex; flex-wrap: wrap; gap: 0 4px; margin-left: -12px; }

td .sub { display: block; margin-top: 2px; font-size: 13px; color: var(--mid); }
td.strong { font-weight: 600; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { display: flex; flex-wrap: nowrap; justify-content: flex-end; gap: 0 4px; white-space: nowrap; }
.row-action.danger { color: #9C2B00; }
.empty { padding: 28px; border-radius: 12px; background: var(--white); color: var(--mid); font-size: 16px; line-height: 1.6; }
.empty[hidden], .table-box[hidden], .orders[hidden] { display: none; }
.empty .btn { margin-top: 14px; }
.table-box { position: relative; }

.pill { display: inline-block; padding: 4px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.hotove { background: #FFE3D1; color: #7A2E00; }
.pill.faktura { background: var(--ink); color: var(--white); }
.pill.ok { background: var(--paper); color: var(--mid); }
.pill.soon { background: #FFE3D1; color: #7A2E00; }
.pill.expired { background: #9C2B00; color: var(--white); }
.pill.off { background: var(--paper); color: var(--mid); }

/* Moje auto */
.car { display: grid; gap: 20px; padding: 24px; border-radius: 12px; background: var(--white); }
.car h2 { font-family: var(--font-head); font-weight: 700; font-size: 28px; }
.car dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px 24px; margin: 0; }
.car dt { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mid); }
.car dd { margin: 4px 0 0; font-size: 18px; word-break: break-word; }

/* Okno pro přidání a úpravu */
dialog { width: calc(100% - 32px); max-width: 560px; max-height: calc(100% - 32px); padding: 0; border: 0; border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .55); }
dialog::backdrop { background: rgba(28, 29, 32, .65); }
dialog form { display: grid; gap: 20px; padding: 28px; }
dialog h2 { font-family: var(--font-head); font-weight: 700; font-size: 26px; letter-spacing: -0.02em; }
.dlg-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dlg-fields .field { min-width: 0; }
.dlg-fields .field.wide { grid-column: 1 / -1; }
@media (max-width: 520px) { .dlg-fields { grid-template-columns: minmax(0, 1fr); } }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.hint { font-size: 13px; color: var(--mid); }

/* Telefon: menu nahoře */
@media (max-width: 800px) {
  .sidebar { flex: none; width: 100%; gap: 16px; padding: 16px 20px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav button { width: auto; flex: 1 1 120px; min-height: 44px; justify-content: center; }
  .side-user { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-top: 0; padding: 12px 0 0; }
}
@media print {
  .sidebar, .toolbar, .ord-actions, .row-action, .rz-tools, .addr-tools, .paid-box input, #add-rozvoz, .alerts { display: none !important; }
  body { background: #fff; }
  .rz { break-inside: avoid; border: 1px solid var(--mist); }
}
.field[hidden], .alerts[hidden], .stats[hidden] { display: none; }
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-content: start; }
.panel[hidden] { display: none; }
.panel > .content-head, .panel > .muted, .panel > .message { margin: 0; }

/* Rozvozy: den → rozvoz → objednávky */
.rozvozy { display: grid; gap: 16px; }
.rozvozy[hidden] { display: none; }
.rz { display: grid; gap: 16px; padding: 22px; border-radius: 12px; background: var(--white); border-top: 6px solid var(--orange); }
.rz-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.rz-title { flex: 1 1 280px; min-width: 0; display: grid; gap: 6px; }
.rz-title h3 { font-weight: 700; font-size: 22px; line-height: 1.2; }
.rz-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 15px; color: var(--mid); }
.rz-meta b { color: var(--ink); font-weight: 600; }
.rz-note { font-size: 15px; color: var(--mid); white-space: pre-wrap; }
.rz-sum { flex: 0 1 auto; display: grid; gap: 4px; justify-items: end; text-align: right; }
.rz-sum .sub { font-size: 14px; color: var(--mid); }
.rz-sum .sub.due { color: #9C2B00; font-weight: 600; }
.rz-orders { display: grid; gap: 10px; }
.rz .ord { background: #F5F4F2; border-radius: 10px; padding: 16px 18px; }
.rz-empty { padding: 16px 18px; border-radius: 10px; background: #F5F4F2; color: var(--mid); font-size: 15px; }
.rz-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ord-main h4 { font-family: var(--font-head); font-weight: 600; font-size: 19px; line-height: 1.3; margin: 0; }
.ord-n { color: var(--orange-ink); }
.ord .price { font-size: 24px; }
.lines { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; gap: 2px 16px; font-size: 15px; line-height: 1.45; }
.lines .l-name { font-weight: 600; min-width: 0; }
.lines .l-qty { color: var(--mid); font-variant-numeric: tabular-nums; }
.lines .l-sum { min-width: 90px; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  .rz { padding: 16px; }
  .rz-sum { justify-items: start; text-align: left; }
  .lines li { grid-template-columns: minmax(0, 1fr) auto; }
  .lines .l-name { grid-column: 1 / -1; }
}

/* Formulář objednávky: řádky zboží */
dialog.wide { max-width: 820px; }
.radky { display: grid; gap: 10px; }
.radky-label { font-size: 14px; font-weight: 600; }
.radky-rows { display: grid; gap: 10px; }
.radek { display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(0, 1fr) minmax(76px, .8fr) minmax(0, 1.2fr) minmax(0, .9fr) auto; gap: 10px; align-items: end; padding: 12px; border-radius: 8px; background: var(--white); }
.radek .field label { font-size: 13px; }
.r-end { display: flex; align-items: center; gap: 4px; min-height: 48px; }
.r-sum { min-width: 90px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.radky-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.radky-total { font-size: 17px; }
.radky-total strong { font-family: var(--font-head); font-size: 22px; }
@media (max-width: 640px) {
  .radek { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .radek .r-f-nazev { grid-column: 1 / -1; }
  .r-end { grid-column: 1 / -1; justify-content: space-between; }
  .r-sum { text-align: left; }
}

/* Oprávnění účtu */
fieldset.prava { margin: 0; padding: 14px 16px; border: 1px solid var(--mist); border-radius: 8px; gap: 4px; }
fieldset.prava legend { padding: 0 6px; font-size: 14px; font-weight: 600; }
fieldset.prava .field.check { min-height: 40px; }

/* Dokončený rozvoz */
.rz.done { border-top-color: var(--line); }
.rz.done .rz-title h3 { color: var(--mid); }
.pill.done { background: var(--ink); color: var(--white); font-family: var(--font-body); vertical-align: middle; }

/* Navigace a kopírování */
.addr-tools { display: flex; flex-wrap: wrap; gap: 0 4px; margin-left: -12px; }
.row-action.link { display: inline-flex; align-items: center; }

/* Našeptávač adres */
.suggest { list-style: none; margin: -4px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .35); }
.suggest li { padding: 10px 12px; border-radius: 4px; font-size: 15px; line-height: 1.35; cursor: pointer; }
.suggest li:hover, .suggest li[aria-selected="true"] { background: #FFE3D1; }

/* Balíky k naložení a vyložení */
.pill.bal { margin-left: 10px; background: #FFE3D1; color: #7A2E00; font-family: var(--font-body); vertical-align: middle; }
.rz-meta .baliky b { color: var(--orange-ink); }
.l-bal { color: var(--orange-ink); font-weight: 600; }
.field select.r-jednotka { padding: 0 8px; }
