/**
 * M.I.L.O. Modern Design System v2.0
 * Movement Integration and Load Optimization
 * by MetiFor LLC
 * Comprehensive UI Framework - Clean, Modern, Functionally Optimized
 */

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

:root {
  /* === MILO Design System v2.0 — canonical tokens === */
  --bg:#020303; --bg-1:#080B0A; --bg-2:#0E1210; --bg-3:#141918; --bg-4:#1A2120;
  --tx-1:#EEF2EE; --tx-2:#A8C4BC; --tx-3:#6A8A82; --tx-4:#778167;
  --accent:#1DC486; --accent-dk:#0D6B56;
  --accent-dim:rgba(29,196,134,0.08); --accent-glo:rgba(29,196,134,0.16);
  --accent-bdr:rgba(29,196,134,0.20);
  --amber:#F07820; --amber-dim:rgba(240,120,32,0.10); --amber-bdr:rgba(240,120,32,0.28);
  --danger:#EF4444; --danger-dim:rgba(239,68,68,0.10); --danger-bdr:rgba(239,68,68,0.22);
  --info:#60A5FA; --info-dim:rgba(96,165,250,0.10);
  --gold:#F5C842; --gold-dim:rgba(245,200,66,0.08); --gold-bdr:rgba(245,200,66,0.25);
  --dev:#334155; --dev-dim:rgba(51,65,85,0.12); --dev-bdr:rgba(51,65,85,0.30);
  --bdr-dim:rgba(168,196,188,0.12); --bdr-soft:rgba(168,196,188,0.16);
  --bdr-med:rgba(168,196,188,0.28); --bdr-hi:rgba(168,196,188,0.50);
  --ff-display:'Plus Jakarta Sans',sans-serif;
  --ff-body:'DM Sans',system-ui,sans-serif;
  --ff-mono:'DM Mono',monospace;
  --r-sm:4px; --r-md:6px; --r-lg:8px; --r-xl:12px; --r-2xl:16px; --r-pill:999px;
  --ease-fast:120ms ease; --ease-med:200ms ease;

  /* Legacy aliases — keeps pages that reference old names working */
  --bg-dark:var(--bg); --bg-primary:var(--bg-1); --bg-secondary:var(--bg-2);
  --bg-tertiary:var(--bg-3); --bg-elevated:var(--bg-4); --bg-hover:var(--bg-4);
  --bg-card:var(--bg-2); --bg-card-hover:var(--bg-3); --bg-input:var(--bg-1);
  --text-primary:var(--tx-1); --text-secondary:var(--tx-2);
  --text-tertiary:var(--tx-3); --text-muted:var(--tx-3); --text-disabled:var(--tx-4);
  --border-subtle:var(--bdr-dim); --border-default:var(--bdr-soft);
  --border-strong:var(--bdr-med); --border-hover:var(--bdr-soft);
  --border-color:var(--bdr-dim); --border-focus:var(--accent);
  --accent-primary:var(--accent); --accent-primary-hover:var(--accent-dk);
  --accent-success:var(--accent); --accent-success-hover:var(--accent-dk);
  --accent-warning:var(--amber); --accent-warning-hover:var(--amber);
  --accent-danger:var(--danger); --accent-danger-hover:var(--danger);
  --accent-info:var(--info);
  --success:var(--accent); --warning:var(--amber); --info-color:var(--info);
  --success-bg:var(--accent-dim); --success-border:var(--accent-bdr);
  --warning-bg:var(--amber-dim); --warning-border:var(--amber-bdr);
  --danger-bg:var(--danger-dim); --danger-border:var(--danger-bdr);
  --info-bg:var(--info-dim); --info-border:rgba(96,165,250,0.22);
  --radius-sm:var(--r-sm); --radius-md:var(--r-md); --radius-lg:var(--r-lg);
  --radius-xl:var(--r-xl); --radius-2xl:var(--r-2xl); --radius-full:var(--r-pill);
  --font-sans:var(--ff-body); --font-mono:var(--ff-mono);
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px; --space-5:20px;
  --space-6:24px; --space-8:32px; --space-10:40px; --space-12:48px; --space-16:64px;
  --text-xs:11px; --text-sm:13px; --text-base:14px; --text-md:16px;
  --text-lg:20px; --text-xl:24px; --text-2xl:28px; --text-3xl:32px;

  /* Role colors — corrected */
  --role-master:var(--gold);
  --role-developer:var(--dev);
  --role-org-admin:var(--info);
  --role-manager:#22C55E;
  --role-trainer:var(--accent);
}

