/* ==========================================================================
   TIRwork — Complete CSS Design System
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Self-hosted fonts (GDPR: no third-party Google Fonts request)
   -------------------------------------------------------------------------- */
/* Inter is served locally from /assets/fonts to avoid leaking visitor IPs to
   Google Fonts. These are VARIABLE fonts: a single file covers weights 100-900,
   so `font-weight: 400` ... `900` all resolve from the same woff2.
   If the woff2 files are ever missing, the `system-ui` fallback in --font keeps
   the site fully legible. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../assets/fonts/inter-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url('../assets/fonts/inter-variable-italic.woff2') format('woff2');
}

/* --------------------------------------------------------------------------
   1. CSS Variables
   -------------------------------------------------------------------------- */
:root {
  --primary: #14304D;
  --primary-light: #2E6BA8;
  --accent: #F5A623;
  --accent-dark: #DB9211;
  --on-accent: #14304D; /* dark text to place on amber accent (road-sign style) */
  --success: #1D9E75;
  --warning: #EF9F27;
  --danger: #E24B4A;
  --info: #378ADD;
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --text-primary: #15233B;
  --text-secondary: #6B7280;
  --text-hint: #9CA3AF;
  --border: #E5E7EB;
  --divider: #F3F4F6;
  --font: 'Inter', system-ui, -apple-system, sans-serif;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);

  --transition: 0.2s ease;

  --sidebar-width: 260px;
  --navbar-height: 64px;
}

/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg);
  min-height: 100vh;
}

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

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary);
}

ul, ol {
  list-style: none;
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2.25rem;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.875rem;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.5rem;
  letter-spacing: -0.015em;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.125rem;
}

h6 {
  font-size: 1rem;
  font-weight: 600;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.text-sm {
  font-size: 0.875rem;
}

.text-lg {
  font-size: 1.125rem;
}

.text-xl {
  font-size: 1.25rem;
}

.text-2xl {
  font-size: 1.5rem;
}

.text-muted {
  color: var(--text-hint);
}

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

.text-accent {
  color: var(--accent);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}

.font-medium {
  font-weight: 500;
}

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

.font-bold {
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   4. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.5;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background-color: #15304d;
}

.btn-accent {
  background-color: var(--accent);
  color: var(--on-accent);
}

.btn-accent:hover {
  background-color: var(--accent-dark);
}

.btn-success {
  background-color: var(--success);
  color: #fff;
}

.btn-success:hover {
  background-color: #178a66;
}

.btn-outline {
  background-color: transparent;
  color: var(--primary);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--primary);
  background-color: rgba(20, 48, 77, 0.04);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--divider);
  color: var(--text-primary);
  box-shadow: none;
  transform: none;
}

.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1.0625rem;
  border-radius: var(--radius);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius);
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

.btn-icon.btn-lg {
  width: 48px;
  height: 48px;
}

/* --------------------------------------------------------------------------
   5. Forms
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-hint);
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-hint);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(46, 107, 168, 0.15);
}

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

.form-input.is-error:focus,
.form-select.is-error:focus,
.form-textarea.is-error:focus {
  box-shadow: 0 0 0 3px rgba(226, 75, 74, 0.15);
}

.form-error {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--danger);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
  padding-right: 2.5rem;
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-checkbox,
.form-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
}

.form-checkbox input,
.form-radio input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   6. Cards
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3,
.card-header h4,
.card-header h5 {
  margin-bottom: 0;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* --------------------------------------------------------------------------
   7. Layout
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-sm {
  max-width: 720px;
}

.container-lg {
  max-width: 1400px;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-1 {
  gap: 0.25rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.gap-6 {
  gap: 1.5rem;
}

.gap-8 {
  gap: 2rem;
}

/* --------------------------------------------------------------------------
   8. Dashboard Layout
   -------------------------------------------------------------------------- */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--primary) 0%, #122840 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar-nav-section {
  padding: 0.5rem 1.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.5rem;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  border-radius: 0;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  position: relative;
}

.sidebar-nav-item:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.08);
}

.sidebar-nav-item.active {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.12);
}

.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-nav-item .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-nav-item.active .icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  min-height: 100vh;
}

