:root {
  --bg: #eef4f1;
  --bg-strong: #dfe9e5;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-muted: #f7faf8;
  --text: #10251f;
  --muted: #6a7d75;
  --line: rgba(20, 47, 39, 0.12);
  --primary: #123c31;
  --primary-strong: #08231d;
  --primary-soft: #dcebe5;
  --accent: #d5ad38;
  --danger: #b53b3b;
  --warning: #b98718;
  --success: #1d7d54;
  --shadow: 0 24px 70px rgba(17, 47, 39, 0.14);
  --shadow-soft: 0 12px 34px rgba(17, 47, 39, 0.1);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #08110f;
  --bg-strong: #101d19;
  --surface: rgba(17, 31, 27, 0.88);
  --surface-solid: #111f1b;
  --surface-muted: #172822;
  --text: #f2faf6;
  --muted: #9bb3aa;
  --line: rgba(226, 245, 237, 0.12);
  --primary: #7bd7ad;
  --primary-strong: #dff8ed;
  --primary-soft: rgba(123, 215, 173, 0.12);
  --accent: #e2bd4e;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(213, 173, 56, 0.16), transparent 32rem),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-strong) 100%);
  color: var(--text);
  font-family: var(--font);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.login-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 6rem 1.25rem 7.5rem;
  overflow: hidden;
}

.ambient {
  position: absolute;
  border-radius: 999px;
  filter: blur(10px);
  opacity: 0.55;
  pointer-events: none;
}

.ambient-one {
  width: 22rem;
  height: 22rem;
  top: 8%;
  left: 8%;
  background: rgba(213, 173, 56, 0.15);
}

.ambient-two {
  width: 28rem;
  height: 28rem;
  right: -7rem;
  bottom: 4rem;
  background: rgba(18, 60, 49, 0.12);
}

