/* ============================================================
   PropDesk — assets/styles.css
   Design system + component styles
   Aesthetic: Refined utilitarian — clean, fast, professional
   ============================================================ */

/* ── Google Fonts loaded in index.html (DM Sans + DM Mono) ── */

/* ============================================================
   CSS CUSTOM PROPERTIES — Design Tokens
   ============================================================ */
:root {
  /* Brand colours */
  --navy-950:  #0B1628;
  --navy-900:  #111E35;
  --navy-800:  #1A2E50;
  --navy-700:  #1E3A5F;
  --navy-600:  #24487A;
  --navy-500:  #2E5FA3;
  --navy-400:  #4A7CC7;
  --navy-300:  #7AAAE0;
  --navy-200:  #B8D4F2;
  --navy-100:  #E0ECFB;
  --navy-50:   #F0F6FE;

  --amber-600: #D97706;
  --amber-500: #F59E0B;
  --amber-400: #FBBF24;
  --amber-100: #FEF3C7;
  --amber-50:  #FFFBEB;

  --green-600: #16A34A;
  --green-100: #DCFCE7;
  --green-50:  #F0FDF4;

  --red-600:   #DC2626;
  --red-100:   #FEE2E2;
  --red-50:    #FFF5F5;

  --slate-900: #0F172A;
  --slate-800: #1E293B;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-50:  #F8FAFC;

  --white:     #FFFFFF;

  /* Semantic colours */
  --bg-base:      var(--slate-50);
  --bg-surface:   var(--white);
  --bg-elevated:  var(--white);
  --bg-sidebar:   var(--navy-900);

  --text-primary:   var(--slate-900);
  --text-secondary: var(--slate-600);
  --text-tertiary:  var(--slate-400);
  --text-inverse:   var(--white);
  --text-brand:     var(--navy-700);
  --text-link:      var(--navy-500);

  --border-subtle:  var(--slate-200);
  --border-default: var(--slate-300);
  --border-strong:  var(--slate-400);
  --border-brand:   var(--navy-500);

  --accent:         var(--amber-500);
  --accent-hover:   var(--amber-600);

  /* Status colours */
  --status-open:        #2563EB;
  --status-open-bg:     #EFF6FF;
  --status-progress:    #D97706;
  --status-progress-bg: #FFFBEB;
  --status-fulfilled:   #16A34A;
  --status-fulfilled-bg:#F0FDF4;
  --status-dropped:     #64748B;
  --status-dropped-bg:  #F1F5F9;
  --status-closed:      #DC2626;
  --status-closed-bg:   #FEF2F2;

  /* Typography */
  --font-sans:  'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:  'DM Mono', 'Courier New', monospace;

  /* Type scale */
  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-lg:   1.0625rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Layout */
  --sidebar-width: 220px;
  --topbar-height: 56px;
  --content-max:   1200px;

  /* Borders */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;

  /* Shadows */
  --shadow-sm:  0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md:  0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl:  0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.05);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
}


/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-base);
  line-height: 1.5;
  min-height: 100vh;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: var(--text-base);
}

ul, ol { list-style: none; }

img { max-width: 100%; display: block; }


/* ============================================================
   BOOT SCREEN (shown before React mounts)
   ============================================================ */
.boot-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: var(--space-8);
  background: var(--navy-900);
}

.boot-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.boot-logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--amber-500);
  color: var(--navy-900);
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  font-weight: 700;
  border-radius: var(--radius-md);
}

.boot-logo-text {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.02em;
}

.boot-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--amber-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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