.main-content-with-navbar {
  padding-top: calc(var(--navbar-height) + 2rem);
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  margin-bottom: 0.25rem;
}

.page-header p {
  margin-bottom: 0;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   9. Navbar
   -------------------------------------------------------------------------- */
.navbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--navbar-height);
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.navbar-standalone {
  left: 0;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.navbar-links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.navbar-links a:hover,
.navbar-links a.active {
  color: var(--primary);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--border);
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   10. Stats Cards
   -------------------------------------------------------------------------- */
.stat-card {
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: box-shadow var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-icon.bg-primary {
  background-color: rgba(20, 48, 77, 0.1);
  color: var(--primary);
}

.stat-card-icon.bg-accent {
  background-color: rgba(245, 166, 35, 0.1);
  color: var(--accent);
}

.stat-card-icon.bg-success {
  background-color: rgba(29, 158, 117, 0.1);
  color: var(--success);
}

.stat-card-icon.bg-warning {
  background-color: rgba(239, 159, 39, 0.1);
  color: var(--warning);
}

.stat-card-icon.bg-info {
  background-color: rgba(55, 138, 221, 0.1);
  color: var(--info);
}

.stat-card-content {
  flex: 1;
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-card-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

.stat-card-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.375rem;
}

.stat-card-change.up {
  color: var(--success);
}

.stat-card-change.down {
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   11. Tables
   -------------------------------------------------------------------------- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  box-shadow: var(--shadow);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
  background-color: var(--divider);
  white-space: nowrap;
}

.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--divider);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr:hover {
  background-color: rgba(20, 48, 77, 0.02);
}

.table tbody tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.01);
}

.table tbody tr:nth-child(even):hover {
  background-color: rgba(20, 48, 77, 0.03);
}

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

/* --------------------------------------------------------------------------
   12. Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  background-color: var(--divider);
  color: var(--text-secondary);
}

.badge-primary {
  background-color: rgba(20, 48, 77, 0.1);
  color: var(--primary);
}

.badge-success {
  background-color: rgba(29, 158, 117, 0.12);
  color: var(--success);
}

.badge-warning {
  background-color: rgba(239, 159, 39, 0.12);
  color: #b37a00;
}

.badge-danger {
  background-color: rgba(226, 75, 74, 0.12);
  color: var(--danger);
}

.badge-info {
  background-color: rgba(55, 138, 221, 0.12);
  color: var(--info);
}

.badge-accent {
  background-color: rgba(245, 166, 35, 0.12);
  color: var(--accent);
}

.badge-lg {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
}

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* --------------------------------------------------------------------------
   13. Match Score
   -------------------------------------------------------------------------- */
.match-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  font-size: 0.9375rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.match-score-sm {
  width: 36px;
  height: 36px;
  font-size: 0.75rem;
}

.match-score-lg {
  width: 72px;
  height: 72px;
  font-size: 1.25rem;
}

.match-score-high {
  background-color: rgba(29, 158, 117, 0.12);
  color: var(--success);
  border: 2px solid var(--success);
}

.match-score-medium {
  background-color: rgba(239, 159, 39, 0.12);
  color: var(--warning);
  border: 2px solid var(--warning);
}

.match-score-low {
  background-color: rgba(226, 75, 74, 0.12);
  color: var(--danger);
  border: 2px solid var(--danger);
}

.match-score-bar {
  height: 6px;
  border-radius: var(--radius-full);
  background-color: var(--divider);
  overflow: hidden;
}

.match-score-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

.match-score-bar-fill.high {
  background-color: var(--success);
}

.match-score-bar-fill.medium {
  background-color: var(--warning);
}

.match-score-bar-fill.low {
  background-color: var(--danger);
}

