/* ============================================================ 
   LOGIN OVERLAY (Glassmorphism & Security)
   ============================================================ */
.login-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at top right, #1e293b, #0f172a);
  z-index: 5000; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
}
body.not-logged-in .sidebar, 
body.not-logged-in .main, 
body.not-logged-in .mobile-overlay {
  display: none !important;
}
.login-card {
  width: 100%; max-width: 400px; padding: 40px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center; color: white;
}
.login-brand-icon { font-size: 40px; margin-bottom: 20px; display: block; }
.login-brand-logo-container { margin-bottom: 24px; display: flex; justify-content: center; align-items: center; }
.brand-logo { max-width: 120px; max-height: 80px; object-fit: contain; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3)); }
.login-header h1 { font-size: 24px; font-weight: 700; margin: 0 0 8px; color: white !important; }
.login-header p { color: #94a3b8; font-size: 14px; margin-bottom: 30px; }
.login-form .form-group { text-align: left; margin-bottom: 20px; }
.login-form label { color: #cbd5e1; font-size: 13px; margin-bottom: 8px; display: block; }
.login-form input {
  width: 100%; padding: 12px 16px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
  color: white; font-size: 16px; transition: all 0.2s;
}
.login-form input:focus { border-color: #3b82f6; outline: none; background: rgba(255, 255, 255, 0.08); }
.login-full { width: 100%; padding: 14px; font-weight: 600; font-size: 15px; margin-top: 10px; }
.login-error { color: #f87171; font-size: 13px; margin-top: 16px; text-align: center; }
.login-footer p { color: #64748b; font-size: 12px; margin-top: 40px; }

/* ============================================================
   FANSHOP MANAGER v2 — STYLESHEET
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #f5f5f3;
  --bg-card:      #ffffff;
  --bg-sidebar:   #18181b;
  --border:       #e4e4e0;
  --border-light: #eeeeea;

  --text-primary:  #18181b;
  --text-secondary:#52525b;
  --text-muted:    #a1a1aa;

  --accent:        #3b5bdb;
  --accent-light:  #eef1ff;
  --accent-hover:  #2f4ac4;

  --green:         #16a34a;
  --green-light:   #dcfce7;
  --red:           #dc2626;
  --red-light:     #fee2e2;
  --yellow:        #d97706;
  --yellow-light:  #fef3c7;

  --sidebar-w:  220px;
  --radius:     10px;
  --radius-sm:  6px;
  --radius-lg:  14px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.07);
  --shadow:     0 2px 10px rgba(0,0,0,0.09);
  --shadow-lg:  0 8px 30px rgba(0,0,0,0.14);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --bg:           #09090b;
  --bg-card:      #18181b;
  --bg-sidebar:   #000000;
  --border:       #27272a;
  --border-light: #1e1e21;

  --text-primary:  #fafafa;
  --text-secondary:#a1a1aa;
  --text-muted:    #71717a;

  --accent-light:  #1e293b;
  --green-light:   #052e16;
  --red-light:     #450a0a;
}

html, body { height: 100%; font-family: var(--font); font-size: 14px;
  background: var(--bg); color: var(--text-primary); -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s; }

/* ROLE-BASED VISIBILITY */
[data-role="admin"] { display: none !important; }
body.is-admin [data-role="admin"] { display: block !important; }
body.is-admin a[data-role="admin"].nav-item { display: flex !important; }
body.is-admin div[data-role="admin"].dashboard-analytics { display: grid !important; }

/* ---- LAYOUT ---- */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ---- SIDEBAR ---- */
.sidebar { width: var(--sidebar-w); background: var(--bg-sidebar); display: flex;
  flex-direction: column; flex-shrink: 0; }

.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 10px; }
.sidebar-logo-container { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.brand-logo-sm { width: 100%; height: 100%; object-fit: contain; }
.brand-icon { font-size: 20px; line-height: 1; }
.brand-name { font-size: 15px; font-weight: 600; color: #fff; letter-spacing: 0.01em; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; flex: 1; }

.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px;
  text-decoration: none; color: #a1a1aa; font-size: 13.5px; font-weight: 450;
  transition: background 0.15s, color 0.15s; cursor: pointer; }
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active { background: rgba(59,91,219,0.22); color: #fff; }
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }

.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.05); }
.sidebar-version { font-size: 11px; color: #52525b; }

.sidebar-item-static { padding: 12px 14px; margin-top: auto; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-label { font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.3); margin: 0 20px 8px; letter-spacing: 0.1em; }
.mobile-toggle-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 8px;
  width: 40px; height: 40px; align-items: center; justify-content: center; color: var(--text-primary);
  margin-right: 15px; cursor: pointer; transition: background 0.2s; }
.mobile-toggle-btn:hover { background: var(--bg-card); }
.mobile-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px); z-index: 99; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
body.sidebar-open .mobile-overlay { opacity: 1; pointer-events: auto; }
.theme-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; color: #a1a1aa; font-size: 12px; user-select: none; }
.theme-switch input { width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent); }
.theme-label { font-weight: 500; }

/* ---- MAIN ---- */
.main { flex: 1; overflow-y: auto; padding: 32px 36px; min-width: 0; position: relative; }

.page { display: none; }
.page.active { display: block; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; gap: 16px; }
.page-header h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; font-family: var(--font); border: none; cursor: pointer;
  transition: all 0.15s; white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-outline { background: transparent; color: var(--green); border: 1.5px solid var(--green); }
.btn-outline:hover { background: var(--green-light); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon-sq { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center;
  justify-content: center; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); cursor: pointer; transition: all 0.15s; font-size: 13px; }
.btn-icon-sq:hover { background: var(--bg); color: var(--text-primary); }
.btn-close { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--text-muted);
  padding: 2px 6px; border-radius: 4px; transition: all 0.15s; line-height: 1; }
