/* ==========================================================================
   SAPAK LOGISTICS — MODERN RESPONSIVE STYLESHEET
   Muted Earthy Palette • Terracotta Accent • Mobile-First Responsive Layout
   ========================================================================== */

:root {
  /* Color Palette */
  /* Link Guard Security Official Logo Palette */
  --bg-page: #F4F6F9;
  --bg-card: #FFFFFF;
  --bg-subtle: #EEF2F6;
  --bg-hover: #E2E8F0;
  
  --sidebar-bg: #101B2B;
  --sidebar-border: #1E2D44;
  --sidebar-text: #E2E8F0;
  --sidebar-muted: #8B9BB0;
  --sidebar-active-bg: #1B2B43;

  /* Security Gold Accent from Logo */
  --accent-gold: #DDA238;
  --accent-gold-hover: #C68F2C;
  --accent-gold-subtle: #FEF7EA;
  --accent-gold-border: #F6DFB6;

  /* Primary Accent Mapping */
  --accent-terracotta: #DDA238;
  --accent-terracotta-hover: #C68F2C;
  --accent-terracotta-subtle: #FEF7EA;
  --accent-terracotta-border: #F6DFB6;

  /* Core Brand Tokens */
  --brand-navy: #132238;
  --brand-navy-dark: #0A1422;
  --brand-navy-light: #1D304E;
  --brand-gold: #DDA238;
  --brand-slate: #48566A;

  --text-primary: #132238;
  --text-secondary: #48566A;
  --text-muted: #8492A6;

  --border-light: #E2E8F0;
  --border-darker: #CBD5E1;

  /* Status Colors */
  --status-transit-bg: #E3F2FD;
  --status-transit-text: #0277BD;
  --status-transit-border: #B3E5FC;

  --status-delivered-bg: #E8F5E9;
  --status-delivered-text: #2E7D32;
  --status-delivered-border: #C8E6C9;

  --status-pending-bg: #FEF3C7;
  --status-pending-text: #B45309;
  --status-pending-border: #FDE68A;

  --status-out-bg: #FFEDD5;
  --status-out-text: #C2410C;
  --status-out-border: #FED7AA;

  --status-delayed-bg: #FEE2E2;
  --status-delayed-text: #B91C1C;
  --status-delayed-border: #FECACA;

  --status-paused-bg: #FFFBEB;
  --status-paused-text: #B45309;
  --status-paused-border: #FDE68A;

  --status-hold-bg: #F3E8FF;
  --status-hold-text: #7E22CE;
  --status-hold-border: #E9D5FF;

  /* Typography */
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(27, 34, 40, 0.04), 0 1px 3px rgba(27, 34, 40, 0.02);
  --shadow-md: 0 4px 12px rgba(27, 34, 40, 0.06), 0 1px 3px rgba(27, 34, 40, 0.04);
  --shadow-lg: 0 12px 30px rgba(27, 34, 40, 0.09), 0 3px 8px rgba(27, 34, 40, 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Reset & Mobile Fixes */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  height: 100dvh;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* ================= App Layout ================= */
.app-layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 25, 0.65);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 85;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

.sidebar-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  z-index: 90;
  transition: transform var(--transition-smooth);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 10px 18px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
}

.brand-link {
  display: block;
  text-decoration: none;
  width: 100%;
  text-align: center;
}

.brand-logo-img {
  width: 100%;
  max-width: 195px;
  height: auto;
  max-height: 78px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  padding: 8px 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.brand-logo-img:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
}