/* ============================================================
   APP SHELL — Sidebar + Main
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--navy-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  height: var(--topbar-height);
}

.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--amber-500);
  color: var(--navy-900);
  font-size: var(--text-base);
  font-weight: 700;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-text {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
  padding: var(--space-4) var(--space-3) var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.6);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  background: rgba(251,191,36,0.15);
  color: var(--amber-400);
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-3);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--navy-600);
  color: var(--white);
  font-size: var(--text-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  text-transform: capitalize;
}

.logout-btn {
  font-size: 14px;
  color: rgba(255,255,255,0.35);
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}
.logout-btn:hover { color: rgba(255,255,255,0.7); }


/* ── Main content area ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-8);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--topbar-height);
}

.page-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.page-body {
  padding: var(--space-6) var(--space-8);
  flex: 1;
}


/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-900);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(251,191,36,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(46,95,163,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  background: var(--navy-800);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.login-logo-mark {
  width: 40px;
  height: 40px;
  background: var(--amber-500);
  color: var(--navy-900);
  font-weight: 700;
  font-size: var(--text-lg);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-text {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.02em;
}

.login-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--white);
  margin-bottom: var(--space-1);
}

.login-subtitle {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.45);
}


/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-label.required::after {
  content: ' *';
  color: var(--red-600);
}

/* Dark variant (login form) */
.login-card .form-label {
  color: rgba(255,255,255,0.6);
}

.form-input {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  line-height: 1.5;
}

.form-input:focus {
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(46,95,163,0.12);
}

.form-input::placeholder { color: var(--text-tertiary); }
.form-input:disabled { opacity: 0.6; cursor: not-allowed; background: var(--slate-100); }

/* Dark input variant */
.login-card .form-input {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  color: var(--white);
}
.login-card .form-input:focus {
  border-color: var(--amber-500);
  box-shadow: 0 0 0 3px rgba(251,191,36,0.15);
}
.login-card .form-input::placeholder { color: rgba(255,255,255,0.3); }

.form-select {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
.form-select:focus {
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(46,95,163,0.12);
}

.form-textarea {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
  outline: none;
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}
.form-textarea:focus {
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(46,95,163,0.12);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--red-600);
  margin-top: var(--space-1);
}

/* Form row — two columns */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

/* Form sections */
.form-section {
  margin-bottom: var(--space-6);
}

.form-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-brand);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-4);
}


/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.5;
  height: 36px;
  border: 1px solid transparent;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--navy-700);
  color: var(--white);
  border-color: var(--navy-700);
}
.btn-primary:hover:not(:disabled) {
  background: var(--navy-800);
  border-color: var(--navy-800);
}

.btn-accent {
  background: var(--amber-500);
  color: var(--navy-900);
  border-color: var(--amber-500);
  font-weight: 600;
}
.btn-accent:hover:not(:disabled) {
  background: var(--amber-600);
  border-color: var(--amber-600);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--slate-100);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--slate-100);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--red-50);
  color: var(--red-600);
  border-color: var(--red-100);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red-100);
}

