/* ============================================================
   Semai Design System — Ops Dashboard
   Brand: forest green accent, sand surfaces, off-white canvas
   ============================================================ */

/* --- Tokens --- */
:root {
  /* Brand */
  --accent:         #2D6A4F; /* forest green */
  --accent-light:   #40916C;
  --accent-xlight:  #D8F3DC;
  --accent-text:    #fff;

  --sand:           #F4EFE6; /* warm sand surface */
  --sand-dark:      #EAE0D0;
  --canvas:         #FDFAF6; /* off-white page bg */

  --danger:         #C0392B;
  --danger-light:   #FDECEA;
  --warning:        #E67E22;
  --warning-light:  #FEF3E2;
  --success:        #27AE60;
  --success-light:  #EAFAF1;

  /* Text */
  --text-primary:   #1A1A1A;
  --text-secondary: #6B7280;
  --text-muted:     #9CA3AF;
  --text-inverse:   #FFFFFF;

  /* Borders */
  --border:         #E5E0D5;
  --border-strong:  #BCBAB4;

  /* Surfaces */
  --surface:        #FFFFFF;
  --surface-raised: #FDFAF6;
  --sidebar-bg:     #1C3A2B; /* deep forest */
  --sidebar-text:   #D1EAD8;
  --sidebar-hover:  rgba(255,255,255,0.08);
  --sidebar-active: rgba(255,255,255,0.15);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  56px;
  --radius:    8px;
  --radius-sm: 4px;
  --radius-lg: 12px;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--canvas);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* --- Utility --- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.ml-auto { margin-left: auto; }
.text-sm { font-size: 0.867rem; }
.text-xs { font-size: 0.8rem; }
.text-muted { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.font-mono { font-family: var(--font-mono); font-size: 0.8rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }

/* --- Splash / loading --- */
.splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 24px;
  background: var(--canvas);
}
.splash-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}
.logo-icon { font-size: 2rem; }

/* --- Spinner --- */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner-sm {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

/* ============================================================
   App Shell
   ============================================================ */

#app { height: 100vh; display: flex; flex-direction: column; }

/* --- Login Screen --- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 40px;
}
.login-header {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.login-logo .logo-icon { font-size: 1.8rem; }
.login-subtitle { color: var(--text-secondary); font-size: 0.9rem; }

/* --- Shell layout --- */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  transition: transform 0.2s ease;
  z-index: 100;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo .logo-icon { font-size: 1.4rem; }

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

.nav-section {
  padding: 4px 0;
}
.nav-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  padding: 8px 18px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--sidebar-text);
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-radius: 0;
  transition: background 0.15s;
  text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-hover); }
.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 500;
}
.nav-icon { font-size: 1rem; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  font-size: 0.8rem;
  color: var(--sidebar-text);
  margin-bottom: 8px;
  truncate: overflow;
}
.sidebar-user strong { display: block; color: #fff; }

/* --- Main content --- */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  padding: 4px;
  cursor: pointer;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--canvas);
}

/* ============================================================
   Form Controls
   ============================================================ */

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.867rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 5px;
}
.form-label .badge-sensitive {
  margin-left: 6px;
}
.form-control {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-size: 0.933rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.12);
}
.form-control:disabled, .form-control[readonly] {
  background: var(--sand);
  color: var(--text-secondary);
  cursor: not-allowed;
}
.form-control.is-error { border-color: var(--danger); }
.form-hint { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }
.form-error { font-size: 0.8rem; color: var(--danger); margin-top: 4px; }

select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

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

.form-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.867rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-light); border-color: var(--accent-light); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--sand); border-color: var(--border-strong); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #a93226; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--sand); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px; }

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 0.933rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}
.card-body { padding: 20px; }

/* ============================================================
   Data Table
   ============================================================ */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.867rem;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--sand);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--accent); }
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--sand); }

/* --- Table toolbar --- */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}
.search-box-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.search-box input {
  padding-left: 32px;
  height: 36px;
}

/* --- Table pagination --- */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 8px;
}
.pagination { display: flex; gap: 4px; }
.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Empty state --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 12px;
  color: var(--text-secondary);
}
.empty-icon { font-size: 2.5rem; opacity: 0.5; }
.empty-text { font-size: 0.933rem; }

