/* =====================================================================
   ACDA NATIONAL — global.css
   Design system foundation + shared header components. Used by every page.
   Version: 0.1.1 (V1 Foundation)
   ===================================================================== */


/* =====================================================================
   1. DESIGN TOKENS — LIGHT THEME (default)
   ===================================================================== */

:root {
    /* ---- Brand colors ---- */
    --acda-green-900: #073C26;
    --acda-green-800: #0B5D3B;   /* PRIMARY */
    --acda-green-700: #147A50;
    --acda-green-600: #1B9464;
    --acda-green-100: #E6F2EC;
    --acda-green-050: #F2F9F5;

    --acda-gold-900: #7A6420;
    --acda-gold-800: #A98A2C;
    --acda-gold-700: #C29E33;
    --acda-gold-600: #D4AF37;    /* ACCENT */
    --acda-gold-100: #FBF5DE;
    --acda-gold-050: #FDFAEE;

    --acda-earth-800: #4A3B2A;
    --acda-earth-500: #8A6E4B;
    --acda-earth-100: #F0E9DE;

    /* ---- Neutrals ---- */
    --neutral-000: #FFFFFF;
    --neutral-050: #FBFAF7;
    --neutral-100: #F7F5F0;      /* Warm ivory background */
    --neutral-200: #EFEDE6;
    --neutral-300: #DDD9CE;
    --neutral-400: #B5B0A2;
    --neutral-500: #8A8578;
    --neutral-600: #625E54;
    --neutral-700: #443F36;
    --neutral-800: #2B2721;
    --neutral-900: #1A1F1C;

    /* ---- Semantic ---- */
    --success-700: #1B5E20;
    --success-500: #2E7D32;
    --success-100: #E4F1E5;

    --warning-700: #B54900;
    --warning-500: #E65100;
    --warning-100: #FDECDD;

    --danger-700: #8E1414;
    --danger-500: #B71C1C;
    --danger-100: #F8E0E0;

    --info-700: #0F4C6E;
    --info-500: #1976D2;
    --info-100: #E1EFFA;

    /* ---- Theme-mapped semantic tokens (LIGHT) ---- */
    --color-bg:              var(--neutral-100);
    --color-bg-elevated:     var(--neutral-000);
    --color-bg-inset:        var(--neutral-050);
    --color-bg-overlay:      rgba(26, 31, 28, 0.55);

    --color-surface:         var(--neutral-000);
    --color-surface-hover:   var(--neutral-050);
    --color-surface-active:  var(--acda-green-050);

    --color-border:          var(--neutral-300);
    --color-border-strong:   var(--neutral-400);
    --color-border-focus:    var(--acda-green-800);

    --color-text:            var(--neutral-900);
    --color-text-muted:      var(--neutral-600);
    --color-text-subtle:     var(--neutral-500);
    --color-text-inverse:    var(--neutral-000);
    --color-text-link:       var(--acda-green-800);
    --color-text-link-hover: var(--acda-green-700);

    --color-primary:         var(--acda-green-800);
    --color-primary-hover:   var(--acda-green-700);
    --color-primary-active:  var(--acda-green-900);
    --color-primary-fg:      var(--neutral-000);

    --color-accent:          var(--acda-gold-600);
    --color-accent-hover:    var(--acda-gold-700);
    --color-accent-fg:       var(--neutral-900);

    --color-success:         var(--success-500);
    --color-success-bg:      var(--success-100);
    --color-warning:         var(--warning-500);
    --color-warning-bg:      var(--warning-100);
    --color-danger:          var(--danger-500);
    --color-danger-bg:       var(--danger-100);
    --color-info:            var(--info-500);
    --color-info-bg:         var(--info-100);

    /* ---- Typography ---- */
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, sans-serif;
    --font-serif: 'Source Serif Pro', Georgia, 'Times New Roman', serif;
    --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;

    --fs-xs:   clamp(0.72rem, 0.70rem + 0.10vw, 0.78rem);
    --fs-sm:   clamp(0.82rem, 0.80rem + 0.12vw, 0.90rem);
    --fs-md:   clamp(0.94rem, 0.90rem + 0.20vw, 1.02rem);
    --fs-lg:   clamp(1.08rem, 1.02rem + 0.28vw, 1.20rem);
    --fs-xl:   clamp(1.24rem, 1.14rem + 0.48vw, 1.44rem);
    --fs-2xl:  clamp(1.50rem, 1.36rem + 0.72vw, 1.82rem);
    --fs-3xl:  clamp(1.86rem, 1.62rem + 1.20vw, 2.42rem);
    --fs-4xl:  clamp(2.32rem, 1.94rem + 1.90vw, 3.20rem);
    --fs-5xl:  clamp(2.86rem, 2.24rem + 3.00vw, 4.20rem);

    --fw-regular: 400;
    --fw-medium:  500;
    --fw-semibold: 600;
    --fw-bold: 700;
    --fw-black: 800;

    --lh-tight:   1.15;
    --lh-snug:    1.30;
    --lh-normal:  1.55;
    --lh-relaxed: 1.72;

    --tracking-tight:   -0.01em;
    --tracking-normal:  0;
    --tracking-wide:    0.03em;
    --tracking-wider:   0.08em;

    /* ---- Spacing (4px base) ---- */
    --space-1:  0.25rem;   /*  4px */
    --space-2:  0.50rem;   /*  8px */
    --space-3:  0.75rem;   /* 12px */
    --space-4:  1.00rem;   /* 16px */
    --space-5:  1.25rem;   /* 20px */
    --space-6:  1.50rem;   /* 24px */
    --space-7:  1.75rem;   /* 28px */
    --space-8:  2.00rem;   /* 32px */
    --space-10: 2.50rem;   /* 40px */
    --space-12: 3.00rem;   /* 48px */
    --space-16: 4.00rem;   /* 64px */
    --space-20: 5.00rem;   /* 80px */
    --space-24: 6.00rem;   /* 96px */

    /* ---- Radius ---- */
    --radius-xs: 3px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 28px;
    --radius-pill: 999px;
    --radius-circle: 50%;

    /* ---- Shadows ---- */
    --shadow-xs: 0 1px 1px rgba(15, 23, 20, 0.04);
    --shadow-sm: 0 1px 2px rgba(15, 23, 20, 0.06), 0 1px 3px rgba(15, 23, 20, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 20, 0.08), 0 2px 4px -1px rgba(15, 23, 20, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 20, 0.10), 0 4px 6px -2px rgba(15, 23, 20, 0.06);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 20, 0.12), 0 10px 10px -5px rgba(15, 23, 20, 0.05);
    --shadow-focus: 0 0 0 3px rgba(11, 93, 59, 0.25);

    /* ---- Z-index ---- */
    --z-base:        0;
    --z-dropdown:    100;
    --z-sticky:      200;
    --z-header:      500;
    --z-overlay:     900;
    --z-modal:       1000;
    --z-toast:       1500;
    --z-tooltip:     2000;

    /* ---- Motion ---- */
    --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out:  cubic-bezier(0.65, 0, 0.35, 1);
    --dur-instant:  90ms;
    --dur-fast:     150ms;
    --dur-normal:   240ms;
    --dur-slow:     380ms;

    /* ---- Layout ---- */
    --container-sm:  640px;
    --container-md:  768px;
    --container-lg:  1024px;
    --container-xl:  1200px;
    --container-2xl: 1400px;

    --header-height: 68px;
    --sidebar-width: 260px;
}


