/* ================================================================
   B2B Platform — Design System v2 (Deep Teal)
   ================================================================ */

/* Geist — self-hosted variable font (latin + latin-ext for RO diacritics) */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/Geist.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/Geist-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Surfaces — cooler, near-neutral base so white cards read crisp instead of
     washed-out. The mint identity survives as an intentional accent (tints,
     hover, active), no longer as the colour of every border on the page. */
  --bg:              #eef3f2;
  --bg-grad-a:       #eef4f3;
  --bg-grad-b:       #e7f0ee;
  --card:            #ffffff;
  --border:          #e3e9e8;   /* neutral cool hairline (was saturated mint) */
  --border-strong:   #cfdad8;
  --text:            #16302d;
  --muted:           #64748b;
  --primary:         #0d9488;
  --primary-dark:    #0f766e;
  --primary-soft:    #ccfbf1;   /* mint, reserved for tints / hover / active */
  --primary-tint:    #f0fdfa;
  --bg-tint:         #f6faf9;
  --sidebar-bg:      #123f3c;
  --sidebar-bg-2:    #0f4f49;
  --sidebar-active:  #0d9488;
  --danger:          #dc2626;
  --danger-soft:     #fef2f2;
  --warning:         #b45309;
  --warning-soft:    #fff8ed;
  --success:         #059669;
  --success-soft:    #ecfdf5;
  --company:         #5b21b6;
  --company-bg:      #ede9fe;
  --auth-bg:         #f0fdfa;
  --hover:           #f4faf9;
  --radius:          11px;
  --radius-sm:       8px;
  --radius-lg:       16px;
  /* Layered, brand-tinted elevation — soft close shadow + a wider ambient one.
     Reads as real depth rather than a flat 1px drop. */
  --shadow-sm:       0 1px 2px rgba(17,63,60,0.05);
  --shadow:          0 1px 2px rgba(17,63,60,0.05), 0 6px 16px -8px rgba(17,63,60,0.12);
  --shadow-md:       0 2px 4px rgba(17,63,60,0.05), 0 12px 28px -10px rgba(17,63,60,0.16);
  --shadow-lg:       0 18px 44px -14px rgba(17,63,60,0.24);
  --ring:            0 0 0 3px rgba(13,148,136,0.18);
  --ease:            cubic-bezier(0.16, 1, 0.3, 1);
  --sidebar-w:       224px;
}

