@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    color-scheme: light;
    
    /* Modern HSL Palette */
    --brand-h: 215;
    --brand-s: 85%;
    --brand-l: 45%;
    
    --primary: hsl(var(--brand-h), var(--brand-s), var(--brand-l));
    --primary-light: hsl(var(--brand-h), var(--brand-s), 95%);
    --primary-dark: hsl(var(--brand-h), var(--brand-s), 35%);
    
    --bg-mesh: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    --surface: rgba(255, 255, 255, 0.8);
    --surface-border: rgba(255, 255, 255, 0.4);
    
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    
    --ok: #10b981;
    --warn: #f59e0b;
    --bad: #ef4444;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: 'Outfit', sans-serif;
    color: var(--ink);
    background: var(--bg-mesh);
    line-height: 1.6;
}

/* Background Decoration */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 600px;
    background: radial-gradient(circle at 50% -10%, hsla(var(--brand-h), var(--brand-s), var(--brand-l), 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

input,
select,
button {
    font: inherit;
}

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

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

/* Public Layout */
.public-shell {
    width: min(720px, calc(100% - 32px));
    min-height: calc(100vh - 80px);
    margin: 0 auto;
    padding: 60px 0 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.hero-panel {
    text-align: center;
    animation: fadeInDown 0.6s ease-out;
}

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

.brand-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.brand-mark {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 32px;
    box-shadow: 0 8px 16px hsla(var(--brand-h), var(--brand-s), var(--brand-l), 0.3);
}

.eyebrow {
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

h1 {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 8px 0 16px;
    line-height: 1.1;
    color: var(--ink);
}

.lead {
    font-size: 18px;
    color: var(--muted);
    max-width: 580px;
    margin: 0 auto;
}

/* Cards & Glassmorphism */
.consent-card,
.login-card,
.admin-panel {
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 32px;
    animation: fadeInUp 0.8s ease-out;
}

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

.form-heading h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
}

.form-heading p {
    color: var(--muted);
    margin: 0 0 24px;
}

/* Form Elements */
.stack-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stack-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.stack-form input,
.filter-row input,
.filter-row select {
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 15px;
    transition: var(--transition);
    outline: none;
}

.stack-form input:focus,
.filter-row input:focus,
.filter-row select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px hsla(var(--brand-h), var(--brand-s), var(--brand-l), 0.1);
}

.iys-frame {
    margin: 24px 0;
    border-radius: var(--radius);
    border: 1.5px solid var(--line);
    overflow: hidden;
    background: #fff;
}

.notice-box {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    padding: 16px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--primary-dark);
}

/* Buttons */
.primary-button,
.secondary-button,
.ghost-button {
    height: 48px;
    padding: 0 24px;
    border-radius: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.primary-button {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px hsla(var(--brand-h), var(--brand-s), var(--brand-l), 0.2);
}

.primary-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px hsla(var(--brand-h), var(--brand-s), var(--brand-l), 0.3);
}

.secondary-button {
    background: #fff;
    color: var(--ink);
    border: 1.5px solid var(--line);
}

.secondary-button:hover {
    background: var(--line);
}

.ghost-button {
    background: transparent;
    color: var(--muted);
}

.ghost-button:hover {
    background: rgba(0,0,0,0.05);
    color: var(--ink);
}

/* Status Boxes */
.status-box {
    margin-top: 24px;
    padding: 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-box.ready { background: #f0f9ff; color: #0369a1; }
.status-box.success { background: #ecfdf5; color: #065f46; border: 1px solid #10b981; }
.status-box.error { background: #fef2f2; color: #991b1b; border: 1px solid #ef4444; }

/* Admin Dashboard */
.admin-body {
    background: #f8fafc;
}

.admin-header {
    padding: 32px 0;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: calc(100% - 40px);
}

.admin-actions,
.public-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-header h1 {
    font-size: 28px;
    margin: 0;
}

.admin-shell {
    max-width: 1200px;
    margin: 0 auto;
    width: calc(100% - 40px);
    padding-bottom: 60px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-tile {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-tile span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-tile strong {
    display: block;
    font-size: 36px;
    margin-top: 8px;
    color: var(--ink);
}

.stat-tile.ok strong { color: var(--ok); }
.stat-tile.wait strong { color: var(--warn); }
.stat-tile.bad strong { color: var(--bad); }

.filter-row {
    padding: 24px;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-row label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

.consent-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.consent-table th {
    background: #f8fafc;
    padding: 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 2px solid var(--line);
}

.consent-table td {
    padding: 16px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.consent-table tr:hover td {
    background: #f1f5f9;
}

.status-pill {
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
}

.status-pill.approved { background: #d1fae5; color: #065f46; }
.status-pill.error { background: #fee2e2; color: #991b1b; }
.status-pill.otp_sent { background: #fef3c7; color: #92400e; }
.status-pill.collected { background: #ede9fe; color: #5b21b6; }
.status-pill.started { background: #e0f2fe; color: #075985; }

/* Mobile Optimizations */
@media (max-width: 768px) {
    h1 { font-size: 32px; }
    .public-shell { padding: 40px 0; }
    .consent-card { padding: 24px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .admin-header { flex-direction: column; align-items: flex-start; gap: 16px; }
    .admin-actions { justify-content: flex-start; }
}