.btn-sm {
  height: 30px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  height: 44px;
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

.btn-full { width: 100%; }

/* Login button special treatment */
.btn-login {
  background: var(--amber-500);
  color: var(--navy-900);
  font-weight: 600;
  border-color: var(--amber-500);
  height: 44px;
}
.btn-login:hover:not(:disabled) {
  background: var(--amber-600);
  border-color: var(--amber-600);
}


/* ============================================================
   CARDS & SURFACES
   ============================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: var(--space-6);
}


/* ============================================================
   DATA TABLE
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead tr {
  background: var(--slate-50);
  border-bottom: 1px solid var(--border-subtle);
}

th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  white-space: nowrap;
}

td {
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
  cursor: pointer;
  transition: background var(--transition-fast);
}
tbody tr:hover { background: var(--slate-50); }

.td-muted { color: var(--text-secondary); }
.td-mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}


/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: nowrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.filter-bar .form-input,
.filter-bar .form-select {
  height: 34px;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.filter-search {
  flex: 0 0 200px;
  min-width: 160px;
}

.filter-select {
  flex: 0 0 150px;
  min-width: 120px;
}

.filter-actions {
  display: flex;
  gap: var(--space-2);
  margin-left: auto;
  flex-shrink: 0;
}


/* ============================================================
   STATUS BADGE
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

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

.badge-open        { background: var(--status-open-bg);        color: var(--status-open);        }
.badge-open::before { background: var(--status-open); }

.badge-in_progress { background: var(--status-progress-bg);    color: var(--status-progress);    }
.badge-in_progress::before { background: var(--status-progress); }

.badge-fulfilled   { background: var(--status-fulfilled-bg);   color: var(--status-fulfilled);   }
.badge-fulfilled::before { background: var(--status-fulfilled); }

.badge-dropped     { background: var(--status-dropped-bg);     color: var(--status-dropped);     }
.badge-dropped::before { background: var(--status-dropped); }

.badge-closed      { background: var(--status-closed-bg);      color: var(--status-closed);      }
.badge-closed::before { background: var(--status-closed); }

.badge-role-super_admin  { background: var(--amber-100);  color: var(--amber-600); }
.badge-role-client_admin { background: var(--navy-100);   color: var(--navy-700);  }
.badge-role-user         { background: var(--slate-100);  color: var(--slate-600); }

.badge-active   { background: var(--green-100);  color: var(--green-600); }
.badge-inactive { background: var(--slate-100);  color: var(--slate-500); }


/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  background: var(--slate-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.pagination-info {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.pagination-btn {
  height: 30px;
  min-width: 30px;
  padding: 0 var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.pagination-btn:hover:not(:disabled) {
  background: var(--navy-50);
  border-color: var(--navy-300);
  color: var(--navy-700);
}
.pagination-btn.active {
  background: var(--navy-700);
  border-color: var(--navy-700);
  color: var(--white);
}
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }


/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,22,40,0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-6);
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
  position: relative;
}

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

.modal-sm  { max-width: 420px; }
.modal-md  { max-width: 600px; }
.modal-lg  { max-width: 800px; }
.modal-xl  { max-width: 1000px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 1;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 18px;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.modal-close:hover { background: var(--slate-100); color: var(--text-primary); }

.modal-body { padding: var(--space-6); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--slate-50);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  position: sticky;
  bottom: 0;
}


/* ============================================================
   ALERTS & NOTICES
   ============================================================ */
.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}

.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-error   { background: var(--red-50);    color: var(--red-600);    border: 1px solid var(--red-100); }
.alert-success { background: var(--green-50);  color: var(--green-600);  border: 1px solid var(--green-100); }
.alert-warning { background: var(--amber-50);  color: var(--amber-600);  border: 1px solid var(--amber-100); }
.alert-info    { background: var(--navy-50);   color: var(--navy-700);   border: 1px solid var(--navy-100); }


/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 300px;
  margin-bottom: var(--space-5);
}


/* ============================================================
   LOADING SPINNER (inline)
   ============================================================ */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-default);
  border-top-color: var(--navy-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
}


/* ============================================================
   DETAIL VIEW
   ============================================================ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4) var(--space-8);
  margin-bottom: var(--space-6);
}

.detail-item {}

.detail-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-1);
}

.detail-value {
  font-size: var(--text-base);
  color: var(--text-primary);
}

.detail-value.masked {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.detail-section {
  margin-bottom: var(--space-6);
}

.detail-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-brand);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-4);
}


/* ============================================================
   AUDIT TRAIL
   ============================================================ */
.audit-trail {
  margin-top: var(--space-6);
}

.audit-entry {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
}

.audit-entry:last-child { border-bottom: none; }

.audit-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--navy-300);
  flex-shrink: 0;
  margin-top: 5px;
}

.audit-meta {
  flex: 1;
}

.audit-action {
  font-weight: 500;
  color: var(--text-primary);
}

.audit-detail {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  margin-top: 2px;
}

.audit-time {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  white-space: nowrap;
}


/* ============================================================
   ADMIN PANEL TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}

.tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  margin-bottom: -1px;
}

.tab:hover { color: var(--text-primary); }

.tab.active {
  color: var(--navy-700);
  border-bottom-color: var(--navy-700);
}


/* ============================================================
   POC MASKED INDICATOR
   ============================================================ */
