:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-2: #eef3f8;
    --sidebar: #151a22;
    --sidebar-soft: #202733;
    --text: #17202c;
    --muted: #657284;
    --line: #dbe3ed;
    --accent: #18a8ff;
    --accent-dark: #0878c5;
    --coral: #ff6f61;
    --green: #1ba672;
    --warning: #c27a14;
    --shadow: 0 18px 50px rgba(25, 34, 48, .10);
    --radius: 8px;
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--sidebar);
    color: #f8fbff;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    font-size: 15px;
}

.brand-mark span {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #06111d;
    font-weight: 800;
    letter-spacing: 0;
}

.sidebar nav {
    display: grid;
    gap: 4px;
}

.nav-item {
    appearance: none;
    border: 0;
    background: transparent;
    color: #b7c0ce;
    width: 100%;
    min-height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    font-size: 14px;
    text-align: left;
}

.nav-item svg,
button svg,
.search svg {
    width: 17px;
    height: 17px;
    stroke-width: 2;
}

.nav-item:hover,
.nav-item.active {
    background: var(--sidebar-soft);
    color: #fff;
}

.sidebar-card {
    margin-top: auto;
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 8px;
    padding: 14px;
    background: rgba(255, 255, 255, .05);
}

.mini-label {
    display: block;
    color: #96a2b3;
    font-size: 12px;
    margin-bottom: 6px;
}

.meter {
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    overflow: hidden;
    margin-top: 14px;
}

.meter span {
    display: block;
    height: 100%;
    background: var(--accent);
}

.workspace {
    min-width: 0;
    padding: 22px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.search {
    height: 44px;
    flex: 1;
    max-width: 620px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
}

.search input {
    border: 0;
    outline: 0;
    width: 100%;
    background: transparent;
    color: var(--text);
}

.topbar-actions,
.hero-actions,
.modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hidden {
    display: none !important;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #f6fbff, #f7f8fb);
}

.auth-panel {
    width: min(420px, 100%);
    display: grid;
    gap: 16px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.auth-panel .brand-mark {
    color: var(--text);
}

.auth-panel h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: 0;
}

.auth-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.auth-form {
    display: grid;
    gap: 12px;
}

.auth-message {
    min-height: 20px;
    font-size: 13px;
}

select,
input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 10px 11px;
    outline: 0;
}

textarea {
    resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(24, 168, 255, .16);
}

.primary-btn,
.ghost-btn,
.dark-btn,
.icon-btn {
    border: 0;
    border-radius: 8px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.primary-btn {
    background: var(--accent);
    color: #04111e;
    padding: 0 14px;
}

.primary-btn:hover {
    background: #33b6ff;
}

.ghost-btn {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    padding: 0 13px;
}

.dark-btn {
    background: var(--text);
    color: #fff;
    padding: 0 14px;
}

.icon-btn {
    width: 36px;
    background: var(--surface-2);
    color: var(--text);
}

.brand-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 180px;
    align-items: stretch;
    gap: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f6fbff 62%, #e8f6ff 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.brand-hero h1 {
    margin: 8px 0 7px;
    font-size: clamp(28px, 3vw, 44px);
    line-height: 1;
    letter-spacing: 0;
}

.brand-hero p {
    margin: 0;
    max-width: 680px;
    color: var(--muted);
    line-height: 1.5;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--green);
}

.status-dot::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.health-card {
    border-radius: 8px;
    background: var(--sidebar);
    color: #fff;
    padding: 15px;
    display: grid;
    align-content: center;
    gap: 4px;
}

.health-card span,
.health-card small {
    color: #aeb8c7;
    font-size: 12px;
}

.health-card strong {
    font-size: 38px;
    line-height: 1;
}

.overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
    margin-top: 16px;
}

.profile-panel {
    grid-column: 1 / -1;
}

.token-panel {
    grid-column: 1 / -1;
}

.profile-form {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.token-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.token-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    min-height: 420px;
}

.token-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-content: start;
    padding: 16px;
    border-right: 1px solid var(--line);
}

.token-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    min-height: 132px;
    display: grid;
    gap: 10px;
    text-align: left;
}

.token-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(24, 168, 255, .16);
}

.token-swatch {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-2);
}

.token-value {
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.token-form {
    align-content: start;
}

.lower-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(25, 34, 48, .05);
    min-width: 0;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.panel-head.compact {
    align-items: center;
}

.panel-head h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.2;
}

.panel-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.segmented {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
}

.segmented button {
    border: 0;
    border-radius: 6px;
    min-height: 30px;
    background: transparent;
    color: var(--muted);
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
}

.segmented button.active {
    background: #fff;
    color: var(--text);
    box-shadow: 0 2px 6px rgba(25, 34, 48, .08);
}