/* =====================================================================
   2. DESIGN TOKENS — DARK THEME
   Activate by setting <html data-theme="dark">.
   ===================================================================== */

html[data-theme="dark"] {
    --color-bg:              #0E1411;
    --color-bg-elevated:     #161D19;
    --color-bg-inset:        #101613;
    --color-bg-overlay:      rgba(0, 0, 0, 0.65);

    --color-surface:         #1A2320;
    --color-surface-hover:   #212B27;
    --color-surface-active:  #263831;

    --color-border:          #2C3833;
    --color-border-strong:   #3E4C46;
    --color-border-focus:    var(--acda-gold-600);

    --color-text:            #E7EBE8;
    --color-text-muted:      #A8B0AA;
    --color-text-subtle:     #78827C;
    --color-text-inverse:    #0E1411;
    --color-text-link:       var(--acda-gold-600);
    --color-text-link-hover: var(--acda-gold-700);

    --color-primary:         var(--acda-green-700);
    --color-primary-hover:   var(--acda-green-600);
    --color-primary-active:  var(--acda-green-800);
    --color-primary-fg:      #FFFFFF;

    --color-accent:          var(--acda-gold-600);
    --color-accent-hover:    var(--acda-gold-700);
    --color-accent-fg:       #0E1411;

    --color-success-bg:      rgba(46, 125, 50, 0.18);
    --color-warning-bg:      rgba(230, 81, 0, 0.18);
    --color-danger-bg:       rgba(183, 28, 28, 0.20);
    --color-info-bg:         rgba(25, 118, 210, 0.18);

    --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.30);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40), 0 1px 3px rgba(0, 0, 0, 0.30);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -1px rgba(0, 0, 0, 0.30);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.55), 0 4px 6px -2px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.60), 0 10px 10px -5px rgba(0, 0, 0, 0.30);
    --shadow-focus: 0 0 0 3px rgba(212, 175, 55, 0.35);
}