/* Legacy tokens referenced elsewhere */
:root {
  --status-active:var(--accent);
  --status-pending:var(--amber);
  --status-inactive:#6b7280;
  --status-error:var(--danger);
  --transition-fast:var(--ease-fast);
  --transition-base:var(--ease-med);
  --transition-slow:300ms ease;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  --z-toast: 800;
  --text-4xl: 30px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-family: var(--ff-body);
  font-size: 14px;
  line-height: 1.65;
  color: var(--tx-2);
  background: var(--bg);
  min-height: 100vh;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); }

p {
    margin-bottom: var(--space-4);
}

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

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

small {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--accent-primary);
}

/* ============================================
   LAYOUT SYSTEM
   ============================================ */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-sm { max-width: 540px; }
.container-md { max-width: 720px; }
.container-lg { max-width: 960px; }
.container-xl { max-width: 1140px; }
.container-fluid { max-width: 100%; }

/* Grid System */
.grid {
    display: grid;
    gap: var(--space-6);
}

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

.grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

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

/* Flexbox Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ============================================
   NAVIGATION BAR
   ============================================ */
.navbar {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: var(--bg-1);
    border-bottom: 1px solid var(--border-default);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    height: 64px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
}

.navbar-logo {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 1px;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: border-color var(--ease-med), opacity var(--ease-med), color var(--ease-med), background-color var(--ease-med);
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-item.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-item-icon {
    font-size: var(--text-lg);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* Role Badge */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge.master { color: var(--role-master); border-color: var(--role-master); }
.role-badge.developer { color: var(--role-developer); border-color: var(--role-developer); }
.role-badge.org-admin { color: var(--role-org-admin); border-color: var(--role-org-admin); }
.role-badge.manager { color: var(--role-manager); border-color: var(--role-manager); }
.role-badge.trainer { color: var(--role-trainer); border-color: var(--role-trainer); }

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    background: var(--bg-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-6) var(--space-8);
    margin-bottom: var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
}

.page-header-content {
    flex: 1;
}

.page-header-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.page-header-subtitle {
    color: var(--text-muted);
    font-size: var(--text-md);
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Colored Headers for Different Roles */
.page-header.master {
    background: var(--bg-2);
    border-color: var(--gold-bdr);
}

.page-header.developer {
    background: var(--bg-2);
    border-color: var(--dev-bdr);
}

.page-header.org-admin {
    background: var(--bg-2);
    border-color: rgba(96,165,250,0.22);
}

.page-header.manager {
    background: var(--bg-2);
    border-color: rgba(34,197,94,0.22);
}

.page-header.trainer {
    background: var(--bg-2);
    border-color: var(--accent-bdr);
}

.page-header.admin {
    background: var(--bg-2);
    border-color: var(--danger-bdr);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--ease-med), opacity var(--ease-med), color var(--ease-med), background-color var(--ease-med);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-clickable {
    cursor: pointer;
}

.card-clickable:hover {
    border-color: var(--bdr-med);
}

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

.card-header-title {
    font-size: var(--text-lg);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

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

.card-footer {
    padding: var(--space-4) var(--space-6);
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* Card Variants */
.card-elevated {
    background: var(--bg-tertiary);
}

.card-flat {
    background: transparent;
    border: none;
}

.card-bordered {
    border-width: 2px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: border-color var(--ease-med), opacity var(--ease-med), color var(--ease-med), background-color var(--ease-med);
    -webkit-user-select: none;
    user-select: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn:focus {
    outline: none;
}

/* Button Sizes */
.btn-xs {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-md);
}

.btn-xl {
    padding: var(--space-5) var(--space-8);
    font-size: var(--text-lg);
}

.btn-block {
    width: 100%;
}

/* Button Variants */
.btn-default {
    background: var(--bg-tertiary);
    border-color: var(--border-default);
    color: var(--text-secondary);
}

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

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-dk);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-4);
}

.btn-success {
    background: var(--accent);
    border-color: var(--accent);
    color: #052e16;
}

.btn-success:hover:not(:disabled) {
    background: var(--accent-dk);
}

.btn-warning {
    background: var(--amber);
    border-color: var(--amber);
    color: #422006;
}

.btn-warning:hover:not(:disabled) {
    background: var(--amber);
    opacity: 0.9;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger);
    opacity: 0.9;
}

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

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

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

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

