/* ============================================================
   ORDERGRAL ADMIN - Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Serif+Display&display=swap');

:root {
  --primary:        #2563eb;
  --primary-hover:  #1d4ed8;
  --secondary:      #64748b;
  --accent:         #f59e0b;
  --font-primary:   'DM Sans', sans-serif;
  --font-secondary: 'DM Serif Display', serif;
  --radius:         12px;
  --radius-sm:      8px;
  --transition:     0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --header-h:       60px;
  --nav-w:          220px;
}

[data-theme="light"] {
  --bg:           #f0f4ff;
  --surface:      #ffffff;
  --surface-alt:  #f1f5f9;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --shadow:       0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.12);
}

[data-theme="dark"] {
  --bg:           #0b1120;
  --surface:      #151f35;
  --surface-alt:  #1e2d4a;
  --text:         #f0f4ff;
  --text-muted:   #7a90b8;
  --border:       #1e2d4a;
  --shadow:       0 2px 12px rgba(0,0,0,0.3);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.5);
}

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

body {
  font-family: var(--font-primary);
  background: var(--bg);
  color: var(--text);
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
}

/* ══════════════════════════════════════════════════════════
   LOGIN
══════════════════════════════════════════════════════════ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.login-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.login-bg-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
}

.shape-1 {
  width: 500px; height: 500px;
  background: var(--primary);
  top: -150px; right: -100px;
  animation: float1 12s ease-in-out infinite;
}

.shape-2 {
  width: 350px; height: 350px;
  background: var(--accent);
  bottom: -100px; left: -80px;
  animation: float2 15s ease-in-out infinite;
}

@keyframes float1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-30px,20px)} }
@keyframes float2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(20px,-15px)} }

.login-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  animation: cardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.login-brand img { height: 48px; width: auto; object-fit: contain; flex-shrink: 0; }

.login-brand-text h1 {
  font-family: var(--font-secondary);
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.2;
}

.admin-badge {
  display: inline-block;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.login-divider { height: 1px; background: var(--border); margin-bottom: 24px; }

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.login-field {
  position: relative;
  margin-bottom: 14px;
}

.login-field input {
  width: 100%;
  padding: 13px 44px 13px 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.login-field input::placeholder { color: transparent; }

.login-field label {
  position: absolute;
  left: 44px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: all var(--transition);
}

.login-field input:focus + label,
.login-field input:not(:placeholder-shown) + label {
  top: -8px;
  left: 12px;
  font-size: 0.72rem;
  color: var(--primary);
  background: var(--surface);
  padding: 0 6px;
  border-radius: 4px;
}

.login-field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

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

.login-toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.login-toggle-pass svg { width: 17px; height: 17px; }

.login-error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.82rem;
  margin-bottom: 14px;
}

[data-theme="dark"] .login-error {
  background: rgba(220,38,38,0.15);
  border-color: rgba(220,38,38,0.3);
  color: #fca5a5;
}

.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition);
  margin-top: 6px;
}

.login-btn:hover { background: var(--primary-hover); transform: translateY(-1px); }
.login-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.login-loader {
  width: 17px; height: 17px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-footer {
  text-align: center;
  margin-top: 16px;
}

.login-footer a {
  font-size: 0.83rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.login-footer a:hover { color: var(--primary); }

/* ══════════════════════════════════════════════════════════
   ADMIN APP LAYOUT
══════════════════════════════════════════════════════════ */
.admin-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.admin-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  box-shadow: var(--shadow);
}

.admin-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-header-brand img { height: 32px; width: auto; object-fit: contain; }

.admin-header-title {
  font-family: var(--font-secondary);
  font-size: 1rem;
  font-weight: 400;
}

