@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  /* Brand */
  --color-accent:      #006953;
  --color-accent-soft: #eaf4f2;
  --color-accent-mid:  #b3d4ce;
  --color-primary:     #ef0081;
  --color-primary-soft:#fce8f3;

  /* Status */
  --color-success: #059669;
  --color-warning: #d97706;
  --color-danger:  #dc2626;

  /* Surfaces */
  --color-bg:       #f0f2f5;
  --color-surface:  #ffffff;
  --color-border:   #e2e8f0;
  --color-muted-bg: #f8fafc;

  /* Text */
  --color-text-base:  #0f172a;
  --color-text-muted: #64748b;
  --color-text-invert:#ffffff;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);

  /* Layout */
  --header-h:  60px;
  --sidebar-w: 228px;
  --radius:    10px;
  --radius-sm: 6px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
  background: var(--color-bg) url('../img/background.webp') center center / cover fixed;
  color: var(--color-text-base);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ───────────────────────────────────────────── */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 1;
}

.app-logo {
  height: 38px;
  width: auto;
  flex-shrink: 0;
}

.app-brand .app-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -0.02em;
}

.app-body {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 16px 10px;
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  overflow-y: auto;
}

.sidebar a {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  margin-bottom: 2px;
  transition: background 0.12s, color 0.12s;
}

.sidebar a:hover {
  background: var(--color-muted-bg);
  color: var(--color-text-base);
  text-decoration: none;
}

.sidebar a.active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: 600;
  border-left-color: var(--color-accent);
}

/* ── Main content ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 28px;
  min-height: calc(100vh - var(--header-h));
}

.content-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

/* ── Typography ──────────────────────────────────────────── */
h1 {
  margin-top: 0;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--color-text-base);
  letter-spacing: -0.03em;
}

h2 {
  margin-top: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text-base);
  letter-spacing: -0.02em;
}

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

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  font-family: inherit;
  transition: all 0.12s;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-text-invert);
  box-shadow: 0 1px 3px rgba(0,105,83,0.2);
  justify-content: center;
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--color-accent) 88%, black);
  color: var(--color-text-invert);
  box-shadow: 0 2px 8px rgba(0,105,83,0.3);
  text-decoration: none;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text-base);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--color-muted-bg);
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}

.btn-danger {
  background: var(--color-danger);
  color: var(--color-text-invert);
}
.btn-danger:hover {
  background: color-mix(in srgb, var(--color-danger) 88%, black);
  color: var(--color-text-invert);
  text-decoration: none;
}

.btn:disabled, .btn[disabled] {
  background: var(--color-border);
  color: var(--color-text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

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

/* ── Forms ───────────────────────────────────────────────── */
label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-base);
}

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-base);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

input::placeholder, textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

.field-error input,
.field-error textarea,
.field-error select { border-color: var(--color-danger); }

.form-group  { margin-bottom: 18px; }
.help-text   { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 4px; }
.error-text  { font-size: 0.78rem; color: var(--color-danger); margin-top: 4px; }

/* ── Tables ──────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead tr {
  border-bottom: 2px solid var(--color-border);
}

.data-table thead th {
  padding: 10px 14px;
  text-align: left;
  background: var(--color-muted-bg);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.data-table tbody tr:nth-child(odd)  { background: var(--color-surface); }
.data-table tbody tr:nth-child(even) { background: var(--color-muted-bg); }

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

.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-border);
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-approved {
  background: color-mix(in srgb, var(--color-success) 12%, white);
  color: var(--color-success);
}
.badge-pending {
  background: color-mix(in srgb, var(--color-warning) 12%, white);
  color: var(--color-warning);
}
.badge-rejected {
  background: color-mix(in srgb, var(--color-danger) 12%, white);
  color: var(--color-danger);
}
.badge-verified {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.875rem;
  border-left: 3px solid;
}
.alert-info    { background: var(--color-accent-soft);                             color: var(--color-accent);  border-color: var(--color-accent);  }
.alert-success { background: color-mix(in srgb, var(--color-success) 10%, white); color: var(--color-success); border-color: var(--color-success); }
.alert-warning { background: color-mix(in srgb, var(--color-warning) 10%, white); color: var(--color-warning); border-color: var(--color-warning); }
.alert-danger  { background: color-mix(in srgb, var(--color-danger)  10%, white); color: var(--color-danger);  border-color: var(--color-danger);  }

/* ── Auth pages ──────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(140deg, #eaf4f2 0%, #fce8f3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--color-surface);
  border-radius: 16px;
  padding: 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.09);
  text-align: center;
  border: 1px solid var(--color-border);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.auth-logo {
  height: 76px;
  width: auto;
}

.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0;
  letter-spacing: -0.03em;
}
.auth-card p { color: var(--color-text-muted); margin-bottom: 24px; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--color-text-muted);
}
.empty-state p { margin: 0; font-size: 0.95rem; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

.modal-box h3 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Scoring panel ───────────────────────────────────────── */
.scoring-panel {
  border-left: 3px solid var(--color-accent);
  padding-left: 20px;
  margin-top: 24px;
}

