/* ------------------------------------------------------------------
   admin.css  -  Dashboard styles (blue / white / neutral).
   Uses the same font stack, 8-12px rounded corners and card style as
   the public site, so both feel like one product.
   Colors live in :root so you can change the whole theme in one place.
------------------------------------------------------------------- */
:root {
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --navy:     #0f172a;
  --text:     #0f172a;
  --muted:    #64748b;
  --border:   #e2e8f0;
  --bg:       #f8fafc;
  --white:    #ffffff;
  --danger:   #b91c1c;
  --danger-bg:#fee2e2;
  --warn-bg:  #fef3c7;
  --warn:     #92400e;
  --ok-bg:    #dcfce7;
  --ok:       #166534;
  --sidebar-w: 248px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
code { background: var(--blue-50); padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }
:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; font: inherit; font-size: 14px; font-weight: 700;
  padding: 10px 18px; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--blue-700); color: #fff; }
.btn-primary:hover { background: var(--blue-600); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--white); color: var(--navy); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-block { width: 100%; }

/* ---------- full-screen cards (login, locked, no access) ---------- */
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.center-card {
  width: 100%; max-width: 400px; background: var(--white); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}
.center-card h1 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.center-card p { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.center-card .btn { margin-top: 6px; }

.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 11px; font-weight: 700; color: #334155;
  text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 6px;
}
.field input {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; padding: 12px;
  font: inherit; font-size: 14px; background: #fff; color: var(--text);
}
.field input:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px var(--blue-100); }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px !important; }

/* ---------- layout ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 40;
  background: var(--navy); color: #cbd5e1; display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform 0.2s ease;
}
.sidebar.open { transform: translateX(0); }
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); z-index: 30; display: none; }
.overlay.show { display: block; }

.brand { padding: 20px 18px 16px; border-bottom: 1px solid #1e293b; }
.brand-name { color: #fff; font-weight: 800; font-size: 14px; letter-spacing: -0.01em; line-height: 1.3; }
.brand-sub { font-size: 12px; color: #94a3b8; margin-top: 2px; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: #cbd5e1; min-height: 44px;
}
.nav-link:hover { background: #1e293b; color: #fff; }
.nav-link.active { background: var(--blue-700); color: #fff; }

.sidebar-foot { padding: 14px 18px; border-top: 1px solid #1e293b; font-size: 13px; }
.who { color: #fff; font-weight: 700; margin-bottom: 6px; word-break: break-all; }
.foot-link { display: block; color: #93c5fd; padding: 4px 0; }
.foot-link:hover { text-decoration: underline; }
.foot-btn { background: none; border: none; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }

.main { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 56px;
}
.topbar-title { font-weight: 800; font-size: 16px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 8px; border: none; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--navy);
}
.icon-btn:hover { background: var(--bg); }

.demo-banner {
  background: var(--warn-bg); color: var(--warn); font-size: 13px; padding: 8px 16px;
  border-bottom: 1px solid #fde68a;
}
.content { padding: 20px 16px 48px; max-width: 1200px; outline: none; }

@media (min-width: 900px) {
  .sidebar { transform: none; }
  .overlay, .overlay.show { display: none; }
  .main { margin-left: var(--sidebar-w); }
  .icon-btn { display: none; }
  .content { padding: 28px 32px 56px; }
}

/* ---------- page pieces ---------- */
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 24px; font-weight: 800; color: var(--navy); }
.page-head p { font-size: 14px; color: var(--muted); margin-top: 2px; }

.card {
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; margin-bottom: 18px;
}
.card h2 { font-size: 16px; font-weight: 800; margin-bottom: 12px; }

.note { font-size: 13px; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.note-placeholder { background: var(--blue-50); color: #1e3a8a; border: 1px solid var(--blue-100); }

.stat-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 18px; }
@media (min-width: 560px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.stat-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 30px; font-weight: 800; color: var(--blue-700); margin-top: 4px; }
.stat-note { font-size: 12px; color: var(--muted); margin-top: 2px; }

.two-col { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 1100px) { .two-col { grid-template-columns: 1fr 1fr; } }

.details { display: grid; grid-template-columns: 1fr; gap: 2px 16px; font-size: 14px; }
.details dt { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-top: 10px; }
@media (min-width: 640px) {
  .details { grid-template-columns: 160px 1fr; }
  .details dt { margin-top: 0; padding: 8px 0; }
  .details dd { padding: 8px 0; border-bottom: 1px solid var(--border); }
  .details dt { border-bottom: 1px solid var(--border); }
}

/* ---------- table: normal on desktop, stacked cards on phones ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:hover { background: var(--bg); }

@media (max-width: 639px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; padding: 6px 0; }
  .data-table td { border: none; padding: 6px 12px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .data-table td::before { content: attr(data-label); font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; text-align: left; }
}

/* ---------- status badges ---------- */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #e2e8f0; color: #334155; white-space: nowrap; }
.badge-new, .badge-pending, .badge-booked, .badge-processing { background: var(--warn-bg); color: var(--warn); }
.badge-sent, .badge-confirmed, .badge-in-transit, .badge-at-port, .badge-admin { background: var(--blue-100); color: #1e40af; }
.badge-accepted, .badge-paid, .badge-approved, .badge-delivered, .badge-shipped { background: var(--ok-bg); color: var(--ok); }
.badge-rejected, .badge-cancelled, .badge-overdue { background: var(--danger-bg); color: var(--danger); }

/* ---------- loading / empty / error states ---------- */
.state { text-align: center; padding: 40px 16px; color: var(--muted); }
.state-title { font-size: 16px; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.state p { font-size: 14px; margin-bottom: 12px; }
.state-error .state-title { color: var(--danger); }
.spinner {
  width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--blue-100); border-top-color: var(--blue-700); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  .sidebar { transition: none; }
}