.login-toolbar {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  padding: 2.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: inline-grid;
  width: 4rem;
  height: 4rem;
  place-items: center;
  border-radius: 1.2rem;
  background: linear-gradient(145deg, var(--accent), #f0cd62);
  color: #153329;
  box-shadow: 0 14px 30px rgba(213, 173, 56, 0.3);
  font-weight: 900;
}

.brand-mark.small {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.9rem;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.6rem;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 2.25rem);
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 0.4rem;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.login-copy {
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.75rem;
  text-align: left;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text);
  outline: none;
  padding: 0 0.95rem;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.primary-button,
.dark-button,
.outline-button,
.ghost-button,
.icon-button,
.text-button,
.chip,
.segment {
  border: 0;
  border-radius: var(--radius-sm);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.primary-button,
.dark-button {
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.1rem;
  background: var(--primary);
  color: #fff;
  font-weight: 850;
}

[data-theme="dark"] .primary-button,
[data-theme="dark"] .dark-button {
  color: #08231d;
}

.primary-button:hover,
.dark-button:hover,
.outline-button:hover,
.ghost-button:hover,
.icon-button:hover,
.chip:hover {
  transform: translateY(-1px);
}

.full {
  width: 100%;
}

.small-button {
  min-height: 2.5rem;
}

.outline-button,
.ghost-button {
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--text);
  font-weight: 800;
}

.icon-button {
  display: inline-grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.text-button {
  padding: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 850;
}

.danger {
  color: var(--danger);
}

.segmented-control {
  display: flex;
  gap: 0.3rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.segmented-control.compact {
  box-shadow: none;
}

.segment {
  min-width: 2.7rem;
  height: 2.45rem;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.segment.active {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}

.install-banner {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.install-banner p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.install-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-view {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(20px);
}

[data-theme="dark"] .sidebar {
  background: rgba(8, 17, 15, 0.72);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.45rem;
}

.sidebar-brand span,
.sidebar-card p {
  display: block;
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.main-nav {
  display: grid;
  gap: 0.45rem;
}

.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.7rem;
  min-height: 3rem;
  padding: 0 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  border-color: var(--line);
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.nav-item.priority {
  color: var(--primary);
}

.sidebar-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.status-dot {
  width: 0.75rem;
  height: 0.75rem;
  margin-top: 0.25rem;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(29, 125, 84, 0.14);
}

.admin-main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(238, 244, 241, 0.8);
  backdrop-filter: blur(20px);
}

[data-theme="dark"] .topbar {
  background: rgba(8, 17, 15, 0.8);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.search {
  position: relative;
  display: flex;
  min-width: 280px;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--muted);
  padding: 0 0.8rem;
}

.search input {
  min-height: 2.75rem;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.search.wide {
  min-width: 0;
  width: 100%;
  margin: 1rem 0;
}
.search.narrow {
  min-width: 0;
}

.content {
  padding: 1.5rem;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.hero-panel,
.panel,
.kpi-card,
.report-card,
.customer-card,
.order-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.4rem;
  border-radius: var(--radius-xl);
}

.hero-panel p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.6;
}

.kpi-grid,
.dashboard-grid,
.report-grid,
.customer-grid,
.order-cards {
  display: grid;
  gap: 1rem;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

.kpi-card {
  display: grid;
  gap: 0.35rem;
  padding: 1.15rem;
  border-radius: var(--radius-lg);
}

.kpi-card span,
.report-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.kpi-card strong {
  font-size: 2rem;
  letter-spacing: -0.05em;
}

.kpi-card em {
  color: var(--success);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 800;
}

.kpi-card.warning em {
  color: var(--warning);
}

.panel {
  padding: 1.15rem;
  border-radius: var(--radius-lg);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0 0.7rem;
  font-size: 0.78rem;
  font-weight: 900;
}

.pill.success,
.badge.success {
  background: rgba(29, 125, 84, 0.12);
  color: var(--success);
}

.badge.warning {
  background: rgba(185, 135, 24, 0.14);
  color: var(--warning);
}

.badge.neutral {
  color: var(--muted);
}

.activity-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.activity-list p,
.activity-list time {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.activity-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
}

.activity-dot.sale {
  background: var(--success);
}

.activity-dot.order {
  background: var(--accent);
}

.activity-dot.stock {
  background: var(--warning);
}

.mini-bars {
  display: grid;
  gap: 0.95rem;
}

.mini-bars div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
}

.mini-bars strong {
  grid-column: 1 / -1;
  height: 0.55rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.mini-bars em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 1rem;
  align-items: start;
}

.cart-panel {
  position: sticky;
  top: 6.5rem;
}

.category-row {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.chip {
  min-height: 2.45rem;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}

.chip.active {
  background: var(--primary);
  color: #fff;
}

[data-theme="dark"] .chip.active {
  color: #08231d;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.product-card {
  display: grid;
  gap: 0.6rem;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  color: var(--text);
  padding: 1rem;
  text-align: left;
}

.product-card:hover {
  box-shadow: var(--shadow-soft);
}

.product-card small {
  color: var(--muted);
  font-weight: 800;
}

.product-card strong {
  font-size: 1rem;
}

.product-card .price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.product-card em {
  color: var(--primary);
  font-size: 1.15rem;
  font-style: normal;
  font-weight: 950;
}

.stock-label {
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 900;
}

.cart-items {
  display: grid;
  gap: 0.75rem;
  min-height: 160px;
}

.empty-cart {
  display: grid;
  min-height: 150px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.cart-item p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.qty-control button {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--surface-solid);
  color: var(--text);
  font-weight: 900;
}

.discount-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1rem 0;
}

.totals {
  display: grid;
  gap: 0.65rem;
  margin: 0 0 1rem;
}

.totals div {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.totals dd {
  margin: 0;
  color: var(--text);
  font-weight: 900;
}

.totals .total {
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 950;
}

.helper-text {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
  text-align: center;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td strong {
  display: block;
}

td small {
  color: var(--muted);
}

.order-cards,
.customer-grid,
.report-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.order-card,
.customer-card,
.report-card {
  padding: 1rem;
  border-radius: var(--radius-md);
}

.order-card {
  display: grid;
  gap: 0.65rem;
}

.order-card p,
.customer-card p {
  margin: 0;
  color: var(--muted);
}

.customer-card span {
  display: block;
  margin: 0.35rem 0 0.75rem;
  color: var(--primary);
  font-weight: 900;
}

.report-card {
  display: grid;
  gap: 0.45rem;
}

.report-card strong {
  font-size: 2rem;
  letter-spacing: -0.05em;
}

.settings-panel {
  max-width: 760px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.setting-row + .setting-row {
  margin-top: 0.8rem;
}

.setting-row small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
}

.setting-row input[type="checkbox"] {
  width: 1.3rem;
  min-height: 1.3rem;
}

@media (max-width: 1180px) {
  .admin-view {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .sidebar {
    padding: 0.9rem;
  }

  .sidebar-brand div:not(.brand-mark),
  .nav-item span:last-child,
  .sidebar-card div {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .sidebar-card {
    justify-content: center;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .admin-view {
    display: block;
    padding-bottom: 5rem;
  }

  .sidebar {
    position: fixed;
    right: 0.75rem;
    bottom: 0.75rem;
    left: 0.75rem;
    top: auto;
    z-index: 5;
    display: block;
    height: auto;
    padding: 0.45rem;
    border: 1px solid var(--line);
    border-radius: 1.3rem;
    box-shadow: var(--shadow);
  }

  .sidebar-brand,
  .sidebar-card {
    display: none;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
  }

  .nav-item {
    min-height: 3rem;
    border-radius: 1rem;
  }

  .topbar {
    position: static;
    display: grid;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .search {
    min-width: min(100%, 360px);
    flex: 1;
  }

  .dashboard-grid,
  .pos-layout,
  .order-cards,
  .customer-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .login-card {
    padding: 1.35rem;
  }

  .install-banner,
  .hero-panel,
  .panel-heading,
  .setting-row {
    align-items: stretch;
    flex-direction: column;
  }

  .install-banner,
  .install-actions {
    justify-content: stretch;
  }

  .install-actions > * {
    flex: 1;
  }

  .content,
  .topbar {
    padding: 1rem;
  }

  .kpi-grid,
  .product-grid,
  .discount-row {
    grid-template-columns: 1fr;
  }

  .main-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-item:nth-child(n + 5) {
    display: none;
  }
}

/* ── MODALS ─────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 18, 0.58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 200;
}

.modal-backdrop.is-hidden,
.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  background: var(--surface-solid);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.5rem;
  position: relative;
  box-shadow: var(--shadow);
  width: min(100%, 520px);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  cursor: pointer;
  font-size: 1.2rem;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  gap: 0.7rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* ── ADMIN FIELDS ────────────────────────────────── */
.admin-field {
  display: grid;
  gap: 0.35rem;
}

.admin-field span,
.admin-field > span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-field input,
.admin-field select,
.admin-field textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  width: 100%;
}

.admin-field textarea {
  resize: vertical;
}

/* ── IMAGE UPLOAD ────────────────────────────────── */
.image-upload-box {
  display: grid;
  gap: 0.65rem;
  padding: 0.9rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-solid) 82%, var(--primary) 8%);
}

.image-watermark-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 0.9rem;
}

.image-upload-button {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0 0.9rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(15, 123, 69, 0.18);
  font-size: 0.9rem;
}

.image-upload-box small {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.82rem;
}

/* ── TABLE ACTIONS ───────────────────────────────── */
.table-actions {
  display: flex;
  gap: 0.4rem;
}

/* Righe tabella prodotti cliccabili */
.product-table-row {
  cursor: pointer;
  transition: background 0.12s;
}

.product-table-row:hover {
  background: var(--primary-soft);
}

.product-table-row:hover .outline-button {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.product-table-row--inactive {
  opacity: 0.5;
}

.small-button {
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  min-height: auto;
}

/* ── NAV BADGE ───────────────────────────────────── */
.nav-item__icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  flex-shrink: 0;
  font-size: 1.05rem;
}

.nav-item__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #d92d20;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
}

/* Badge sull'icona — visibile SOLO quando sidebar è chiusa */
@media (min-width: 1181px) {
  .nav-item__badge--icon:not([hidden]) { display: none !important; }
}

.nav-item__badge--icon {
  position: absolute;
  top: -0.38rem;
  right: -0.5rem;
  left: auto;
  min-width: 1.15rem;
  height: 1.15rem;
  font-size: 0.62rem;
  box-shadow: 0 0 0 2px var(--surface-solid);
}

.nav-item__badge--icon[hidden] { display: none !important; }

/* Badge testo — visibile solo a sidebar espansa, nascosto quando chiusa */
.nav-item__badge--text[hidden] { display: none !important; }

.nav-item__badge--reply {
  background: #e53935;
  font-size: 0.95rem;
  min-width: 1.6rem;
  height: 1.6rem;
  animation: reply-pulse 1.4s ease-in-out infinite;
}
.nav-item__badge--reply[hidden] { display: none !important; }
@keyframes reply-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.18); opacity: .8; }
}

@media (max-width: 1180px) {
  .nav-item > span.nav-item__label,
  .sidebar-brand div:not(.brand-mark),
  .sidebar-card div {
    display: none;
  }

  /* Quando sidebar chiusa, il badge testo è inutile (label nascosta) */
  .nav-item__badge--text:not([hidden]) { display: none !important; }
}

@media (max-width: 900px) {
  .nav-item__badge--icon:not([hidden]) {
    top: -0.28rem;
    right: -0.2rem;
  }
}

/* ── REPORTS STACK ───────────────────────────────── */
.reports-stack {
  display: grid;
  gap: 1.2rem;
}

/* ── DAILY SPLIT ─────────────────────────────────── */
.daily-split-panel {
  background: linear-gradient(135deg, rgba(15,123,69,0.06) 0%, transparent 60%), var(--surface);
}

.daily-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
}

.daily-split-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  background: var(--surface-muted, rgba(0,0,0,0.03));
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.daily-split-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.daily-split-card--shop::before  { background: #0f7b45; }
.daily-split-card--web::before   { background: #c9a227; }
.daily-split-card--total::before { background: linear-gradient(90deg, #0f7b45, #c9a227); }

.daily-split-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.6;
  margin: 0;
}

.daily-split-card strong {
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1;
  color: var(--text);
}

.daily-split-card--total strong { font-size: 2rem; }

.daily-split-card em {
  font-size: 0.75rem;
  opacity: 0.55;
  font-style: normal;
}

@media (max-width: 600px) {
  .daily-split-grid { grid-template-columns: 1fr; }
}

/* ── ORDERS CSS ──────────────────────────────────── */
.web-orders-panel {
  background:
    radial-gradient(circle at 96% 12%, rgba(201, 162, 39, 0.14), transparent 14rem),
    radial-gradient(circle at 4% 94%, rgba(15, 123, 69, 0.1), transparent 16rem),
    var(--surface);
}

.web-orders-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.web-orders-hero__actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.web-realtime {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.7rem;
  border-radius: 999px;
  background: rgba(12, 31, 26, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.web-realtime::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: currentColor;
}

.web-realtime--online  { background: rgba(15, 123, 69, 0.14); color: var(--primary); }
.web-realtime--connecting { background: rgba(201, 162, 39, 0.16); color: #9a7315; }
.web-realtime--offline { background: rgba(217, 45, 32, 0.12); color: #d92d20; }

.web-order-date-filters,
.web-order-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.web-order-date-filters { margin-bottom: 0.55rem; }

.web-order-date-filter,
.web-order-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--muted);
  padding: 0.5rem 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.web-order-date-filter span,
.web-order-filter span {
  min-width: 1.45rem;
  height: 1.45rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(12, 31, 26, 0.08);
  color: var(--text);
  font-size: 0.76rem;
}

.web-order-date-filter--active {
  background: rgba(15, 123, 69, 0.12);
  border-color: rgba(15, 123, 69, 0.28);
  color: var(--primary);
}

.web-order-filter--active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-soft);
}

.web-order-filter--active span {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.orders-table tbody tr.is-selected { background: rgba(15, 123, 69, 0.06); }
.orders-table tbody tr:hover { background: rgba(15, 123, 69, 0.04); }

.dashboard-orders-panel { margin-top: 1rem; }

.dashboard-order-message small {
  display: block;
  max-width: 280px;
  line-height: 1.45;
  color: var(--muted);
}

.dashboard-order-message--pending small { color: #9a7315; font-weight: 800; }
.orders-table tr.needs-jane-reply { background: rgba(201, 162, 39, 0.08); }

.jane-message-box {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15, 123, 69, 0.22);
  background: rgba(15, 123, 69, 0.06);
}

.jane-message-box__head h4 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.jane-message-box__head p { margin: 0; color: var(--muted); line-height: 1.45; }

.jane-bubble {
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  display: grid;
  gap: 0.3rem;
}
.jane-bubble p { margin: 0; line-height: 1.5; font-size: 0.95rem; }
.jane-bubble__label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .75; }
.jane-bubble--customer {
  background: rgba(255,255,255,.7);
  border: 1px solid var(--line);
  align-self: flex-start;
}
.jane-bubble--sent {
  background: rgba(15,123,69,.12);
  border: 1px solid rgba(15,123,69,.3);
}
.jane-bubble--sent .jane-bubble__label { color: var(--success, #0f7b45); }
.order-form-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.web-order-status-block h4 { margin: 0 0 0.55rem; }

.activity-order-item { align-items: center; }
.activity-order-item .badge { margin-left: auto; }

.activity-order-item[data-order-open] {
  cursor: pointer;
  transition: background 0.18s;
  border-radius: var(--radius-sm, 6px);
  margin: 0 -0.6rem;
  padding: 0.45rem 0.6rem;
}

.activity-order-item[data-order-open]:hover {
  background: rgba(15,123,69,0.1);
  box-shadow: inset 3px 0 0 #0f7b45;
}

.order-modal-card {
  width: min(96vw, 1080px);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-left: 3px solid #d5a820;
  border-right: 3px solid #d5a820;
  background: color-mix(in srgb, #d5a820 12%, var(--surface-solid));
}

/* ── ORDER MODAL HEADER ── */
.order-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem 1.2rem;
  background: linear-gradient(135deg, #d5a820 0%, #f0cd62 100%);
  color: #1a2b1a;
  flex-shrink: 0;
}

.order-modal-header__info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.order-modal-header__code {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
}

.order-modal-header__name {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
}

.order-modal-header__sub {
  font-size: 0.85rem;
  opacity: 0.7;
}

.order-modal-header__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
}

.order-modal-header__total {
  font-size: 1.55rem;
  font-weight: 900;
  color: #1a2b1a;
  line-height: 1;
}

.order-modal-header__close {
  background: rgba(0,0,0,0.12);
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: #1a2b1a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.order-modal-header__close:hover {
  background: rgba(0,0,0,0.22);
}

/* ── ORDER MODAL BODY ── */
.order-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: grid;
  gap: 1rem;
  align-content: start;
  background: color-mix(in srgb, #d5a820 12%, var(--surface-solid));
}
.order-modal-body--cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0;
  overflow: hidden;
}
.order-col {
  padding: 1.1rem 1.25rem;
  display: grid;
  gap: 0.85rem;
  align-content: start;
  overflow-y: auto;
}
.order-col--left {
  border-right: 1px solid var(--line);
}
.order-col--right {
  background: rgba(15,123,69,.04);
}

/* chat thread */
.order-chat { display: grid; gap: 0.6rem; }
.order-chat__title { margin: 0; font-size: 0.9rem; font-weight: 700; opacity: .8; }
.order-chat__thread {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 60px;
}
.order-chat__reply {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.order-chat__reply textarea {
  resize: vertical;
  min-height: 60px;
}
.order-modal-feedback {
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 1.2em;
  transition: color .2s;
}
.order-modal-feedback--ok  { color: #0f7b45; }
.order-modal-feedback--error { color: #c0392b; }
.web-order-item--total {
  border-top: 1px solid var(--line);
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  font-weight: 700;
}

/* ── ORDER MODAL FOOTER ── */
.order-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(135deg, #d5a820 0%, #f0cd62 100%);
  color: #1a2b1a;
  flex-shrink: 0;
}

.order-modal-footer__date {
  font-size: 0.82rem;
  opacity: 0.7;
  font-weight: 600;
}

.order-modal-footer__close {
  background: rgba(0,0,0,0.14);
  border: none;
  border-radius: var(--radius);
  padding: 0.45rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #1a2b1a;
  cursor: pointer;
  transition: background 0.15s;
}

.order-modal-footer__close:hover {
  background: rgba(0,0,0,0.24);
}

/* ── STATS DETAIL MODAL ── */
.stats-detail-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.6rem;
}

.stats-detail-kpi-item {
  background: color-mix(in srgb, #1e7a50 10%, var(--surface-solid));
  border: 1px solid color-mix(in srgb, #1e7a50 20%, transparent);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stats-detail-kpi-item span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.stats-detail-kpi-item strong {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

/* Card giornaliere cliccabili */
.daily-split-card--clickable {
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.daily-split-card--clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* ── SALE MODAL — tema verde ── */
.sale-modal-card {
  border-left-color: #1e7a50;
  border-right-color: #1e7a50;
  background: color-mix(in srgb, #1e7a50 12%, var(--surface-solid));
}

.sale-modal-card .order-modal-header,
.sale-modal-card .order-modal-footer {
  background: linear-gradient(135deg, #1a6b47 0%, #27a870 100%);
  color: #e6f8ef;
}

.sale-modal-card .order-modal-header__name,
.sale-modal-card .order-modal-header__total {
  color: #e6f8ef;
}

.sale-modal-card .order-modal-header__close {
  color: #e6f8ef;
  background: rgba(255,255,255,0.12);
}

.sale-modal-card .order-modal-header__close:hover {
  background: rgba(255,255,255,0.22);
}

.sale-modal-card .order-modal-body {
  background: color-mix(in srgb, #1e7a50 12%, var(--surface-solid));
}

.sale-modal-card .order-modal-footer__date {
  color: #e6f8ef;
}

.sale-modal-card .order-modal-footer__close {
  color: #e6f8ef;
  background: rgba(255,255,255,0.12);
}

.sale-modal-card .order-modal-footer__close:hover {
  background: rgba(255,255,255,0.22);
}

/* ── STATS FILTERS ── */
.stats-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.stats-filter-btns {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.stats-filter-btn {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.stats-filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.stats-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

[data-theme="light"] .stats-filter-btn.active {
  color: var(--surface-solid);
}

.stats-filter-tz {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

/* KPI grid statistiche */
.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stats-kpi-card {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stats-kpi-card span {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats-kpi-card strong {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.stats-kpi-card--accent {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.stats-kpi-card--accent strong {
  color: var(--primary);
}

/* ── PRODUCT MODAL ── */
.product-modal-card {
  width: min(96vw, 760px);
  max-height: 94vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: 0 !important;
}

.product-modal-card > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.product-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  background: color-mix(in srgb, var(--primary) 22%, var(--bg-strong));
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  flex-shrink: 0;
}

.product-modal-header__info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.product-modal-header__eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.product-modal-header__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
}

.product-modal-header__close {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 2rem;
  height: 2rem;
  font-size: 1.15rem;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.product-modal-header__close:hover {
  background: var(--line);
  color: var(--text);
}

/* ── body form ── */
.product-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.4rem 1.5rem;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-muted));
}

/* input più contrastati dentro il modal prodotto */
.product-modal-body .admin-field input,
.product-modal-body .admin-field select,
.product-modal-body .admin-field textarea {
  background: color-mix(in srgb, var(--primary) 6%, var(--surface-solid));
  border-color: color-mix(in srgb, var(--muted) 45%, transparent);
}

.product-modal-body .admin-field input:focus,
.product-modal-body .admin-field select:focus,
.product-modal-body .admin-field textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* riga anteprima + nomi */
.pf-row--top {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 1rem;
  align-items: start;
}

.product-image-preview {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  background: var(--surface-muted);
  overflow: visible;
  flex-shrink: 0;
  position: relative;
}

.product-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.product-image-preview .pf-remove-img-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  background: #e53935;
  color: #fff;
  border: 2px solid var(--surface-solid);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s, transform 0.15s;
  line-height: 1;
}

.product-image-preview .pf-remove-img-btn:hover {
  background: #b71c1c;
  transform: scale(1.15);
}

.pf-names {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-content: start;
}

/* righe generiche */
.pf-row--3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

.pf-row--4 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 0.75rem;
}

/* riga upload immagine + visibilità */
.pf-row--image {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: end;
}

/* ── sezione immagine ── */
.pf-image-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.pf-image-row__label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pf-image-row__controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.pf-image-row__controls .pf-url-input {
  flex: 1 1 160px;
  min-width: 0;
}

.pf-vis-field {
  flex-shrink: 0;
  min-width: 120px;
}

.pf-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.pf-upload-btn:hover {
  background: color-mix(in srgb, var(--primary) 20%, var(--primary-soft));
}

.pf-remove-img-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  background: color-mix(in srgb, #e53935 12%, var(--surface-solid));
  color: #c62828;
  border: 1px solid color-mix(in srgb, #e53935 30%, transparent);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.pf-remove-img-btn:hover {
  background: #e53935;
  color: #fff;
  border-color: #e53935;
}

.pf-url-input {
  border: 1px solid color-mix(in srgb, var(--muted) 45%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface-solid));
  color: var(--text);
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  width: 100%;
}

/* ── footer ── */
.product-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.9rem 1.5rem;
  background: color-mix(in srgb, var(--primary) 22%, var(--bg-strong));
  border-top: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  flex-shrink: 0;
}

.product-modal-footer__cancel {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.product-modal-footer__cancel:hover {
  border-color: var(--muted);
  color: var(--text);
}

.product-modal-footer__save {
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.6rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s;
}

[data-theme="light"] .product-modal-footer__save { color: #fff; }

.product-modal-footer__save:hover { opacity: 0.85; }

@media (max-width: 600px) {
  .pf-row--top, .pf-row--3, .pf-row--image, .pf-names {
    grid-template-columns: 1fr;
  }
  .product-image-preview { width: 100%; height: 140px; }
}

/* status badge dentro header giallo */
.order-modal-header .status-badge {
  filter: brightness(0.88) saturate(1.2);
}

.web-order-detail {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.web-order-detail--modal {
  padding-top: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  overflow: hidden;
  min-height: 0;
}

.web-order-detail__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.web-order-detail__top h3 { margin: 0.2rem 0; font-size: 1.35rem; }
.web-order-detail__top p { margin: 0; color: var(--muted); }
.web-order-detail__top > strong { font-size: 1.2rem; color: var(--primary); }

.web-order-detail__meta { display: grid; gap: 0.55rem; }

.web-order-detail__meta span,
.web-order-note,
.web-order-items {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(15, 123, 69, 0.05);
}

.web-order-detail__meta strong,
.web-order-note strong {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.web-order-note p { margin: 0; }
.web-order-items h4 { margin: 0 0 0.35rem; }

.web-order-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
}

.web-order-item:first-of-type { border-top: 0; }

.web-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.web-order-action--active {
  background: rgba(15, 123, 69, 0.12);
  border-color: rgba(15, 123, 69, 0.35);
  color: var(--primary);
}

.order-form-field { display: grid; gap: 0.45rem; }
.order-form-field span { font-weight: 800; }

.order-form-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 0.8rem 0.95rem;
  resize: vertical;
}

.dashboard-order-row { cursor: pointer; transition: background 0.18s; }
.dashboard-order-row:hover td { background: rgba(15,123,69,0.1); }

/* ── LOGOUT BUTTON ───────────────────────────────── */
[data-logout] {
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
}

.activity-sale-item[data-sale-open] {
  cursor: pointer;
  transition: background 0.18s;
  border-radius: var(--radius-sm, 6px);
  margin: 0 -0.6rem;
  padding: 0.45rem 0.6rem;
}

.activity-sale-item[data-sale-open]:hover {
  background: rgba(15,123,69,0.1);
  box-shadow: inset 3px 0 0 #0f7b45;
}


/* ── Activity full log modal ───────────────────────────────────────── */
.activity-modal-card {
  width: min(680px, 96vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 1.15rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.activity-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.activity-modal-header h2 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.activity-modal-header .modal-close {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  width: 1.9rem;
  height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.activity-modal-header .modal-close:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.activity-modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

.activity-modal-footer {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}

/* Same card style as .activity-list li on the dashboard */
.activity-list--full {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-list--full li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}

.activity-list--full li:hover {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}

.activity-list--full li > div { min-width: 0; }
.activity-list--full li > div strong { display: block; font-size: 0.88rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-list--full li > div p { font-size: 0.82rem; color: var(--muted); margin: 0.15rem 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-list--full time,
.activity-list--full .badge { font-size: 0.79rem; white-space: nowrap; flex-shrink: 0; }
.activity-list--full time { color: var(--muted); }

/* ── IMAGE LIBRARY ───────────────────────────────────────────────── */
/* ── Sidebar accordion group ─────────────────────────────────────── */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nav-item--group {
  position: relative;
  justify-content: flex-start;
}

.nav-group__chevron {
  margin-left: auto;
  font-size: 1rem;
  font-weight: 900;
  color: var(--muted);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1), color 0.18s;
  display: inline-block;
  line-height: 1;
  flex-shrink: 0;
}

.nav-group.is-open .nav-group__chevron {
  transform: rotate(90deg);
  color: var(--primary);
}

.nav-item--group.active .nav-group__chevron,
.nav-item--group:hover .nav-group__chevron {
  color: var(--primary);
}

/* Children container — animated slide */
.nav-group__children {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.32s cubic-bezier(.4,0,.2,1),
              opacity 0.28s cubic-bezier(.4,0,.2,1),
              padding 0.28s cubic-bezier(.4,0,.2,1);
  opacity: 0;
  padding-top: 0;
}

.nav-group.is-open .nav-group__children {
  max-height: 200px;
  opacity: 1;
  padding-top: 3px;
}

/* Child nav items */
.nav-item--child {
  padding-left: 2.5rem;
  min-height: 2.6rem;
  font-size: 0.86rem;
  position: relative;
}

.nav-item--child::before {
  content: '';
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 60%;
  background: var(--line);
  border-radius: 1px;
  transition: background 0.18s;
}

.nav-item--child.active::before,
.nav-item--child:hover::before {
  background: var(--primary);
}

.nav-item--child .nav-item__icon {
  font-size: 0.8rem;
  opacity: 0.75;
}

.nav-item--child.active .nav-item__icon,
.nav-item--child:hover .nav-item__icon {
  opacity: 1;
}

.lib-upload-label { cursor: pointer; white-space: nowrap; }

.image-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.image-library-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 3rem;
  font-size: 0.9rem;
}

.image-library-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, border-color .15s;
}
.image-library-card:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, transparent);
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}

.image-library-card__thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.image-library-card__info {
  padding: 0.4rem 0.55rem 0.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  border-top: 1px solid var(--line);
}

.image-library-card__name {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.image-library-card__del {
  background: none;
  border: none;
  color: var(--danger, #c0392b);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.2rem;
  border-radius: var(--radius-sm);
  line-height: 1;
  flex-shrink: 0;
  transition: background .12s;
}
.image-library-card__del:hover { background: rgba(192,57,43,.12); }

/* picker uses same grid inside the modal body */
#imagePickerGrid .image-library-card__thumb { cursor: pointer; }
#imagePickerGrid .image-library-card:hover { border-color: var(--primary); }

/* ── IMAGE LIGHTBOX ───────────────────────────────────────────────── */
#imageLightbox {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.88);
  z-index: 9999;
}

.lightbox-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-img {
  max-width: 88vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 60px rgba(0,0,0,.6);
  animation: lightbox-in .18s ease;
}

@keyframes lightbox-in {
  from { opacity: 0; transform: scale(.93); }
  to   { opacity: 1; transform: scale(1); }
}

.lightbox-close {
  position: absolute;
  top: -2.2rem;
  right: 0;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }

.lightbox-name {
  color: rgba(255,255,255,.7);
  font-size: 0.82rem;
  text-align: center;
}

/* Make library thumbnails show cursor pointer clearly */
.image-library-card__thumb { cursor: zoom-in; }

/* ── CATEGORIES MANAGER ──────────────────────────────────────────── */
.cat-manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.cat-manager-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .18s, border-color .18s;
}
.cat-manager-card:hover {
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
.cat-manager-card--inactive { opacity: 0.6; }

.cat-manager-card__img {
  width: 100%;
  height: 140px;
  background: var(--surface-muted) center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}
.cat-manager-card__emoji { font-size: 3rem; opacity: 0.35; }

.cat-manager-card__body {
  padding: 0.9rem 1rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}
.cat-manager-card__name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}
.cat-manager-card__th {
  font-size: 0.82rem;
  color: var(--muted);
}
.cat-manager-card__meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}

.cat-manager-card__actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
}
.cat-manager-card__actions .outline-button { flex: 1; }

/* ── TABLE TOOLBAR ───────────────────────────────────────────────── */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem 0;
}
.table-toolbar .category-row {
  flex: 1;
  min-width: 0;
}

/* ── PRODUCT MODAL FOOTER DELETE ─────────────────────────────────── */
.product-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.product-modal-footer__actions {
  display: flex;
  gap: 0.5rem;
}
.product-modal-footer__delete {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border: 1.5px solid #e74c3c;
  background: transparent;
  color: #e74c3c;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.product-modal-footer__delete:hover {
  background: #e74c3c;
  color: #fff;
}

/* ── PRODUCT ID BADGE ────────────────────────────────────────────── */
.product-id-badge {
  display: block;
  margin-top: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-muted, #888);
  transition: color 0.15s;
}
.product-id-badge:hover { color: var(--accent, #2980b9); }
.product-id-badge code {
  font-family: 'Courier New', monospace;
  background: rgba(0,0,0,0.07);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ── TOAST NOTIFICATION ──────────────────────────────────────────── */
#crm-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: #1a1a2e;
  color: #fff;
  padding: 0.55rem 1.2rem;
  border-radius: 99px;
  font-size: 0.88rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 9999;
  white-space: nowrap;
}
#crm-toast.crm-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── CUSTOMERS TABLE ─────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th,
.data-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
  white-space: nowrap;
}
.data-table th {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted, #888);
  background: var(--surface-muted, rgba(255,255,255,.03));
}
.data-table tbody tr:hover {
  background: var(--surface-hover, rgba(255,255,255,.05));
}
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-accepted  { background: rgba(39,174,96,.18); color: #27ae60; }
.badge-pending   { background: rgba(243,156,18,.18); color: #e67e22; }
.badge-shipped   { background: rgba(52,152,219,.18); color: #2980b9; }
.badge-completed { background: rgba(39,174,96,.22); color: #1e8449; }
.badge-cancelled { background: rgba(231,76,60,.18); color: #e74c3c; }

/* ── CUSTOMER DETAIL MODAL ───────────────────────────────────────── */
.customer-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1.5rem;
}
@media (max-width: 680px) {
  .customer-detail-grid { grid-template-columns: 1fr; }
}
.detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1rem;
  font-size: 0.88rem;
  margin: 0 0 1rem;
}
.detail-list dt {
  font-weight: 600;
  color: var(--text-muted, #888);
  white-space: nowrap;
}
.detail-list dd { margin: 0; word-break: break-word; }

.customer-kpi-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.customer-kpi {
  flex: 1;
  min-width: 80px;
  background: var(--surface-muted, rgba(255,255,255,.04));
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.customer-kpi span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted, #888);
}
.customer-kpi strong {
  font-size: 1.1rem;
  font-weight: 700;
}

/* ── CUSTOMER MODAL ──────────────────────────────────────────────── */
.customer-modal-card {
  width: min(96vw, 1000px) !important;
  max-width: min(96vw, 1000px) !important;
  max-height: 88vh;
  overflow-y: auto;
}
