:root {
    /* Colors */
    --color-primary: #003d5c;
    --color-primary-hover: #002d44;
    --color-primary-dark: #001d2e;
    --color-secondary: #00B29D;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-bg: #f5f5f5;
    --color-surface: #ffffff;
    --color-border: #e5e5e5;
    --color-error: #ef4444;
    --color-success: #10b981;
    --color-focus-ring: rgba(0, 61, 92, 0.25);
    
    /* Typography */
    --font-primary: 'PSL Kanda New', 'PSL Kanda Modern', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    
    /* Font Weights */
    --font-weight-light: 200;    /* W2 Pro */
    --font-weight-normal: 300;   /* W3 Pro */
    --font-weight-medium: 400;   /* W4 Pro */
    --font-weight-semibold: 500; /* W5 Pro */
    --font-weight-bold: 600;     /* W6 Pro Modern */
    
    /* Type Scale (Base 16px, ratio 1.125) */
    --text-xs: 1.375rem;      /* 22px */
    --text-sm: 1.5rem;        /* 24px */
    --text-base: 1.625rem;    /* 26px */
    --text-lg: 2rem;          /* 32px */
    --text-xl: 2.5rem;        /* 40px */
    --text-2xl: 3rem;         /* 48px */
    --text-3xl: 3.75rem;      /* 60px */
    --text-4xl: 4.5rem;       /* 72px */
    --text-5xl: 6rem;         /* 96px */
    
    /* Line Heights */
    --leading-none: 1.1;
    --leading-tight: 1.2;
    --leading-normal: 1.5;
    --leading-relaxed: 1.8;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
}

/* Reset & Base */
html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
}

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

body {
    font-family: var(--font-primary);
    line-height: var(--leading-relaxed);
    color: var(--color-text);
    background: var(--color-bg);
    margin: 0;
    padding: var(--space-8);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-wrap: break-word;
    word-break: break-word;
}

::selection {
    background: var(--color-primary);
    color: var(--color-surface);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-primary);
    font-weight: 700;
    line-height: var(--leading-tight);
    margin-top: 0;
    margin-bottom: var(--space-4);
}

h1 {
    font-size: var(--text-4xl);
    letter-spacing: -0.025em;
}

h2 {
    font-size: var(--text-3xl);
    letter-spacing: -0.025em;
}

h3 {
    font-size: var(--text-2xl);
}

h4 {
    font-size: var(--text-xl);
}

h5 {
    font-size: var(--text-lg);
}

h6 {
    font-size: var(--text-base);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.display-1 {
    font-size: var(--text-5xl);
    font-weight: 800;
    line-height: 1.1;
}

/* Text Elements */
p {
    margin-bottom: 0;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

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

:focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
    border-radius: 2px;
}

small {
    font-size: var(--text-xs);
    color: var(--color-text-light);
}

blockquote {
    border-left: 4px solid var(--color-secondary);
    padding-left: var(--space-4);
    margin: var(--space-6) 0;
    font-style: italic;
    color: var(--color-text);
    background: rgba(255,255,255,0.5);
    padding: var(--space-4);
    border-radius: 0 4px 4px 0;
}

code, pre, kbd {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

code {
    background-color: #e5e7eb;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    color: #c2410c;
}

pre {
    background: #111827;
    color: #f3f4f6;
    padding: var(--space-4);
    border-radius: 8px;
    overflow-x: auto;
}

/* Forms */
label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--color-text);
}

input[type="text"], input[type="email"], input[type="password"], textarea, select {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-family: inherit;
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    -webkit-appearance: none;
    appearance: none;
}

::placeholder {
    color: #9ca3af;
    opacity: 1;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-focus-ring);
}

input:disabled, textarea:disabled, button:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.7;
}

input:invalid, input.error {
    border-color: var(--color-error);
}

input:invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

button, .btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.625rem 1.25rem;
    font-family: inherit;
    font-weight: 600;
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: white;
    background-color: var(--color-primary);
    border: 1px solid transparent;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

button:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: var(--space-6);
}

th, td {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

th {
    background-color: #f9fafb;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

tbody tr:hover {
    background-color: #f0fdfa;
}

/* =========================================
   OVERRIDE FLOWBITE / TAILWIND UTILITIES
   ========================================= */
/* Force Tailwind text size classes to use our variables */
.text-xs   { font-size: var(--text-xs) !important; }
.text-sm   { font-size: var(--text-sm) !important; }
.text-base { font-size: var(--text-base) !important; }
.text-lg   { font-size: var(--text-lg) !important; }
.text-xl   { font-size: var(--text-xl) !important; }
.text-2xl  { font-size: var(--text-2xl) !important; }
.text-3xl  { font-size: var(--text-3xl) !important; }
.text-4xl  { font-size: var(--text-4xl) !important; }
.text-5xl  { font-size: var(--text-5xl) !important; }
