/* ============================================================
   Shared Design System — used across every page of the app
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f3f4fb;
  --surface: #ffffff;
  --surface-2: #f8f9ff;
  --text: #1a1d29;
  --muted: #6b7280;
  --border: #e6e8f0;

  --accent-1: #6d28d9;
  --accent-2: #4f46e5;
  --accent-3: #ec4899;
  --gradient-brand: linear-gradient(135deg, var(--accent-2), var(--accent-1) 55%, var(--accent-3));

  --sidebar-bg: #14101f;
  --sidebar-bg-2: #1c1530;
  --sidebar-text: #cfc9e6;
  --sidebar-text-dim: #8d84ad;
  --sidebar-active: linear-gradient(90deg, rgba(109, 40, 217, 0.35), rgba(236, 72, 153, 0.18));

  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 2px 8px rgba(20, 16, 31, 0.06);
  --shadow: 0 10px 30px rgba(20, 16, 31, 0.10);
  --shadow-lg: 0 25px 60px rgba(20, 16, 31, 0.18);

  --sidebar-w: 268px;
  --topbar-h: 72px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

/* ---------- Scrollbar (webkit) ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3d6e6; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #b9bdd6; }

/* ============================================================
   App shell layout (sidebar + topbar + main)
   ============================================================ */

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg-2), var(--sidebar-bg) 70%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.28s ease;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(109, 40, 217, 0.35), transparent 45%),
    radial-gradient(circle at 90% 85%, rgba(236, 72, 153, 0.18), transparent 40%);
  pointer-events: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 26px 24px 22px;
  position: relative;
}

.sidebar-brand .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 8px 20px rgba(109, 40, 217, 0.45);
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.sidebar-brand .brand-text strong {
  font-size: 15px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.sidebar-brand .brand-text span {
  font-size: 11.5px;
  color: var(--sidebar-text-dim);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}

.sidebar-nav .nav-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--sidebar-text-dim);
  padding: 16px 12px 6px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--sidebar-text);
  position: relative;
  transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  border-radius: 4px;
  background: var(--gradient-brand);
}

.nav-item.logout-item {
  color: #f3a8bc;
}

.nav-item.logout-item:hover {
  background: rgba(220, 38, 38, 0.16);
  color: #ff8fa3;
}

.sidebar-footer {
  padding: 16px 20px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-footer .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-footer .who {
  line-height: 1.2;
  overflow: hidden;
}

.sidebar-footer .who strong {
  display: block;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer .who span {
  font-size: 11.5px;
  color: var(--sidebar-text-dim);
}

/* ---------- Main / content area ---------- */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.menu-toggle svg { width: 20px; height: 20px; }

.page-title {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-title span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--accent-2);
}

.icon-btn svg { width: 18px; height: 18px; }

.content {
  flex: 1;
  padding: 28px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 20, 0.5);
  z-index: 90;
}

/* ============================================================
   Reusable components
   ============================================================ */

.hero-banner {
  border-radius: var(--radius-lg);
  padding: 32px;
  background: var(--gradient-brand);
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.hero-banner::before,
.hero-banner::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}

.hero-banner::before { width: 220px; height: 220px; top: -90px; right: -60px; }
.hero-banner::after { width: 140px; height: 140px; bottom: -70px; right: 140px; background: rgba(255,255,255,0.08); }

.hero-banner h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  position: relative;
}

.hero-banner p {
  margin: 0;
  opacity: 0.9;
  font-size: 14px;
  max-width: 520px;
  position: relative;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 26px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: #fff;
}

.stat-card .stat-icon svg { width: 20px; height: 20px; }

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--muted);
}

.stat-card .stat-trend {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}

.stat-trend.up { color: var(--success); background: rgba(22, 163, 74, 0.1); }
.stat-trend.down { color: var(--danger); background: rgba(220, 38, 38, 0.1); }
.stat-trend.soon { color: var(--muted); background: rgba(107, 114, 128, 0.12); }