.asset-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
}

.asset-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 176px;
    background: #fff;
    padding: 12px;
    display: grid;
    align-content: space-between;
    gap: 12px;
    text-align: left;
}

.asset-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(24, 168, 255, .16);
}

.asset-preview {
    height: 86px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, #edf6ff, #f8fbff);
    color: var(--accent-dark);
}

.asset-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.asset-preview strong {
    font-size: 26px;
    letter-spacing: 0;
}

.asset-title {
    margin: 0;
    font-size: 14px;
    line-height: 1.25;
}

.asset-subrow,
.row-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #eef3f8;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
}

.status.Approved,
.status.Live,
.status.Published,
.status.Active,
.status.Synced,
.status.Pass {
    background: rgba(27, 166, 114, .12);
    color: var(--green);
}

.status.Review,
.status.Building,
.status.Needs {
    background: rgba(24, 168, 255, .14);
    color: var(--accent-dark);
}

.status.Draft,
.status.Planning,
.status.Open,
.status.Manual {
    background: rgba(194, 122, 20, .14);
    color: var(--warning);
}

.status.Changes {
    background: rgba(255, 111, 97, .14);
    color: #bd3f33;
}

.status.Blocked,
.status.Broken {
    background: rgba(255, 111, 97, .14);
    color: #bd3f33;
}

.status.Accepted {
    background: rgba(27, 166, 114, .12);
    color: var(--green);
}

.status.Rejected {
    background: rgba(255, 111, 97, .14);
    color: #bd3f33;
}