/* --------------------------------------------------------------------------
   14. Alerts
   -------------------------------------------------------------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.alert-success {
  background-color: rgba(29, 158, 117, 0.08);
  border-color: var(--success);
  color: var(--success);
}

.alert-danger {
  background-color: rgba(226, 75, 74, 0.08);
  border-color: var(--danger);
  color: var(--danger);
}

.alert-warning {
  background-color: rgba(239, 159, 39, 0.08);
  border-color: var(--warning);
  color: #8a5c00;
}

.alert-info {
  background-color: rgba(55, 138, 221, 0.08);
  border-color: var(--info);
  color: var(--info);
}

.alert-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  transition: opacity var(--transition);
  padding: 0;
}

.alert-dismiss:hover {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   15. Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background-color: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--divider);
}

.modal-header h3 {
  margin-bottom: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.modal-close:hover {
  background-color: var(--divider);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--divider);
}

.modal-lg {
  max-width: 720px;
}

.modal-sm {
  max-width: 400px;
}

/* --------------------------------------------------------------------------
   16. Chat
   -------------------------------------------------------------------------- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 600px;
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--divider);
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.chat-header-info h5 {
  margin-bottom: 0;
  font-size: 0.9375rem;
}

.chat-header-info span {
  font-size: 0.75rem;
  color: var(--text-hint);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background-color: var(--bg);
}

.chat-message {
  max-width: 75%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  line-height: 1.5;
  position: relative;
}

.chat-message-sent {
  align-self: flex-end;
  background-color: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message-received {
  align-self: flex-start;
  background-color: var(--surface);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.chat-message-time {
  font-size: 0.6875rem;
  opacity: 0.6;
  margin-top: 0.25rem;
  text-align: right;
}

.chat-message-received .chat-message-time {
  color: var(--text-hint);
}

.chat-input-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--divider);
  background-color: var(--surface);
}

.chat-input {
  flex: 1;
  padding: 0.625rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color var(--transition);
}

.chat-input:focus {
  border-color: var(--primary-light);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background-color: #15304d;
}

/* --------------------------------------------------------------------------
   17. Loading States
   -------------------------------------------------------------------------- */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

.spinner-accent {
  border-top-color: var(--accent);
}

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

