﻿:root {
    --bg-0: #f3f0ea;
    --bg-1: #e6dfd4;
    --bg-2: #d8cbb7;
    --panel: #fbf8f3;
    --panel-strong: #fffdf8;
    --ink: #251e17;
    --muted: #6f665c;
    --line: #d9cfc0;
    --line-soft: #ebe4d8;
    --accent: #c24f2f;
    --accent-strong: #8f3520;
    --accent-cool: #2f6f98;
    --accent-gold: #c48a23;
    --ok: #2f8a57;
    --err: #b1462f;
    --shadow-lg: 0 30px 60px rgba(38, 25, 12, 0.16);
    --shadow-md: 0 14px 32px rgba(38, 25, 12, 0.12);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    color: var(--ink);
    font-family: "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at top left, #fff2dc 0%, transparent 25%),
        radial-gradient(circle at right center, #d4e2eb 0%, transparent 20%),
        linear-gradient(135deg, var(--bg-0) 0%, var(--bg-1) 42%, var(--bg-2) 100%);
    line-height: 1.5;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0.01em;
}

p {
    margin: 0;
}

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

.hidden {
    display: none !important;
}

.dashboard-shell {
    width: min(1480px, calc(100% - 28px));
    margin: 14px auto;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 18px;
    min-height: calc(100vh - 28px);
}

.left-rail {
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(41, 30, 22, 0.94), rgba(55, 41, 30, 0.94));
    color: #fdf3e8;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 14px;
    max-height: calc(100vh - 28px);
    overflow: auto;
}

.brand-block h1 {
    margin-top: 4px;
    font-size: 2rem;
}

.brand-block p {
    margin-top: 8px;
    color: rgba(253, 243, 232, 0.8);
}

.eyebrow,
.section-kicker,
.metric-title,
.mini-label,
.token-chip-index,
.rail-label {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 700;
}

.rail-nav {
    display: grid;
    gap: 8px;
}

.rail-link {
    text-decoration: none;
    color: #fdf3e8;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    padding: 10px 12px;
    font-size: 0.9rem;
    transition: background 180ms ease;
}

.rail-link:hover {
    background: rgba(255, 255, 255, 0.12);
}

.rail-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    padding: 14px;
    display: grid;
    gap: 10px;
}

.rail-card h2 {
    font-size: 1.08rem;
}

.path-copy {
    color: #f9ddbc;
    word-break: break-all;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.84rem;
}

.main-workspace {
    border-radius: var(--radius-xl);
    background: rgba(249, 244, 237, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-lg);
    padding: 18px;
    display: grid;
    gap: 16px;
}