/* ── Reset ── */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(120% 80% at 100% 0%, var(--bg-grad-a) 0%, var(--bg) 46%),
    radial-gradient(110% 90% at 0% 100%, var(--bg-grad-b) 0%, transparent 42%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Tabular figures everywhere numbers carry meaning — aligns decimals down
   money/quantity columns and stops digits from dancing as values change. */
.kpi-value,
.table td, .table th,
.data-table td, .data-table th,
.bar-value, .bar-label,
.order-cart-total, .order-cart-item-total,
.info-list dd,
code {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ================================================================
   APP SHELL — Sidebar layout
   ================================================================ */

/* Hidden checkbox — powers the CSS-only mobile drawer */
.nav-toggle-input { display: none; }

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  background-image: linear-gradient(180deg, var(--sidebar-bg-2) 0%, var(--sidebar-bg) 55%);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
  scrollbar-width: none;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 20px 16px 16px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.sidebar-brand-logo {
  max-height: 56px;
  max-width: 160px;
  object-fit: contain;
  border-radius: 4px;
}
.sidebar-brand-placeholder {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.sidebar-brand-desc {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  line-height: 1.4;
}

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-section {
  padding: 12px 16px 4px;
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 8px;
  border-radius: 8px;
  color: rgba(255,255,255,0.62);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(13,148,136,0.95), rgba(13,148,136,0.75));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 14px -6px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.12);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: #5eead4;
}
.nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 10px 8px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 6px;
}
.avatar {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.user-chip > div { min-width: 0; overflow: hidden; }
.user-name { font-size: 12px; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.45); text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 4px;
  margin-left: auto;
  display: block;
  flex-shrink: 0;
}
.btn-logout:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* ── Main content area ── */
.app-main {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

/* Overflow containment — a wide table (`.table { min-width }`) must scroll
   INSIDE its card, never widen the whole page. Without min-width:0 the table's
   min-content propagates up through card → grid → container and forces a
   horizontal page scroll on mobile. */
.app-main .container { width: 100%; min-width: 0; }
.grid-2 > *, .kpi-grid > * { min-width: 0; }
.card { min-width: 0; }

/* ── Mobile topbar (hidden on desktop) ── */
.mobile-topbar { display: none; }

/* ── Drawer overlay (hidden on desktop) ── */
.drawer-overlay { display: none; }

/* ── Bottom tabs (hidden on desktop) ── */
.bottom-tabs { display: none; }

/* ================================================================
   PAGE ELEMENTS
   ================================================================ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px max(24px, env(safe-area-inset-right)) 40px max(24px, env(safe-area-inset-left));
}

/* ── Entrance motion ──
   Top-level blocks ease up into place on load so the page feels composed
   rather than snapping in. Purely presentational and fully disabled under
   reduced-motion. */
@media (prefers-reduced-motion: no-preference) {
  .container > .page-header,
  .container > section,
  .container > .card,
  .container > .grid-2,
  .container > .kpi-grid {
    animation: rise-in 0.5s var(--ease) both;
  }
  .container > *:nth-child(1) { animation-delay: 0.02s; }
  .container > *:nth-child(2) { animation-delay: 0.07s; }
  .container > *:nth-child(3) { animation-delay: 0.12s; }
  .container > *:nth-child(4) { animation-delay: 0.17s; }
  .container > *:nth-child(5) { animation-delay: 0.22s; }
  .container > *:nth-child(6) { animation-delay: 0.27s; }
  .container > *:nth-child(n+7) { animation-delay: 0.3s; }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.page-header h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }

/* ── Flash messages ── */
.flash {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-weight: 500;
  font-size: 13px;
  transition: opacity 0.3s ease;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.card h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 15px;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── KPI ── */
.kpi-grid {
  display: grid;
  /* Dashboard renders exactly 6 KPIs. 3 and 2 both divide 6 evenly, so the
     grid always packs into full rows with zero orphaned cells. */
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 800px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
/* Accent hairline down the left edge — the brand touch that makes a plain
   metric box read as a designed tile. */
.kpi::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  opacity: 0.55;
}
/* Link KPIs lift toward the cursor and gain depth — fluid, tactile. */
a.kpi-link {
  color: inherit;
  text-decoration: none;
  display: block;
}
a.kpi-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  text-decoration: none;
}
a.kpi-link::after {
  content: "→";
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 13px;
  color: var(--muted);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
a.kpi-link:hover::after { opacity: 0.85; transform: translateX(0); }
.kpi-label {
  display: block;
  color: var(--primary-dark);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 650;
}
.kpi-value {
  display: block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 5px;
  color: var(--text);
  line-height: 1.1;
}
.kpi-value.highlight { color: var(--primary); }
.kpi .muted.small { margin-top: 6px; }
/* Alert state — driven by data-state so urgency reads at a glance instead of a
   muddy inline brown. Falls back gracefully when the attribute is absent. */
.kpi[data-state="warn"]::before { background: linear-gradient(180deg, #f59e0b, var(--warning)); opacity: 1; }
.kpi[data-state="warn"] .kpi-value { color: var(--warning); }
.kpi[data-state="danger"]::before { background: linear-gradient(180deg, #f87171, var(--danger)); opacity: 1; }
.kpi[data-state="danger"] .kpi-value { color: var(--danger); }

/* ── Tables ── */
.table, .data-table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .data-table th {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--bg-tint, #f6faf9);
  font-weight: 650;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
.table td, .data-table td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td, .data-table tbody tr:last-child td { border-bottom: none; }
.table tbody tr, .data-table tbody tr { transition: background 0.13s var(--ease); }
.table tbody tr:hover td, .data-table tbody tr:hover td { background: var(--hover); }
.table tfoot td, .data-table tfoot td { background: var(--hover); }
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
}
.badge-noua       { background: #dbeafe; color: #1e40af; }
.badge-confirmata { background: #d1fae5; color: #065f46; }
.badge-livrata    { background: #cffafe; color: #155e75; }
.badge-anulata    { background: #fee2e2; color: #991b1b; }
.badge-draft      { background: #e5e7eb; color: #374151; }
.badge-warning    { background: #fef3c7; color: #92400e; }
.badge-preorder   { background: #ffe8b3; color: #7a4a00; border: 1px solid #f5b800; }
.badge-company    { background: var(--company-bg); color: var(--company); }
.badge-teal       { background: var(--border); color: var(--sidebar-bg); }
.badge-machine-active   { background: #d1fae5; color: #065f46; }
.badge-machine-expiring { background: #fef3c7; color: #92400e; }
.badge-machine-expired  { background: #fee2e2; color: #991b1b; }
.badge-machine-overdue  { background: #fee2e2; color: #991b1b; }
.badge-machine-returned { background: #f1f5f9; color: #475569; }

/* ── Forms ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
}
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
label > input, label > select, label > textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
}
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], select, textarea {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  width: 100%;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}
.req { color: var(--danger); }
.form-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.08s var(--ease);
}
.btn:hover { background: var(--hover); border-color: var(--border-strong); text-decoration: none; }
/* Physical press feedback — the button gives, then springs back */
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary {
  background: linear-gradient(180deg, #10a99b 0%, var(--primary) 55%, var(--primary-dark) 100%);
  color: #fff;
  border-color: var(--primary-dark);
  box-shadow: 0 1px 2px rgba(15,118,110,0.4), 0 6px 16px -8px rgba(13,148,136,0.6);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #0fa093 0%, var(--primary-dark) 100%);
  border-color: var(--primary-dark);
  box-shadow: 0 2px 4px rgba(15,118,110,0.4), 0 10px 22px -8px rgba(13,148,136,0.7);
}
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f3f4f6; color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; }
.btn-icon {
  background: none; border: 0;
  font-size: 22px; cursor: pointer;
  color: var(--muted); padding: 0 6px; line-height: 1;
}
.btn-icon:hover { color: var(--text); }

.inline { display: inline; }
.actions { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── Search bar ── */
.search-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.search-bar input { flex: 1; min-width: 160px; }
.search-bar select { min-width: 140px; width: auto; }

/* ── Tab bar ── */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-bar a {
  padding: 10px 18px;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  text-decoration: none;
}
.tab-bar a:hover { color: var(--text); text-decoration: none; }
.tab-bar a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Filter tabs (alias) */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.filter-tabs a {
  padding: 8px 16px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-weight: 500;
  white-space: nowrap;
}
.filter-tabs a:hover { color: var(--text); text-decoration: none; }
.filter-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Info list ── */
.info-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 12px;
  margin: 0;
}
.info-list dt { color: var(--muted); font-weight: 500; }
.info-list dd { margin: 0; }

/* ── Bar chart ── */
.bar-chart { list-style: none; margin: 0; padding: 0; }
.bar-chart li {
  display: grid;
  grid-template-columns: 70px 1fr 90px;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 13px;
}
.bar-label { color: var(--muted); font-family: monospace; }
.bar-track { background: var(--bg-tint); border: 1px solid var(--border); border-radius: 999px; height: 14px; overflow: hidden; }
.bar-fill {
  display: block;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  height: 100%;
  min-width: 4px;
  border-radius: 999px;
}
.bar-value { text-align: right; color: var(--text); font-weight: 600; }

/* ── Status form ── */
.status-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.status-form label { flex: 1; min-width: 160px; }

/* ── Helpers ── */
.muted    { color: var(--muted); }
.small    { font-size: 12px; }
code {
  background: #f0fdfa;
  color: var(--primary-dark);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.req { color: var(--danger); }

/* ── Breadcrumb ── */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }
.breadcrumb-sep { color: var(--border); }

/* ── Empty state ── */
.empty-state, .empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state p, .empty p { margin: 0 0 12px; }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; margin-top: 16px; }

/* ================================================================
   MODAL (order product catalog)
   ================================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; padding: 20px;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
  background: #fff; border-radius: 12px;
  width: 100%; max-width: 900px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-toolbar {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: #f9fafb; flex-wrap: wrap;
}
.modal-toolbar input[type=text] { flex: 1; min-width: 200px; }
.modal-toolbar select { width: auto; }
.modal-body { flex: 1; overflow-y: auto; padding: 0; }
.modal-body .table { margin: 0; border-radius: 0; }
.modal-body .table thead { position: sticky; top: 0; background: #fff; z-index: 1; box-shadow: 0 1px 0 var(--border); }
.modal-body .table tbody tr:hover td { background: var(--hover); }
.modal-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--border);
  background: #f9fafb; flex-wrap: wrap; gap: 10px;
}

/* Recent pills (order modal) */
.recent-pill {
  background: #f3f4f6; border: 1px solid var(--border);
  border-radius: 20px; padding: 8px 14px;
  cursor: pointer; font-size: 13px; color: var(--text);
  transition: all 0.12s; text-align: left;
}
.recent-pill:hover { background: var(--border); border-color: var(--primary); transform: translateY(-1px); }
.recent-pill:active { transform: translateY(0); }

/* ================================================================
   BULK BAR (products list)
   ================================================================ */
.bulk-bar {
  position: sticky;
  top: calc(0px + env(safe-area-inset-top, 0px));
  z-index: 40;
  background: #fff8e1; border: 1px solid #f5b800;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  margin: 12px 0;
  animation: bulk-slide-in 0.18s ease-out;
}
@keyframes bulk-slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.bulk-bar-inner { padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.bulk-count {
  font-size: 13px; color: var(--text); white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
  padding-right: 12px; border-right: 1px solid rgba(0,0,0,0.1);
}
.bulk-count strong { font-size: 16px; color: #ef6c00; }
.bulk-count .btn-link {
  background: none; border: 0; color: var(--primary);
  cursor: pointer; padding: 0; font-size: 12px; text-decoration: underline;
}
.bulk-ops { display: flex; flex-wrap: wrap; gap: 12px; flex: 1; }
.bulk-op, .bulk-op-actions {
  display: flex; gap: 4px; align-items: center;
  background: rgba(255,255,255,0.7); padding: 4px 6px;
  border-radius: 6px; border: 1px solid rgba(0,0,0,0.05);
}
.bulk-op-actions { margin-left: auto; background: transparent; border: 0; padding: 0; gap: 6px; }
.bulk-op select, .bulk-op input {
  font-size: 13px; padding: 5px 8px;
  border: 1px solid var(--border); border-radius: 4px; margin: 0; background: #fff;
  width: auto;
}
.bulk-op .btn-sm, .bulk-op-actions .btn-sm { padding: 5px 10px; font-size: 12px; }
tr:has(.row-check:checked) { background: #fff8e1 !important; }

/* ================================================================
   INLINE CONFIRM PATTERN
   ================================================================ */
.confirm-group { display: inline-flex; align-items: center; gap: 4px; }
.confirm-step-2 { display: none; align-items: center; gap: 4px; }
.confirm-group.confirming .confirm-step-1 { display: none; }
.confirm-group.confirming .confirm-step-2 { display: inline-flex; }

/* ================================================================
   GROUP LOGO (admin groups table)
   ================================================================ */
.group-logo {
  width: 32px; height: 32px;
  border-radius: 7px; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 11px; font-weight: 700;
  background: #e2e8f0; color: var(--muted);
}
.group-logo-placeholder { background: #f1f5f9; color: #94a3b8; }

/* ================================================================
   LOGO UPLOAD (group form)
   ================================================================ */
.upload-zone {
  border: 2px dashed var(--primary);
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  background: var(--bg);
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 6px;
}
.upload-zone:hover { background: #ccfbf1; }
.upload-zone-icon { font-size: 28px; margin-bottom: 6px; display: block; }
.upload-zone-text { font-size: 13px; color: var(--primary-dark); font-weight: 500; }
.upload-zone-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.logo-preview {
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px;
}
.logo-preview img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 2px solid var(--border); }
.logo-preview-info { flex: 1; }
.logo-preview-name { font-size: 12px; font-weight: 600; color: var(--text); }
.logo-preview-size { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ================================================================
   PORTAL CATALOG LAYOUT
   ================================================================ */
.catalog-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.catalog-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.catalog-sidebar-title {
  font-size: 10px;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  padding: 0 8px;
  margin-bottom: 8px;
}
.catalog-group-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
}
.catalog-group-item:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.catalog-group-item.active {
  background: var(--bg);
  color: var(--sidebar-bg);
  font-weight: 600;
  border-left-color: var(--primary);
}
.catalog-group-logo {
  width: 26px; height: 26px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.catalog-group-logo.placeholder { background: #e2e8f0; color: var(--muted); }
.catalog-group-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}
.catalog-sidebar-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 4px;
}
.catalog-sidebar-username { font-size: 11px; color: var(--text); font-weight: 600; }

.catalog-main { flex: 1; min-width: 0; }

/* ── Catalog row highlight when qty > 0 ── */
.catalog-row-selected { background: #f0fdfa; }
.catalog-row-selected td { border-color: var(--primary-light, #99f6e4); }

/* ── Catalog cart panel ── */
.catalog-cart {
  width: 210px;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.catalog-cart-header {
  background: var(--sidebar-bg);
  color: #fff;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.catalog-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  scrollbar-width: thin;
}
.catalog-cart-empty {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 20px 8px;
}
.catalog-cart-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.catalog-cart-item:last-child { border-bottom: none; }
.catalog-cart-item-name { flex: 1; font-weight: 500; line-height: 1.3; }
.catalog-cart-item-total { font-weight: 600; color: var(--primary-dark); white-space: nowrap; }
.catalog-cart-footer {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  flex-shrink: 0;
  background: var(--card);
}
.catalog-cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}
.catalog-cart-notes {
  width: 100%;
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: none;
  margin-bottom: 8px;
  font-family: inherit;
  box-sizing: border-box;
}
.catalog-cart-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.catalog-cart-btn:hover { background: var(--primary-dark); }
.catalog-cart-btn:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 800px) {
  .catalog-cart { display: none; }
  /* Mobile fallback: fixed bottom bar */
  .catalog-cart-mobile {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--sidebar-bg);
    color: #fff;
    z-index: 150;
    padding: 10px 16px;
    align-items: center;
    gap: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.18);
  }
  .catalog-cart-mobile-summary { flex: 1; font-size: 13px; }
  .catalog-cart-mobile-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
  }
}
@media (min-width: 801px) {
  .catalog-cart-mobile { display: none; }
}

.catalog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.catalog-header-logo {
  width: 36px; height: 36px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.catalog-header-logo.placeholder { background: #e2e8f0; color: var(--muted); }
.catalog-header-name { font-size: 16px; font-weight: 700; color: var(--text); }
.catalog-header-count { font-size: 12px; color: var(--muted); margin-top: 1px; }
.catalog-search {
  display: flex;
  gap: 6px;
  margin-left: auto;
  align-items: center;
}
.catalog-search input { width: 200px; }

/* Mobile pills (hidden on desktop) */
.catalog-pills { display: none; }

/* ── Quantity stepper buttons ── */
.stepper-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.1s;
}
.stepper-btn:hover { background: var(--bg); }
.stepper-inc { background: var(--primary); color: #fff; border-color: var(--primary); }
.stepper-inc:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ================================================================
   AUTH PAGES
   ================================================================ */
.auth-body {
  background: #0c3230;
  background-image:
    radial-gradient(80% 60% at 15% 10%, #155e56 0%, transparent 55%),
    radial-gradient(90% 70% at 90% 90%, #0d766e 0%, transparent 55%),
    linear-gradient(160deg, #0f4340 0%, #0a2a28 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.auth-wrap { width: 100%; max-width: 400px; padding: 24px; }
.auth-card {
  position: relative;
  background: #fff;
  padding: 34px 32px;
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.45), 0 12px 24px -12px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.14);
  overflow: hidden;
  animation: rise-in 0.5s var(--ease) both;
}
/* Brand accent along the top edge of the card */
.auth-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0f766e, #14b8a6, #5eead4);
}
.auth-card h1 { margin: 0 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--sidebar-bg); }
.auth-card p.muted { margin: 0 0 22px; }
.auth-card label { margin-bottom: 12px; }
@media (prefers-reduced-motion: reduce) {
  .auth-card { animation: none; }
}

/* ================================================================
   UTILITY CLASSES
   ================================================================ */
.flex          { display: flex; }
.flex-wrap     { display: flex; flex-wrap: wrap; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0  { margin-bottom: 0; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.auto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.hidden     { display: none !important; }

/* ── Group access chips ── */
.group-access-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.5;
}
.group-chips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}
.group-chips-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link:hover { color: var(--primary-dark); }
.group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  user-select: none;
  line-height: 1;
}
.group-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.group-chip input[type="checkbox"] { display: none; }
.chip-check { display: none; }
.group-chip:has(input:checked) {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.group-chip:has(input:checked) .chip-check { display: block; }
.text-right { text-align: right; }
.w-full     { width: 100%; }

/* ================================================================
   MOBILE RESPONSIVE (≤ 800px)
   ================================================================ */
@media (max-width: 800px) {

  /* Sidebar: off-screen by default, slides in when #nav-toggle checked */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    height: 100%;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
    padding-top: env(safe-area-inset-top);
  }
  .nav-toggle-input:checked ~ .app-shell .sidebar {
    transform: translateX(0);
  }

  /* Overlay */
  .drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    cursor: pointer;
  }
  .nav-toggle-input:checked ~ .app-shell .drawer-overlay {
    display: block;
  }

  /* Mobile topbar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    background: var(--sidebar-bg);
    color: #fff;
    padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
    min-height: calc(52px + env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
    gap: 12px;
  }
  .mobile-brand { font-weight: 700; font-size: 15px; flex: 1; }
  .hamburger-btn {
    background: none; border: none; color: #fff;
    font-size: 22px; cursor: pointer; padding: 0;
    line-height: 1; flex-shrink: 0;
  }

  /* Bottom tabs */
  .bottom-tabs {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -1px 6px rgba(0,0,0,0.06);
  }
  .bottom-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px 6px;
    font-size: 10px;
    color: var(--muted);
    text-decoration: none;
    gap: 3px;
  }
  .bottom-tab:hover { text-decoration: none; }
  .bottom-tab.active { color: var(--primary); }
  .bottom-tab-icon { font-size: 18px; }

  /* Main area needs padding for bottom tabs */
  .container {
    margin: 0 auto;
    padding: 16px max(12px, env(safe-area-inset-right)) 80px max(12px, env(safe-area-inset-left));
  }

  /* Page header stacks */
  .page-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-header h1 { font-size: 18px; }

  /* Larger tap targets */
  input[type=text], input[type=email], input[type=password],
  input[type=number], input[type=date], select, textarea {
    padding: 12px 10px;
    font-size: 16px; /* prevents Safari zoom */
  }
  .btn { padding: 11px 16px; font-size: 14px; min-height: 44px; }
  .btn-sm { padding: 8px 12px; min-height: 36px; font-size: 13px; }
  .btn.block { padding: 14px 16px; }

  /* Cards */
  .card { padding: 14px; }
  .table th, .table td, .data-table th, .data-table td { padding: 10px 8px; font-size: 12px; }
  .table { min-width: 520px; }
  .data-table { min-width: 400px; }

  /* Forms */
  .search-bar input { min-width: 100%; flex-basis: 100%; }
  .status-form { flex-direction: column; align-items: stretch; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }

  /* Info list */
  .info-list { grid-template-columns: 110px 1fr; font-size: 13px; }

  /* KPI */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 20px; }

  /* Actions in tables */
  .actions { flex-direction: column; gap: 4px; }

  /* Auth */
  .auth-wrap { padding: 16px; }
  .auth-card { padding: 24px 20px; }

  /* Bulk bar */
  .bulk-bar { top: calc(52px + env(safe-area-inset-top, 0px)); }
  .bulk-bar-inner { padding: 8px 10px; gap: 8px; }
  .bulk-count { width: 100%; border-right: 0; border-bottom: 1px solid rgba(0,0,0,0.1); padding-right: 0; padding-bottom: 6px; }
  .bulk-ops { width: 100%; }
  .bulk-op-actions { margin-left: 0; width: 100%; justify-content: flex-end; }

  /* Modal */
  .modal-content { max-height: 95vh; }
  .modal-toolbar { padding: 10px 14px; }
  .modal-toolbar input[type=text] { width: 100%; flex-basis: 100%; }
  .modal-footer { flex-direction: column; align-items: stretch; }

  /* Catalog layout: sidebar → pills */
  .catalog-layout { flex-direction: column; gap: 0; }
  .catalog-sidebar { display: none; }
  .catalog-pills {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding: 0 0 10px;
    margin-bottom: 10px;
  }
  .catalog-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    flex-shrink: 0;
  }
  .catalog-pill:hover { text-decoration: none; color: var(--text); }
  .catalog-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }
  .catalog-pill-logo { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; }
  .catalog-pill-placeholder {
    width: 18px; height: 18px; border-radius: 4px;
    background: var(--sidebar-bg); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700; flex-shrink: 0;
  }
  .catalog-pill-count { font-size: 10px; opacity: 0.75; }
  .catalog-search { margin-left: 0; width: 100%; }
  .catalog-search input { width: 100%; }
  .catalog-header { margin-bottom: 10px; }
}

@media (max-width: 400px) {
  .table th, .table td, .data-table th, .data-table td { padding: 8px 6px; font-size: 11px; }
  .info-list { grid-template-columns: 95px 1fr; }
}

/* ================================================================
   GROUP TILES (Produse — navigare grupe)
   ================================================================ */

.group-tiles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.group-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  position: relative;
  transition:
    box-shadow 0.22s ease,
    border-color 0.22s ease,
    transform 0.22s ease-out;
}
.group-tile:hover {
  will-change: transform;
  transition:
    box-shadow 0.22s ease,
    border-color 0.22s ease,
    transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 10px 28px rgba(13,148,136,.18),
    0 4px 10px rgba(13,148,136,.1);
  border-color: var(--primary);
  transform: translateY(-5px) scale(1.015);
  text-decoration: none;
  color: var(--text);
}

.group-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 40%,
    rgba(255,255,255,0.45) 50%,
    transparent 60%
  );
  background-size: 200% 100%;
  background-position: 200% 0;
  transition: background-position 0.5s ease;
  border-radius: inherit;
  pointer-events: none;
}
.group-tile:hover::after { background-position: -200% 0; }

.group-tile-arrow {
  font-size: 15px;
  color: var(--muted);
  transition: transform 0.2s ease, color 0.2s ease;
  display: inline-block;
}
.group-tile:hover .group-tile-arrow {
  transform: translateX(4px);
  color: var(--primary);
}

.group-tile-image {
  width: 100%;
  height: 110px;
  background: #f1f9f8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.group-tile-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 14px;
  transition: transform 0.3s ease;
}
.group-tile:hover .group-tile-image img { transform: scale(1.07); }

.group-tile-placeholder {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
  opacity: 0.4;
  transition: transform 0.3s ease;
  user-select: none;
}
.group-tile:hover .group-tile-placeholder { transform: scale(1.12); }

.group-tile-body {
  padding: 12px 14px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.group-tile-name {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}
.group-tile-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.group-tile-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 12px;
}
.group-tile-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: #f0fdfa;
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

.group-tile-nogroup {
  border-style: dashed;
  border-color: #cbd5e1;
}
.group-tile-nogroup .group-tile-image { background: #f8fafc; }
.group-tile-nogroup:hover {
  border-color: #94a3b8;
  border-style: dashed;
  box-shadow: 0 8px 20px rgba(100,116,139,.14);
}
.group-tile-nogroup .group-tile-count {
  color: var(--muted);
  background: #f1f5f9;
  border-color: #e2e8f0;
}

@media (max-width: 900px) {
  .group-tiles-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .group-tiles-grid { grid-template-columns: 1fr; }
}

/* ── New order page layout ── */
.order-page-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.order-page-main { flex: 1; min-width: 0; }
.order-page-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.order-page-search input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.order-page-search input:focus {
  outline: none;
  border-color: var(--primary);
}
.order-row-selected { background: #f0fdfa !important; }
.order-row-selected td { border-color: var(--primary-light, #99f6e4); }
.order-group-header td {
  background: #f8fffe;
  color: var(--primary-dark);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

/* ── Order cart sidebar (same visual as catalog-cart) ── */
.order-cart {
  width: 220px;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.order-cart-header {
  background: var(--sidebar-bg);
  color: #fff;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.order-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  scrollbar-width: thin;
}
.order-cart-empty {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 20px 8px;
}
.order-cart-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.order-cart-item:last-child { border-bottom: none; }
.order-cart-item-name { flex: 1; font-weight: 500; line-height: 1.3; }
.order-cart-item-total { font-weight: 600; color: var(--primary-dark); white-space: nowrap; }
.order-cart-footer {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  flex-shrink: 0;
}
.order-cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}
.order-cart-notes {
  width: 100%;
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: none;
  margin-bottom: 8px;
  font-family: inherit;
  box-sizing: border-box;
}
.order-cart-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.order-cart-btn:hover { background: var(--primary-dark); }
.order-cart-btn:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 800px) {
  .order-page-layout { flex-direction: column; }
  .order-cart { width: 100%; position: static; max-height: none; }
}

/* ── Portal hero banner ── */
.portal-hero {
  background: linear-gradient(135deg, #134e4a, #0d9488);
  border-radius: var(--radius);
  margin-bottom: 20px;
  color: #fff;
}
.portal-hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 24px 28px;
}
.portal-hero-title { margin: 0 0 4px; font-size: 20px; font-weight: 700; }
.portal-hero-date  { margin: 0; font-size: 13px; opacity: 0.8; }
.portal-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.portal-hero-btn {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  transition: background 0.15s;
}
.portal-hero-btn:hover { background: rgba(255,255,255,0.25); color: #fff; text-decoration: none; }
.portal-hero-btn.primary { background: #fff; color: var(--primary-dark); border-color: #fff; }
.portal-hero-btn.primary:hover { background: #f0fdfa; color: var(--primary-dark); }

/* ── Warranty timeline ── */
.warranty-list { display: flex; flex-direction: column; gap: 16px; }
.warranty-item {}
.warranty-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}
.warranty-item-name { font-weight: 600; font-size: 13px; margin-right: 8px; }
.warranty-item-product { display: inline; }
.warranty-bar-track {
  position: relative;
  height: 10px;
  background: #e2e8f0;
  border-radius: 5px;
  overflow: visible;
}
.warranty-bar-fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  min-width: 6px;
  border-radius: 5px;
  transition: width 0.3s;
}
.warranty-bar-marker {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 16px;
  background: #1e293b;
  border-radius: 2px;
  transform: translateX(-1px);
}
.warranty-item-dates {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* ================================================================
   MACHINE LIST TABLE
   ================================================================ */
.machine-list-table { width: 100%; border-collapse: collapse; }
.machine-list-table th {
  text-align: left;
  padding: 10px 16px;
  border-bottom: 2px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--primary-dark);
  background: #f8fffe;
}
.machine-list-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.machine-list-table tbody tr:last-child td { border-bottom: none; }
.machine-list-table tbody tr:hover td { background: var(--hover); }

/* Equipment cell */
.machine-eq-cell { min-width: 160px; }
.machine-serial { font-weight: 700; color: var(--primary); font-size: 14px; text-decoration: none; }
.machine-serial:hover { text-decoration: underline; }
.machine-model { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* Client cell */
.machine-client-cell { min-width: 140px; }
.machine-client-name { font-size: 13px; font-weight: 500; color: var(--text); }
.machine-type-pill {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.pill-garantie { background: #dbeafe; color: #1e40af; }
.pill-imprumut { background: #ede9fe; color: #5b21b6; }

/* Bar cell */
.machine-bar-cell { min-width: 200px; max-width: 260px; }
.machine-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.machine-bar-days { font-size: 11px; font-weight: 600; white-space: nowrap; }
.days-active   { color: var(--primary-dark); }
.days-expiring { color: var(--warning); }
.days-expired  { color: var(--danger); }
.days-overdue  { color: var(--danger); }
.days-returned { color: var(--muted); }

.machine-bar-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.machine-bar-fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  border-radius: 4px;
  min-width: 4px;
}
.fill-active   { background: var(--primary); }
.fill-expiring { background: var(--warning); }
.fill-expired  { background: var(--danger); }
.fill-overdue  { background: var(--danger); }
.fill-returned { background: #cbd5e1; }

.machine-bar-dates {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
}
.machine-bar-unlimited {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* Actions */
.machine-actions { display: flex; gap: 4px; flex-wrap: nowrap; }

@media (max-width: 800px) {
  .machine-list-table th, .machine-list-table td { padding: 10px 10px; }
  .machine-bar-cell { min-width: 150px; }
  .machine-actions { flex-wrap: wrap; }
}

/* ================================================================
   CLIENT TYPE TOGGLE
   ================================================================ */
.type-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.type-toggle label {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  background: var(--card);
  transition: background 0.12s, color 0.12s;
  user-select: none;
  line-height: 1.4;
}
.type-toggle label:not(:first-child) {
  border-left: 1px solid var(--border);
}
.type-toggle label:has(input:checked) {
  background: var(--primary);
  color: #fff;
}
.type-toggle label:not(:has(input:checked)):hover {
  background: var(--hover);
  color: var(--text);
}
.type-toggle input[type="radio"] { display: none; }

/* Juridică-only field wrapper — collapsible nested grid */
#juridicaFields {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-height: 600px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.18s ease, opacity 0.18s ease, gap 0.18s ease;
}
#juridicaFields.hidden-section {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  gap: 0;
}
@media (max-width: 700px) {
  #juridicaFields { grid-template-columns: 1fr; }
}

/* Financial sub-label inside form grid */
.field-group-label {
  grid-column: span 2;
  margin: 4px 0 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-dark);
  font-weight: 600;
}
@media (max-width: 700px) {
  .field-group-label { grid-column: span 1; }
}

/* ================================================================
   WIZARD — New Order (3-step)
   ================================================================ */

/* ── Step indicator bar ── */
.wizard-steps {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.wizard-step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.wizard-step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.wizard-step-item.active .wizard-step-circle { background: var(--primary); color: #fff; }
.wizard-step-item.done   .wizard-step-circle { background: var(--success);  color: #fff; }

.wizard-step-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.3;
}
.wizard-step-item.active .wizard-step-title,
.wizard-step-item.done   .wizard-step-title { color: var(--text); }

.wizard-step-sub { font-size: 11px; color: var(--muted); line-height: 1.3; }

.wizard-step-connector {
  flex: 1;
  max-width: 80px;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
  transition: background 0.2s;
}
.wizard-step-connector.done { background: var(--success); }

/* ── Two-panel catalog layout ── */
.catalog-panel {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 520px;
  overflow: hidden;
  margin-bottom: 16px;
}

.catalog-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--border);
}

.catalog-panel .catalog-search {
  display: block;
  margin-left: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--hover);
  flex-shrink: 0;
}

.catalog-panel .catalog-search input {
  width: 100%;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--card);
  box-sizing: border-box;
}
.catalog-panel .catalog-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
}

.catalog-panel #accordion-groups { flex: 1; overflow-y: auto; }

/* ── Accordion ── */
.accordion-group { border-bottom: 1px solid var(--border); }

.accordion-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  user-select: none;
}
.accordion-header:hover { background: var(--hover); }
.accordion-header.open  { background: #f0fdfa; border-left-color: var(--primary); }

.accordion-group-name { font-weight: 600; font-size: 13px; flex: 1; color: var(--text); }
.accordion-count      { font-size: 11px; color: var(--muted); white-space: nowrap; }

.in-cart-badge {
  background: #dcfce7;
  color: #166534;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.accordion-arrow {
  color: var(--muted);
  font-size: 16px;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

/* ── Catalog table: fixed layout so opening groups never shifts column widths ── */
.catalog-panel .table {
  table-layout: fixed;
  width: 100%;
}
.catalog-panel .table td:nth-child(1) { width: auto; }
.catalog-panel .table td:nth-child(2) { width: 70px; }
.catalog-panel .table td:nth-child(3) { width: 120px; }
.catalog-panel .table td:nth-child(4) { width: 160px; }

/* ── Product rows ── */
.product-row.in-cart { background: #f0fdfa; }
.product-row.in-cart .product-name { font-weight: 600; color: var(--primary-dark); }
.product-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* ── Stepper (catalog rows) — scoped to wizard to avoid portal collision ── */
.catalog-panel .stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1.5px solid var(--primary);
  border-radius: 7px;
  padding: 3px 6px;
  background: #f0fdfa;
}

.catalog-panel .stepper-dec, .catalog-panel .stepper-inc {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}
.catalog-panel .stepper-inc { background: var(--primary); color: #fff; border-color: var(--primary); }
.catalog-panel .stepper-inc:hover { background: var(--primary-dark, #0b7a70); border-color: var(--primary-dark, #0b7a70); }

.qty-display {
  width: 40px;
  text-align: center;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  padding: 0;
}

/* ── Cart panel ── */
.catalog-right {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fafafa;
}

.cart-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.cart-body { flex: 1; overflow-y: auto; padding: 8px; }

.cart-empty { padding: 20px 8px; text-align: center; }

.cart-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  margin-bottom: 6px;
}

.cart-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
  line-height: 1.3;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.cart-stepper { display: flex; align-items: center; gap: 4px; }

.cart-dec, .cart-inc {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--hover);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.cart-inc { background: var(--primary); color: #fff; border-color: var(--primary); }

.cart-qty {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  min-width: 20px;
  text-align: center;
}

.cart-item-total { font-size: 12px; font-weight: 700; color: var(--text); white-space: nowrap; }

.cart-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.cart-summary-total { font-size: 15px; font-weight: 700; color: var(--primary); }

/* ── Wizard panels (JS-toggled via .hidden) ── */
.wizard-panel { display: block; }

/* ── Step 1 centered card ── */
.wizard-step-1-wrap { max-width: 480px; margin: 40px auto; }

/* ── Mobile ── */
@media (max-width: 700px) {
  .catalog-panel    { flex-direction: column; }
  .catalog-left     { border-right: none; border-bottom: 1px solid var(--border); }
  .catalog-right    { width: 100%; max-height: 280px; }
  .wizard-steps     { padding: 12px 16px; }
  .wizard-step-connector { max-width: 40px; margin: 0 8px; }
  .wizard-step-sub  { display: none; }
}

/* ── Module CRM: badge-uri stare echipament ── */
.badge-stare-activ { background: #d1fae5; color: #065f46; }
.badge-stare-in_service { background: #fef3c7; color: #92400e; }
.badge-stare-retras { background: #e5e7eb; color: #4b5563; }

/* ── Module CRM: tichete service ── */
.badge-t-nou { background: #dbeafe; color: #1e40af; }
.badge-t-preluat { background: #e0e7ff; color: #3730a3; }
.badge-t-in_lucru { background: #fef3c7; color: #92400e; }
.badge-t-asteapta_piese { background: #ffe8b3; color: #7a4a00; }
.badge-t-rezolvat { background: #d1fae5; color: #065f46; }
.badge-t-inchis { background: #e5e7eb; color: #4b5563; }
.badge-urgenta-scazuta { background: #e5e7eb; color: #4b5563; }
.badge-urgenta-normala { background: #dbeafe; color: #1e40af; }
.badge-urgenta-ridicata { background: #fee2e2; color: #991b1b; }

/* Poze tichete */
.poze-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.poze-grid img {
  width: 110px; height: 110px; object-fit: cover;
  border-radius: var(--radius, 8px); border: 1px solid var(--border, #e2e8f0);
}

/* Vederi tehnician (mobil): carduri mari, butoane late */
.tichet-card {
  display: block; background: var(--card, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 8px);
  padding: 14px 16px; margin-bottom: 10px; color: inherit;
}
.tichet-card:hover { border-color: #94a3b8; text-decoration: none; }
.tichet-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.tap-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-tap { padding: 14px 22px; font-size: 16px; }

/* ── Module CRM: badge-uri contracte ── */
.badge-c-activ { background: #d1fae5; color: #065f46; }
.badge-c-expirat { background: #fee2e2; color: #991b1b; }
.badge-c-reziliat { background: #e5e7eb; color: #4b5563; }

/* Dashboard CRM: KPI-uri clicabile */
a.kpi-link { color: inherit; display: block; }

/* ================================================================
   FLUID CATALOG (portal client — card grid + instant filtering)
   ================================================================ */
.fc-layout { display: flex; gap: 18px; align-items: flex-start; }

/* ── Category rail: prominent "windows" ── */
.fc-rail { width: 258px; flex-shrink: 0; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; scrollbar-width: thin; padding: 2px; }
.fc-rail-title { font-size: 11px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); font-weight: 650; padding: 2px 4px 10px; }
.fc-tile {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; margin-bottom: 9px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 13px; box-shadow: var(--shadow-sm);
  cursor: pointer; text-decoration: none; color: var(--text);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.fc-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); text-decoration: none; }
.fc-tile.active { border-color: var(--primary); background: linear-gradient(180deg, #f0fdfa, #ffffff); box-shadow: 0 10px 26px -14px rgba(13,148,136,.55); }
.fc-tile.active::before { content: ""; position: absolute; left: 0; top: 13px; bottom: 13px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--primary), var(--primary-dark)); }
.fc-logo {
  width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff;
  background: linear-gradient(135deg, #0f766e, #0d9488);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18); overflow: hidden;
}
.fc-logo img { width: 100%; height: 100%; object-fit: cover; }
.fc-logo-all { background: linear-gradient(135deg, #334155, #0f172a); }
.fc-tile.active .fc-logo { box-shadow: 0 0 0 3px rgba(13,148,136,.28); }
.fc-meta { flex: 1; min-width: 0; }
.fc-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.fc-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.fc-count {
  flex-shrink: 0; min-width: 30px; text-align: center;
  font-size: 12px; font-weight: 700; color: var(--primary-dark);
  background: var(--primary-tint); border: 1px solid var(--primary-soft);
  border-radius: 999px; padding: 3px 9px;
}
.fc-tile.active .fc-count { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Main column ── */
.fc-main { flex: 1; min-width: 0; }
.fc-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.fc-heading h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.fc-heading .fc-sub { margin-top: 1px; }
.fc-searchwrap { margin-left: auto; position: relative; }
.fc-searchwrap input { width: 300px; padding-left: 34px; }
.fc-searchico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; pointer-events: none; }

/* Mobile category strip (hidden on desktop) */
.fc-strip { display: none; }

/* ── Product card grid ── */
.fc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 14px; }
@media (prefers-reduced-motion: no-preference) {
  .fc-grid.animate { animation: fc-grid-in .28s var(--ease); }
}
@keyframes fc-grid-in { from { opacity: .35; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.fc-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 15px; padding: 16px 16px 15px; box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.fc-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.fc-card.selected { border-color: var(--primary); background: linear-gradient(180deg, #f0fdfa, #ffffff); box-shadow: 0 12px 28px -16px rgba(13,148,136,.55); }
.fc-card-top { margin-bottom: 11px; }
.fc-card-name { font-size: 14px; font-weight: 650; line-height: 1.32; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fc-card-sub { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.fc-card-price { margin-top: auto; padding-top: 14px; }
.fc-was { display: block; font-size: 11.5px; color: var(--muted); text-decoration: line-through; margin-bottom: 2px; }
.fc-now { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.fc-now.disc { color: #15803d; }
.fc-cur { font-size: 12px; color: var(--muted); font-weight: 600; }
.fc-card-foot { margin-top: 13px; }

/* Pill quantity stepper */
.fc-qty { display: flex; align-items: center; width: 100%; background: #fff; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.fc-qty button { width: 40px; height: 36px; border: 0; background: transparent; color: var(--primary-dark); font-size: 18px; line-height: 1; cursor: pointer; transition: background .12s; flex-shrink: 0; }
.fc-qty button:hover { background: var(--primary-tint); }
.fc-qty input { flex: 1; width: 100%; height: 36px; text-align: center; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); font-size: 14px; font-weight: 700; color: var(--muted); background: transparent; -moz-appearance: textfield; border-radius: 0; }
.fc-qty input::-webkit-outer-spin-button, .fc-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fc-card.selected .fc-qty { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,148,136,.16); }
.fc-card.selected .fc-qty input { color: var(--primary-dark); }

/* ── Cart panel ── */
.fc-cart { width: 262px; flex-shrink: 0; position: sticky; top: 16px; max-height: calc(100vh - 32px); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); display: flex; flex-direction: column; overflow: hidden; }
.fc-cart-head { background: var(--sidebar-bg); background-image: linear-gradient(180deg, var(--sidebar-bg-2), var(--sidebar-bg)); color: #fff; padding: 13px 15px; font-size: 13.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.fc-cart-n { margin-left: auto; background: rgba(255,255,255,.16); border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 700; }
.fc-cart-items { flex: 1; overflow-y: auto; padding: 8px 12px; scrollbar-width: thin; }
.fc-cart-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 24px 8px; }
.fc-cart-item { display: flex; justify-content: space-between; gap: 8px; padding: 9px 2px; border-bottom: 1px solid var(--border); animation: fc-cci .28s var(--ease) both; }
@keyframes fc-cci { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fc-cart-item:last-child { border-bottom: none; }
.fc-cart-item-name { font-size: 12.5px; font-weight: 500; line-height: 1.3; }
.fc-cart-item-qty { font-size: 11px; color: var(--muted); margin-top: 2px; }
.fc-cart-item-total { font-size: 12.5px; font-weight: 700; color: var(--primary-dark); white-space: nowrap; }
.fc-cart-foot { border-top: 1px solid var(--border); padding: 13px 15px; background: var(--bg-tint); flex-shrink: 0; }
.fc-cart-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 11px; }
.fc-cart-total .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 650; }
.fc-cart-total .val { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.fc-cart-notes { width: 100%; font-size: 12px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 9px; resize: none; margin-bottom: 10px; font-family: inherit; box-sizing: border-box; }
.fc-cart-btn { width: 100%; border: 0; border-radius: 10px; padding: 12px; font-size: 14px; font-weight: 650; color: #fff; cursor: pointer; background: linear-gradient(180deg, #10a99b, var(--primary) 55%, var(--primary-dark)); box-shadow: 0 8px 18px -8px rgba(13,148,136,.7); transition: transform .1s var(--ease), box-shadow .15s var(--ease); }
.fc-cart-btn:hover { box-shadow: 0 12px 24px -8px rgba(13,148,136,.85); }
.fc-cart-btn:active { transform: translateY(1px); }
.fc-cart-btn:disabled { opacity: .5; cursor: default; box-shadow: none; }

/* Mobile bottom bar (hidden on desktop) */
.fc-cart-mobile { display: none; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .fc-layout { flex-direction: column; gap: 0; }
  .fc-rail { display: none; }
  .fc-cart { display: none; }
  .fc-main { width: 100%; }

  /* Category strip: horizontal swipe */
  .fc-strip {
    display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 2px 0 12px; margin-bottom: 4px; scrollbar-width: none;
  }
  .fc-strip::-webkit-scrollbar { display: none; }
  .fc-chip {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    padding: 8px 14px; border-radius: 999px; flex-shrink: 0;
    background: var(--card); border: 1px solid var(--border);
    font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none;
    box-shadow: var(--shadow-sm);
  }
  .fc-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
  .fc-chip-n { font-size: 11px; opacity: .8; font-weight: 700; }
  .fc-chip.active .fc-chip-n { opacity: .9; }

  .fc-searchwrap { margin-left: 0; width: 100%; }
  .fc-searchwrap input { width: 100%; }
  .fc-toolbar { gap: 10px; }
  .fc-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .fc-card { padding: 13px 13px 12px; }

  /* Cart → fixed bottom bar (shown only when it has items, via .show) */
  .fc-cart-mobile.show {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--sidebar-bg); color: #fff; z-index: 150;
    padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    align-items: center; gap: 12px; box-shadow: 0 -4px 20px rgba(0,0,0,.18);
  }
  .fc-cart-mobile-sum { flex: 1; font-size: 13px; }
  .fc-cart-mobile-btn { background: var(--primary); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap; }
}

/* Dashboard CRM: KPI-uri clicabile (hover) */
a.kpi-link:hover { border-color: #94a3b8; text-decoration: none; }