.skeleton {
  background: linear-gradient(90deg, var(--divider) 25%, var(--border) 50%, var(--divider) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 0.5rem;
}

.skeleton-text-lg {
  height: 20px;
}

.skeleton-heading {
  height: 28px;
  width: 60%;
  margin-bottom: 0.75rem;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
}

.skeleton-card {
  height: 200px;
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

/* --------------------------------------------------------------------------
   18. Utilities — Spacing
   -------------------------------------------------------------------------- */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.m-6 { margin: 1.5rem; }
.m-8 { margin: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.ml-0 { margin-left: 0; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 0.75rem; }
.ml-4 { margin-left: 1rem; }
.ml-auto { margin-left: auto; }

.mr-0 { margin-right: 0; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }
.mr-4 { margin-right: 1rem; }
.mr-auto { margin-right: auto; }

.mx-auto { margin-left: auto; margin-right: auto; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.pt-0 { padding-top: 0; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pt-8 { padding-top: 2rem; }

.pb-0 { padding-bottom: 0; }
.pb-4 { padding-bottom: 1rem; }
.pb-6 { padding-bottom: 1.5rem; }
.pb-8 { padding-bottom: 2rem; }

.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }

.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }

/* --------------------------------------------------------------------------
   18b. Utilities — Text & Display
   -------------------------------------------------------------------------- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }

.relative { position: relative; }
.absolute { position: absolute; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.border { border: 1px solid var(--border); }
.border-top { border-top: 1px solid var(--border); }
.border-bottom { border-bottom: 1px solid var(--border); }

.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-none { box-shadow: none; }

.cursor-pointer { cursor: pointer; }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.transition { transition: all var(--transition); }

/* --------------------------------------------------------------------------
   18c. Utilities — Backgrounds
   -------------------------------------------------------------------------- */
.bg-surface { background-color: var(--surface); }
.bg-muted { background-color: var(--bg); }
.bg-primary { background-color: var(--primary); color: #fff; }
.bg-accent { background-color: var(--accent); color: var(--on-accent); }

/* --------------------------------------------------------------------------
   19. Divider
   -------------------------------------------------------------------------- */
.divider {
  height: 1px;
  background-color: var(--divider);
  margin: 1.5rem 0;
}

/* --------------------------------------------------------------------------
   20. Avatar
   -------------------------------------------------------------------------- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-sm {
  width: 32px;
  height: 32px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
}

.avatar-xl {
  width: 80px;
  height: 80px;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary-light);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}

.avatar-placeholder.avatar-sm {
  font-size: 0.75rem;
}

.avatar-placeholder.avatar-lg {
  font-size: 1.25rem;
}

/* --------------------------------------------------------------------------
   21. Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  color: var(--text-hint);
  opacity: 0.5;
}

.empty-state h4 {
  margin-bottom: 0.5rem;
}

.empty-state p {
  max-width: 360px;
  margin-bottom: 1.5rem;
}

/* --------------------------------------------------------------------------
   22. Tabs
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--divider);
  gap: 0;
}

.tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
  transition: color var(--transition);
}

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

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

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--primary);
  border-radius: 2px 2px 0 0;
}

/* --------------------------------------------------------------------------
   23. Auth Container
   -------------------------------------------------------------------------- */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 70px);
  background-color: var(--bg);
  padding: 2rem 1rem;
}

.auth-container .card {
  width: 100%;
  max-width: 560px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
}

.auth-container .card.card-wide {
  max-width: 640px;
}

.auth-container .card-body {
  padding: 2.5rem;
}

/* --------------------------------------------------------------------------
   23b. Nav Login Button
   -------------------------------------------------------------------------- */
.nav-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--primary);
  background-color: transparent;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.nav-login:hover {
  background-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.nav-login:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   24. Responsive
   -------------------------------------------------------------------------- */

/* Tablet — max 1024px */
@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .container {
    padding: 0 1rem;
  }

  .main-content {
    padding: 1.5rem;
  }

  .hide-tablet {
    display: none;
  }

  /* Subscription grid 2 cols on tablet */
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Mobile — max 768px */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  /* Sidebar collapses */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .navbar {
    left: 0;
    padding: 0 1rem;
  }

  .navbar-toggle {
    display: flex;
  }

  .navbar-links {
    display: none;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 1.25rem;
  }

  .modal {
    margin: 0.5rem;
    max-height: 95vh;
    border-radius: var(--radius-lg);
  }

  .chat-message {
    max-width: 85%;
  }

  .table-container {
    border-radius: var(--radius);
  }

  .table th,
  .table td {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
  }

  .btn {
    padding: 0.5rem 1rem;
  }

  .btn-lg {
    padding: 0.75rem 1.5rem;
  }

  .auth-container {
    padding: 1.5rem 0.75rem;
    min-height: calc(100vh - 60px);
  }

  .auth-container .card-body {
    padding: 1.5rem;
  }

  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--primary);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 98;
  }

  .mobile-header .navbar-toggle {
    display: flex;
    color: white;
    font-size: 24px;
    padding: 4px;
  }

  .main-content {
    margin-top: 52px;
  }

  .hide-mobile {
    display: none;
  }

  .show-mobile {
    display: block;
  }

  /* Dashboard responsive fixes */
  .dashboard {
    display: block;
  }

  /* Subscription pricing grid */
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* Messages layout */
  .messages-layout {
    flex-direction: column !important;
    height: calc(100vh - 52px) !important;
  }

  #conversationsList {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    max-height: 35vh;
    min-height: 120px;
    flex-shrink: 0;
  }

  .messages-layout > div:last-child {
    flex: 1;
    min-height: 0;
  }

  /* Job/application card actions */
  .card-body[style*="display:flex"][style*="align-items:center"] {
    flex-wrap: wrap;
  }

  /* Auth split layout */
  .auth-split {
    flex-direction: column;
  }

  .auth-split-brand {
    display: none;
  }

  .auth-split-form {
    width: 100%;
    min-height: 100vh;
  }
}

/* Small mobile — max 480px */
@media (max-width: 480px) {
  .container {
    padding: 0 0.75rem;
  }

  .card-body {
    padding: 1rem;
  }

  .card-header {
    padding: 1rem;
  }

  .stat-card-value {
    font-size: 1.5rem;
  }

  /* Stack action buttons */
  .card-body [style*="display:flex"][style*="gap:8px"] {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

.mobile-header {
  display: none;
}

/* --------------------------------------------------------------------------
   24. Print
   -------------------------------------------------------------------------- */
@media print {
  .sidebar,
  .navbar,
  .btn,
  .chat-input-area,
  .modal-overlay {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
