* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: #222;
  background: #fff;
  font-size: 14px;
}

/* ---- Horní lišta ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #2c3e50;
  color: #fff;
  padding: 10px 18px;
}
.topbar a, .topbar strong { color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.topbar select { padding: 3px 6px; }
.admin-link { text-decoration: none; }
.admin-link:hover { text-decoration: underline; }

/* ---- Rozložení ---- */
.layout { display: flex; align-items: flex-start; }
.sidebar {
  width: 270px;
  flex: 0 0 270px;
  background: #eceff1;
  border-right: 1px solid #d0d4d8;
  padding: 14px;
  min-height: calc(100vh - 48px);
}
.content { flex: 1; padding: 14px 18px; min-width: 0; }

/* ---- Filtry ---- */
.facet {
  margin-bottom: 8px;
  border: 1px solid #d8dce0;
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}
.facet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #2c3e50;
  cursor: pointer;
  user-select: none;
}
.facet-head:hover { background: #f3f6f8; }
.facet-head .caret {
  width: 0; height: 0;
  border-left: 5px solid #7a8288;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .15s;
  flex: 0 0 auto;
}
.facet.open .facet-head .caret { transform: rotate(90deg); }
.facet-body {
  display: none;
  padding: 4px 12px 10px;
  border-top: 1px solid #eceff1;
  max-height: 280px;
  overflow-y: auto;
}
.facet.open .facet-body { display: block; }
.facet label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  cursor: pointer;
}
.facet label:hover { color: #2980b9; }
.facet .fc-count { margin-left: auto; color: #7a8288; font-size: 12px; }
.facet label.disabled { color: #b0b6bb; cursor: default; }
.reset-btn, .save-btn {
  background: #2980b9; color: #fff; border: 0;
  padding: 8px 14px; border-radius: 3px; cursor: pointer; font-size: 13px;
}
.reset-btn:hover, .save-btn:hover { background: #2471a3; }
.reset-btn { width: 100%; margin-top: 8px; }

/* ---- Toolbar ---- */
.toolbar {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.toolbar input[type=text] {
  flex: 1; min-width: 220px;
  padding: 7px 10px; border: 1px solid #cfd4d8; border-radius: 3px;
}
.toolbar input[type=number] { padding: 6px; border: 1px solid #cfd4d8; border-radius: 3px; }
.instock { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.show-desc { display: flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.count { margin-left: auto; color: #7a8288; }

/* ---- Produkty ---- */
.products { display: flex; flex-direction: column; gap: 12px; }
.card {
  border: 1px solid #e1e4e8; border-radius: 5px;
  padding: 12px 14px; background: #fff;
}
.card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; flex-wrap: wrap;
}
.card-title { font-size: 16px; font-weight: 600; color: #2c3e50; }
.card-code { color: #7a8288; font-weight: 400; font-size: 13px; margin-left: 8px; }
.card-meta { text-align: right; white-space: nowrap; }
.stock-total { font-size: 15px; font-weight: 700; }
.stock-total.ok { color: #1e8449; }
.stock-total.zero { color: #b03a2e; }
.rrp { color: #555; font-size: 13px; }
.stock-price { color: #b9770e; font-size: 13px; font-weight: 600; }

.card-desc {
  margin: 6px 0 2px;
  color: #4a5560;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
}

.tags-row { margin: 6px 0; }
.tag-chip {
  display: inline-block; background: #eef2f5; color: #4a5560;
  border-radius: 10px; padding: 1px 9px; font-size: 11px; margin: 2px 4px 2px 0;
}
/* dvouřádkový chip: název atributu nad hodnotou */
.tag-chip2 {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  background: #eef2f5; border-radius: 6px; padding: 3px 10px; margin: 2px 5px 2px 0;
  vertical-align: top;
}
.tag-chip2 .tc-name {
  font-size: 9px; font-weight: 700; color: #aab0b6;
  text-transform: uppercase; letter-spacing: .03em; line-height: 1.2;
}
.tag-chip2 .tc-val { font-size: 12px; color: #3a4550; font-weight: 500; line-height: 1.3; }

/* rozpad podle barvy */
.colors { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.color-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-top: 1px solid #f0f2f4;
}
.swatch {
  width: 16px; height: 16px; border-radius: 3px; border: 1px solid #00000022;
  flex: 0 0 16px;
}
.color-photo {
  flex: 0 0 auto; display: inline-flex; line-height: 0;
}
.color-photo img {
  width: 64px; height: 64px; object-fit: contain;
  background: #f6f8fa; border: 1px solid #e1e4e8; border-radius: 4px;
}
.color-name { min-width: 150px; font-weight: 500; }
.color-stock { color: #555; }
.color-stock.zero { color: #b03a2e; }
.sizes { margin-left: auto; display: flex; flex-wrap: wrap; gap: 5px; }
.size-pill {
  font-size: 11px; padding: 1px 7px; border-radius: 3px;
  background: #f4f6f8; border: 1px solid #e1e4e8; color: #555;
}
.size-pill.zero { color: #b8b8b8; background: #fafafa; }
.size-pill b { color: #2c3e50; }

.muted { color: #9aa0a6; }

/* ---- Klikací "Skladem" ---- */
.stock-total.clickable { cursor: pointer; }
.stock-total.clickable:hover { text-decoration: underline; }

/* ---- Modální okno ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 1000;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #fff; border-radius: 6px;
  width: 100%; max-width: 960px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); overflow: hidden;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  background: #3498db; color: #fff; padding: 14px 18px; font-size: 17px; font-weight: 600;
}
.modal-close {
  background: transparent; border: 0; color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: #e8f4fc; }

.modal-tabs {
  display: flex; gap: 4px; padding: 8px 14px 0;
  border-bottom: 1px solid #e1e4e8; flex-wrap: wrap;
}
.modal-tab {
  display: inline-flex; align-items: center; gap: 7px;
  background: #f4f6f8; border: 1px solid #e1e4e8; border-bottom: 0;
  border-radius: 5px 5px 0 0; padding: 8px 14px; cursor: pointer;
  font-size: 14px; color: #2980b9;
}
.modal-tab.active { background: #fff; color: #2c3e50; font-weight: 600; }
.modal-tab .tab-swatch {
  width: 13px; height: 13px; border-radius: 3px; border: 1px solid #00000022;
}
.modal-tab .tab-total { color: #7a8288; font-size: 12px; font-weight: 400; }

.modal-body { padding: 0; overflow: auto; }

.stock-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stock-table th, .stock-table td {
  padding: 8px 10px; border-bottom: 1px solid #eef1f3; text-align: right; white-space: nowrap;
}
.stock-table thead th {
  position: sticky; top: 0; background: #fff;
  border-bottom: 2px solid #d8dce0; color: #2c3e50; z-index: 1;
}
.stock-table th.wh, .stock-table td.wh { text-align: left; width: 40%; }
.stock-table td.wh { color: #2c3e50; }
.wh-code { color: #9aa0a6; font-size: 12px; }
.stock-table td.num { color: #444; }
.stock-table td.num.z { color: #c2c7cc; }
.stock-table th.tot, .stock-table td.tot { font-weight: 700; background: #f6f8fa; }
.stock-table tr.sum td { border-top: 2px solid #d8dce0; font-weight: 700; background: #eef2f5; }
.stock-table tbody tr:hover td { background: #f0f7fc; }
.stock-table tbody tr:hover td.tot { background: #e7f0f7; }

/* ---- Domovská ikona v liště ---- */
.home-link {
  text-decoration: none; color: #fff; font-size: 20px;
  margin-right: 12px; opacity: .85;
}
.home-link:hover { opacity: 1; }

/* ---- Rozcestník aplikací ---- */
.launcher { max-width: 1000px; margin: 36px auto; padding: 0 18px; }
.launcher-title { font-size: 22px; color: #2c3e50; margin: 0 0 22px; }
.app-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.app-tile {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px; padding: 26px 18px; background: #fff;
  border: 1px solid #e1e4e8; border-radius: 10px; text-decoration: none;
  color: #2c3e50; transition: box-shadow .15s, transform .15s, border-color .15s;
}
.app-tile:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,.12); transform: translateY(-2px);
  border-color: #2980b9;
}
.app-icon {
  width: 84px; height: 84px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: #eaf2fb; color: #2980b9; font-size: 40px;
}
.app-name { font-size: 16px; font-weight: 600; }
.app-desc { font-size: 12px; color: #7a8288; }
.app-tile.placeholder {
  border-style: dashed; color: #aab0b6; cursor: default;
}
.app-tile.placeholder:hover { box-shadow: none; transform: none; border-color: #d8dce0; }
.app-tile.placeholder .app-icon { background: #f3f5f7; color: #c2c7cc; }

/* ---- Hlavička: uživatel ---- */
.topbar-user {
  color: #cfe3f5; font-weight: 600;
  border-left: 1px solid #ffffff33; padding-left: 16px;
}

/* ---- Přihlášení / auth ---- */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #2c3e50;
}
.auth-card {
  background: #fff; border-radius: 8px; padding: 28px 30px;
  width: 340px; box-shadow: 0 12px 40px rgba(0,0,0,.35);
  display: flex; flex-direction: column; gap: 12px;
}
.auth-card h1 { margin: 0; font-size: 20px; color: #2c3e50; }
.auth-sub { margin: 0 0 6px; color: #7a8288; font-size: 13px; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #2c3e50; }
.auth-card input {
  padding: 9px 10px; border: 1px solid #cfd4d8; border-radius: 4px; font-size: 14px;
}
.auth-card .save-btn { margin-top: 6px; padding: 10px; }
.auth-error {
  background: #fdecea; color: #b03a2e; border: 1px solid #f5c6c0;
  border-radius: 4px; padding: 8px 10px; font-size: 13px;
}

/* ---- Správa uživatelů ---- */
.user-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.user-form input[type=text], .user-form select {
  padding: 8px 10px; border: 1px solid #cfd4d8; border-radius: 4px; font-size: 14px;
}
.user-form input[type=text] { min-width: 180px; }
.user-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.user-table th, .user-table td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid #eef1f3; font-size: 14px;
}
.user-table thead th { color: #2c3e50; border-bottom: 2px solid #d8dce0; }
.mini-btn {
  background: #ecf0f3; border: 1px solid #d8dce0; border-radius: 4px;
  padding: 5px 10px; margin-left: 6px; cursor: pointer; font-size: 12px; color: #2c3e50;
}
.mini-btn:hover { background: #e2e7eb; }
.mini-btn.danger { color: #b03a2e; border-color: #f0c8c2; background: #fdecea; }
.mini-btn.danger:hover { background: #fbd9d4; }
.mini-btn.toggle { margin-left: 0; min-width: 64px; }
.mini-btn.toggle.on { color: #1e8449; border-color: #abdcc0; background: #e9f7ef; }
.perm-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #2c3e50; cursor: pointer; }
.app-checks-label { font-size: 14px; color: #2c3e50; }
.app-checks { display: inline-flex; flex-wrap: wrap; gap: 10px; }
.user-table td .mini-btn.toggle { margin: 2px 4px 2px 0; }

/* ---- Admin ---- */
.admin-wrap { max-width: 720px; margin: 24px auto; padding: 0 18px; }
.tag-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.tag-list label {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid #e1e4e8; border-radius: 4px; cursor: pointer;
}
.tag-list label:hover { background: #f6f8fa; }
.tag-list .tn-count { margin-left: auto; color: #7a8288; font-size: 12px; }
.admin-actions { display: flex; align-items: center; gap: 14px; }
.status { color: #1e8449; }
