/* ==========================================================================
   Southern Cross Safaris — Workshop Management System
   Design tokens + component styles.
   Palette sourced from the company logo (charcoal + gold) plus a deep
   teal/green primary per the brand direction for this system.
   ========================================================================== */

:root {
  /* Brand */
  --teal-950: #0C2825;
  --teal-900: #123B36;   /* primary — sidebar, headers, primary buttons */
  --teal-800: #17493F;
  --teal-700: #1E6155;
  --teal-600: #237A67;   /* interactive accents on light surfaces */
  --teal-100: #E4EFEA;
  --teal-50:  #F1F7F4;

  --gold-600: #B98A2E;
  --gold-500: #C99A3F;   /* accent — sparingly: badges, highlights */
  --gold-100: #F8EBCF;

  --charcoal-900: #2A2E2C;
  --charcoal-700: #4B4F4D;
  --charcoal-500: #6B726C;
  --charcoal-300: #9CA39D;

  /* Surfaces */
  --surface: #F5F7F5;
  --surface-alt: #EFF2EF;
  --card: #FFFFFF;
  --border: #E3E8E4;
  --border-strong: #D2D9D3;

  /* Text */
  --text-primary: #1E2422;
  --text-muted: #6B726C;
  --text-inverse: #F5F7F5;

  /* Status */
  --success: #2E8B57;
  --success-bg: #E7F5EC;
  --warning: #B9791E;
  --warning-bg: #FBF0DD;
  --danger: #C0392B;
  --danger-bg: #FBEAE8;
  --info: #2F6FB0;
  --info-bg: #E9F1FA;
  --neutral: #6B726C;
  --neutral-bg: #EEF0EE;

  /* Shape / motion */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(18, 59, 54, 0.06);
  --shadow-md: 0 6px 20px rgba(18, 59, 54, 0.10);
  --sidebar-w: 248px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-700); text-decoration: none; }
a:hover { color: var(--teal-900); }

h1, h2, h3, h4 { margin: 0 0 4px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12.5px; }

/* ---------------------------------------------------------------------- */
/* App shell                                                               */
/* ---------------------------------------------------------------------- */

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--teal-950) 0%, var(--teal-900) 100%);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  transition: transform 0.2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand img { height: 30px; width: auto; filter: brightness(0) invert(1); opacity: 0.95; }
.sidebar-brand .brand-text { line-height: 1.2; }
.sidebar-brand .brand-text .name { font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; color: #fff; text-transform: uppercase; }
.sidebar-brand .brand-text .tag { font-size: 10.5px; color: var(--gold-500); letter-spacing: 0.08em; text-transform: uppercase; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px; }
.sidebar-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.45); margin: 16px 10px 6px; }
.sidebar-section:first-child { margin-top: 4px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.78);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
}
.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-link.active { background: rgba(255,255,255,0.12); color: #fff; }
.sidebar-link.active svg { opacity: 1; color: var(--gold-500); }
.sidebar-link .count {
  margin-left: auto;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}
.sidebar-link.active .count { background: var(--gold-500); color: var(--teal-950); }

.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 11px; color: rgba(255,255,255,0.4); }

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

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--text-muted);
}
.topbar-search svg { width: 16px; height: 16px; flex-shrink: 0; }
.topbar-search input { border: none; background: none; outline: none; font-size: 13.5px; width: 100%; font-family: var(--font-sans); color: var(--text-primary); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }

.icon-btn {
  position: relative;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--charcoal-700);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-alt); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 999px; background: var(--danger); border: 1.5px solid #fff; }

.user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.avatar {
  width: 34px; height: 34px; border-radius: 999px;
  background: var(--teal-100); color: var(--teal-900);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.user-chip .who { line-height: 1.25; }
.user-chip .who .name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-chip .who .role { font-size: 11px; color: var(--text-muted); }
.user-chip > svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--charcoal-500); }

.page-content { padding: 24px 28px 60px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }

