:root {
    color-scheme: light;
    --bg: #eef3f8;
    --bg-rgb: 238, 243, 248;
    --panel: #ffffff;
    --panel-soft: #f8fbff;
    --ink: #111827;
    --muted: #64748b;
    --line: #dbe5f0;
    --nav: #08111f;
    --nav-soft: rgba(255,255,255,.08);
    --primary: #0ea5e9;
    --primary-2: #14b8a6;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 18px 48px rgba(15,23,42,.08);
    --shadow-strong: 0 28px 80px rgba(15,23,42,.14);
    --input-bg: #ffffff;
    --table-stripe: #f7fbff;
    --hero-shade: linear-gradient(90deg, rgba(9,14,25,.92) 0%, rgba(9,14,25,.72) 42%, rgba(9,14,25,.16) 100%);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #07101d;
    --bg-rgb: 7, 16, 29;
    --panel: #101a2b;
    --panel-soft: #0d1728;
    --ink: #f8fafc;
    --muted: #9aa8bd;
    --line: rgba(148,163,184,.22);
    --nav: #050b14;
    --nav-soft: rgba(255,255,255,.08);
    --primary: #38bdf8;
    --primary-2: #2dd4bf;
    --success: #52d39b;
    --warning: #f8d66d;
    --danger: #fb7185;
    --shadow: 0 18px 54px rgba(0,0,0,.28);
    --shadow-strong: 0 30px 90px rgba(0,0,0,.38);
    --input-bg: #0b1424;
    --table-stripe: rgba(255,255,255,.025);
    --hero-shade: linear-gradient(90deg, rgba(3,6,13,.94) 0%, rgba(7,12,24,.8) 48%, rgba(7,12,24,.32) 100%);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
        radial-gradient(circle at 12% 4%, rgba(45,212,191,.14), transparent 28%),
        radial-gradient(circle at 86% 0%, rgba(56,189,248,.12), transparent 30%),
        linear-gradient(135deg, var(--bg), var(--bg));
    color: var(--ink);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

a { color: var(--primary); }
.app { display: grid; grid-template-columns: 286px 1fr; min-height: 100vh; }
aside {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
    color: #fff;
    padding: 22px 16px;
    background:
        linear-gradient(180deg, rgba(45,212,191,.12), transparent 28%),
        var(--nav);
    border-right: 1px solid rgba(148,163,184,.14);
}

main { min-width: 0; padding: 28px; }
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    color: #fff;
    font-size: 21px;
    font-weight: 900;
}
.brand::before {
    content: "CF";
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #03111c;
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    border-radius: 8px;
    font-size: 13px;
}