.btn-outline-primary:hover:not(:disabled) {
    background: rgba(74, 158, 255, 0.1);
    color: var(--accent-primary-hover);
}

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

.btn-outline-danger:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.1);
    color: var(--accent-danger-hover);
}

/* Icon Buttons */
.btn-icon {
    padding: var(--space-2);
    min-width: 36px;
    min-height: 36px;
}

.btn-icon.btn-sm {
    padding: var(--space-1);
    min-width: 28px;
    min-height: 28px;
}

.btn-icon.btn-lg {
    padding: var(--space-3);
    min-width: 44px;
    min-height: 44px;
}

/* Button Groups */
.btn-group {
    display: inline-flex;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.btn-group .btn:not(:last-child) {
    border-right: none;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--space-5);
}

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

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

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: border-color var(--ease-med), opacity var(--ease-med), color var(--ease-med), background-color var(--ease-med);
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

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

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-tertiary);
}

/* Input Sizes */
.form-input-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
}

.form-input-lg {
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-md);
}

/* Input States */
.form-input.is-error,
.form-select.is-error,
.form-textarea.is-error {
    border-color: var(--accent-danger);
}

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

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

/* Textarea */
.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Select */
.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='%23808080' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    padding-right: var(--space-10);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

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

.form-check-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

/* Input Group */
.input-group {
    display: flex;
}

.input-group .form-input {
    flex: 1;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group .btn {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-left: none;
}

.input-group-prepend,
.input-group-append {
    display: flex;
    align-items: center;
    padding: 0 var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.input-group-prepend {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: none;
}

.input-group-prepend + .form-input {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Search Input */
.search-input {
    padding-left: var(--space-10);
    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='%23808080' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: var(--space-3) center;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
}

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

.table thead {
    background: var(--bg-tertiary);
}

.table th {
    padding: var(--space-4) var(--space-5);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
}

.table td {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

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

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

/* Table Variants */
.table-striped tbody tr:nth-child(even) {
    background: var(--bg-tertiary);
}

.table-compact th,
.table-compact td {
    padding: var(--space-2) var(--space-3);
}

/* Table Actions Column */
.table-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    justify-content: flex-end;
}

/* ============================================
   ALERTS & MESSAGES
   ============================================ */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: var(--text-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.alert-icon {
    flex-shrink: 0;
    font-size: var(--text-lg);
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.alert-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--accent-success);
}

.alert-warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--accent-warning);
}

.alert-danger {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--accent-danger);
}

.alert-info {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--accent-info);
}

/* ============================================
   BADGES & TAGS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-radius: var(--radius-sm);
    border: 1px solid;
}

.badge-default {
    background: var(--bg-tertiary);
    border-color: var(--border-default);
    color: var(--text-secondary);
}

.badge-primary {
    background: rgba(74, 158, 255, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.badge-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--accent-success);
}

.badge-warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--accent-warning);
}

.badge-danger {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--accent-danger);
}

.badge-info {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--accent-info);
}

/* Role Badges */
.badge-master {
    background: rgba(255, 215, 0, 0.15);
    border-color: var(--role-master);
    color: var(--role-master);
}

.badge-developer {
    background: var(--dev-dim);
    border-color: var(--role-developer);
    color: var(--role-developer);
}

.badge-org-admin {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--role-org-admin);
    color: var(--role-org-admin);
}

.badge-manager {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--role-manager);
    color: var(--role-manager);
}

.badge-trainer {
    background: rgba(249, 115, 22, 0.15);
    border-color: var(--role-trainer);
    color: var(--role-trainer);
}

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    display: flex;
    flex-direction: column;
    transition: border-color var(--ease-med), opacity var(--ease-med), color var(--ease-med), background-color var(--ease-med);
}

.stat-card:hover {
    border-color: var(--border-hover);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.stat-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: var(--text-xl);
    background: var(--bg-tertiary);
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--space-2);
}

.stat-label {
    font-size: var(--text-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    font-weight: 600;
    margin-top: var(--space-2);
}

.stat-change.positive { color: var(--accent-success); }
.stat-change.negative { color: var(--accent-danger); }

/* ============================================
   TABS
   ============================================ */
.tabs {
    margin-bottom: var(--space-6);
}

.tabs-list {
    display: flex;
    gap: var(--space-1);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--space-2);
    overflow-x: auto;
}