.icon-violet { background: linear-gradient(135deg, #6d28d9, #4f46e5); }
.icon-pink { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.icon-blue { background: linear-gradient(135deg, #0ea5e9, #4f46e5); }
.icon-amber { background: linear-gradient(135deg, #f59e0b, #ea580c); }

.panel-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-header h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
}

.panel-header a {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-2);
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13.5px;
  font-weight: 600;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.quick-link:hover {
  border-color: var(--accent-2);
  transform: translateY(-2px);
}

.quick-link .ql-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.quick-link .ql-icon svg { width: 16px; height: 16px; }

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.activity-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-item p {
  margin: 0;
  font-size: 13.5px;
}

.activity-item span {
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- Buttons & badges (shared across future pages) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 10px 24px rgba(109, 40, 217, 0.28);
}

.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(0.98); }

.btn-outline {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover { border-color: var(--accent-2); color: var(--accent-2); }

.btn-outline.danger { color: var(--danger); border-color: rgba(220, 38, 38, 0.3); }
.btn-outline.danger:hover { border-color: var(--danger); background: rgba(220, 38, 38, 0.06); color: var(--danger); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
}

.badge-success { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.badge-warning { background: rgba(217, 119, 6, 0.1); color: var(--warning); }
.badge-danger { background: rgba(220, 38, 38, 0.1); color: var(--danger); }

/* ============================================================
   List pages: page header, toolbar, data table, pagination, modal
   ============================================================ */

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header-row h2 {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 800;
}

.page-header-row p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

.page-header-row.centered {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.page-header-row.centered .header-center {
  text-align: center;
  grid-column: 2;
}

.page-header-row.centered .header-spacer {
  grid-column: 1;
}

.page-header-row.centered .header-actions {
  grid-column: 3;
  justify-self: end;
}

@media (max-width: 640px) {
  .page-header-row.centered {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .page-header-row.centered .header-spacer {
    display: none;
  }

  .page-header-row.centered .header-center,
  .page-header-row.centered .header-actions {
    grid-column: 1;
    justify-self: center;
  }
}

.data-table tbody tr.row-inactive {
  opacity: 0.55;
}

.data-table tbody tr.row-inactive:hover {
  opacity: 0.8;
}

/* ---------- List-page flourishes ---------- */

.page-icon-badge {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin: 0 auto 14px;
  box-shadow: 0 12px 26px rgba(109, 40, 217, 0.35);
}

.page-icon-badge svg { width: 24px; height: 24px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

.chip svg { width: 13px; height: 13px; flex-shrink: 0; }

.chip-violet { color: var(--accent-1); border-color: rgba(109, 40, 217, 0.22); background: rgba(109, 40, 217, 0.06); }
.chip-blue { color: #0369a1; border-color: rgba(14, 165, 233, 0.25); background: rgba(14, 165, 233, 0.07); }
.chip-pink { color: #be185d; border-color: rgba(236, 72, 153, 0.22); background: rgba(236, 72, 153, 0.06); }
.chip-amber { color: #b45309; border-color: rgba(245, 158, 11, 0.25); background: rgba(245, 158, 11, 0.07); }
.chip-green { color: #15803d; border-color: rgba(22, 163, 74, 0.25); background: rgba(22, 163, 74, 0.08); }
.chip-slate { color: #475569; border-color: rgba(71, 85, 105, 0.22); background: rgba(71, 85, 105, 0.07); }

.text-violet { color: var(--accent-1); }
.text-blue { color: #0369a1; }
.text-pink { color: #be185d; }
.text-amber { color: #b45309; }
.text-green { color: #15803d; }
.text-slate { color: #475569; }

.data-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent-2);
}

.stat-grid.stat-grid-tight {
  margin-bottom: 22px;
}

.cell-avatar.sm {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.desc-cell {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  color: var(--muted);
}

.inline-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  vertical-align: middle;
}

.inline-badge.pending {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}

.action-menu button.pending-action {
  color: var(--success);
}

.action-menu button.pending-action svg {
  color: var(--success);
}

.btn-success {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.28);
}

.btn-success:hover { filter: brightness(1.06); }
.btn-success:active { transform: scale(0.98); }

.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.detail-card-header {
  padding: 16px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
  font-weight: 800;
}

.detail-rows { display: flex; flex-direction: column; }

.detail-row {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  gap: 12px;
}

.detail-row:last-child { border-bottom: none; }
.detail-row:nth-child(even) { background: var(--surface-2); }

.detail-row .detail-label {
  flex: 0 0 42%;
  color: var(--muted);
  font-weight: 600;
}

.detail-row .detail-value {
  flex: 1;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.section-heading {
  font-size: 15px;
  font-weight: 800;
  margin: 28px 0 14px;
}

.download-bar {
  display: flex;
  justify-content: center;
  margin-top: 32px;
  padding-bottom: 8px;
}

@media (max-width: 780px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.btn-outline.pending-action {
  color: var(--success);
  border-color: rgba(22, 163, 74, 0.3);
}

.btn-outline.pending-action:hover {
  border-color: var(--success);
  background: rgba(22, 163, 74, 0.06);
  color: var(--success);
}

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

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 340px;
}

.search-box svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-size: 13.5px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.13);
  background: #fff;
}

.toolbar-meta {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

.data-table thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 700;
  padding: 13px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 14px 18px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.12s ease;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cell-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.cell-user .cell-user-name {
  font-weight: 600;
  white-space: nowrap;
}

.cell-mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--accent-1);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.active { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.status-pill.inactive { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.status-pill.pending { background: rgba(217, 119, 6, 0.1); color: var(--warning); }
.status-pill.confirmed { background: rgba(14, 165, 233, 0.12); color: #0369a1; }
.status-pill.delivered { background: rgba(22, 163, 74, 0.1); color: var(--success); }

.total-amount {
  font-weight: 800;
  color: var(--accent-1);
  font-size: 13.5px;
}

.row-actions {
  position: relative;
  display: inline-block;
}

.action-trigger {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.action-trigger:hover {
  background: var(--surface-2);
  color: var(--accent-2);
}

.action-trigger svg { width: 17px; height: 17px; }

.action-menu {
  position: fixed;
  top: -9999px;
  left: -9999px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 168px;
  padding: 6px;
  z-index: 500;
  display: none;
  animation: menuIn 0.14s ease;
}

.action-menu.show { display: block; }

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.action-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #14161f;
  cursor: pointer;
  text-align: left;
}

.action-menu button:hover {
  background: var(--surface-2);
}

.action-menu button svg { width: 15px; height: 15px; flex-shrink: 0; color: #14161f; }
.action-menu button.danger { color: var(--danger); }
.action-menu button.danger svg { color: var(--danger); }

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 22px;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 12.5px;
  color: var(--muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.page-btn.active {
  background: var(--gradient-brand);
  border-color: transparent;
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state svg {
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p { margin: 0; font-size: 14px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 11, 30, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.modal-header p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
}

.modal-close:hover { color: var(--danger); border-color: var(--danger); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body {
  padding: 24px 26px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-grid .full { grid-column: 1 / -1; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}

.field label .req { color: var(--danger); }

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field input[type="url"],
.field input[type="number"],
.field input[type="date"],
.field select,
.field textarea {
  padding: 10px 13px;
  font-size: 13.5px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  outline: none;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  font-family: inherit;
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.13);
  background: #fff;
}

.field input.error, .field select.error {
  border-color: var(--danger);
}

.field-error {
  font-size: 11.5px;
  color: var(--danger);
  display: none;
}

.field-error.show { display: block; }

.status-toggle-group {
  display: flex;
  gap: 10px;
}

.status-toggle-group label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s ease;
}

.status-toggle-group input {
  display: none;
}

.status-toggle-group input:checked + span {
  color: inherit;
}

.status-toggle-group label:has(input:checked)[data-state="active"] {
  border-color: var(--success);
  background: rgba(22, 163, 74, 0.08);
  color: var(--success);
}

.status-toggle-group label:has(input:checked)[data-state="inactive"] {
  border-color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--surface);
}

.view-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.view-detail-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.view-detail-item span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.view-detail-item strong {
  font-size: 14px;
  font-weight: 600;
}

.toast-notice {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #16171f;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 9px;
}

.toast-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-notice svg { width: 17px; height: 17px; color: var(--success); flex-shrink: 0; }

@media (max-width: 640px) {
  .field-grid, .view-detail-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .quick-links { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 0 16px; }
  .hero-banner { padding: 24px; }
  .hero-banner h2 { font-size: 20px; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Auth Pages — Login, Register, Registration Success, Approval
   Shared by index.html, register.html, register-success.html
   and awaiting-approval.html
   ============================================================ */

.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  background: #0f0b1e;
}

.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  z-index: 0;
  pointer-events: none;
}

.bg-blob.b1 { width: 480px; height: 480px; background: #6d28d9; top: -160px; left: -140px; animation: authFloat1 12s ease-in-out infinite; }
.bg-blob.b2 { width: 420px; height: 420px; background: #ec4899; bottom: -160px; right: -120px; animation: authFloat2 14s ease-in-out infinite; }
.bg-blob.b3 { width: 300px; height: 300px; background: #0ea5e9; top: 40%; right: 8%; animation: authFloat1 16s ease-in-out infinite reverse; }
.bg-blob.b4 { width: 260px; height: 260px; background: #16a34a; bottom: 6%; left: 8%; animation: authFloat2 18s ease-in-out infinite; }

@keyframes authFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.06); }
}

@keyframes authFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-25px, 25px) scale(1.08); }
}

@keyframes authRise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 408px;
  margin: auto;
}

.auth-card {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 44px 36px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.5);
  animation: authRise 0.5s ease;
}

.auth-logo {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--gradient-brand);
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 10px 26px rgba(109, 40, 217, 0.4);
}

.auth-card h1 {
  font-size: 23px;
  font-weight: 800;
  text-align: center;
  margin: 0 0 6px;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 28px;
}

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.input-wrapper { position: relative; }

.input-wrapper svg.leading-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.auth-card input[type="text"],
.auth-card input[type="password"],
.auth-card input[type="email"] {
  width: 100%;
  padding: 12px 14px 12px 40px;
  font-size: 14.5px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-card input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  background: #fff;
}

.auth-card input.error { border-color: var(--danger); }

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 6px;
}

.toggle-password:hover { color: var(--accent-2); }

.form-alert {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.25);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 18px;
}

.form-alert.show { display: flex; }
.form-alert svg { width: 16px; height: 16px; flex-shrink: 0; }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  font-size: 13px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.remember-me input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-2);
}

.forgot-link { color: var(--accent-2); font-weight: 600; }
.forgot-link:hover { text-decoration: underline; }

.submit-btn { width: 100%; padding: 13px; }

.demo-hint {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px;
}

.demo-hint b { color: var(--text); }

.auth-switch {
  margin-top: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.auth-switch a { color: var(--accent-2); font-weight: 700; }
.auth-switch a:hover { text-decoration: underline; }

/* ---------- Two-column registration shell ---------- */

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 940px;
  margin: auto;
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  animation: authRise 0.5s ease;
  max-height: calc(100dvh - 40px);
}

.auth-side {
  background: var(--gradient-brand);
  padding: 44px 36px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-side::before {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  top: -80px;
  right: -80px;
}

.auth-side::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  bottom: -60px;
  left: -50px;
}

.auth-side-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.auth-side h2 {
  font-size: 25px;
  font-weight: 800;
  margin: 0 0 10px;
  position: relative;
  z-index: 1;
}

.auth-side p.lead {
  font-size: 13.5px;
  opacity: 0.9;
  line-height: 1.6;
  margin: 0 0 28px;
  position: relative;
  z-index: 1;
}

.auth-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.auth-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  opacity: 0.95;
}

.auth-feature-list .feat-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-feature-list svg { width: 14px; height: 14px; }

.auth-form-panel {
  background: rgba(255, 255, 255, 0.98);
  padding: 40px 40px 34px;
  overflow-y: auto;
}

.auth-form-panel h1 {
  font-size: 21px;
  font-weight: 800;
  margin: 0 0 4px;
}

.auth-form-panel .subtitle {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 24px;
}

.pw-field-wrap { position: relative; }
.pw-field-wrap input { padding-right: 54px !important; }

/* Password strength meter */
.pw-strength {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.pw-strength span {
  height: 4px;
  flex: 1;
  border-radius: 3px;
  background: var(--border);
  transition: background 0.2s ease;
}

.pw-strength.s1 span:nth-child(1) { background: var(--danger); }
.pw-strength.s2 span:nth-child(1),
.pw-strength.s2 span:nth-child(2) { background: var(--warning); }
.pw-strength.s3 span:nth-child(1),
.pw-strength.s3 span:nth-child(2),
.pw-strength.s3 span:nth-child(3) { background: #d97706; }
.pw-strength.s4 span { background: var(--success); }

.pw-strength-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  display: block;
}

/* ---------- Success / org-id reveal ---------- */

.success-check {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(22, 163, 74, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.success-check svg { width: 34px; height: 34px; color: var(--success); }

.org-id-box {
  margin: 22px 0;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(236, 72, 153, 0.08));
  border: 1.5px dashed var(--accent-2);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.org-id-box .org-id-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.org-id-box .org-id-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent-1);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  word-break: break-all;
}

.org-id-copy {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
  cursor: pointer;
}

.org-id-copy:hover { border-color: var(--accent-2); }
.org-id-copy svg { width: 13px; height: 13px; }

.org-id-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin: 0 0 8px;
}

/* ---------- Approval progress steps ---------- */

.progress-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin: 26px 0 24px;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 96px;
}

.progress-step .step-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}

.progress-step .step-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.progress-step.done .step-circle { background: var(--success); border-color: var(--success); color: #fff; }
.progress-step.done .step-label { color: var(--success); }
.progress-step.done .step-circle svg { width: 16px; height: 16px; }

.progress-step.active .step-circle {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
  animation: pulseRing 1.8s ease-in-out infinite;
}

.progress-step.active .step-label { color: var(--accent-2); }

@keyframes pulseRing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.35); }
  50% { box-shadow: 0 0 0 7px rgba(79, 70, 229, 0); }
}

.progress-connector {
  height: 2px;
  background: var(--border);
  flex: 1;
  margin-top: 18px;
  max-width: 40px;
}

.progress-connector.done { background: var(--success); }

.info-box {
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 6px 0 24px;
}

.info-box .info-box-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--warning);
  margin-bottom: 8px;
}

.info-box .info-box-title svg { width: 15px; height: 15px; }

.info-box ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.8;
}

.org-ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-1);
  margin: 0 auto 20px;
}

@media (max-width: 860px) {
  .auth-shell {
    grid-template-columns: 1fr;
    max-height: none;
    overflow-y: auto;
  }
  .auth-side { padding: 30px 28px; }
  .auth-side .auth-feature-list { display: none; }
}

@media (max-width: 460px) {
  .auth-card { padding: 34px 24px; }
  .auth-form-panel { padding: 30px 22px; }
  .progress-step { width: 76px; }
}

/* ============================================================
   Icon-prefixed inputs (date pickers, search combos, etc.)
   ============================================================ */

.icon-field-wrap { position: relative; }

.icon-field-wrap .field-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
  z-index: 1;
}

.icon-field-wrap input { padding-left: 36px !important; }

.field input[type="date"] {
  color-scheme: light;
  cursor: pointer;
}

.field input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  filter: invert(24%) sepia(72%) saturate(3540%) hue-rotate(246deg) brightness(93%) contrast(93%);
  transition: background 0.15s ease;
}

.field input[type="date"]::-webkit-calendar-picker-indicator:hover {
  background: rgba(79, 70, 229, 0.12);
}

/* ============================================================
   Searchable combobox (trader / product pickers)
   ============================================================ */

.combo-wrap { position: relative; }

.combo-panel {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  z-index: 260;
  padding: 6px;
  display: none;
}

.combo-panel.show { display: block; animation: comboIn 0.15s ease; }

@keyframes comboIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.combo-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 8px;
  cursor: pointer;
}

