:root {
  --bg: #f4f5f7;
  --panel: #fff;
  --text: #1a1d23;
  --muted: #6b7280;
  --line: #e3e6eb;
  --accent: #d5151f; /* kaufland červená */
  --accent-soft: #fdecec;
  --ok: #1c8a4c;
  --ok-soft: #e4f5ea;
  --warn: #c77800;
  --warn-soft: #fff3dc;
  --danger: #c62828;
  --danger-soft: #fde5e5;
  --info: #2b5fb3;
  --info-soft: #e6eefb;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--info); text-decoration: none; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 6px 12px; }
button:hover { background: #f7f8fa; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #b8121a; }
button.small { padding: 3px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=search], select, textarea { border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; background: #fff; }
textarea { width: 100%; min-height: 70px; resize: vertical; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 22px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 800; }
nav a { display: inline-block; padding: 7px 12px; border-radius: 7px; color: var(--text); margin-left: 4px; }
nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav a .badge { margin-left: 6px; }

main { max-width: 1400px; margin: 0 auto; padding: 18px 22px 60px; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 15px; margin: 22px 0 8px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; }
.tile.active { outline: 2px solid var(--accent); }
.tile .n { font-size: 26px; font-weight: 700; line-height: 1.1; }
.tile .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tile.red .n { color: var(--danger); }
.tile.orange .n { color: var(--warn); }
.tile.blue .n { color: var(--info); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #fafbfc; font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #fbfbfc; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.closed td { color: var(--muted); }
tr.cancelled td { color: var(--muted); text-decoration: line-through; }
tr.cancelled td.nostrike { text-decoration: none; }
tr.done td { background: var(--ok-soft); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-nova { background: var(--danger-soft); color: var(--danger); }
.b-potvrdena { background: var(--info-soft); color: var(--info); }
.b-vyroba { background: var(--warn-soft); color: var(--warn); }
.b-dodana { background: var(--ok-soft); color: var(--ok); }
.b-fakturovana { background: #eceff3; color: var(--muted); }
.b-zrusena { background: #eceff3; color: var(--muted); text-decoration: line-through; }
.b-change { background: var(--accent); color: #fff; }
.b-storno { background: var(--danger-soft); color: var(--danger); }
.b-termin { background: var(--warn-soft); color: var(--warn); }
.b-info { background: var(--info-soft); color: var(--info); }

.deadline { font-weight: 600; white-space: nowrap; }
.dl-over { color: var(--danger); }
.dl-soon { color: var(--warn); }
.dl-ok { color: var(--ok); }
.dl-none { color: var(--muted); font-weight: 400; }
.days { font-size: 11px; font-weight: 500; color: var(--muted); display: block; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar input[type=search] { min-width: 260px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; background: #fff; cursor: pointer; font-size: 13px; }
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }

.detail-head { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.spec { white-space: pre-line; color: var(--muted); font-size: 12px; }
details summary { cursor: pointer; color: var(--info); font-size: 12px; }
.changes li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.changes li:last-child { border-bottom: 0; }
.changes time { color: var(--muted); font-size: 12px; margin-right: 8px; }
.changes li.unseen { background: var(--warn-soft); margin: 0 -8px; padding: 6px 8px; border-radius: 6px; }

.drop { border: 2px dashed #c9ced6; border-radius: var(--radius); padding: 34px; text-align: center; color: var(--muted); background: #fff; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.results li { padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.results .imported { color: var(--ok); }
.results .duplicate { color: var(--muted); }
.results .error { color: var(--danger); }
code { background: #f0f2f5; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.empty { padding: 30px; text-align: center; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.warnbox { background: var(--warn-soft); border: 1px solid #f3d9a4; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.alertbox { background: var(--danger-soft); border: 1px solid #f2b8b8; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
@media (max-width: 800px) {
  main { padding: 12px; }
  .top { padding: 8px 12px; flex-wrap: wrap; gap: 6px; }
  .hide-m { display: none; }
}

.status-inline { border: 0; border-radius: 999px; padding: 3px 24px 3px 9px; font-size: 12px; font-weight: 600; cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%23666'/></svg>"); background-repeat: no-repeat; background-position: right 8px center; }

a.dl { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 7px; border: 1px solid var(--line); color: var(--info); font-size: 12px; font-weight: 600; white-space: nowrap; text-decoration: none; }
a.dl:hover { background: var(--info-soft); }