/* =====================================================================
   3. RESET & NORMALIZE
   ===================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font-sans);
    font-size: var(--fs-md);
    line-height: var(--lh-normal);
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    transition: background-color var(--dur-normal) var(--ease-out),
                color var(--dur-normal) var(--ease-out);
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

input, button, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
}

a {
    color: var(--color-text-link);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
    color: var(--color-text-link-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
    box-shadow: var(--shadow-focus);
    border-radius: var(--radius-sm);
}

hr {
    border: 0;
    height: 1px;
    background: var(--color-border);
    margin: var(--space-6) 0;
}

::selection {
    background: var(--acda-green-800);
    color: var(--neutral-000);
}

html[data-theme="dark"] ::selection {
    background: var(--acda-gold-600);
    color: var(--neutral-900);
}


/* =====================================================================
   4. TYPOGRAPHY
   ===================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--color-text);
    margin-bottom: var(--space-3);
}

h1 { font-size: var(--fs-4xl); font-weight: var(--fw-black); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl);  font-weight: var(--fw-semibold); }
h5 { font-size: var(--fs-lg);  font-weight: var(--fw-semibold); }
h6 { font-size: var(--fs-md);  font-weight: var(--fw-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; }

p {
    margin-bottom: var(--space-4);
    max-width: 72ch;
}

small { font-size: var(--fs-sm); }
strong, b { font-weight: var(--fw-semibold); }

.text-xs   { font-size: var(--fs-xs); }
.text-sm   { font-size: var(--fs-sm); }
.text-md   { font-size: var(--fs-md); }
.text-lg   { font-size: var(--fs-lg); }
.text-xl   { font-size: var(--fs-xl); }
.text-2xl  { font-size: var(--fs-2xl); }

.text-muted    { color: var(--color-text-muted); }
.text-subtle   { color: var(--color-text-subtle); }
.text-primary  { color: var(--color-primary); }
.text-accent   { color: var(--color-accent); }
.text-success  { color: var(--color-success); }
.text-warning  { color: var(--color-warning); }
.text-danger   { color: var(--color-danger); }

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

.fw-medium   { font-weight: var(--fw-medium); }
.fw-semibold { font-weight: var(--fw-semibold); }
.fw-bold     { font-weight: var(--fw-bold); }

.uppercase   { text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.mono        { font-family: var(--font-mono); }
.truncate    {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* =====================================================================
   5. LAYOUT UTILITIES
   ===================================================================== */

.container {
    width: 100%;
    max-width: var(--container-xl);
    margin-inline: auto;
    padding-inline: var(--space-5);
}

.container-sm  { max-width: var(--container-sm); }
.container-md  { max-width: var(--container-md); }
.container-lg  { max-width: var(--container-lg); }
.container-2xl { max-width: var(--container-2xl); }

@media (min-width: 768px) {
    .container { padding-inline: var(--space-8); }
}

.stack   { display: flex; flex-direction: column; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; }
.row     { display: flex; align-items: center; }

.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); }