.admin-header-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-user-info {
  font-size: 0.83rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px; height: 34px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-icon:hover { color: var(--primary); border-color: var(--primary); }
.btn-icon svg { width: 15px; height: 15px; }

/* Sidebar nav */
.admin-layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

.admin-sidebar {
  width: var(--nav-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 90;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 10px 4px;
  margin-top: 8px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  text-align: left;
}

.sidebar-btn:hover { background: var(--surface-alt); color: var(--text); }
.sidebar-btn.active { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.sidebar-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-logout {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Main content */
.admin-main {
  margin-left: var(--nav-w);
  flex: 1;
  padding: 28px 24px;
}

.admin-view { display: none; }
.admin-view.active { display: block; }

/* ══════════════════════════════════════════════════════════
   PAGE HEADER
══════════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-family: var(--font-secondary);
  font-size: 1.6rem;
  font-weight: 400;
}

/* ══════════════════════════════════════════════════════════
   STATS CARDS
══════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-card-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-card-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ══════════════════════════════════════════════════════════
   TABLE
══════════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.table-search {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.table-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.table-search input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition);
}

.table-search input:focus { border-color: var(--primary); }

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

thead { background: var(--surface-alt); }

th {
  padding: 11px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-alt); }

.table-empty {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ══════════════════════════════════════════════════════════
   STATUS BADGES
══════════════════════════════════════════════════════════ */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pending    { background: #fef3c7; color: #92400e; }
.status-confirmed  { background: #dbeafe; color: #1e40af; }
.status-processing { background: #ede9fe; color: #5b21b6; }
.status-completed  { background: #dcfce7; color: #166534; }
.status-cancelled  { background: #fee2e2; color: #991b1b; }

[data-theme="dark"] .status-pending    { background: rgba(245,158,11,0.15); color: #fcd34d; }
[data-theme="dark"] .status-confirmed  { background: rgba(37,99,235,0.15); color: #93c5fd; }
[data-theme="dark"] .status-processing { background: rgba(124,58,237,0.15); color: #c4b5fd; }
[data-theme="dark"] .status-completed  { background: rgba(22,163,74,0.15); color: #86efac; }
[data-theme="dark"] .status-cancelled  { background: rgba(220,38,38,0.15); color: #fca5a5; }

.active-badge   { background: #dcfce7; color: #166534; }
.inactive-badge { background: #fee2e2; color: #991b1b; }
.billing-pending   { background: #fef3c7; color: #92400e; }
.billing-invoiced  { background: #dcfce7; color: #166534; }
.billing-sent      { background: #dbeafe; color: #1e40af; }

[data-theme="dark"] .active-badge   { background: rgba(22,163,74,0.15); color: #86efac; }
[data-theme="dark"] .inactive-badge { background: rgba(220,38,38,0.15); color: #fca5a5; }
[data-theme="dark"] .billing-pending   { background: rgba(245,158,11,0.15); color: #fcd34d; }
[data-theme="dark"] .billing-invoiced  { background: rgba(22,163,74,0.15); color: #86efac; }
[data-theme="dark"] .billing-sent      { background: rgba(37,99,235,0.15); color: #93c5fd; }

/* ══════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════ */
.btn-primary {
  padding: 9px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all var(--transition);
}

.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-primary svg { width: 15px; height: 15px; }

.btn-secondary {
  padding: 8px 16px;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all var(--transition);
}

.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-secondary svg { width: 15px; height: 15px; }

.btn-danger {
  padding: 7px 14px;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-danger:hover { background: #dc2626; color: #fff; }

[data-theme="dark"] .btn-danger { background: rgba(220,38,38,0.15); border-color: rgba(220,38,38,0.3); color: #fca5a5; }

.btn-sm { padding: 5px 10px; font-size: 0.78rem; }

/* ══════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: min(520px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal { transform: scale(1) translateY(0); }

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

.modal-header h3 {
  font-family: var(--font-secondary);
  font-size: 1.2rem;
  font-weight: 400;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }

/* ══════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

.form-field { margin-bottom: 0; }

.form-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
  resize: none;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--primary); }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.form-msg {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  margin-top: 12px;
}

.form-msg.success { background: #dcfce7; color: #166534; }
.form-msg.error   { background: #fee2e2; color: #991b1b; }

[data-theme="dark"] .form-msg.success { background: rgba(22,163,74,0.15); color: #86efac; }
[data-theme="dark"] .form-msg.error   { background: rgba(220,38,38,0.15); color: #fca5a5; }

/* ══════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 11px 20px;
  border-radius: var(--radius);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.toast.toast-show { opacity: 1; transform: translateY(0); }
.toast.toast-success { background: #166534; color: #fff; }
.toast.toast-error   { background: #dc2626; color: #fff; }
.toast.toast-info    { background: var(--primary); color: #fff; }

/* ══════════════════════════════════════════════════════════
   UPLOAD ZONE
══════════════════════════════════════════════════════════ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface-alt);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}

.upload-zone svg { width: 36px; height: 36px; color: var(--text-muted); margin-bottom: 10px; }
.upload-zone p { font-size: 0.88rem; color: var(--text-muted); }
.upload-zone strong { color: var(--primary); }

/* ══════════════════════════════════════════════════════════
   TOGGLE SWITCH
══════════════════════════════════════════════════════════ */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ══════════════════════════════════════════════════════════
   USER MENU DROPDOWN (admin)
══════════════════════════════════════════════════════════ */
.user-menu-wrap { position: relative; }

.btn-user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px 5px 6px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-primary);
  font-size: 0.83rem;
  font-weight: 500;
  transition: all var(--transition);
}

.btn-user-menu:hover { border-color: var(--primary); }

.user-menu-avatar {
  width: 26px; height: 26px;
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.user-menu-avatar svg { width: 14px; height: 14px; color: var(--primary); }
.user-menu-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-chevron { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 150;
  overflow: hidden;
  animation: dropIn 0.15s ease;
}

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

.user-dropdown-header {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-dropdown-header span:first-child { font-weight: 600; font-size: 0.9rem; }
.user-dropdown-divider { height: 1px; background: var(--border); }

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}

.user-dropdown-item:hover { background: var(--surface-alt); }
.user-dropdown-item.danger { color: #dc2626; }
.user-dropdown-item.danger:hover { background: #fee2e2; }
[data-theme="dark"] .user-dropdown-item.danger:hover { background: rgba(220,38,38,0.15); }
.user-dropdown-item svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════
   FILTER SELECT
══════════════════════════════════════════════════════════ */
.filter-select {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════
   SETTINGS MODAL TABS
══════════════════════════════════════════════════════════ */
.settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar { display: none; }

.settings-tab {
  padding: 8px 16px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  white-space: nowrap;
}

.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.settings-panel { display: none; }
.settings-panel.active { display: block; }

/* ══════════════════════════════════════════════════════════
   CATEGORIES LIST
══════════════════════════════════════════════════════════ */
.categories-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.category-item button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.category-item button:hover { color: #dc2626; }
.category-item button svg { width: 15px; height: 15px; }

/* ══════════════════════════════════════════════════════════
   SORTABLE TABLE HEADERS
══════════════════════════════════════════════════════════ */
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th.sortable:hover { color: var(--primary); }
th.sortable.asc .sort-icon::after { content: ' ↑'; }
th.sortable.desc .sort-icon::after { content: ' ↓'; }
.sort-icon { font-size: 0.7rem; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   ORDER DETAIL PANEL (fullscreen slide)
══════════════════════════════════════════════════════════ */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.panel-overlay.active { opacity: 1; pointer-events: all; }

.order-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(1000px, 95vw);
  background: var(--bg);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.order-detail-panel.open { transform: translateX(0); }

.order-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 12px;
}

.order-detail-header h2 {
  font-family: var(--font-secondary);
  font-size: 1.3rem;
  font-weight: 400;
  margin-top: 6px;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-primary);
  font-size: 0.83rem;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition);
}

.btn-back:hover { color: var(--primary); }
.btn-back svg { width: 16px; height: 16px; }

.order-detail-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.order-detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.order-detail-card h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.order-states-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.order-states-row .form-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.order-states-row .form-field select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
}

.order-states-row .form-field select:focus { border-color: var(--primary); }

.detail-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.detail-items-table th {
  padding: 8px 10px;
  background: var(--surface-alt);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.detail-items-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.detail-items-table tr:last-child td { border-bottom: none; }

.detail-totals {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.detail-total-row.total {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.client-data-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.client-data-item { display: flex; flex-direction: column; gap: 2px; }
.client-data-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.client-data-value { font-size: 0.875rem; color: var(--text); }

@media (max-width: 700px) {
  .order-detail-body { grid-template-columns: 1fr; }
  .order-states-row { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .user-menu-name { display: none; }
}