.poc-masked-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--slate-100);
  border-radius: 99px;
  padding: 2px 6px;
  margin-left: var(--space-2);
  letter-spacing: 0.03em;
}


/* ============================================================
   STAT CARDS (Dashboard style row)
   ============================================================ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

.stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}


/* ============================================================
   UTILITIES
   ============================================================ */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2         { gap: var(--space-2); }
.gap-3         { gap: var(--space-3); }
.gap-4         { gap: var(--space-4); }
.mt-4          { margin-top: var(--space-4); }
.mt-6          { margin-top: var(--space-6); }
.mb-4          { margin-bottom: var(--space-4); }
.mb-6          { margin-bottom: var(--space-6); }
.text-sm       { font-size: var(--text-sm); }
.text-xs       { font-size: var(--text-xs); }
.text-muted    { color: var(--text-secondary); }
.text-danger   { color: var(--red-600); }
.text-success  { color: var(--green-600); }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full        { width: 100%; }
.sr-only       { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }


/* ============================================================
   RESPONSIVE — mobile adjustments
   ============================================================ */

/* Hamburger button — hidden on desktop, shown on mobile */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--navy-800);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
  /* Show hamburger */
  .hamburger-btn { display: flex !important; }

  /* Sidebar slides in from left */
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    z-index: 100;
  }
  .sidebar.open { transform: translateX(0); }

  /* Main content full width */
  .main-content { margin-left: 0; }

  /* Page padding */
  .page-body   { padding: var(--space-4) var(--space-3); }
  .page-header {
    padding: var(--space-3) var(--space-3) var(--space-3) 60px;
    height: auto;
    min-height: var(--topbar-height);
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  .page-title { font-size: var(--text-base); }

  /* Grid collapses */
  .detail-grid      { grid-template-columns: 1fr; }
  .form-row         { grid-template-columns: 1fr; }
  .stat-row         { grid-template-columns: 1fr 1fr; }
  .dashboard-grid   { grid-template-columns: 1fr !important; }

  /* Filter bar */
  .filter-bar {
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  .filter-search { flex: 1 1 100%; min-width: unset; }
  .filter-select { flex: 1 1 calc(50% - 4px); min-width: unset; }
  .filter-actions { width: 100%; justify-content: flex-end; }

  /* Table → card layout on mobile */
  .table-wrapper table,
  .table-wrapper thead,
  .table-wrapper tbody,
  .table-wrapper th,
  .table-wrapper td,
  .table-wrapper tr {
    display: block;
  }

  .table-wrapper thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .table-wrapper tbody tr {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
  }

  .table-wrapper tbody tr:hover {
    background: var(--navy-50);
  }

  .table-wrapper tbody td {
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-2) var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
  }

  .table-wrapper tbody td:last-child {
    border-bottom: none;
  }

  .table-wrapper tbody td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    min-width: 90px;
    flex-shrink: 0;
  }

  /* Pagination on mobile */
  .pagination {
    flex-direction: column;
    gap: var(--space-3);
    align-items: center;
  }

  /* Modal full screen on mobile */
  .modal-overlay { padding: var(--space-3); align-items: flex-end; }
  .modal { max-height: 85vh; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .modal-sm, .modal-md, .modal-lg, .modal-xl { max-width: 100%; }

  /* Card body padding */
  .card-body { padding: var(--space-4); }
  .card-header { padding: var(--space-3) var(--space-4); }

  /* Tabs scroll */
  .tabs { padding-bottom: 2px; }

  /* Buttons on mobile */
  .btn-full-mobile { width: 100%; }
}

@media (max-width: 400px) {
  .stat-row { grid-template-columns: 1fr; }
  .page-header .btn { font-size: var(--text-xs); padding: var(--space-1) var(--space-3); }
}
