:root {
    --bg0: #0f1c24;
    --bg1: #16303a;
    --bg2: #1d3f4a;
    --surface: rgba(247, 244, 238, 0.94);
    --surface-solid: #f7f4ee;
    --ink: #142028;
    --muted: #5c6b73;
    --accent: #1aa6a0;
    --accent-deep: #0e7c78;
    --copper: #c47a4a;
    --danger: #b42318;
    --ok: #1b7a4e;
    --line: rgba(20, 32, 40, 0.12);
    --shadow: 0 18px 50px rgba(8, 18, 24, 0.28);
    --radius: 18px;
    --font-display: "Syne", sans-serif;
    --font-body: "Figtree", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(26, 166, 160, 0.28), transparent 55%),
        radial-gradient(900px 500px at 100% 0%, rgba(196, 122, 74, 0.22), transparent 50%),
        linear-gradient(160deg, var(--bg0), var(--bg1) 45%, var(--bg2));
    background-attachment: fixed;
    line-height: 1.5;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.08;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    z-index: 0;
}

.container {
    width: min(1100px, 92%);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
    background: rgba(15, 28, 36, 0.72);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner,
.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-header { padding: 0.9rem 0; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: #f7f4ee;
}

.brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.65rem;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--copper));
    font-family: var(--font-display);
    font-weight: 800;
    color: #072022;
}

.brand-text {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.02em;
    font-size: 1.15rem;
}

.site-nav a,
.site-nav button,
.nav-email {
    color: rgba(247, 244, 238, 0.88);
    text-decoration: none;
    font-size: 0.95rem;
}

.site-nav a:hover { color: #fff; }
.nav-email { opacity: 0.7; font-size: 0.85rem; }

main { padding: 1.75rem 0 3rem; }

.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(247, 244, 238, 0.55);
    padding: 1.25rem 0 2rem;
    font-size: 0.9rem;
}

h1, h2, .app-title {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    margin: 0 0 0.5rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 0.35rem;
}

.subtitle, .lede, .muted { color: var(--muted); }

.auth-hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2rem;
    align-items: center;
    min-height: calc(100vh - 10rem);
}

.auth-hero-copy h1 {
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    color: #f7f4ee;
    max-width: 12ch;
    line-height: 1.05;
    animation: rise 0.7s ease both;
}

.auth-hero-copy .lede {
    color: rgba(247, 244, 238, 0.78);
    max-width: 36ch;
    font-size: 1.05rem;
    animation: rise 0.7s ease 0.08s both;
}

.auth-hero-copy .eyebrow {
    color: #9fe7e2;
    animation: rise 0.7s ease both;
}

.auth-card,
.auth-card-solo,
.app-shell,
.admin-shell .admin-card,
.error-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.auth-card-solo { max-width: 440px; margin: 2rem auto; }
.auth-card h2, .auth-card-solo h1 { margin-top: 0; }

label {
    display: block;
    margin: 0.85rem 0 0.35rem;
    font-weight: 600;
    font-size: 0.92rem;
}

input, select, textarea, button {
    font: inherit;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
}

textarea { resize: vertical; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: none;
    border-radius: 999px;
    padding: 0.7rem 1.15rem;
    cursor: pointer;
    font-weight: 650;
    text-decoration: none;
    transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    color: #fff;
}

.btn-secondary {
    background: #142028;
    color: #f7f4ee;
}

.btn-ghost {
    background: transparent;
    color: inherit;
    border: 1px solid currentColor;
}

.btn-block { width: 100%; margin-top: 1rem; }

.alert {
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    margin: 0.75rem 0;
}