.sync-strip {
    border-radius: var(--radius-md);
    border: 1px solid var(--line-soft);
    background: linear-gradient(120deg, #fffaf2, #f7efe4);
    padding: 10px 12px;
    color: var(--muted);
    font-size: 0.9rem;
}

.sync-strip strong {
    color: var(--ink);
}

.top-hero {
    border-radius: var(--radius-lg);
    background: linear-gradient(120deg, #251c14 0%, #423022 100%);
    color: #fdf2e7;
    padding: 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.top-hero h2 {
    margin-top: 2px;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.hero-copy {
    margin-top: 8px;
    max-width: 70ch;
    color: rgba(253, 242, 231, 0.84);
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.hero-tags span {
    display: inline-block;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: 8px 10px;
    font-size: 0.82rem;
    white-space: nowrap;
}

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

.metric-card {
    border-radius: var(--radius-lg);
    padding: 14px;
    color: #f7efe5;
    background: linear-gradient(155deg, #2e2219, #4a3728);
    box-shadow: var(--shadow-md);
}

.metric-value {
    margin-top: 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.4rem, 2vw, 2rem);
    font-weight: 700;
}

.metric-sub {
    margin-top: 4px;
    color: rgba(247, 239, 229, 0.77);
    font-size: 0.86rem;
}

.token-tone {
    box-shadow: inset 0 0 0 1px rgba(194, 79, 47, 0.5), var(--shadow-md);
}

.proxy-tone {
    box-shadow: inset 0 0 0 1px rgba(196, 138, 35, 0.5), var(--shadow-md);
}

.binding-tone {
    box-shadow: inset 0 0 0 1px rgba(47, 111, 152, 0.5), var(--shadow-md);
}

.inline-notice {
    min-height: 22px;
    padding-left: 2px;
    color: var(--muted);
}

.inline-notice.ok {
    color: var(--ok);
}

.inline-notice.err {
    color: var(--err);
}

.workspace-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 12px;
}

.panel {
    border-radius: var(--radius-lg);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    padding: 16px;
    transition: transform 170ms ease, box-shadow 170ms ease;
}

.panel:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(38, 25, 12, 0.14);
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-heading h3 {
    margin-top: 2px;
    font-size: 1.34rem;
}

.section-kicker {
    color: var(--muted);
}

.token-list {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.token-status-wrap {
    margin-bottom: 12px;
}

.token-status-list {
    display: grid;
    gap: 8px;
    margin-top: 6px;
}

.token-state-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line-soft);
    background: #fffdf9;
    padding: 9px 10px;
}

.token-state-main code {
    display: block;
    margin-top: 4px;
    font-size: 0.84rem;
    font-family: Consolas, "Courier New", monospace;
}

.token-state-badge {
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.token-state-item.cooldown {
    border-left: 4px solid var(--err);
}

.token-state-item.cooldown .token-state-badge {
    color: #fff5ef;
    background: var(--err);
}

.token-state-item.working {
    border-left: 4px solid var(--ok);
}

.token-state-item.working .token-state-badge {
    color: #effff5;
    background: var(--ok);
}

.token-state-item.idle {
    border-left: 4px solid var(--accent-cool);
}

.token-state-item.idle .token-state-badge {
    color: #eff6ff;
    background: var(--accent-cool);
}

.token-list.empty {
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
    padding: 24px 10px;
    text-align: center;
    background: var(--panel-strong);
}

.token-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-radius: var(--radius-md);
    background: #2f251d;
    color: #fff4e7;
    padding: 10px;
}

.token-chip code {
    display: block;
    margin-top: 5px;
    font-size: 0.86rem;
    font-family: Consolas, "Courier New", monospace;
}

.chip-remove {
    border: 0;
    border-radius: 999px;
    padding: 7px 12px;
    color: #fff4e7;
    background: rgba(255, 255, 255, 0.14);
    cursor: pointer;
}

.mode-toggle {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px;
    background: #ece5da;
    margin-bottom: 12px;
}

.mode-btn {
    border: 0;
    border-radius: 999px;
    background: transparent;
    padding: 9px 16px;
    color: var(--muted);
    cursor: pointer;
    font-weight: 700;
}

.mode-btn.active {
    background: linear-gradient(140deg, var(--accent), var(--accent-strong));
    color: #fff7ef;
}

.auth-actions,
.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.status-box,
.result-box {
    border-radius: var(--radius-md);
    border: 1px solid var(--line-soft);
    background: #fffdf9;
    padding: 12px;
}

.status-box {
    margin-bottom: 10px;
}

.status-title {
    font-weight: 700;
}

.result-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.result-meta strong {
    display: block;
    margin-top: 3px;
    font-size: 0.96rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-span-2 {
    grid-column: span 2;
}

.field-toggle {
    justify-content: center;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    padding: 11px 12px;
    background: #fffcf8;
}

.field-toggle input {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

.field-label {
    font-size: 0.84rem;
    color: var(--muted);
    font-weight: 700;
}

.input,
.textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffefa;
    color: var(--ink);
    padding: 10px 11px;
}

.textarea {
    resize: vertical;
    min-height: 110px;
}

.token-preview {
    font-family: Consolas, "Courier New", monospace;
    min-height: 80px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.activity-list {
    margin-top: 10px;
    display: grid;
    gap: 8px;
    max-height: 460px;
    overflow: auto;
    padding-right: 4px;
}

.activity-item {
    border: 1px solid var(--line-soft);
    border-left-width: 4px;
    border-radius: var(--radius-md);
    background: #fffdf9;
    padding: 10px;
    display: grid;
    gap: 8px;
}

.activity-item.ok {
    border-left-color: var(--ok);
}

.activity-item.error {
    border-left-color: var(--err);
}

.activity-head {
    display: grid;
    gap: 2px;
}

.activity-head span {
    color: var(--muted);
    font-size: 0.82rem;
}

.activity-item summary {
    cursor: pointer;
    color: var(--accent-strong);
    font-weight: 700;
}

.activity-item pre {
    margin: 8px 0 0;
    max-height: 240px;
    overflow: auto;
    border-radius: 10px;
    border: 1px solid var(--line-soft);
    background: #f8f2e8;
    padding: 10px;
    font-size: 0.78rem;
    line-height: 1.4;
    font-family: Consolas, "Courier New", monospace;
}

.field-help,
.status-sub,
.empty-state {
    font-size: 0.84rem;
    color: var(--muted);
}

.button {
    border: 0;
    border-radius: 999px;
    padding: 10px 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 150ms ease, filter 150ms ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.button:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.button.primary {
    color: #fff7ef;
    background: linear-gradient(140deg, var(--accent), var(--accent-strong));
}

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

.button.full {
    width: 100%;
}

.compact-ui .dashboard-shell {
    gap: 12px;
}

.compact-ui .left-rail {
    padding: 16px;
    gap: 12px;
}

.compact-ui .main-workspace {
    padding: 12px;
    gap: 10px;
}

.compact-ui .top-hero,
.compact-ui .panel,
.compact-ui .rail-card,
.compact-ui .sync-strip {
    padding: 12px;
}

.compact-ui .metrics-grid,
.compact-ui .workspace-grid,
.compact-ui .form-grid {
    gap: 8px;
}

.compact-ui .metric-card {
    padding: 10px;
}

.compact-ui .metric-value {
    font-size: 1.45rem;
}

.compact-ui .button {
    padding: 8px 12px;
}

.compact-ui .input,
.compact-ui .textarea {
    padding: 8px 10px;
}

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

    .left-rail {
        order: 2;
        position: static;
        max-height: none;
        overflow: visible;
    }

    .main-workspace {
        order: 1;
    }
}

@media (max-width: 900px) {
    .metrics-grid,
    .workspace-grid,
    .result-meta,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .field-span-2 {
        grid-column: auto;
    }

    .hero-tags {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .dashboard-shell {
        width: calc(100% - 14px);
        margin: 7px auto;
    }

    .left-rail,
    .main-workspace,
    .top-hero,
    .panel {
        border-radius: 16px;
    }

    .auth-actions .button,
    .result-actions .button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