/* ── Collapsible ─────────────────────────────────────────── */
.collapsible-header {
  background: var(--color-muted-bg);
  border: 1px solid var(--color-border);
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-sm);
  user-select: none;
}

.collapsible-header .chevron { color: var(--color-accent); transition: transform 0.2s; }
.collapsible-header.open .chevron { transform: rotate(180deg); }

/* ── Toast ───────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  min-width: 240px;
  border-left: 3px solid;
  background: var(--color-surface);
}

.toast-success { color: var(--color-success); border-color: var(--color-success); }
.toast-error   { color: var(--color-danger);  border-color: var(--color-danger);  }

/* ── Avatar / dropdown ───────────────────────────────────── */
.avatar-dropdown { position: relative; }

.avatar-btn {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-base);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  transition: all 0.12s;
  font-family: inherit;
}

.avatar-btn:hover { background: var(--color-muted-bg); border-color: var(--color-accent); }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-width: 180px;
  box-shadow: var(--shadow-md);
  z-index: 150;
  overflow: hidden;
}

.dropdown-menu a,
.dropdown-menu button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--color-text-base);
  text-decoration: none;
  font-family: inherit;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover { background: var(--color-muted-bg); color: var(--color-accent); }

/* ── Utilities ───────────────────────────────────────────── */
.text-muted   { color: var(--color-text-muted); }
.text-sm      { font-size: 0.875rem; }
.flex         { display: flex; }
.items-center { align-items: center; }
.gap-2        { gap: 8px; }
.gap-3        { gap: 12px; }
.mb-4         { margin-bottom: 16px; }
.mt-4         { margin-top: 16px; }
.w-full       { width: 100%; display: flex; justify-content: center; }

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.highlighted-row { background: var(--color-accent-soft) !important; font-weight: 600; }

.window-banner {
  background: color-mix(in srgb, var(--color-warning) 10%, white);
  color: var(--color-warning);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
  border-left: 3px solid var(--color-warning);
}

/* ── Hamburger (hidden on desktop) ──────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-base);
  border-radius: 2px;
  transition: background 0.12s;
}
.hamburger:hover span { background: var(--color-accent); }

/* Sidebar close button (hidden on desktop) */
.sidebar-close {
  display: none;
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 4px 8px;
  margin-bottom: 8px;
  align-self: flex-end;
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.4);
  z-index: 80;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Header */
  .app-header { padding: 0 14px; gap: 10px; }
  .hamburger  { display: flex; }

  /* Sidebar becomes a fixed drawer below the header */
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    padding-top: 12px;
    display: flex;
    flex-direction: column;
  }
  .sidebar.open    { transform: translateX(0); }
  .sidebar-close   { display: none; }
  .sidebar-overlay { display: block; }

  /* Main content fills the full width */
  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  /* Cards */
  .content-card { padding: 16px; }

  /* Tables scroll horizontally */
  .content-card > .data-table,
  .content-card > div > .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Modals */
  .modal-box { margin: 16px; max-width: calc(100vw - 32px); padding: 20px; }
  .modal-actions { flex-wrap: wrap; }

  /* Auth card */
  .auth-card { padding: 28px 18px; }

  /* Typography */
  h1 { font-size: 1.4rem; }

  /* Toasts */
  #toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: 0; width: 100%; }
}

@media (max-width: 480px) {
  .app-name { display: none; }
  .avatar-btn span:first-child { display: none; }
}