.mobile-brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.mobile-brand-logo-img {
  height: 34px;
  width: auto;
  max-width: 130px;
  object-fit: contain;
  border-radius: 4px;
  background: #FFFFFF;
  padding: 2px 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Navigation items */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.nav-item:hover {
  background-color: var(--sidebar-active-bg);
  color: #FFFFFF;
}

.nav-item.active {
  background-color: var(--sidebar-active-bg);
  border-color: rgba(221, 162, 56, 0.4);
  color: #FFFFFF;
  font-weight: 600;
}

.nav-item.active .nav-icon {
  color: var(--accent-terracotta);
}

.nav-icon {
  color: var(--sidebar-muted);
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.badge-count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-nav-admin {
  color: #FFB3A1 !important;
  border: 1px solid rgba(221, 162, 56, 0.3) !important;
  background: rgba(221, 162, 56, 0.08) !important;
  margin-top: 10px;
}

.btn-nav-admin:hover, .btn-nav-admin.active {
  background: var(--accent-terracotta) !important;
  color: #FFFFFF !important;
  border-color: var(--accent-terracotta) !important;
}

.btn-nav-admin:hover .nav-icon, .btn-nav-admin.active .nav-icon {
  color: #FFFFFF !important;
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.quick-status-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px;
  border-radius: var(--radius-sm);
}

.pulse-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #70E28B;
  margin-bottom: 4px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #55D673;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(85, 214, 115, 0.6);
  animation: pulse-ring 2s infinite cubic-bezier(0.45, 0, 0.2, 1);
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(85, 214, 115, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(85, 214, 115, 0); }
  100% { box-shadow: 0 0 0 0 rgba(85, 214, 115, 0); }
}

.quick-status-desc {
  font-size: 0.75rem;
  color: var(--sidebar-muted);
  line-height: 1.35;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #3B4652;
  color: #FFFFFF;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: var(--sidebar-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================= Main View Wrapper ================= */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  background-color: var(--bg-page);
  overflow: hidden;
}

/* Topbar */
.topbar {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 520px;
}

.mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 7px;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 0;
}

.mobile-brand-title {
  display: none;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-terracotta);
  letter-spacing: -0.02em;
}

.quick-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  width: 100%;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.quick-search-box:focus-within {
  background: #FFFFFF;
  border-color: var(--accent-terracotta);
  box-shadow: 0 0 0 3px var(--accent-terracotta-subtle);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.quick-search-box input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.88rem;
  width: 100%;
  color: var(--text-primary);
}

.search-kbd {
  font-size: 0.7rem;
  background: var(--bg-card);
  border: 1px solid var(--border-darker);
  border-radius: 4px;
  padding: 2px 5px;
  color: var(--text-muted);
  font-family: monospace;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

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

.btn-terracotta {
  background: linear-gradient(135deg, #E5A93C 0%, #D4931E 100%);
  color: #0E1A2C !important;
  font-weight: 700;
  border: 1px solid #C68F2C;
  box-shadow: 0 2px 8px rgba(221, 162, 56, 0.35);
}

.btn-terracotta:hover {
  background: linear-gradient(135deg, #EDB348 0%, #DC9B26 100%);
  color: #08111D !important;
  box-shadow: 0 4px 14px rgba(221, 162, 56, 0.48);
  transform: translateY(-1px);
}

.btn-terracotta:active {
  transform: translateY(0);
}

.btn-outline {
  background: var(--bg-card);
  border-color: var(--border-darker);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-secondary {
  background: var(--bg-subtle);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--border-light);
}

.btn-danger {
  background-color: #DC2626;
  color: #FFFFFF;
}

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

.btn-danger-outline {
  background: transparent;
  border-color: #FECACA;
  color: #DC2626;
  padding: 6px 8px;
}

.btn-danger-outline:hover {
  background: #FEE2E2;
  border-color: #DC2626;
}

.btn-warning {
  background-color: #D97706;
  color: #FFFFFF;
}

.btn-warning:hover {
  background-color: #B45309;
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent-terracotta);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}

.btn-text:hover {
  text-decoration: underline;
}

/* ================= Content Area & Views ================= */
.content-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 28px 60px 28px;
}

.view-panel {
  display: none;
  max-width: 1240px;
  margin: 0 auto;
  animation: fadeIn 200ms ease;
}

.view-panel.active {
  display: block;
}

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

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

.view-title {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.view-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Base Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ================= TRACK HERO (PUBLIC HOME) ================= */
.track-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px 30px 16px;
}

.track-hero-inner {
  text-align: center;
  max-width: 580px;
  width: 100%;
}

.track-hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--accent-terracotta-subtle);
  color: var(--accent-terracotta);
  margin-bottom: 16px;
}