.items-start   { align-items: flex-start; }
.items-center  { align-items: center; }
.items-end     { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center{ justify-content: center; }
.justify-end   { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1 1 auto; }
.flex-auto     { flex: 0 0 auto; }
.flex-column   { flex-direction: column; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: 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-auto   { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

@media (max-width: 768px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 { grid-template-columns: 1fr; }
}

.m-0 { margin: 0; }
.mt-1 { margin-top: var(--space-1); }  .mb-1 { margin-bottom: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }  .mb-2 { margin-bottom: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }  .mb-3 { margin-bottom: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }  .mb-4 { margin-bottom: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }  .mb-5 { margin-bottom: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }  .mb-6 { margin-bottom: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }  .mb-8 { margin-bottom: var(--space-8); }

.mx-auto { margin-inline: auto; }

.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.hidden { display: none !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;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: var(--space-4);
    padding: var(--space-2) var(--space-4);
    background: var(--color-primary);
    color: var(--color-primary-fg);
    border-radius: var(--radius-sm);
    z-index: var(--z-tooltip);
    font-weight: var(--fw-semibold);
    transition: top var(--dur-normal) var(--ease-out);
}
.skip-link:focus { top: var(--space-4); text-decoration: none; }


/* =====================================================================
   6. BUTTONS
   ===================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.7rem 1.2rem;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    line-height: 1;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    min-height: 44px;
    transition: background-color var(--dur-fast) var(--ease-out),
                border-color   var(--dur-fast) var(--ease-out),
                color          var(--dur-fast) var(--ease-out),
                transform      var(--dur-fast) var(--ease-out),
                box-shadow     var(--dur-fast) var(--ease-out);
}

.btn:hover:not(:disabled) { text-decoration: none; transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-primary-fg);
    border-color: var(--color-primary);
}
.btn-primary:hover:not(:disabled)  { background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: var(--color-primary-fg); }
.btn-primary:active:not(:disabled) { background: var(--color-primary-active); }

.btn-accent {
    background: var(--color-accent);
    color: var(--color-accent-fg);
    border-color: var(--color-accent);
}
.btn-accent:hover:not(:disabled) { background: var(--color-accent-hover); border-color: var(--color-accent-hover); color: var(--color-accent-fg); }

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-outline:hover:not(:disabled) {
    background: var(--color-primary);
    color: var(--color-primary-fg);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text);
    border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--color-surface-hover); }

.btn-danger {
    background: var(--color-danger);
    color: var(--neutral-000);
    border-color: var(--color-danger);
}
.btn-danger:hover:not(:disabled) { background: var(--danger-700); border-color: var(--danger-700); color: var(--neutral-000); }

.btn-success {
    background: var(--color-success);
    color: var(--neutral-000);
    border-color: var(--color-success);
}
.btn-success:hover:not(:disabled) { background: var(--success-700); border-color: var(--success-700); color: var(--neutral-000); }

.btn-sm    { padding: 0.45rem 0.85rem; font-size: var(--fs-sm); min-height: 36px; }
.btn-lg    { padding: 0.95rem 1.6rem; font-size: var(--fs-lg); min-height: 52px; }
.btn-block { display: flex; width: 100%; }
.btn-icon  { padding: 0.55rem; min-height: 44px; min-width: 44px; }


/* =====================================================================
   7. FORMS
   ===================================================================== */

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.form-label {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--color-text);
}
.form-label .req { color: var(--color-danger); margin-left: 2px; }

.form-hint {
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
}

.form-error {
    font-size: var(--fs-xs);
    color: var(--color-danger);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 0.95rem;
    background: var(--color-bg-elevated);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--fs-md);
    line-height: var(--lh-snug);
    transition: border-color var(--dur-fast) var(--ease-out),
                box-shadow var(--dur-fast) var(--ease-out),
                background var(--dur-fast) var(--ease-out);
    min-height: 44px;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--color-border-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: var(--shadow-focus);
}

.form-input[aria-invalid="true"],
.form-select[aria-invalid="true"],
.form-textarea[aria-invalid="true"] {
    border-color: var(--color-danger);
}

.form-textarea { min-height: 100px; resize: vertical; }

.form-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238A8578' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.4rem;
}

.form-checkbox,
.form-radio {
    width: 18px; height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.form-check-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--fs-md);
}