.alert-error { background: #fde8e6; color: var(--danger); }
.alert-success { background: #e7f6ee; color: var(--ok); }
.hidden { display: none !important; }

.auth-switch { margin-top: 1rem; font-size: 0.92rem; }

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.app-title {
    color: #f7f4ee;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.app-topbar .eyebrow { color: #9fe7e2; }

.kontor-chip {
    background: rgba(247, 244, 238, 0.12);
    border: 1px solid rgba(247, 244, 238, 0.2);
    color: #f7f4ee;
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    animation: fadein 0.5s ease both;
}

.kontor-label { opacity: 0.7; font-size: 0.8rem; }
.kontor-quota { opacity: 0.65; font-size: 0.8rem; }

.app-shell {
    padding: 1.25rem;
    animation: rise 0.55s ease both;
}

.app-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.75rem;
}

.tab {
    background: transparent;
    border: none;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    color: var(--muted);
    cursor: pointer;
    font-weight: 600;
}

.tab.active {
    background: rgba(26, 166, 160, 0.15);
    color: var(--accent-deep);
}

.panel { display: none; }
.panel.active { display: block; animation: fadein 0.35s ease both; }

.wizard-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.step {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(20, 32, 40, 0.05);
}

.step.active {
    background: rgba(26, 166, 160, 0.16);
    color: var(--accent-deep);
}

.wizard-pane { display: none; }
.wizard-pane.active { display: block; }

.inline-upload {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 1fr auto;
    gap: 0.55rem;
    margin: 0.75rem 0 1rem;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.media-card {
    border: 2px solid transparent;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
    position: relative;
}

.media-card:hover { transform: translateY(-2px); }
.media-card.selected { border-color: var(--accent); }
.media-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: #e8eef0;
}
.media-card .cap {
    padding: 0.45rem 0.55rem 0.6rem;
    font-size: 0.82rem;
    font-weight: 600;
}
.media-card .del {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    background: rgba(20, 32, 40, 0.75);
    color: #fff;
    border: none;
    border-radius: 999px;
    width: 1.6rem;
    height: 1.6rem;
    cursor: pointer;
}

.wizard-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

.model-picker {
    display: grid;
    gap: 0.65rem;
    margin: 0.75rem 0 1rem;
}

.model-option {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
}

.model-option.selected {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.tier-badge {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.3rem 0.5rem;
    border-radius: 999px;
    background: rgba(26, 166, 160, 0.14);
    color: var(--accent-deep);
}

.tier-badge.high {
    background: rgba(196, 122, 74, 0.18);
    color: #8a4d28;
}

.model-cost { font-weight: 700; white-space: nowrap; }

.loading-state {
    text-align: center;
    padding: 2.5rem 1rem;
}

.pulse-ring {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    border: 3px solid rgba(26, 166, 160, 0.25);
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}

.result-image {
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    border-radius: 14px;
    background: #111;
}

.results-list { display: grid; gap: 0.75rem; }

.result-row {
    display: grid;
    grid-template-columns: 96px 1fr auto;
    gap: 0.85rem;
    align-items: center;
    background: #fff;
    border-radius: 14px;
    padding: 0.65rem;
    border: 1px solid var(--line);
}

.result-row img {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 10px;
}

.profile-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.45rem 1rem;
    background: #fff;
    border-radius: 14px;
    padding: 1rem;
    border: 1px solid var(--line);
}

.profile-list dt { color: var(--muted); font-weight: 600; }
.profile-list dd { margin: 0; }

.onboarding {
    background: linear-gradient(160deg, rgba(26, 166, 160, 0.12), rgba(196, 122, 74, 0.1));
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.onboarding-steps { padding-left: 1.2rem; }

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-card.wide { margin-top: 1rem; }
.admin-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--line);
}

.data-table th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }

.error-card {
    max-width: 520px;
    margin: 3rem auto;
    text-align: center;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

@keyframes fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 860px) {
    .auth-hero { grid-template-columns: 1fr; min-height: auto; }
    .auth-hero-copy h1 { max-width: none; }
    .inline-upload { grid-template-columns: 1fr; }
    .admin-grid { grid-template-columns: 1fr; }
    .result-row { grid-template-columns: 72px 1fr; }
    .result-row .actions { grid-column: 1 / -1; }
}