.btn-close:hover { background: var(--border-light); color: var(--text-primary); }

/* ---- VIEW TOGGLE ---- */
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.view-btn { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer; color: var(--text-muted); transition: all 0.15s; }
.view-btn svg { width: 14px; height: 14px; }
.view-btn.active { background: var(--accent); color: #fff; }
.view-btn:hover:not(.active) { background: var(--bg); color: var(--text-primary); }

/* ---- STATS GRID ---- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; margin-bottom: 4px; }
.stat-sub { font-size: 11.5px; color: var(--text-muted); }

/* ---- DASHBOARD SECTIONS ---- */
.dashboard-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.section-block { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); }
.section-title { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.06em; padding: 14px 16px 12px; border-bottom: 1px solid var(--border-light); }

.product-mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; padding: 16px; }
.product-mini-card { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
  cursor: pointer; transition: all 0.15s; background: var(--bg); }
.product-mini-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.product-mini-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--border-light);
  display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--text-muted); }
.product-mini-img img { width: 100%; height: 100%; object-fit: cover; }
.product-mini-info { padding: 8px 10px; }
.product-mini-code { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; }
.product-mini-name { font-size: 12px; font-weight: 500; color: var(--text-primary); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

/* ---- FILTER BAR ---- */
.filter-bar { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-btn { padding: 5px 14px; border-radius: 20px; border: 1px solid var(--border); background: transparent;
  font-size: 12.5px; font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: all 0.15s;
  font-family: var(--font); }
.filter-btn:hover { background: var(--bg-card); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- PRODUCT GRID ---- */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }

.product-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: all 0.18s; box-shadow: var(--shadow-sm); }
.product-card:hover { border-color: #a5b4fc; box-shadow: var(--shadow); transform: translateY(-2px); }

.product-card-photo { width: 100%; aspect-ratio: 4/3; background: var(--border-light);
  display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.product-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.product-card-no-photo { font-size: 36px; color: var(--border); }

.product-card-badge { position: absolute; top: 8px; left: 8px; background: rgba(24,24,27,0.75);
  color: #fff; font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 20px;
  letter-spacing: 0.04em; backdrop-filter: blur(4px); }

.product-card-body { padding: 12px 14px 14px; }
.product-card-meta { font-size: 10.5px; color: var(--text-muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.product-card-name { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.3;
  margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card-sizes { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }

.product-card-prices { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.price-sell { font-size: 16px; font-weight: 700; color: var(--accent); }
.price-profit { font-size: 11.5px; font-weight: 600; color: var(--green);
  background: var(--green-light); padding: 2px 7px; border-radius: 20px; }

.product-card-actions { display: flex; gap: 5px; padding: 0 14px 12px; }

/* ---- PRODUCT LIST TABLE ---- */
.products-list-table { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); }
.products-list-table .thumb { width: 40px; height: 40px; border-radius: var(--radius-sm);
  object-fit: cover; background: var(--border-light); display: inline-flex; align-items: center;
  justify-content: center; font-size: 18px; color: var(--text-muted); vertical-align: middle; }
.products-list-table .thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }

/* ---- DATA TABLE ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em; padding: 9px 14px; background: #fafaf8;
  border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border-light);
  color: var(--text-primary); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafaf8; }
.empty-row td { color: var(--text-muted); font-style: italic; text-align: center; padding: 32px; }

/* Margin bar */
.margin-bar-wrap { display: flex; align-items: center; gap: 8px; }
.margin-bar { height: 6px; background: var(--green); border-radius: 3px; min-width: 2px; }

/* ---- CUSTOMERS ---- */
.quick-add-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.quick-add-title { font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }
.quick-add-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.qa-field { display: flex; flex-direction: column; gap: 5px; }
.qa-field-wide { flex: 1; min-width: 200px; }
.qa-field label { font-size: 11.5px; font-weight: 500; color: var(--text-secondary); }
.qa-field input { padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: var(--font); color: var(--text-primary); background: var(--bg);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s; min-width: 150px; }
.qa-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,91,219,0.1); background: var(--bg-card); }

.customers-table-main { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); }

/* ---- INVENTORY ---- */
.inventory-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.inv-tab { padding: 8px 16px; border-radius: 20px; font-size: 13.5px; font-weight: 500; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); transition: all 0.15s; }
.inv-tab:hover { border-color: var(--accent); color: var(--accent); }
.inv-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.inventory-qty { width: 60px; text-align: center; padding: 6px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; font-family: var(--font); color: var(--text-primary);
  background: var(--bg); transition: all 0.15s; outline: none; }
.inventory-qty:focus { border-color: var(--accent); background: var(--bg-card); box-shadow: 0 0 0 3px rgba(59,91,219,0.1); }
.inventory-qty::-webkit-inner-spin-button, .inventory-qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.assortment-item { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-bottom: 1px solid var(--border-light); cursor: pointer; }
.assortment-item:last-child { border-bottom: none; }
.assortment-item:hover { background: #fafaf8; }
.assortment-checkbox { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.assortment-info { display: flex; flex-direction: column; }
.assortment-name { font-weight: 500; font-size: 14px; color: var(--text-primary); }
.assortment-code { font-size: 12px; color: var(--text-secondary); }

/* ---- POS (POKLADNA) ---- */
.pos-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; height: calc(100vh - 140px); }

.pos-products { display: flex; flex-direction: column; overflow: hidden; }
.pos-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px;
            overflow-y: auto; padding-right: 5px; align-content: start; }

.pos-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: all 0.15s; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; }
.pos-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.pos-card-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--border-light);
  display: flex; align-items: center; justify-content: center; font-size: 30px; color: var(--text-muted); }