/* =====================================================================
   8. CARDS
   ===================================================================== */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--dur-normal) var(--ease-out),
                transform var(--dur-normal) var(--ease-out),
                border-color var(--dur-normal) var(--ease-out);
}

.card-hover:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-strong);
}

.card-elevated { box-shadow: var(--shadow-md); }
.card-flat     { box-shadow: none; }
.card-inset    { background: var(--color-bg-inset); box-shadow: none; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}
.card-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin: 0; }
.card-body  { display: flex; flex-direction: column; gap: var(--space-3); }
.card-footer {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    flex-wrap: wrap;
}


/* =====================================================================
   9. BADGES & STATUS PILLS
   ===================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.28rem 0.7rem;
    border-radius: var(--radius-pill);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-neutral { background: var(--color-bg-inset);    color: var(--color-text-muted); border-color: var(--color-border); }
.badge-success { background: var(--color-success-bg);  color: var(--success-700); }
.badge-warning { background: var(--color-warning-bg);  color: var(--warning-700); }
.badge-danger  { background: var(--color-danger-bg);   color: var(--danger-700); }
.badge-info    { background: var(--color-info-bg);     color: var(--info-700); }
.badge-primary { background: var(--acda-green-100);    color: var(--acda-green-900); }
.badge-accent  { background: var(--acda-gold-100);     color: var(--acda-gold-900); }

html[data-theme="dark"] .badge-success { color: #7BD088; }
html[data-theme="dark"] .badge-warning { color: #FFA76B; }
html[data-theme="dark"] .badge-danger  { color: #FF7A7A; }
html[data-theme="dark"] .badge-info    { color: #7CB8F2; }
html[data-theme="dark"] .badge-primary { color: #7DDBA8; background: rgba(20, 122, 80, 0.20); }
html[data-theme="dark"] .badge-accent  { color: var(--acda-gold-600); background: rgba(212, 175, 55, 0.15); }

.badge-dot::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: var(--radius-circle);
    background: currentColor;
    display: inline-block;
}


/* =====================================================================
   10. ALERTS
   ===================================================================== */

.alert {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border-left: 4px solid;
    background: var(--color-bg-inset);
    color: var(--color-text);
    font-size: var(--fs-md);
}

.alert-title { font-weight: var(--fw-semibold); margin-bottom: var(--space-1); }

.alert-success { background: var(--color-success-bg); border-left-color: var(--color-success); }
.alert-warning { background: var(--color-warning-bg); border-left-color: var(--color-warning); }
.alert-danger  { background: var(--color-danger-bg);  border-left-color: var(--color-danger); }
.alert-info    { background: var(--color-info-bg);    border-left-color: var(--color-info); }


/* =====================================================================
   11. TABLES
   ===================================================================== */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
}

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    background: var(--color-bg-inset);
    font-weight: var(--fw-semibold);
    font-size: var(--fs-xs);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-text-muted);
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td      { background: var(--color-surface-hover); }


/* =====================================================================
   12. MODALS
   ===================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    z-index: var(--z-modal);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-normal) var(--ease-out);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - var(--space-8));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(8px) scale(0.98);
    transition: transform var(--dur-normal) var(--ease-out);
}

.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header,
.modal-footer {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
}
.modal-footer {
    border-bottom: none;
    border-top: 1px solid var(--color-border);
    justify-content: flex-end;
}

.modal-body {
    padding: var(--space-5);
    overflow-y: auto;
}

.modal-close {
    width: 40px; height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.modal-close:hover { background: var(--color-surface-hover); color: var(--color-text); }


/* =====================================================================
   13. TOASTS
   ===================================================================== */

.toast-container {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-width: 380px;
    width: calc(100% - var(--space-10));
}

.toast {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: var(--fs-sm);
    animation: toast-in var(--dur-normal) var(--ease-out);
}

.toast-success { border-left-color: var(--color-success); }
.toast-warning { border-left-color: var(--color-warning); }
.toast-danger  { border-left-color: var(--color-danger); }
.toast-info    { border-left-color: var(--color-info); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* =====================================================================
   14. LOADING STATES
   ===================================================================== */

.spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2.5px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-circle);
    animation: spin 0.75s linear infinite;
}