.track-hero-title {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.track-hero-subtitle {
  font-size: 0.98rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.track-hero-form {
  width: 100%;
}

.track-input-group {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 2px solid var(--border-darker);
  border-radius: var(--radius-lg);
  padding: 6px 6px 6px 16px;
  gap: 10px;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.track-input-group:focus-within {
  border-color: var(--accent-terracotta);
  box-shadow: 0 0 0 3px var(--accent-terracotta-subtle), var(--shadow-md);
}

.track-input-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.track-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  padding: 8px 0;
  min-width: 0;
}

.track-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.btn-track-submit {
  padding: 10px 22px;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
}

/* Recent Tracked Shipments Cards Grid */
.recent-tracked-section {
  margin-top: 16px;
}

.recent-tracked-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.recent-tracked-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.tracked-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.tracked-card:hover {
  border-color: var(--accent-terracotta);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tracked-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

.tracked-card-id {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tracked-card-route {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.tracked-card-route svg {
  color: var(--accent-terracotta);
  flex-shrink: 0;
}

.tracked-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--border-light);
}

.tracked-card-carrier {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ================= Status Badges ================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-badge.status-transit {
  background: var(--status-transit-bg);
  color: var(--status-transit-text);
  border-color: var(--status-transit-border);
}
.status-badge.status-transit::before { background: var(--status-transit-text); }

.status-badge.status-delivered {
  background: var(--status-delivered-bg);
  color: var(--status-delivered-text);
  border-color: var(--status-delivered-border);
}
.status-badge.status-delivered::before { background: var(--status-delivered-text); }

.status-badge.status-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending-text);
  border-color: var(--status-pending-border);
}
.status-badge.status-pending::before { background: var(--status-pending-text); }

.status-badge.status-out {
  background: var(--status-out-bg);
  color: var(--status-out-text);
  border-color: var(--status-out-border);
}
.status-badge.status-out::before { background: var(--status-out-text); }

.status-badge.status-delayed {
  background: var(--status-delayed-bg);
  color: var(--status-delayed-text);
  border-color: var(--status-delayed-border);
}
.status-badge.status-delayed::before { background: var(--status-delayed-text); }

.status-badge.status-paused {
  background: var(--status-paused-bg);
  color: var(--status-paused-text);
  border-color: var(--status-paused-border);
}
.status-badge.status-paused::before { background: var(--status-paused-text); }

.status-badge.status-hold {
  background: var(--status-hold-bg);
  color: var(--status-hold-text);
  border-color: var(--status-hold-border);
}
.status-badge.status-hold::before { background: var(--status-hold-text); }

.status-badge.status-lg {
  padding: 5px 14px;
  font-size: 0.88rem;
}

/* ================= Public Shipments List & Table ================= */
.table-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  margin-bottom: 16px;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-group-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
}

.search-input-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  min-width: 220px;
  flex: 1;
}

.search-input-pill input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.85rem;
  width: 100%;
}

.filter-select-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.filter-select {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  font-size: 0.85rem;
  cursor: pointer;
}

.filter-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Data Table */
.table-container {
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
  background-color: var(--bg-hover);
}

.tracking-code-cell {
  font-family: monospace;
  font-weight: 700;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-cell-copy {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  transition: color var(--transition-fast);
  line-height: 0;
}

.btn-cell-copy:hover {
  color: var(--accent-terracotta);
}

.table-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.text-right {
  text-align: right;
}

.empty-state-card {
  padding: 40px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 2.2rem;
  margin-bottom: 10px;
}

/* ================= Shipment Detail View ================= */
.detail-header-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.btn-back {
  padding: 7px 14px;
}

.detail-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Hero Banner */
.shipment-hero-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  margin-bottom: 18px;
  background: #FFFFFF;
  border-left: 5px solid var(--accent-terracotta);
  gap: 16px;
}

.hero-tracking-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.tracking-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--accent-terracotta);
}

.tracking-number-code {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.hero-recipient {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.hero-route-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 4px;
}

.route-arrow {
  color: var(--accent-terracotta);
}

.hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  min-width: 180px;
}

.hero-progress-container {
  width: 100%;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.progress-bar-bg {
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #DDA238, #F5CF85);
  border-radius: var(--radius-pill);
  transition: width 600ms ease;
}

/* Map Card */
.map-tracking-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid var(--border-darker);
}

.map-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
  flex-wrap: wrap;
}