.combo-option:hover, .combo-option.active { background: var(--surface-2); }

.combo-option .combo-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--gradient-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.combo-option .combo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.combo-option .combo-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combo-option .combo-sub {
  font-size: 11.5px;
  color: var(--muted);
}

.combo-empty {
  padding: 16px 10px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

/* ============================================================
   Group modal — tabbed sections, member picker, permissions
   ============================================================ */

.modal-box.wide { max-width: 900px; }

.modal-tabs {
  display: flex;
  gap: 6px;
  padding: 0 26px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 73px;
  background: var(--surface);
  z-index: 5;
}

.modal-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 6px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 2.5px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.modal-tab svg { width: 15px; height: 15px; }

.modal-tab .tab-count {
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
}

.modal-tab.active { color: var(--accent-2); border-bottom-color: var(--accent-2); }
.modal-tab.active .tab-count { background: rgba(79, 70, 229, 0.12); color: var(--accent-2); }
.modal-tab:hover:not(.active) { color: var(--text); }

.modal-tab-panel { display: none; }
.modal-tab-panel.active { display: block; }

.section-heading {
  font-size: 14.5px;
  font-weight: 800;
  margin: 0 0 2px;
}

.section-subheading {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 16px;
}

/* ---------- Members picker ---------- */

.member-context-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(236, 72, 153, 0.06));
  border: 1px solid rgba(79, 70, 229, 0.18);
  border-radius: var(--radius);
  padding: 11px 15px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--text);
}