.spinner-lg { width: 36px; height: 36px; border-width: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
    background: linear-gradient(90deg,
        var(--color-bg-inset) 0%,
        var(--color-surface-hover) 50%,
        var(--color-bg-inset) 100%);
    background-size: 200% 100%;
    animation: skeleton-shine 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
    display: block;
}

@keyframes skeleton-shine {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* =====================================================================
   15. EMPTY STATES
   ===================================================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--color-text-muted);
    gap: var(--space-3);
}

.empty-state-icon {
    width: 64px; height: 64px;
    border-radius: var(--radius-circle);
    background: var(--color-bg-inset);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-subtle);
    margin-bottom: var(--space-2);
}

.empty-state-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    color: var(--color-text);
    margin: 0;
}


/* =====================================================================
   16. APP LAYOUT SHELL (dashboards)
   ===================================================================== */

.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    background: var(--color-bg);
}

.app-header  { grid-area: header;  position: sticky; top: 0; z-index: var(--z-header); }
.app-sidebar { grid-area: sidebar; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.app-main    { grid-area: main;    padding: var(--space-6); max-width: 100%; overflow-x: hidden; }

@media (max-width: 1024px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }
    .app-sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        width: min(280px, 82vw);
        transform: translateX(-100%);
        transition: transform var(--dur-normal) var(--ease-out);
        z-index: var(--z-overlay);
        box-shadow: var(--shadow-xl);
    }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { padding: var(--space-4); }
}


/* =====================================================================
   17. THEME TOGGLE BUTTON
   ===================================================================== */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    color: var(--color-text);
    background: transparent;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.theme-toggle:hover { background: var(--color-surface-hover); }

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { width: 20px; height: 20px; }

html[data-theme="dark"]  .theme-toggle .icon-sun  { display: block; }
html[data-theme="dark"]  .theme-toggle .icon-moon { display: none; }
html:not([data-theme="dark"]) .theme-toggle .icon-sun  { display: none; }
html:not([data-theme="dark"]) .theme-toggle .icon-moon { display: block; }


/* =====================================================================
   18. SHARED SITE HEADER & NAVIGATION (Used across all public pages)
   ===================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: color-mix(in srgb, var(--color-bg) 88%, transparent);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
            backdrop-filter: saturate(140%) blur(14px);
    border-bottom: 1px solid transparent;
    transition: background var(--dur-normal) var(--ease-out),
                border-color var(--dur-normal) var(--ease-out),
                box-shadow var(--dur-normal) var(--ease-out);
}

.site-header.scrolled {
    background: color-mix(in srgb, var(--color-bg) 96%, transparent);
    border-bottom-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: var(--header-height);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--color-text);
    font-weight: var(--fw-bold);
}
.brand:hover { text-decoration: none; color: var(--color-text); }

.brand-mark {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    flex: 0 0 auto;
}

.brand-mark svg {
    width: 100%;
    height: 100%;
    display: block;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: var(--fs-md); font-weight: var(--fw-bold); letter-spacing: -0.01em; }
.brand-sub  { font-size: var(--fs-xs); color: var(--color-text-muted); letter-spacing: var(--tracking-wide); }

.primary-nav .nav-list {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    list-style: none;
    margin: 0; padding: 0;
}

.primary-nav a {
    color: var(--color-text-muted);
    font-weight: var(--fw-medium);
    font-size: var(--fs-md);
    padding: var(--space-2) 0;
    position: relative;
    transition: color var(--dur-fast) var(--ease-out);
}

.primary-nav a:hover {
    color: var(--color-text);
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 0 0 auto;
}

.hide-mobile { display: inline-flex; }

@media (max-width: 900px) {
    .hide-mobile { display: none !important; }
}


/* =====================================================================
   19. PRINT STYLES
   ===================================================================== */

@media print {
    :root {
        --color-bg:              #FFFFFF;
        --color-surface:         #FFFFFF;
        --color-text:            #000000;
        --color-border:          #B0B0B0;
    }
    .app-sidebar,
    .app-header,
    .site-header,
    .no-print,
    .theme-toggle,
    .btn { display: none !important; }

    .app-shell {
        display: block;
    }
    .app-main { padding: 0; }
    a { color: inherit; text-decoration: none; }
}