.map-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-pin-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-terracotta-subtle);
  color: var(--accent-terracotta);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.origin-dot { background: #2E7D32; }
.current-dot { background: var(--accent-terracotta); }
.dest-dot { background: #1E252B; }

.map-viewport-wrapper {
  position: relative;
  height: 380px;
  width: 100%;
  background: #E8EAE6;
}

.leaflet-map-element {
  width: 100%;
  height: 100%;
  z-index: 10;
}

.map-floating-overlay {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 400;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.floating-stat {
  display: flex;
  flex-direction: column;
}

.stat-caption {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-highlight {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.floating-divider {
  width: 1px;
  height: 24px;
  background: var(--border-light);
}

/* Custom Map Pins */
.custom-map-pin {
  display: grid;
  place-items: center;
}

.pin-marker-body {
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: grid;
  place-items: center;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
  border: 2px solid #FFFFFF;
}

.pin-marker-inner {
  transform: rotate(45deg);
  font-size: 10px;
  font-weight: 700;
  color: #FFFFFF;
}

.origin-pin .pin-marker-body { background: #2E7D32; }
.dest-pin .pin-marker-body { background: #1B2228; }

.moving-parcel-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent-terracotta);
  border: 3px solid #FFFFFF;
  border-radius: 50%;
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(221, 162, 56, 0.4);
  animation: pulse-truck 1.8s infinite;
}

@keyframes pulse-truck {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(221, 162, 56, 0.6); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(221, 162, 56, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(221, 162, 56, 0); }
}

/* Detail Grid Specs */
.detail-two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 18px;
}

.specs-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.info-box-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.info-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.info-cell-full {
  grid-column: span 2;
  border-top: 1px dashed var(--border-light);
  padding-top: 10px;
  margin-top: 4px;
}

.info-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.info-val {
  font-size: 0.92rem;
  color: var(--text-primary);
}

.info-val.font-semibold {
  font-weight: 600;
}

.info-notes {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
}

/* Vertical Stepper Timeline */
.timeline-card {
  height: 100%;
}

.stepper-timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 26px;
  margin-top: 8px;
}

.stepper-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 20px;
  width: 2px;
  background: var(--border-light);
}

.timeline-step-node {
  position: relative;
  padding-bottom: 20px;
}

.timeline-step-node:last-child {
  padding-bottom: 0;
}

.step-marker {
  position: absolute;
  left: -26px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-darker);
  display: grid;
  place-items: center;
}

.step-marker-inner {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}

.timeline-step-node.completed .step-marker {
  background: #2E7D32;
  border-color: #2E7D32;
  color: #FFFFFF;
}

.timeline-step-node.completed .step-marker-inner {
  background: #FFFFFF;
}

.timeline-step-node.active .step-marker {
  background: var(--accent-terracotta);
  border-color: var(--accent-terracotta);
  box-shadow: 0 0 0 4px var(--accent-terracotta-subtle);
}

.timeline-step-node.active .step-marker-inner {
  background: #FFFFFF;
}

.step-content {
  display: flex;
  flex-direction: column;
}

.step-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.step-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-step-node.active .step-title {
  color: var(--accent-terracotta);
}

.timeline-step-node.upcoming .step-title {
  color: var(--text-muted);
}

.step-timestamp {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.step-location {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
}

.step-message {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  background: var(--bg-page);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

/* ================= ADMIN PORTAL ================= */
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(221, 162, 56, 0.15);
  border: 1px solid rgba(221, 162, 56, 0.35);
  color: var(--accent-terracotta);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
  padding: 20px;
}

.admin-login-card {
  max-width: 400px;
  width: 100%;
  text-align: center;
  padding: 30px 24px;
}

.admin-login-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent-terracotta-subtle);
  color: var(--accent-terracotta);
  display: grid;
  place-items: center;
  margin: 0 auto 14px auto;
}

/* Metrics Grid (Admin) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

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

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.metric-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 1rem;
}

.icon-transit { background: var(--status-transit-bg); }
.icon-delivered { background: var(--status-delivered-bg); }

.metric-value {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.metric-foot {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ================= Modals ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27, 34, 40, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 16px;
  animation: fadeIn 150ms ease;
}

.modal-backdrop.show {
  display: grid;
}

.modal-dialog {
  background: var(--bg-card);
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 88vh;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
}

.modal-dialog-sm {
  max-width: 440px;
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-terracotta-subtle);
  color: var(--accent-terracotta);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.modal-icon-danger {
  background-color: #FEE2E2 !important;
  color: #DC2626 !important;
}

.modal-icon-warning {
  background-color: #FEF3C7 !important;
  color: #B45309 !important;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: grid;
  gap: 12px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.required-star { color: var(--accent-terracotta); }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-darker);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent-terracotta);
  box-shadow: 0 0 0 3px var(--accent-terracotta-subtle);
}

.input-with-action {
  display: flex;
  gap: 6px;
}

.btn-input-accessory {
  background: var(--bg-subtle);
  border: 1px solid var(--border-darker);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  background: var(--bg-page);
}

/* ================= Toast Notification ================= */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #1B2228;
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInToast 200ms ease;
  border-left: 4px solid var(--accent-terracotta);
}

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

