/* ============ ZÁKLAD ============ */
:root{
  --bg:#faf8f6;
  --card:#ffffff;
  --text:#1f2937;
  --muted:#6b7280;
  --accent:#f39a3d;
  --accent-strong:#d67f24;
  --ring: rgba(243,154,61,0.35);
  --radius:16px;
  --shadow:0 10px 24px rgba(0,0,0,.06), 0 2px 6px rgba(0,0,0,.04);
}

*{ box-sizing:border-box; }
html, body{ height:100%; margin:0; padding:0; }

/* Layout */
body{
  min-height:100vh;
  display:flex;
  flex-direction:column;
  background:var(--bg);
  color:var(--text);
  font:16px/1.55 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Arial,sans-serif;
}
a{ color:inherit; }

.container{ width:min(1100px,92vw); margin-inline:auto; padding:24px 0; }

/* ============ HEADER (sticky) ============ */
.site-header{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-bottom:1px solid #eee;
}
.head-row{ display:flex; align-items:center; justify-content:space-between; gap:16px; }
.brand{ margin:0; letter-spacing:.5px; }
.main-nav{ display:flex; gap:10px; flex-wrap:wrap; }

/* ============ HLAVNÍ OBSAH ============ */
main{ flex:1; }

.card{
  background:var(--card);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:24px;
  border:1px solid #f1f1f1;
}

/* ============ FOOTER ============ */
.site-footer{
  margin-top:auto;
  border-top:1px solid #eee;
  color:var(--muted);
}

/* ============ TLAČÍTKA ============ */
.btn, a.btn, button.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:56px;
  padding:14px 24px;
  border-radius:16px;
  text-decoration:none;
  background:var(--accent);
  color:#fff;
  font-weight:700;
  letter-spacing:.3px;
  transition:background .15s ease, transform .1s ease, box-shadow .15s ease;
  box-shadow:0 6px 14px var(--ring);
  border:0;
  cursor:pointer;
  line-height:1;
}
.btn:hover{ background:var(--accent-strong); transform: translateY(-1px); }
.btn:focus{ outline:3px solid var(--ring); outline-offset:2px; }
.btn.active{ outline:3px solid var(--ring); }

/* Malá tlačítka */
.btn-small, a.btn-small, button.btn-small{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-height:36px;
  padding:6px 12px;
  border-radius:10px;
  background:#fff;
  color:var(--text);
  border:1px solid #ddd;
}

/* Ghost */
.btn-ghost{
  background:#fff;
  color:var(--text);
  box-shadow:none;
  border:1px solid #eee;
}
.btn-ghost:hover{ background:#f7f7f7; }

/* ============ FORMULÁŘE ============ */
form input, form select, form textarea, form button{
  width:100%;
  max-width:420px;
  display:block;
  margin:10px 0;
  padding:12px 14px;
  border-radius:10px;
  border:1px solid #ddd;
  font:inherit;
}
form button{
  background:var(--accent);
  color:#fff;
  border:none;
  font-weight:700;
}
form button:hover{ background:var(--accent-strong); }

/* ============ LOGIN (vystředění bez ohledu na HTML strukturu) ============ */
/* Pokud šablona nepoužívá .center-screen, postará se o centrování rovnou .login-card */
.center-screen{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--bg);
  padding:24px;
}
/* karta přihlášení – vždy doprostřed a s rozumným horním offsetem */
.login-card{
  max-width:520px;
  width:100%;
  background:var(--card);
  box-shadow:var(--shadow);
  border-radius:var(--radius);
  padding:32px;
  margin-inline:auto;                 /* vodorovné vystředění i bez flex parenta */
  margin-top:clamp(24px, 12vh, 120px);/* přibližné svislé vystředění, když .center-screen není k dispozici */
}

/* ============ RESPONSIVE ============ */
@media (max-width: 640px){
  .head-row{ flex-direction:column; align-items:flex-start; }
  .main-nav{ width:100%; }
}

/* ============ ADMIN ============ */
.admin-page { max-width:1100px; margin:24px auto; padding:0 16px; }
.admin-page h1 { margin-top:8px; }
.admin-page h2 { margin:16px 0 8px; }