/* Dropdown (notifications / user menu) */
.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + 10px);
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); min-width: 280px; max-width: 340px;
  display: none; z-index: 50; overflow: hidden;
}
.dropdown.open .dropdown-panel { display: block; }
.dropdown-panel .dd-head { padding: 12px 16px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); }
.dropdown-panel .dd-item { padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: 13px; display: block; }
.dropdown-panel .dd-item.dd-link { display: flex; align-items: center; gap: 9px; }
.dropdown-panel .dd-item.dd-link svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--charcoal-500); }
.dropdown-panel .dd-item:last-child { border-bottom: none; }
.dropdown-panel .dd-item:hover { background: var(--surface); }
.dropdown-panel .dd-empty { padding: 20px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ---------------------------------------------------------------------- */
/* Cards / KPIs                                                            */
/* ---------------------------------------------------------------------- */

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

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kpi-card .kpi-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.kpi-card .kpi-icon svg { width: 18px; height: 18px; }
.kpi-icon.teal { background: var(--teal-100); color: var(--teal-800); }
.kpi-icon.gold { background: var(--gold-100); color: var(--gold-600); }
.kpi-icon.warn { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.info { background: var(--info-bg); color: var(--info); }
.kpi-icon.danger { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.success { background: var(--success-bg); color: var(--success); }
.kpi-card .kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.kpi-card .kpi-label { font-size: 12.5px; color: var(--text-muted); }

.section-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1080px) { .section-grid { grid-template-columns: 1fr; } }

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { margin: 0; }
.card-head .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------------------------------------------------------------------- */
/* Tables                                                                  */
/* ---------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--surface); }
.table-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); }

/* ---------------------------------------------------------------------- */
/* Badges                                                                  */
/* ---------------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); }

/* ---------------------------------------------------------------------- */
/* Buttons / forms                                                         */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; font-family: var(--font-sans);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--teal-900); color: #fff; }
.btn-primary:hover { background: var(--teal-800); color: #fff; }
.btn-gold { background: var(--gold-500); color: var(--teal-950); }
.btn-gold:hover { background: var(--gold-600); }
.btn-outline { background: var(--card); color: var(--text-primary); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #A93226; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--charcoal-700); }
.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: var(--font-sans); background: #fff; color: var(--text-primary);
}
.form-control:focus { outline: none; border-color: var(--teal-600); box-shadow: 0 0 0 3px var(--teal-100); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B726C' stroke-width='1.6' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 11.5px; color: var(--danger); margin-top: 5px; }

/* ---------------------------------------------------------------------- */
/* Alerts / flash                                                          */
/* ---------------------------------------------------------------------- */

.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: rgba(46,139,87,0.25); }
.alert-error   { background: var(--danger-bg); color: var(--danger); border-color: rgba(192,57,43,0.25); }
.alert-info    { background: var(--info-bg); color: var(--info); border-color: rgba(47,111,176,0.25); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(185,121,30,0.25); }

/* ---------------------------------------------------------------------- */
/* Auth pages (login / request access)                                    */
/* ---------------------------------------------------------------------- */

.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, var(--teal-800) 0%, var(--teal-950) 60%);
  padding: 24px;
}
.auth-card { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); width: 100%; max-width: 400px; padding: 34px 32px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand img { height: 44px; margin-bottom: 10px; }
.auth-brand .tag { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-600); font-weight: 700; }
.auth-brand h1 { font-size: 17px; margin-top: 4px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--text-muted); }

/* ---------------------------------------------------------------------- */
/* Module stub (not-yet-built pages)                                      */
/* ---------------------------------------------------------------------- */

.stub-card {
  text-align: center; padding: 70px 30px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--card);
}
.stub-card .stub-icon { width: 52px; height: 52px; margin: 0 auto 16px; color: var(--teal-700); }
.stub-card .stub-icon svg { width: 100%; height: 100%; }
.stub-card h2 { margin-bottom: 8px; }
.stub-card p { color: var(--text-muted); max-width: 460px; margin: 0 auto; }

/* ---------------------------------------------------------------------- */
/* Misc utility                                                            */
/* ---------------------------------------------------------------------- */

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar-search { display: none; }
}