/* ==========================================================================
   MOBILE-FIRST RESPONSIVE MEDIA QUERIES (TABLETS & SMARTPHONES)
   ========================================================================== */

@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .detail-two-col-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Layout & Navigation */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 270px;
    max-width: 82vw;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.4);
  }

  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-brand-title {
    display: inline-block;
  }

  .quick-search-box {
    display: none;
  }

  .topbar {
    padding: 0 14px;
    height: 56px;
  }

  .content-scroll {
    padding: 14px 14px 50px 14px;
  }

  /* Track Hero on Mobile */
  .track-hero {
    padding: 18px 0 14px 0;
  }

  .track-hero-icon {
    width: 52px;
    height: 52px;
    margin-bottom: 10px;
  }

  .track-hero-title {
    font-size: 1.55rem;
  }

  .track-hero-subtitle {
    font-size: 0.88rem;
    margin-bottom: 16px;
  }

  .track-input-group {
    flex-direction: column;
    padding: 10px;
    gap: 8px;
  }

  .track-input {
    width: 100%;
    font-size: 16px; /* Prevents auto-zoom on iOS */
    text-align: center;
    padding: 6px 0;
  }

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

  .recent-tracked-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Detail View & Map on Mobile */
  .shipment-hero-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
  }

  .hero-recipient {
    font-size: 1.25rem;
  }

  .hero-right {
    align-items: flex-start;
    width: 100%;
    min-width: 0;
  }

  .map-viewport-wrapper {
    height: 260px; /* Touch friendly on phone */
  }

  .map-floating-overlay {
    bottom: 8px;
    left: 8px;
    padding: 6px 10px;
    gap: 8px;
  }

  .stat-caption { font-size: 0.62rem; }
  .stat-highlight { font-size: 0.78rem; }
  .floating-divider { height: 18px; }

  .info-box-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .info-cell-full {
    grid-column: span 1;
  }

  /* Filter bar on Mobile */
  .table-filter-bar {
    padding: 10px 12px;
  }

  .filter-group-left {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .search-input-pill {
    min-width: 0;
    width: 100%;
  }

  .filter-select-wrapper {
    justify-content: space-between;
    width: 100%;
  }

  .filter-select {
    flex: 1;
  }

  /* Forms & Modals on Mobile */
  .form-row-2, .form-row-3 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .modal-dialog {
    max-height: 92dvh;
  }

  .modal-body {
    padding: 16px;
    gap: 12px;
  }

  .modal-header, .modal-footer {
    padding: 12px 16px;
  }

  /* Toast on Mobile */
  .toast-container {
    left: 14px;
    right: 14px;
    bottom: 14px;
    align-items: center;
  }

  .toast {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .view-title {
    font-size: 1.35rem;
  }

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

  .detail-header-nav {
    flex-wrap: wrap;
  }
}

/* Link Guard Security Trust & Features Section */
.features-section {
  margin-top: 40px;
  padding: 36px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.features-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 36px auto;
}

.features-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-terracotta);
  background: var(--accent-terracotta-subtle);
  border: 1px solid var(--accent-terracotta-border);
  padding: 4px 14px;
  border-radius: 9999px;
  margin-bottom: 12px;
}

.features-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.features-subtitle {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.feature-card {
  padding: 22px 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-smooth);
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-darker);
}

.feature-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-terracotta);
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}

.feature-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.feature-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
}


/* Admin Only Navigation Guard */
.admin-only-nav {
  display: none !important;
}

body.is-admin .admin-only-nav {
  display: flex !important;
}

/* ================= Link Guard Support Line ================= */
.header-support-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 7px 15px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: all var(--transition-smooth);
}

.header-support-pill:hover {
  background: #FEF7EA;
  border-color: #F6DFB6;
  color: #966718;
  transform: translateY(-1px);
}

.header-support-pill svg {
  color: var(--accent-gold);
  flex-shrink: 0;
}

.support-label {
  font-weight: 500;
  color: var(--text-secondary);
}

.support-number {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sidebar-support-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.support-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
}

.support-card-phone {
  font-size: 0.96rem;
  font-weight: 700;
  color: #FFFFFF;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color var(--transition-fast);
}

.support-card-phone:hover {
  color: var(--accent-gold);
}

.support-card-sub {
  font-size: 0.72rem;
  color: var(--sidebar-muted);
}

@media (max-width: 640px) {
  .header-support-pill .support-label {
    display: none;
  }
  .header-support-pill {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
}