.member-context-banner .member-context-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--gradient-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.member-context-banner .member-context-icon svg { width: 15px; height: 15px; }

.member-context-banner strong {
  color: var(--accent-1);
  font-weight: 800;
}

.member-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 34px;
}

.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: 24px;
  padding: 4px 8px 4px 4px;
  font-size: 12px;
}

.member-chip .member-chip-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}

.member-chip .member-chip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.member-chip .member-chip-name { font-weight: 700; color: var(--text); }

.member-chip .member-chip-group {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.member-chip button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  margin-left: 2px;
}

.member-chip button:hover { background: var(--danger); color: #fff; }
.member-chip button svg { width: 9px; height: 9px; }

.member-chip-empty { font-size: 12px; color: var(--muted); padding: 6px 2px; }

.member-search-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 260px;
  overflow-y: auto;
  margin-top: 12px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}

.member-row:last-child { border-bottom: none; }
.member-row:hover { background: var(--surface-2); }
.member-row.checked { background: rgba(79, 70, 229, 0.05); }

.member-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-2);
  flex-shrink: 0;
  pointer-events: none;
}

.member-row .cell-avatar { flex-shrink: 0; }

.member-row .member-info { min-width: 0; flex: 1; }
.member-row .member-name { font-size: 13px; font-weight: 700; color: var(--text); }
.member-row .member-email { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.member-row .member-group-badge {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 3px 9px;
}

/* ---------- Permissions table ---------- */

.perm-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.perm-toolbar button {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
}

.perm-toolbar button:hover { border-color: var(--accent-2); }

.perm-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.perm-head-row, .perm-row {
  display: grid;
  grid-template-columns: 1fr repeat(4, 78px);
  align-items: center;
}

.perm-head-row {
  background: var(--surface-2);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.perm-col-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.perm-col-label:hover { color: var(--accent-2); }

.perm-row {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.perm-row:last-child { border-bottom: none; }

.perm-module {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.perm-module-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--accent-1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.perm-module-icon svg { width: 17px; height: 17px; }

.perm-module-text { min-width: 0; }
.perm-module-name { font-size: 13px; font-weight: 700; color: var(--text); }
.perm-module-desc { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.perm-switch-cell { display: flex; justify-content: center; }

.perm-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 21px;
  flex-shrink: 0;
}

.perm-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.perm-switch .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.perm-switch .slider::before {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.perm-switch input:checked + .slider { background: var(--gradient-brand); }
.perm-switch input:checked + .slider::before { transform: translateX(15px); }
.perm-switch input:focus-visible + .slider { box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25); }

@media (max-width: 640px) {
  .perm-head-row, .perm-row { grid-template-columns: 1fr repeat(4, 56px); }
  .perm-module-desc { display: none; }
}

/* ---------- Single-toggle permission row (e.g. Machine Management) ---------- */

.perm-row.perm-row-single {
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.perm-single-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
}

.perm-single-toggle .perm-switch { width: 34px; height: 20px; }
.perm-single-toggle .perm-switch .slider::before { width: 14px; height: 14px; }
.perm-single-toggle .perm-switch input:checked + .slider::before { transform: translateX(14px); }

.perm-single-toggle span {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* ============================================================
   Permission enforcement — restricted overlay & disabled state
   ============================================================ */

.perm-restricted-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(15, 11, 30, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: authRise 0.3s ease;
}

.perm-restricted-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 44px 40px;
  max-width: 380px;
  text-align: center;
}

.perm-restricted-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.perm-restricted-icon svg { width: 28px; height: 28px; }

.perm-restricted-card h3 { margin: 0 0 8px; font-size: 18px; font-weight: 800; }

.perm-restricted-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.perm-restricted-actions .btn { flex: 1; }
.perm-restricted-card p { margin: 0 0 22px; font-size: 13px; color: var(--muted); line-height: 1.6; }

.toast-notice.perm-denied svg { color: var(--danger); }

.btn.perm-disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.btn.perm-disabled:hover,
.btn:disabled:hover {
  filter: grayscale(0.3);
  transform: none;
}

/* ============================================================
   Machine Management page
   ============================================================ */

.machine-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.machine-status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.machine-status-pill.active { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.machine-status-pill.maintenance { background: rgba(217, 119, 6, 0.12); color: var(--warning); }
.machine-status-pill.inactive { background: rgba(220, 38, 38, 0.1); color: var(--danger); }

.weighing-spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 6px;
}

.weighing-spec-tile {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.weighing-spec-tile::before {
  content: "";
  position: absolute;
  top: -20px;
  right: -20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-brand);
  opacity: 0.08;
}

.weighing-spec-tile .spec-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}

.weighing-spec-tile .spec-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.weighing-spec-tile .spec-value small {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 2px;
}

.calibration-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(79, 70, 229, 0.06));
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: var(--radius);
  padding: 13px 16px;
  margin-top: 14px;
}

.calibration-banner .cal-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #0ea5e9;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.calibration-banner .cal-icon svg { width: 17px; height: 17px; }
.calibration-banner .cal-text { font-size: 12.5px; color: var(--text); }
.calibration-banner .cal-text strong { color: #0369a1; }

/* ---------- Service history timeline ---------- */

.service-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.service-timeline {
  position: relative;
  padding-left: 26px;
}

.service-timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.service-entry {
  position: relative;
  padding-bottom: 20px;
}

.service-entry:last-child { padding-bottom: 0; }

.service-entry::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-2);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--accent-2);
}

.service-entry.pending::before { background: var(--warning); box-shadow: 0 0 0 2px var(--warning); }

.service-entry-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
}

.service-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.service-entry-type {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.service-entry-date {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

.service-entry-notes {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 8px;
}

.service-entry-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.service-entry-tech {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--accent-2);
  font-weight: 700;
}

.service-entry-tech svg { width: 12px; height: 12px; }

.service-status-badge {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 9px;
  border-radius: 999px;
}

.service-status-badge.completed { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.service-status-badge.pending { background: rgba(217, 119, 6, 0.12); color: var(--warning); }

.service-empty {
  text-align: center;
  padding: 30px 10px;
  color: var(--muted);
  font-size: 12.5px;
}

@media (max-width: 640px) {
  .weighing-spec-grid { grid-template-columns: 1fr 1fr; }
}