.tab-button {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--ease-med), opacity var(--ease-med), color var(--ease-med), background-color var(--ease-med);
    white-space: nowrap;
}

.tab-button:hover {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.tab-button.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tab-content {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: var(--space-6);
}

.tab-content.active {
    display: block;
}

/* ============================================
   MODALS
   ============================================ */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: var(--z-modal-backdrop);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    animation: fadeIn var(--transition-fast);
}

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

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp var(--transition-base);
}

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

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }
.modal-full { max-width: calc(100vw - 48px); }

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

.modal-title {
    font-size: var(--text-xl);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: var(--text-xl);
    cursor: pointer;
    transition: border-color var(--ease-med), opacity var(--ease-med), color var(--ease-med), background-color var(--ease-med);
}

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

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* ============================================
   DROPDOWN MENUS
   ============================================ */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: var(--z-dropdown);
    min-width: 180px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    display: none;
    animation: dropdownFadeIn var(--transition-fast);
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu.right {
    left: auto;
    right: 0;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color var(--ease-med), opacity var(--ease-med), color var(--ease-med), background-color var(--ease-med);
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-item.danger {
    color: var(--accent-danger);
}

.dropdown-item.danger:hover {
    background: var(--danger-bg);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-default);
    margin: var(--space-2) 0;
}

.dropdown-header {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

/* ============================================
   LOADING STATES
   ============================================ */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-sm { width: 14px; height: 14px; border-width: 1.5px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
.spinner-xl { width: 48px; height: 48px; border-width: 4px; }

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

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 13, 13, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
    color: var(--text-muted);
}

.loading-text {
    margin-top: var(--space-4);
    font-size: var(--text-sm);
}

/* Skeleton Loading */
.skeleton {
    background: var(--bg-3);
    border-radius: var(--r-md);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    overflow: hidden; position: relative;
}
.skeleton::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(168,196,188,0.06) 50%, transparent 100%);
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skeleton-text { height: 14px; margin-bottom: var(--space-2); }
.skeleton-title { height: 24px; width: 60%; margin-bottom: var(--space-4); }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-button { height: 36px; width: 100px; }
.skeleton-card { height: 120px; }

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-6);
    text-align: center;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

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

.empty-state-description {
    color: var(--text-muted);
    max-width: 400px;
    margin-bottom: var(--space-6);
}

/* ============================================
   TOOLTIPS
   ============================================ */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: border-color var(--ease-med), opacity var(--ease-med), color var(--ease-med), background-color var(--ease-med);
    z-index: var(--z-tooltip);
    margin-bottom: var(--space-2);
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-sm { height: 4px; }
.progress-lg { height: 12px; }

/* ============================================
   AVATAR
   ============================================ */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: var(--text-sm); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--text-xl); }
.avatar-xl { width: 72px; height: 72px; font-size: var(--text-2xl); }

.avatar-group {
    display: flex;
}

.avatar-group .avatar {
    border: 2px solid var(--bg-primary);
    margin-left: -8px;
}

.avatar-group .avatar:first-child {
    margin-left: 0;
}

/* ============================================
   DIVIDERS
   ============================================ */
.divider {
    height: 1px;
    background: var(--border-default);
    margin: var(--space-6) 0;
}

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

.divider-text {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-default);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text Colors */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--accent-success) !important; }
.text-warning { color: var(--accent-warning) !important; }
.text-danger { color: var(--accent-danger) !important; }
.text-info { color: var(--accent-info) !important; }

/* Font Weight */
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Font Size */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