.stacked-form,
.modal form,
.drawer form {
    display: grid;
    gap: 12px;
    padding: 16px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.checkline {
    display: flex;
    align-items: center;
    gap: 9px;
}

.checkline input {
    width: auto;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.inspector-meta {
    display: grid;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px;
    color: var(--muted);
    font-size: 12px;
}

.replace-form {
    border-top: 1px solid var(--line);
}

.asset-history {
    display: grid;
    border-top: 1px solid var(--line);
}

.guideline-panel {
    grid-column: span 2;
}

.guideline-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
}

.guideline-form {
    border-left: 1px solid var(--line);
    align-content: start;
}

.guideline-history {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.approval-workflow {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.approval-form {
    border-top: 1px solid var(--line);
}

.history-item {
    display: grid;
    gap: 5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.history-item:last-child {
    border-bottom: 0;
}

.history-item strong {
    font-size: 12px;
}

.history-item span {
    color: var(--muted);
    font-size: 12px;
}

.chapter-list,
.approval-list,
.campaign-list,
.activity-list {
    display: grid;
    gap: 0;
    align-content: start;
}

.chapter,
.approval,
.campaign,
.activity {
    display: grid;
    gap: 7px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}

.approval.selected {
    background: #f6fbff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.campaign-workspace {
    display: grid;
    grid-template-columns: minmax(220px, 0.85fr) minmax(300px, 1.15fr);
    min-height: 520px;
}

.campaign-panel {
    grid-column: span 2;
}

.compliance-panel {
    grid-column: span 2;
}

.change-panel {
    grid-column: span 2;
}

.members-panel {
    grid-column: span 2;
}

.audit-panel {
    grid-column: span 2;
}

.usage-panel {
    grid-column: span 2;
}

.integrations-panel {
    grid-column: span 2;
}

.references-panel {
    grid-column: span 2;
}

.campaign-list {
    border-right: 1px solid var(--line);
}

button.campaign {
    width: 100%;
    border: 0;
    background: #fff;
    text-align: left;
}

button.campaign.selected {
    background: #f6fbff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.campaign-form {
    padding: 16px;
}

.campaign-readiness,
.linked-assets {
    display: grid;
    gap: 8px;
}

.readiness-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.readiness-grid span,
.linked-asset {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fbfcfd;
}

.readiness-grid strong,
.linked-asset strong {
    display: block;
    font-size: 12px;
}

.readiness-grid small,
.linked-asset p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.campaign-asset-picker {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    align-items: end;
}

.linked-asset {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.compliance-form {
    border-bottom: 1px solid var(--line);
}

.compliance-list {
    display: grid;
    gap: 0;
}

.compliance-check {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.compliance-check:last-child {
    border-bottom: 0;
}

.compliance-check p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.compliance-check ul {
    margin: 0;
    padding: 0;
    display: grid;
    gap: 7px;
    list-style: none;
}

.compliance-check li {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 10px;
    background: #fbfcfd;
    color: var(--text);
    font-size: 12px;
}

.compliance-check li strong {
    text-transform: capitalize;
    color: var(--accent-dark);
    margin-right: 5px;
}

.compliance-check li span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    line-height: 1.4;
}

.change-workflow {
    display: grid;
    grid-template-columns: minmax(240px, .9fr) minmax(300px, 1.1fr);
}

.change-list,
.member-list,
.integration-list,
.reference-list {
    display: grid;
    gap: 0;
    align-content: start;
    border-right: 1px solid var(--line);
}

.change-request,
.member,
.integration,
.reference {
    display: grid;
    gap: 7px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}

.change-request.selected,
.member.selected,
.integration.selected,
.reference.selected {
    background: #f6fbff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.change-request:last-child,
.member:last-child,
.integration:last-child,
.reference:last-child {
    border-bottom: 0;
}

.change-request p,
.member p,
.integration p,
.reference p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.change-form {
    align-content: start;
}

.member-workflow {
    display: grid;
    grid-template-columns: minmax(240px, .9fr) minmax(300px, 1.1fr);
}

.integration-workflow {
    display: grid;
    grid-template-columns: minmax(240px, .9fr) minmax(300px, 1.1fr);
}

.reference-workflow {
    display: grid;
    grid-template-columns: minmax(240px, .9fr) minmax(300px, 1.1fr);
}

.member-form,
.integration-form,
.reference-form {
    align-content: start;
}

.audit-list {
    display: grid;
    gap: 0;
}

.audit-event {
    display: grid;
    gap: 7px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}

.audit-event:last-child {
    border-bottom: 0;
}

.audit-event p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.usage-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.usage-stat {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfcfd;
    display: grid;
    gap: 4px;
}

.usage-stat strong {
    font-size: 22px;
}

.usage-stat span,
.usage-stat small {
    color: var(--muted);
    font-size: 12px;
    text-transform: capitalize;
}

.usage-list {
    display: grid;
    gap: 0;
}

.usage-event {
    display: grid;
    gap: 7px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}

.usage-event:last-child {
    border-bottom: 0;
}

.usage-event p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

button.chapter {
    width: 100%;
    border: 0;
    background: #fff;
    text-align: left;
}

button.chapter.selected {
    background: #f6fbff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.chapter:last-child,
.approval:last-child,
.campaign:last-child,
.activity:last-child {
    border-bottom: 0;
}

.chapter strong,
.approval strong,
.campaign strong {
    font-size: 13px;
}

.chapter p,
.approval p,
.campaign p,
.activity p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.approval-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.approval-actions button {
    min-height: 30px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    padding: 0 9px;
}

.count-pill {
    font-size: 12px;
    font-weight: 750;
    color: var(--accent-dark);
}

.modal {
    width: min(520px, calc(100vw - 28px));
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0;
    box-shadow: var(--shadow);
}

.modal::backdrop {
    background: rgba(11, 18, 28, .42);
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(410px, 100vw);
    height: 100vh;
    background: #fff;
    border-left: 1px solid var(--line);
    box-shadow: -20px 0 60px rgba(25, 34, 48, .18);
    transform: translateX(105%);
    transition: transform .22s ease;
    z-index: 20;
}

.drawer.open {
    transform: translateX(0);
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    background: var(--text);
    color: #fff;
    border-radius: 8px;
    padding: 11px 13px;
    font-size: 13px;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: .18s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1180px) {
    .overview-grid,
    .brand-hero {
        grid-template-columns: 1fr;
    }

    .token-layout,
    .token-list,
    .guideline-layout,
    .campaign-workspace {
        grid-template-columns: 1fr;
    }

    .token-list {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .guideline-panel {
        grid-column: 1 / -1;
    }

    .guideline-form {
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    .campaign-list {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .lower-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .campaign-panel,
    .compliance-panel,
    .change-panel,
    .members-panel,
    .audit-panel,
    .usage-panel,
    .integrations-panel,
    .references-panel {
        grid-column: 1 / -1;
    }

    .asset-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 780px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        padding: 14px;
    }

    .sidebar nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nav-item {
        min-width: 0;
        font-size: 13px;
    }

    .sidebar-card {
        display: none;
    }

    .workspace {
        padding: 14px;
    }

    .topbar,
    .topbar-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .search {
        max-width: none;
    }

    .lower-grid,
    .asset-grid,
    .profile-grid,
    .campaign-asset-picker,
    .readiness-grid,
    .usage-grid,
    .change-workflow,
    .member-workflow,
    .integration-workflow,
    .reference-workflow {
        grid-template-columns: 1fr;
    }

    .change-list,
    .member-list,
    .integration-list,
    .reference-list {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .panel-head {
        flex-direction: column;
        align-items: stretch;
    }

    .panel-head.compact {
        flex-direction: row;
        align-items: center;
    }

    .segmented {
        width: 100%;
        overflow-x: auto;
    }

    .segmented button {
        flex: 1 0 auto;
    }

    .hero-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .health-card {
        width: 100%;
    }
}