.nav-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    color: #c4ccdc;
    border-radius: 8px;
    margin-bottom: 5px;
    font-weight: 700;
}
.nav-link:hover { background: var(--nav-soft); color: #fff; }
.nav-link.text-danger { color: #fda4af !important; }

.panel,
.surface-card,
.metric-card,
.login-card,
.signup-card,
.contract-card {
    background: rgba(var(--bg-rgb), .1);
    background-color: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel:hover,
.surface-card:hover,
.metric-card:hover {
    border-color: rgba(45,212,191,.34);
}

.page-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    padding: 24px;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(45,212,191,.13), rgba(56,189,248,.07)),
        var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.page-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    margin-bottom: 12px;
    color: var(--primary-2);
    background: rgba(45,212,191,.1);
    border: 1px solid rgba(45,212,191,.22);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.page-hero h1 { font-size: clamp(28px, 4vw, 48px); font-weight: 900; line-height: 1; margin: 0 0 8px; }
.page-hero p { color: var(--muted); margin: 0; max-width: 720px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card { padding: 18px; min-height: 112px; }
.metric-card i { color: var(--primary-2); font-size: 24px; }
.metric-card strong { display: block; margin-top: 12px; font-size: 26px; line-height: 1; }
.metric-card span { color: var(--muted); font-size: 13px; font-weight: 700; }

.unit-card { padding: 18px; height: 100%; display: flex; flex-direction: column; gap: 14px; }
.unit-card__top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.unit-card h2 { font-size: 18px; font-weight: 900; margin: 0; }
.unit-card p { color: var(--muted); margin: 0; }
.unit-card__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.unit-sound-form {
    padding: 12px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}
.unit-sound-form .form-label {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.unit-sound-form .input-group .btn {
    min-width: 42px;
}
.unit-theme-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: background-color .2s ease, color .2s ease;
}
.unit-theme-grid label {
    display: grid;
    gap: 5px;
    min-width: 0;
    margin: 0;
}
.unit-theme-grid span {
    overflow: hidden;
    color: inherit;
    font-size: 11px;
    font-weight: 900;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}
.unit-theme-grid input[type="color"] {
    width: 100%;
    height: 34px;
    padding: 3px;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 8px;
}
.unit-theme-preview {
    display: grid;
    grid-column: 1 / -1;
    min-height: 58px;
    align-content: center;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
}
.unit-theme-preview strong {
    font-size: 22px;
    line-height: 1;
}
.unit-theme-preview small {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 900;
    opacity: .78;
    text-transform: uppercase;
}

.media-thumb {
    width: 64px;
    height: 44px;
    object-fit: cover;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}
.status-dot--pending { color: #ffe8a3; background: rgba(245,158,11,.14); border: 1px solid rgba(245,158,11,.24); }
.status-dot--approved { color: #bff8d8; background: rgba(22,163,74,.14); border: 1px solid rgba(22,163,74,.24); }
.status-dot--rejected { color: #fecdd3; background: rgba(239,68,68,.14); border: 1px solid rgba(239,68,68,.24); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 94vw); padding: 28px; box-shadow: var(--shadow-strong); }

.form-control, .form-select {
    min-height: 44px;
    background-color: var(--input-bg);
    color: var(--ink);
    border-color: var(--line);
    border-radius: 8px;
}
.form-control:focus, .form-select:focus {
    background-color: var(--input-bg);
    color: var(--ink);
    border-color: var(--primary-2);
    box-shadow: 0 0 0 .2rem rgba(45,212,191,.14);
}
.form-control::placeholder { color: var(--muted); }

.btn { border-radius: 8px; font-weight: 800; }
.btn-primary {
    color: #03111c;
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    border: 0;
}
.btn-outline-secondary { color: var(--ink); border-color: var(--line); }
.btn-outline-secondary:hover { color: #03111c; background: var(--primary-2); border-color: var(--primary-2); }

.table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-border-color: var(--line); }
.table-striped { --bs-table-striped-bg: var(--table-stripe); --bs-table-striped-color: var(--ink); }
.text-muted { color: var(--muted) !important; }
.modal-content, .dropdown-menu { background: var(--panel); color: var(--ink); border-color: var(--line); border-radius: 8px; }
.modal-header, .modal-footer { border-color: var(--line); }
.btn-close { filter: invert(.7); }
.btn-light { background: rgba(255,255,255,.92); border-color: rgba(255,255,255,.72); color: #101624; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.22);
    background: rgba(255,255,255,.1);
    color: #fff;
}
.theme-toggle:hover { background: rgba(255,255,255,.18); color: #fff; }
.theme-toggle i { pointer-events: none; }
.sidebar-theme-toggle {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    color: #c4ccdc;
    border-color: rgba(255,255,255,.12);
    background: transparent;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px clamp(18px, 4vw, 56px);
    color: #fff;
}
.site-brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 20px; }
.site-nav { display: flex; gap: 18px; align-items: center; }
.site-nav a { color: rgba(255,255,255,.88); text-decoration: none; font-weight: 600; font-size: 14px; }
.site-nav a:hover { color: #fff; }
.hero-site {
    min-height: 92vh;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 110px clamp(22px, 6vw, 88px) 54px;
    color: #fff;
}
.hero-site__image, .hero-site__shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-site__image { object-fit: cover; }
.hero-site__shade { background: var(--hero-shade); }
.hero-site__content { position: relative; max-width: 660px; z-index: 2; }
.eyebrow { display: inline-block; color: #75d1ff; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 12px; }
.hero-site h1 { font-size: clamp(44px, 8vw, 86px); font-weight: 900; line-height: .96; margin-bottom: 22px; }
.hero-site p { font-size: clamp(18px, 2vw, 23px); color: rgba(255,255,255,.84); max-width: 610px; margin-bottom: 28px; }
.site-main { background: var(--bg); }
.section-band { max-width: 1180px; margin: 0 auto; padding: 64px 22px; }
.section-title { max-width: 720px; margin-bottom: 28px; }
.section-title h2, .section-band h2 { font-size: clamp(28px, 4vw, 44px); font-weight: 850; margin-bottom: 10px; }
.section-title p, .section-band p { color: var(--muted); font-size: 18px; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.tool-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 24px; min-height: 250px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.tool-card i { font-size: 30px; color: var(--primary); margin-bottom: 18px; }
.tool-card h3 { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.tool-card p { color: var(--muted); flex: 1; }
.tool-card a, .tool-card span { font-weight: 800; color: var(--primary); text-decoration: none; }
.tool-card--accent { border-color: rgba(22,132,91,.32); }
.clients-section { padding-top: 30px; }
.client-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.client-card { display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.client-card img { width: 56px; height: 56px; object-fit: contain; }
.client-card span { color: var(--ink); font-weight: 800; font-size: 11px; line-height: 1.2; text-align: center; }
.section-band--split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; border-top: 1px solid var(--line); }
.site-footer { padding: 28px clamp(22px, 6vw, 88px); background: #101624; color: #fff; display: flex; justify-content: space-between; gap: 16px; }
.signup-page { padding-top: 82px; }
.signup-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); gap: 18px; align-items: start; }
.contract-check { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-weight: 700; }
.contract-check input { margin-top: 4px; }

@media(max-width: 1080px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media(max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    aside { position: static; height: auto; }
    main { padding: 18px; }
    .page-hero { align-items: stretch; flex-direction: column; }
    .tool-grid, .client-grid, .section-band--split, .signup-grid { grid-template-columns: 1fr; }
    .site-header { position: absolute; }
    .site-nav { gap: 12px; }
}

@media(max-width: 620px) {
    .metric-grid { grid-template-columns: 1fr; }
    .site-nav a:not(:last-child) { display: none; }
    .hero-site { min-height: 86vh; }
    .site-footer { flex-direction: column; }
}