.admin-page .toolbar { margin:12px 0; display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.admin-page .toolbar input[type="text"] { padding:8px; min-width:280px; }

.admin-page .table { width:100%; border-collapse:collapse; }
.admin-page .table th, .admin-page .table td { border:1px solid #e5e7eb; padding:8px; text-align:left; }
.admin-page .table th { background:#f8fafc; }

.admin-page .badge { display:inline-block; padding:2px 8px; border-radius:12px; font-size:12px; background:#e5e7eb; }
.admin-page .badge-on { background:#dcfce7; }
.admin-page .badge-off { background:#fee2e2; }

.admin-page .btn { padding:6px 10px; border:1px solid #d1d5db; border-radius:8px; background:#fff; cursor:pointer; text-decoration:none; }
.admin-page .btn.primary { background:#111827; color:#fff; border-color:#111827; }
.admin-page .btn.link { border:none; background:none; color:#2563eb; padding:0; }

.admin-page .card { border:1px solid #e5e7eb; border-radius:12px; padding:16px; background:#fff; max-width:640px; }
.admin-page label { display:block; margin-top:10px; }
.admin-page input[type="text"],
.admin-page input[type="email"],
.admin-page input[type="password"],
.admin-page select { width:100%; max-width:420px; padding:8px; }

.admin-page .checkbox { margin-top:8px; }
.admin-page .form-actions { margin-top:12px; display:flex; gap:8px; align-items:center; }
.admin-page .note { color:#065f46; margin:8px 0; }
.admin-page .error { color:#b91c1c; margin:8px 0; }

/* HEADER doplňky */
.main-nav .btn.active { background:var(--accent-strong); color:#fff; }
.user-info { display:inline-block; padding:8px 12px; font-size:14px; color:var(--muted); }
.btn-ghost.active { background:#eee; }

/* UTILITIES */
.mt-10{ margin-top:10px; }
.mt-14{ margin-top:14px; }
.btn-row{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }

/* TABULKY */
.table-wrap{ overflow:auto; width:100%; }
.table{ width:100%; border-collapse:collapse; }
.table th,.table td{ padding:8px; border-bottom:1px solid #eee; text-align:left; }
.table thead th{ border-bottom:1px solid #eee; }
.table-actions{ width:1%; white-space:nowrap; }
.table th.num-cell,.table td.num-cell{
  text-align:right;
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
}
.table input.num-input{
  text-align:right;
  font-variant-numeric:tabular-nums;
  width:12ch;
}

/* FORM GRID */
.form-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:12px; }
.checkbox-inline{ display:flex; align-items:center; gap:8px; }

/* INACTIVE ROW */
table tr.inactive{ background-color:#f9f9f9; color:#888; }
table tr.inactive a{ color:#888; }

/* BADGES */
.badge{ display:inline-block; padding:2px 8px; border-radius:10px; font-size:.85em; font-weight:600; color:#fff; }
.badge-ok{ background-color:#28a745; }
.badge-nok{ background-color:#dc3545; }

/* DETAIL */
.detail-card{ max-width:800px; margin:0 auto; }
.detail-form{ display:flex; gap:20px; flex-wrap:wrap; }
.detail-left,.detail-right{ flex:1; min-width:250px; }

.detail-form .form-row{ display:flex; align-items:center; gap:12px; margin:8px 0; flex-wrap:nowrap; }
.detail-form .form-row>label{ flex:0 0 160px; margin:0; font-weight:700; }
.detail-form .form-row input[type="text"],
.detail-form .form-row textarea,
.detail-form .form-row select{
  flex:1 1 auto;
  width:auto;
  max-width:none;
  display:inline-block;
  margin:0;
  padding:6px;
  border:1px solid #ccc;
  border-radius:6px;
  font-size:.95em;
  min-width:0;
}
.detail-form input[disabled]{ background:#f9fafb; color:#6b7280; }

.detail-form--single{ display:block; max-width:820px; margin:0 auto; }
.detail-form--single .form-row{ display:flex; align-items:center; gap:12px; margin:10px 0; }
.detail-form--single .form-row>label{ flex:0 0 180px; margin:0; font-weight:700; }
.detail-form--single .form-row input[type="text"],
.detail-form--single .form-row textarea,
.detail-form--single .form-row select{
  flex:1 1 auto;
  width:auto !important;
  max-width:none !important;
  display:inline-block !important;
  margin:0;
  min-width:0;
}

.sep{ border:0; border-top:1px solid #eee; margin:14px 0; }

.detail-buttons{ display:flex; gap:12px; margin-top:20px; flex-wrap:wrap; }
.detail-buttons .btn{ flex:0 0 220px; text-align:center; min-height:56px; }
@media (max-width:640px){ .detail-buttons .btn{ flex:1 0 160px; } }

.table th{ position:relative; }
.table th a{ display:inline-block; padding-right:16px; text-decoration:none; }
.table th a:hover{ text-decoration:underline; }
.table th.sorted-asc a::after,
.table th.sorted-desc a::after{
  content:"";
  position:absolute;
  right:4px;
  top:50%;
  margin-top:-4px;
  border-left:4px solid transparent;
  border-right:4px solid transparent;
}
.table th.sorted-asc a::after{ border-bottom:6px solid #666; }
.table th.sorted-desc a::after{ border-top:6px solid #666; }

.table-actions{ width:70px; white-space:nowrap; text-align:center; }
.table-actions a{ margin:0 4px; font-size:1.1em; }
.btn>*{ vertical-align:middle; }

.active-warehouse-badge{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px; border-radius:12px;
  background:#fef3c7; color:#92400e; border:1px solid #fde68a; font-size:.9em;
}
.active-warehouse-badge strong{ font-weight:800; }

/* ===== Scoped extracted CSS (bez přepisu oranžové) ===== */
.admin-page{
  --bg:#f8fafc; --card:#ffffff; --muted:#6b7280;
  --border:#e5e7eb; --ink:#0f172a;
}

.admin-page body{ background:var(--bg); color:var(--ink); }
.admin-page .wrap{ max-width:1200px; margin:24px auto; padding:0 16px; }
.admin-page .grid{ display:grid; grid-template-columns:1fr; gap:16px; }
@media (min-width:1100px){ .admin-page .grid{ grid-template-columns:1fr 1fr; } }
.admin-page .card{ background:var(--card); border:1px solid var(--border); border-radius:14px; padding:14px 16px; }
.admin-page h1{ margin:6px 0 14px; font-size:22px; }
.admin-page h2{ margin:6px 0 10px; font-size:18px; }
.admin-page details{ border:1px dashed var(--border); border-radius:12px; padding:8px 10px; background:#fff; }
.admin-page details summary{ cursor:pointer; font-weight:600; }
.admin-page .muted{ color:var(--muted); }
.admin-page .pill{ display:inline-block; padding:3px 8px; border-radius:999px; border:1px solid var(--border); background:#f3f4f6; font-size:12px; }

.table .num-cell { text-align:right; font-variant-numeric:tabular-nums; }
#cenik input.num { width:12ch; text-align:right; }
.rowform { margin:0; }
.sorted-asc a::after { content:" ▲"; font-size:.85em; color:#888; }
.sorted-desc a::after { content:" ▼"; font-size:.85em; color:#888; }

@media print {
  header,.site-header,.site-footer,.detail-buttons,form[enctype]{ display:none!important; }
  #printArea{ box-shadow:none; border:none; }
  body{ background:#fff; }
}
/* --- Admin UI vylepšení --- */
.btn.sm { padding: 4px 10px; font-size: 0.875rem; line-height: 1.2; }
.btn.link { background: transparent; border: 0; padding: 0 6px; }
.table td, .table th { vertical-align: middle; }
.table .min { white-space: nowrap; width: 1%; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.inline { display: inline; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-2col .form-actions { grid-column: 1 / -1; }
.input { width: 100%; }
.checkbox { display: flex; gap: 8px; align-items: center; user-select: none; }
.table input[type="checkbox"] { transform: scale(1.05); }
/* --- Tabulky: jednotný bílý podklad a ořez --- */
.table-responsive {
  background: #fff;
  border: 1px solid #e9edf3;
  border-radius: 14px;
  padding: 0;              /* žádné vnitřní okraje */
  overflow: auto;          /* scrolly uvnitř, ať nic nevyteče ven */
  margin: 8px 0 0 0;       /* drobný odstup od nadpisu */
}

/* Tabulka musí vyplnit šířku a nesmí mít mezery */
.table {
  width: 100%;
  border-collapse: collapse;   /* zruší mezery mezi buňkami */
  margin: 0;                   /* žádný posun tabulky vůči bílému pozadí */
  background: transparent;     /* podklad bere wrapper */
}

/* Buňky: konzistentní výška/zarovnání */
.table th, .table td {
  padding: 10px 12px;
  vertical-align: middle;
}

/* Hlava tabulky má jemný odlišný podklad (ne „druhé bílé plátno“) */
.table thead th {
  background: #f7f9fc;
}

/* Lepší ořez rožků u tabulky uvnitř wrapperu */
.table-responsive > table {
  border-radius: 14px;
  overflow: hidden; /* na některých prohlížečích je třeba dát i tabulce */
}

/* Drobnosti z minula – zmenšená tlačítka, zarovnání */
.btn.sm { padding: 4px 10px; font-size: .875rem; line-height: 1.2; }
.btn.link { background: transparent; border: 0; padding: 0 6px; }
.table .min { white-space: nowrap; width: 1%; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.inline { display: inline; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-2col .form-actions { grid-column: 1 / -1; }
.input { width: 100%; }
.checkbox { display: flex; gap: 8px; align-items: center; user-select: none; }
.table input[type="checkbox"] { transform: scale(1.05); }
/* === Fullwidth tabulka uživatelů === */
.container.fullwidth {
  max-width: none;
  width: 100%;
  padding: 0;
}

/* Sekce přes celou stránku */
.table-bleed {
  width: 100%;
  background: #fff;
  margin-top: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border-top: 1px solid #e0e4ea;
  border-bottom: 1px solid #e0e4ea;
}

.table-bleed__head {
  padding: 12px 24px;
  border-bottom: 1px solid #e0e4ea;
}

.table-bleed__head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.table-bleed__body {
  overflow-x: auto;
}

.table-bleed__body table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  margin: 0;
}

/* Styl buněk */
.table th, .table td {
  padding: 10px 12px;
  vertical-align: middle;
  border-bottom: 1px solid #f0f2f5;
}

.table thead th {
  background: #f8fafc;
  font-weight: 600;
  text-align: left;
}

.table tr:hover {
  background: #fdfdfd;
}

/* Zarovnání */
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }

/* Checkboxy a tlačítka */
.table input[type="checkbox"] {
  transform: scale(1.1);
  cursor: pointer;
}
.btn.sm {
  padding: 4px 8px;
  font-size: 0.85rem;
}
.btn.link {
  background: none;
  border: none;
  color: #0056d6;
  text-decoration: underline;
  cursor: pointer;
}
.btn.link:hover { color: #003f9e; }
/* === Fullwidth tabulka === */
.container.fullwidth { max-width:none; width:100%; padding:0; }
.table-bleed { width:100%; background:#fff; margin-top:16px; box-shadow:0 2px 8px rgba(0,0,0,.04); border-top:1px solid #e0e4ea; border-bottom:1px solid #e0e4ea; }
.table-bleed__head { padding:12px 24px; border-bottom:1px solid #e0e4ea; }
.table-bleed__head h2 { margin:0; font-size:1.1rem; font-weight:600; }
.table-bleed__body { overflow-x:auto; }
.table-bleed__body table { width:100%; border-collapse:collapse; margin:0; background:transparent; }

.table th, .table td { padding:10px 12px; vertical-align:middle; border-bottom:1px solid #f0f2f5; }
.table thead th { background:#f8fafc; font-weight:600; text-align:left; }
.table .min { white-space:nowrap; width:1%; }
.center { text-align:center; }
.right { text-align:right; }
.nowrap { white-space:nowrap; }
.inline { display:inline; }

/* Checkboxy */
.table input[type="checkbox"] { transform:scale(1.05); cursor:pointer; }

/* --- Mini tlačítka pod sebou v "Akce" --- */
.btn-group-col { display:flex; flex-direction:column; gap:4px; min-width:84px; }
.btn { cursor:pointer; }
.btn.xs { padding:2px 6px; font-size:.78rem; line-height:1.1; border-radius:4px; }
.btn.block { display:block; width:100%; text-align:left; }
.btn.link { background:none; border:none; color:#0056d6; text-decoration:underline; padding-left:0; padding-right:0; }
.btn.link:hover { color:#003f9e; }

/* Toolbar drobnější */
.toolbar .btn.xs { margin-left:6px; }
.input { width:100%; }

/* Volitelně zmenši výšku řádků na velkých seznamech */
.table tr { height: 38px; }
/* === Minimalistické ikonové akce === */
.icon-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: #1a73e8;
  text-decoration: none;
  transition: transform 0.15s ease, color 0.15s ease;
}

.icon-btn:hover,
.icon-btn:focus {
  color: #0c47a1;
  transform: scale(1.15);
}

.icon-btn:active {
  transform: scale(0.95);
}

/* tooltip (nativní title) – vylepšíme jemnou pozicí */
.icon-btn[title] {
  position: relative;
}

.icon-btn[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 120%;
  top: 50%;
  transform: translateY(-50%);
  background: #222;
  color: #fff;
  font-size: 0.75rem;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 10;
  opacity: 0.9;
}

/* Další zarovnání tabulky */
.table td.nowrap { vertical-align: middle; }
.table th.min, .table td.min { width: 1%; white-space: nowrap; }
/* dlaždice pro modulové menu */
.grid-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.tile {
  display: block;
  background: #fff;
  border: 1px solid #e6eaf2;
  border-radius: 12px;
  padding: 14px;
  text-decoration: none;
  color: inherit;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
  border-color: #d9deea;
}
.tile-ico { font-size: 26px; line-height: 1; margin-bottom: 6px; }
.tile-title { font-weight: 600; margin-bottom: 4px; }
.tile-desc { font-size: .9rem; color: #58627a; }