/* Margins */
.m-0 { margin: 0 !important; }
.m-1 { margin: var(--space-1) !important; }
.m-2 { margin: var(--space-2) !important; }
.m-3 { margin: var(--space-3) !important; }
.m-4 { margin: var(--space-4) !important; }
.m-5 { margin: var(--space-5) !important; }
.m-6 { margin: var(--space-6) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--space-1) !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-3 { margin-top: var(--space-3) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mt-5 { margin-top: var(--space-5) !important; }
.mt-6 { margin-top: var(--space-6) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--space-1) !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mb-3 { margin-bottom: var(--space-3) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mb-5 { margin-bottom: var(--space-5) !important; }
.mb-6 { margin-bottom: var(--space-6) !important; }

.ml-auto { margin-left: auto !important; }
.mr-auto { margin-right: auto !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-1 { padding: var(--space-1) !important; }
.p-2 { padding: var(--space-2) !important; }
.p-3 { padding: var(--space-3) !important; }
.p-4 { padding: var(--space-4) !important; }
.p-5 { padding: var(--space-5) !important; }
.p-6 { padding: var(--space-6) !important; }

/* Width & Height */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Border Radius */
.rounded-none { border-radius: 0; }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadows — removed decorative shadows */
.shadow-none { box-shadow: none; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* Visibility */
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-100 { opacity: 1; }

/* Truncate Text */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */
@media (max-width: 1200px) {
    .container { padding: 0 var(--space-5); }
    .page-header { padding: var(--space-5) var(--space-6); }
}

@media (max-width: 992px) {
    .hide-lg { display: none !important; }
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root {
        --text-4xl: 24px;
        --text-3xl: 20px;
        --text-2xl: 18px;
    }

    .hide-md { display: none !important; }
    .show-md { display: block !important; }

    .container { padding: 0 var(--space-4); }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-4) var(--space-5);
    }

    .page-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

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

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

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

    .modal {
        margin: var(--space-4);
        max-height: calc(100vh - 32px);
    }

    .navbar-container {
        padding: 0 var(--space-4);
        height: 56px;
    }

    .navbar-nav {
        display: none;
    }
}

@media (max-width: 480px) {
    .hide-sm { display: none !important; }
    .show-sm { display: block !important; }

    .container { padding: 0 var(--space-3); }

    .page-content { padding: var(--space-4); }

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

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        border-radius: var(--radius-md);
        border: 1px solid var(--border-default);
    }

    /* FIX: Modal responsive for small phones */
    .modal {
        margin: var(--space-2);
        max-width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--space-3);
    }
}

/* FIX: Form grid responsive */
@media (max-width: 768px) {
    .form-row,
    .form-grid,
    .form-2col {
        display: block !important;
    }

    .form-row > *,
    .form-grid > *,
    .form-2col > * {
        width: 100% !important;
        margin-bottom: var(--space-4);
    }
}

/* FIX: Body padding for sticky navbar */
body.has-navbar {
    padding-top: 70px;
}

@media (max-width: 768px) {
    body.has-navbar {
        padding-top: 60px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .no-print { display: none !important; }

    body {
        background: white;
        color: black;
    }

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

/* ============================================
   AUTH PAGE LAYOUTS
   ============================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background: var(--bg);
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.auth-header {
    background: var(--bg-3);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    border-bottom: 1px solid var(--border-default);
}

.auth-logo {
    font-size: var(--text-3xl);
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

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

.auth-subtitle {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

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

.auth-footer {
    padding: var(--space-5) var(--space-6);
    text-align: center;
    border-top: 1px solid var(--border-default);
    background: var(--bg-tertiary);
}

.auth-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.auth-link {
    color: var(--text-muted);
    font-size: var(--text-sm);
    transition: color var(--transition-fast);
}

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

/* ============================================
   ACTION TOOLBAR
   ============================================ */
.action-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
}

.action-toolbar-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.action-toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-default);
}

.action-toolbar-spacer {
    flex: 1;
}

/* ============================================
   LIST ITEMS
   ============================================ */
.list {
    display: flex;
    flex-direction: column;
}

.list-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: var(--bg-tertiary);
}

.list-item-clickable {
    cursor: pointer;
}

.list-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: var(--text-lg);
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.list-item-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.list-item-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ============================================
   QUICK ACTIONS PANEL
   ============================================ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: border-color var(--ease-med), opacity var(--ease-med), color var(--ease-med), background-color var(--ease-med);
    cursor: pointer;
}

.quick-action:hover {
    border-color: var(--border-hover);
}

.quick-action-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    font-size: var(--text-2xl);
}

.quick-action-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

/* Color variants for quick actions */
.quick-action.primary .quick-action-icon {
    background: rgba(74, 158, 255, 0.15);
}

.quick-action.success .quick-action-icon {
    background: var(--success-bg);
}

.quick-action.warning .quick-action-icon {
    background: var(--warning-bg);
}

.quick-action.danger .quick-action-icon {
    background: var(--danger-bg);
}

/* =========================================
   Phase 5.7: Mobile Touch Optimization
   ========================================= */