/* ============================================================
   Badges / Pills
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 99px;
  line-height: 1.4;
}
.badge-default { background: var(--sand); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-accent { background: var(--accent-xlight); color: var(--accent); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-sensitive { background: #FFF3CD; color: #856404; border: 1px solid #FFE69C; font-size: 0.7rem; padding: 1px 6px; }

/* ============================================================
   Toast Notifications
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 14px 16px;
  min-width: 280px;
  max-width: 380px;
  font-size: 0.867rem;
  pointer-events: all;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 2px; }
.toast-msg { color: var(--text-secondary); }
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error   { border-left: 3px solid var(--danger); }
.toast.toast-warning { border-left: 3px solid var(--warning); }
.toast.toast-info    { border-left: 3px solid var(--accent); }

/* ============================================================
   Modal
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 24px;
  z-index: 1000;
  overflow-y: auto;
  animation: fade-in 0.15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 520px;
  animation: modal-in 0.2s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }
.modal-header {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.modal-title { font-size: 1rem; font-weight: 600; flex: 1; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--sand); color: var(--text-primary); }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   Page scaffolding
   ============================================================ */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-left h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}
.page-header-left p {
  font-size: 0.867rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.stat-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================================
   Permission Matrix
   ============================================================ */

.matrix-wrap {
  overflow-x: auto;
}
.perm-matrix {
  border-collapse: collapse;
  font-size: 0.8rem;
  width: 100%;
}
.perm-matrix th, .perm-matrix td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.perm-matrix th { background: var(--sand); font-weight: 600; color: var(--text-secondary); }
.perm-matrix th.role-col { text-align: center; min-width: 90px; }
.perm-matrix td.perm-name { font-family: var(--font-mono); font-size: 0.78rem; }
.perm-matrix td.perm-label { color: var(--text-secondary); }
.perm-matrix td.check-cell { text-align: center; }
.perm-matrix tr.perm-category th {
  background: var(--accent-xlight);
  color: var(--accent);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.check-toggle {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}
.check-toggle[disabled] { cursor: not-allowed; opacity: 0.5; }

/* ============================================================
   Detail / profile view
   ============================================================ */

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.detail-row {
  display: contents;
}
.detail-label {
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--sand);
  border-bottom: 1px solid var(--border);
}
.detail-value {
  padding: 10px 14px;
  font-size: 0.867rem;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 600px) {
  .detail-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Tabs
   ============================================================ */

.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 16px;
  font-size: 0.867rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--accent); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ============================================================
   Status badges for orders
   ============================================================ */

.status-pending_payment { background: #FEF3E2; color: #92400E; }
.status-preparing       { background: #EFF6FF; color: #1E40AF; }
.status-on_the_way      { background: #F0FDF4; color: #166534; }
.status-ready_for_pickup{ background: #F5F3FF; color: #6D28D9; }
.status-delivered       { background: var(--success-light); color: var(--success); }
.status-completed       { background: var(--accent-xlight); color: var(--accent); }
.status-cancelled       { background: var(--danger-light); color: var(--danger); }

/* ============================================================
   Responsive — sidebar collapse under 768px
   ============================================================ */

@media (max-width: 768px) {
  .topbar-hamburger { display: block; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    width: 260px;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
  }
  .sidebar-overlay.open { display: block; }

  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }

  .form-row { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   Search-select (lazy typeahead)
   ============================================================ */

.ss-wrap {
  position: relative;
}

.ss-input { padding-right: 12px; transition: padding-right 0.1s; }
.ss-wrap.ss-searching .ss-input { padding-right: 34px; }

.ss-spinner {
  display: none;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  pointer-events: none;
}
.ss-wrap.ss-searching .ss-spinner { display: block; }

.ss-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
}
.ss-dropdown.open { display: block; }

.ss-option {
  padding: 9px 12px;
  font-size: 0.867rem;
  cursor: pointer;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.ss-option:last-child { border-bottom: none; }
.ss-option:hover { background: var(--accent-xlight); color: var(--accent); }

/* ============================================================
   Image upload widget
   ============================================================ */

.img-uploader {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--sand);
  min-height: 64px;
}

.img-upload-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.img-slot {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.img-slot-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.img-slot-key {
  font-size: 0.67rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 6px;
  word-break: break-all;
  font-family: var(--font-mono);
  line-height: 1.3;
}

.img-slot-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.img-slot:hover .img-slot-remove { opacity: 1; }

.img-slot-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.38);
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-slot--pending { opacity: 0.75; }

.img-add-btn {
  width: 90px;
  height: 90px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.img-add-btn:hover { border-color: var(--accent); color: var(--accent); }

.img-add-icon {
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
}

/* ============================================================
   Print
   ============================================================ */

@media print {
  .sidebar, .topbar, .table-toolbar, .table-footer, .btn, .toast-container { display: none !important; }
  .page-content { overflow: visible; }
}