.pos-card-info { padding: 10px; display: flex; flex-direction: column; flex: 1; justify-content: space-between; }
.pos-card-name { font-size: 12.5px; font-weight: 600; line-height: 1.3; color: var(--text-primary);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 8px; }
.pos-card-price { font-size: 14px; font-weight: 700; color: var(--accent); text-align: right; }

.pos-cart { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-sm); }
.pos-cart-header { padding: 16px 20px; font-size: 15px; font-weight: 600; border-bottom: 1px solid var(--border);
  background: #fafaf8; }
.pos-cart-items { flex: 1; overflow-y: auto; padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.empty-cart { color: var(--text-muted); font-style: italic; text-align: center; margin-top: 40px; font-size: 13px; }

.cart-item { display: flex; align-items: stretch; justify-content: space-between; padding-bottom: 10px;
  border-bottom: 1px dashed var(--border); gap: 10px; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-meta { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.cart-item-price { font-weight: 600; font-size: 13.5px; color: var(--accent); white-space: nowrap; }
.cart-qty-ctrl { display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; width: 28px; }
.cart-qty-btn { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-secondary);
  border-radius: 4px; transition: background 0.1s; }
.cart-qty-btn:hover { background: var(--border); color: var(--text-primary); }
.cart-qty-val { font-size: 12px; font-weight: 700; }

.pos-cart-footer { padding: 16px 20px; border-top: 1px solid var(--border); background: #fafaf8; }
.pos-total-row { display: flex; align-items: baseline; justify-content: space-between; font-size: 15px;
  font-weight: 600; color: var(--text-secondary); margin-bottom: 16px; }
.pos-total-row span { font-size: 24px; font-weight: 700; color: var(--accent); }

/* ---- SETTINGS ---- */
.location-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.location-name { font-weight: 500; font-size: 13.5px; }

/* ---- SALES HISTORIE ---- */
.sales-checkbox { cursor: pointer; accent-color: var(--green); width: 16px; height: 16px; margin: 0; padding: 0; vertical-align: middle; }
.sale-items-list { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* ---- DASHBOARD ANALYTICS ---- */
.dashboard-analytics { display: grid; grid-template-columns: 1fr 340px; gap: 18px; margin-bottom: 24px; }
.dashboard-side-stats { display: flex; flex-direction: column; gap: 18px; }
.dashboard-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.dashboard-list-item { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding-bottom: 8px; border-bottom: 1px dashed var(--border-light); }
.dashboard-list-item:last-child { border-bottom: none; padding-bottom: 0; }
.stock-badge { font-weight: 700; color: var(--red); background: var(--red-light); padding: 1px 6px; border-radius: 4px; font-size: 11px; }
.seller-badge { font-weight: 600; color: var(--accent); font-size: 12px; }
.chart-container { position: relative; height: 260px; width: 100%; }

/* DARK MODE OVERRIDES */
[data-theme="dark"] .stat-card, 
[data-theme="dark"] .section-block,
[data-theme="dark"] .product-card,
[data-theme="dark"] .pos-cart,
[data-theme="dark"] .modal,
[data-theme="dark"] .quick-add-card { background: var(--bg-card); border-color: var(--border); }

[data-theme="dark"] .section-title { background: rgba(255,255,255,0.02); border-color: var(--border-light); }
[data-theme="dark"] .data-table th { background: rgba(255,255,255,0.02); border-color: var(--border); }
[data-theme="dark"] .data-table td { border-color: var(--border-light); }
[data-theme="dark"] .data-table tr:hover { background: rgba(255,255,255,0.03); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #121214; border-color: var(--border); color: var(--text-primary); }
[data-theme="dark"] input:focus, [data-theme="dark"] select:focus, [data-theme="dark"] textarea:focus { background: #1a1a1d; }
[data-theme="dark"] .modal-footer { background: #1a1a1d; border-color: var(--border); }
[data-theme="dark"] .btn-secondary { border-color: var(--border); }
[data-theme="dark"] .btn-secondary:hover { background: #27272a; }
[data-theme="dark"] .pos-cart-header, [data-theme="dark"] .pos-cart-footer { background: #1c1c1f; border-color: var(--border); }
[data-theme="dark"] .modal-footer { background: #1c1c1f; border-color: var(--border); }

/* ---- PROFIT PAGE ---- */
.profit-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.profit-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow-sm); }
.profit-card.highlight { border-color: #c7d2fe; background: var(--accent-light); }
.profit-card.highlight-green { border-color: #bbf7d0; background: var(--green-light); }
.profit-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 8px; }
.profit-amount { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.profit-card.highlight .profit-label { color: #6272d8; }
.profit-card.highlight .profit-amount { color: var(--accent); }
.profit-card.highlight-green .profit-label { color: #15803d; }
.profit-card.highlight-green .profit-amount { color: var(--green); }

/* ---- MODALS ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex;
  align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(3px);
  animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 560px; max-width: 95vw; max-height: 91vh; overflow-y: auto; animation: slideUp 0.18s ease; }
.modal-lg { width: 780px; }
.modal-xl { width: 900px; }
.modal-sm { width: 360px; }
.modal-xs { width: 280px; }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header { display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border); gap: 12px; }
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 22px 24px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 24px; border-top: 1px solid var(--border); background: var(--bg-card);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ---- URL IMPORT BAR ---- */
.url-import-bar { background: var(--accent-light); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 4px; }
.url-import-label { font-size: 10.5px; font-weight: 700; color: var(--accent); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 8px; }
.url-import-row { display: flex; gap: 8px; }
.url-import-row input { flex: 1; padding: 7px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: var(--font); color: var(--text-primary); background: var(--bg-card); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s; }
.url-import-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,91,219,0.15); }
.btn-import { background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 7px 16px; font-size: 13px; font-weight: 500; font-family: var(--font);
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: background 0.15s; min-width: 92px; justify-content: center; }
.btn-import:hover { background: var(--accent-hover); }
.btn-import:disabled { opacity: 0.65; cursor: not-allowed; }

.url-import-status { display: flex; align-items: center; gap: 7px; margin-top: 8px;
  font-size: 12.5px; font-weight: 500; padding: 4px 2px; }
.url-import-status.loading { color: var(--accent); }
.url-import-status.success { color: var(--green); }
.url-import-status.error   { color: var(--red); }

.url-import-divider { height: 1px; background: var(--border); margin: 16px 0 14px; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 13px; height: 13px; border: 2px solid rgba(59,91,219,0.3);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite;
  display: inline-block; flex-shrink: 0; }

/* ---- PRODUCT MODAL LAYOUT ---- */
.modal-two-col { display: grid; grid-template-columns: 200px 1fr; gap: 22px; }

/* Photo upload */
.photo-upload-area { border: 2px dashed var(--border); border-radius: var(--radius);
  aspect-ratio: 1; position: relative; cursor: pointer; transition: border-color 0.15s;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: var(--bg); }
.photo-upload-area:hover { border-color: var(--accent); }
.photo-upload-area img#product-photo-preview { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--text-muted); pointer-events: none; }
.photo-placeholder span { font-size: 12.5px; font-weight: 500; }
.photo-hint { font-size: 11px; color: var(--text-muted); }
.btn-remove-photo { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  background: rgba(220,38,38,0.85); color: #fff; border: none; border-radius: 50%;
  font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: var(--font); color: var(--text-primary); background: var(--bg-card);
  transition: border-color 0.15s, box-shadow 0.15s; outline: none; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,91,219,0.1); }
.form-group textarea { resize: vertical; min-height: 58px; }
.field-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-2 .form-group { margin-bottom: 0; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-row-3 .form-group { margin-bottom: 0; }

/* Input with suffix */
.input-suffix { position: relative; }
.input-suffix input { padding-right: 34px; }
.input-suffix span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--text-muted); pointer-events: none; }

/* Sizes row */
.sizes-row { display: flex; flex-wrap: wrap; gap: 6px; }
.size-chip { display: flex; align-items: center; gap: 5px; padding: 5px 10px; border: 1px solid var(--border);
  border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.12s;
  color: var(--text-secondary); user-select: none; }
.size-chip:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
.size-chip input { display: none; }

/* Profit preview */
.profit-preview-box { display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); min-height: 40px; gap: 1px; }
.profit-preview-box #ppp-kc { font-size: 14px; font-weight: 700; color: var(--green); }
.ppp-pct { font-size: 11px; color: var(--text-muted); }

/* ---- PRODUCT DETAIL MODAL ---- */
.detail-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.detail-photo-wrap { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  aspect-ratio: 1; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.detail-photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-no-photo { color: var(--text-muted); font-size: 13px; font-style: italic; }
.detail-info { display: flex; flex-direction: column; gap: 0; }
.detail-row { display: flex; padding: 10px 0; border-bottom: 1px solid var(--border-light); gap: 12px; }
.detail-row:last-child { border-bottom: none; }
.dr-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.04em; width: 110px; flex-shrink: 0; padding-top: 1px; }
.detail-divider { height: 1px; background: var(--border); margin: 4px 0; }
.detail-notes-row .dr-label { padding-top: 0; }

/* ---- ACTIONS CELL ---- */
.actions-cell { display: flex; gap: 5px; }

/* ---- TOAST ---- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text-primary); color: #fff; padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; opacity: 0; transition: all 0.25s; pointer-events: none; z-index: 9999; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green); }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d4d0; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #b4b4b0; }

/* ---- EMPTY STATE ---- */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--text-muted); text-align: center; }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; line-height: 1.6; max-width: 280px; }

/* ---- MOBILE TOP BAR [NEW] ---- */
.mobile-top-bar {
  display: none;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 1000;
  display: none; /* Skryto na desktopu */
  grid-template-columns: 40px 1fr 40px; /* 3 sloupce pro perfektní vycentrování */
  align-items: center;
  margin: -32px -36px 20px -36px;
}
.mobile-top-bar-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  text-align: center;
}
.mobile-toggle-btn-global {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .profit-summary { grid-template-columns: repeat(2, 1fr); }
  .modal-two-col { grid-template-columns: 1fr; }
  .photo-upload-area { aspect-ratio: 16/9; max-height: 200px; }
  .detail-layout { grid-template-columns: 1fr; }
  
  .pos-container { grid-template-columns: 1fr; }
  .pos-cart { position: sticky; bottom: 0; z-index: 10; max-height: 400px; 
    border-top: 2px solid var(--accent); background: var(--bg-card); 
    box-shadow: 0 -10px 30px rgba(0,0,0,0.05); }
}

@media (max-width: 768px) {
  .mobile-top-bar { display: grid; }
  
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 9000;
    transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 20px 0 50px rgba(0,0,0,0.3); width: min(280px, 85%) !important; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  
  .main { padding: 12px; height: 100dvh; }
  .mobile-top-bar { margin: -12px -12px 15px -12px; } /* Pro menší padding main na mobilu */
  
  .page-header { margin-bottom: 24px; flex-direction: column; text-align: center; gap: 12px; align-items: center; }
  .page-header > div { display: flex; flex-direction: column; align-items: center; }
  .page-header h1 { font-size: 20px; text-align: center; }
  .page-subtitle { text-align: center; margin-top: 4px; }
  .header-actions { justify-content: center; width: 100%; display: flex; gap: 10px; }
  
  .section-title { text-align: center; justify-content: center; width: 100%; display: flex; font-size: 15px; }
  .pos-cart-header { text-align: center; font-weight: 700; width: 100%; display: block; margin: 10px 0; }
  .pos-total-row { text-align: center; font-size: 26px !important; font-weight: 800; color: var(--accent); margin-bottom: 20px; width: 100%; display: block; }
  
  .form-group label { text-align: center; display: block; width: 100%; }
  .form-group input, .form-group select { text-align: center; text-align-last: center; }
  
  .cart-item { text-align: center; flex-direction: column; padding: 15px; border-bottom: 1px solid var(--border-light); }
  .cart-item-info { margin-bottom: 10px; }
  .cart-qty-ctrl { justify-content: center; }
  
  .empty-cart, .empty-state { text-align: center; justify-content: center; width: 100%; display: flex; flex-direction: column; }
  
  /* Zákazníci a Vyhledávání */
  .search-area { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 20px; }
  .search-area input { text-align: center; }
  .search-area .btn { width: 100%; justify-content: center; }
  
  .pos-search-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .pos-search-bar input { text-align: center; }
  
  .form-row-2, .form-row-3 { grid-template-columns: 1fr !important; gap: 10px; }
  
  .data-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; 
    border-radius: 8px; border: 1px solid var(--border); margin: 0; }
  .data-table { min-width: 600px; }
  
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .product-card { border-radius: 12px; }
  .product-card .p-name { font-size: 13px; line-height: 1.3; }
  
  .modal-content { width: 100%; height: 100%; margin: 0; border-radius: 0; max-height: 100dvh; }
  .modal-body { padding: 20px; padding-bottom: 40px; }
}