/* Touch-friendly minimum sizes (WCAG 2.5.5) */
@media (max-width: 768px) {
    /* Ensure minimum touch target size of 44x44px */
    .btn,
    button:not(.modal-close),
    input[type="button"],
    input[type="submit"],
    input[type="reset"],
    a.btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Larger checkbox/radio for touch */
    input[type="checkbox"],
    input[type="radio"] {
        width: 22px;
        height: 22px;
    }

    /* Larger form inputs on mobile */
    .form-input,
    .form-select,
    .form-textarea,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    select,
    textarea {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: var(--space-3) var(--space-4);
    }

    /* Touch-friendly links in lists */
    .nav-link,
    .menu-item,
    .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Improved spacing for tappable cards */
    .program-card,
    .client-card,
    .feature-card,
    .pricing-card {
        touch-action: manipulation;
    }

    /* Prevent double-tap zoom on interactive elements */
    button,
    a,
    input,
    select,
    textarea {
        touch-action: manipulation;
    }
}

/* Safe area insets for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .landing-nav,
    .navbar {
        padding-top: env(safe-area-inset-top);
    }

    .landing-footer,
    footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* PWA standalone mode optimizations */
@media (display-mode: standalone) {
    .landing-nav,
    .navbar {
        padding-top: calc(var(--space-2) + env(safe-area-inset-top, 0px));
    }

    /* Hide browser-specific elements in standalone */
    .browser-only {
        display: none !important;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* === MOBILE RESPONSIVE SYSTEM — MILO v2.0 === */
@media (max-width: 768px) {
  body { font-size: 14px; }
  .btn, button, [role="button"] { min-height: 44px; min-width: 44px; }
  .btn-sm { min-height: 36px; }
  .stats-grid { grid-template-columns: 1fr; gap: 12px; }
  .card-grid-2, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 540px; }
  .page-header { padding: 12px 16px; }
  .container { padding: 12px 16px; }
  .btn + .btn, button + button { margin-left: 8px; }
  .stat-value, [class*="text-3xl"] { font-size: 24px; }
  [class*="text-2xl"] { font-size: 20px; }
}

@media (max-width: 480px) {
  .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .page-header-actions { width: 100%; }
  .action-row { flex-direction: column; gap: 8px; }
  .action-row .btn { width: 100%; justify-content: center; }
  .container, .page-header, .card { max-width: 100%; overflow-x: hidden; }
}

@media (max-width: 768px) {
  .workout-tracker-page .sidebar { display: none; }
  .workout-tracker-page .main { padding: 8px; }
  .exercise-set-row { padding: 12px 8px; }
  .set-input { min-height: 44px; font-size: 16px; }
}

/* === COGNITIVE SCAFFOLDING STATES === */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center; min-height: 200px;
}
.empty-state-icon {
  width: 48px; height: 48px; background: var(--accent-dim); border-radius: var(--r-xl);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.empty-state-icon svg { width: 24px; height: 24px; color: var(--accent); }
.empty-state-title { font-size: 16px; font-weight: 500; color: var(--tx-1); margin-bottom: 8px; }
.empty-state-body { font-size: 13px; color: var(--tx-3); max-width: 320px; line-height: 1.6; margin-bottom: 20px; }

.skeleton {
  background: var(--bg-3);
  border-radius: var(--r-md);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  overflow: hidden; position: relative;
}
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(168,196,188,0.06) 50%, transparent 100%);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-text { height: 13px; margin-bottom: 8px; }
.skeleton-text:last-child { width: 60%; }
.skeleton-title { height: 20px; margin-bottom: 12px; }
.skeleton-card { height: 120px; border-radius: var(--r-xl); }
.skeleton-stat { height: 80px; border-radius: var(--r-xl); }
@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton, .skeleton::after { animation: none; }
}

.form-field { position: relative; margin-bottom: 16px; }
.form-field.error .form-input, .form-field.error input, .form-field.error select, .form-field.error textarea {
  border-color: var(--danger);
  background: var(--danger-dim);
}
.form-field.error .form-label { color: var(--danger); }
.form-error-msg {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--danger); margin-top: 4px;
}
.form-error-msg svg { width: 12px; height: 12px; flex-shrink: 0; }

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--bdr-dim);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--amber);
  display: inline-block; position: relative;
}
.pulse-dot::before {
  content: ''; position: absolute; inset: -4px;
  border-radius: 50%; background: var(--amber);
  opacity: 0; animation: pulse-ring 2s ease-out infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(0.5); opacity: 0.6; }
  100% { transform: scale(2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .pulse-dot::before { animation: none; } }
