:root {
    --bg: #eef7ff;
    --panel: #ffffff;
    --ink: #07111f;
    --muted: #6b7280;
    --line: #c9dff4;
    --nav: #061225;
    --nav-soft: #0d2848;
    --green: #38bdf8;
    --blue: #1d4ed8;
    --gold: #7dd3fc;
    --red: #0f172a;
    --cyan: #0ea5e9;
}

* {
    box-sizing: border-box;
}

body.dvault-body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.login-body {
    min-height: 100vh;
    margin: 0;
    background: #061225;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(125, 211, 252, .20), transparent 32%),
        linear-gradient(315deg, rgba(29, 78, 216, .24), transparent 36%),
        #061225;
}

.login-panel {
    width: min(440px, 100%);
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 28px 70px rgba(0, 0, 0, .28);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
}

.login-brand strong,
.login-brand small {
    display: block;
}

.login-brand small {
    color: var(--muted);
}

.login-panel h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0;
}

.login-panel p {
    margin: 8px 0 22px;
    color: var(--muted);
}

.login-error {
    margin-bottom: 16px;
    padding: 10px 12px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    font-weight: 700;
}

.login-notice {
    margin-bottom: 16px;
    padding: 10px 12px;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    background: #f0fdf4;
    color: #166534;
    font-weight: 750;
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 16px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.auth-tabs a {
    display: grid;
    min-height: 38px;
    place-items: center;
    border-radius: 6px;
    color: #475569;
    font-size: 13px;
    font-weight: 850;
    text-decoration: none;
}

.auth-tabs a.active {
    background: #111827;
    color: #ffffff;
}

.ussd-card {
    padding: 12px;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    background: #f8fafc;
}

.login-form {
    display: grid;
    gap: 14px;
}

.login-form label {
    display: grid;
    gap: 7px;
}

.login-form span {
    color: #334155;
    font-size: 13px;
    font-weight: 800;
}

.login-form input {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: 0;
}

.login-form input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.login-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    background: var(--green);
    color: #04111f;
    font-weight: 850;
}

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

.app-shell.sidebar-collapsed {
    grid-template-columns: 82px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px 96px;
    background: var(--nav);
    color: #eef4ff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 30px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    text-decoration: none;
    margin-bottom: 0;
}

.brand-mark,
.brand-logo {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    flex-shrink: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    background: #7dd3fc;
    color: #061225;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.sidebar-toggle {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    color: #eef4ff;
}

.sidebar-collapsed .brand-copy,
.sidebar-collapsed .sidebar-nav span,
.sidebar-collapsed .sidebar-status span {
    display: none;
}

.sidebar-collapsed .sidebar {
    padding-inline: 14px;
}

.sidebar-collapsed .sidebar-nav a,
.sidebar-collapsed .brand {
    justify-content: center;
}

.brand small,
.sidebar-status,
.eyebrow,
.panel-pill,
.metric-card small,
.user-chip small,
.market-row small,
.transaction-row small,
.admin-card p {
    color: var(--muted);
}

.sidebar-nav {
    display: grid;
    gap: 6px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
}

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

.sidebar-status {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    background: rgba(6, 18, 37, .92);
    font-size: 12px;
    line-height: 1.3;
    pointer-events: none;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: var(--green);
}

.app-main {
    padding: 26px;
}

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

.topbar h1,
.panel h2,
.admin-hero h2,
.admin-card h3 {
    margin: 0;
    letter-spacing: 0;
}

.topbar h1 {
    font-size: 28px;
    font-weight: 750;
}

.eyebrow {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

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

.icon-btn,
.logout-link,
.primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border-radius: 8px;
    text-decoration: none;
}

.icon-btn {
    width: 42px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
}

.user-chip {
    display: grid;
    min-width: 150px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    line-height: 1.1;
}

.user-chip span {
    font-weight: 700;
}

.logout-link {
    padding: 0 14px;
    background: #fee2e2;
    color: #991b1b;
    font-weight: 700;
}

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

.metric-card,
.panel,
.admin-hero,
.admin-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 12px 34px rgba(15, 23, 42, .06);
}

.metric-card {
    position: relative;
    overflow: hidden;
    padding: 18px;
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--blue);
}

.metric-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
    text-transform: uppercase;
}

.metric-card strong {
    display: block;
    margin-bottom: 5px;
    font-size: 34px;
    line-height: 1;
}

.accent-green::before { background: var(--green); }
.accent-blue::before { background: var(--blue); }
.accent-gold::before { background: var(--gold); }
.accent-red::before { background: var(--red); }

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

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

.event-card {
    display: grid;
    gap: 12px;
    min-height: 238px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 34px rgba(15, 23, 42, .06);
}

.event-card-top,
.event-card-meta,
.event-odds-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.event-card h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
}

.event-card p,
.event-card small {
    margin: 0;
    color: var(--muted);
}

.event-card-meta {
    flex-wrap: wrap;
    justify-content: flex-start;
    font-size: 13px;
    color: #475569;
}

.event-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.event-odds-row {
    margin-top: auto;
}

.event-odds-row button {
    display: grid;
    flex: 1;
    min-height: 58px;
    padding: 8px;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    background: #f0fdf4;
    color: #14532d;
}

.event-odds-row strong {
    font-size: 15px;
    line-height: 1.1;
}

.panel {
    padding: 18px;
}

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

.panel h2 {
    font-size: 18px;
    font-weight: 750;
}

.panel-pill {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
}

.chart-panel canvas {
    width: 100%;
    max-height: 260px;
}

.market-list,
.transaction-list {
    display: grid;
    gap: 10px;
}

.market-row,
.transaction-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.market-row strong,
.transaction-row strong {
    display: block;
}

.market-row span,
.transaction-row span {
    color: var(--ink);
    font-weight: 800;
    white-space: nowrap;
}

.empty-state {
    margin: 0;
    color: var(--muted);
}

.admin-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    margin-bottom: 16px;
}

.admin-hero h2 {
    font-size: 24px;
}

.admin-hero p {
    max-width: 720px;
    margin: 8px 0 0;
    color: var(--muted);
}

.primary-action {
    padding: 0 16px;
    background: var(--green);
    color: #052e16;
    font-weight: 800;
    white-space: nowrap;
}

.muted-action {
    background: #e2e8f0;
    color: #0f172a;
}

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

.admin-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    padding: 18px;
}

.linked-card {
    color: inherit;
    text-decoration: none;
    transition: transform .16s ease, box-shadow .16s ease;
}

.linked-card:hover {
    color: inherit;
    transform: translateY(-2px);
    box-shadow: 0 18px 42px rgba(15, 23, 42, .10);
}

.admin-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: #e0f2fe;
    color: var(--cyan);
    font-size: 20px;
}

.admin-card h3 {
    font-size: 17px;
}

.admin-card p {
    margin: 6px 0 12px;
}

.admin-card span {
    grid-column: 1 / -1;
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

.data-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th,
.data-table td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: #475569;
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.data-table td {
    color: #1f2937;
    font-size: 14px;
}

.data-table a {
    color: var(--blue);
    font-weight: 800;
    text-decoration: none;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.compact-table {
    max-height: 520px;
}

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

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

    .app-shell.sidebar-collapsed {
        grid-template-columns: 1fr;
    }

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

    .sidebar-head {
        margin-bottom: 12px;
    }

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

    .sidebar-nav a {
        justify-content: center;
        min-height: 42px;
        padding: 8px;
        font-size: 0;
    }

    .sidebar-nav a i {
        font-size: 18px;
    }

    .sidebar-status {
        position: static;
        margin-top: 18px;
    }

    .topbar,
    .admin-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        flex-wrap: wrap;
    }

    .metric-grid,
    .dashboard-grid,
    .admin-grid,
    .event-card-grid {
        grid-template-columns: 1fr;
    }

    .app-main {
        padding: 16px;
    }

    .login-shell {
        padding: 12px;
        place-items: stretch;
    }

    .login-panel {
        align-self: center;
        padding: 18px;
    }
}

.app-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-footer {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    background: var(--bg);
    color: #475569;
    font-size: 13px;
}

.score-current {
    margin: 16px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #eff6ff;
    color: #334155;
    font-size: 14px;
}

.score-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 12px;
    align-items: end;
    margin-top: 16px;
}

.score-team {
    display: grid;
    gap: 8px;
}

.score-team strong,
.score-team input[type="text"] {
    min-height: 38px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eff6ff;
    font-size: 14px;
}

.score-team input[type="text"] {
    width: 100%;
}

.score-label {
    display: block;
    margin-bottom: 6px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.score-team input {
    width: 100%;
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-align: center;
    font-size: 24px;
    font-weight: 850;
}

.score-divider {
    align-self: center;
    color: #475569;
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.score-hint {
    grid-column: 1 / -1;
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.score-form button {
    grid-column: 1 / -1;
    border: 0;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.55);
}

.modal-backdrop[hidden] {
    display: none;
}

.menu-modal {
    width: min(920px, 100%);
    max-height: 90vh;
    overflow: auto;
}

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

.menu-form-grid label {
    display: grid;
    gap: 6px;
}

.menu-form-grid label span {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.menu-form-grid input,
.menu-form-grid textarea,
.menu-form-grid select {
    width: 100%;
    min-height: 40px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
}

.menu-form-grid .full-span {
    grid-column: 1 / -1;
}

.menu-form-actions {
    display: flex;
    justify-content: flex-end;
}

.menu-form-error {
    margin: 0 20px 20px;
}

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 20px 0;
    border-bottom: 1px solid var(--line);
}

.settings-tab {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    background: #f8fafc;
    color: #334155;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

.settings-tab.active {
    background: #fff;
    color: #0f172a;
    position: relative;
    top: 1px;
}

.settings-tab-panel {
    padding: 20px;
}

.settings-group-block + .settings-group-block {
    margin-top: 24px;
}

.settings-group-block h3 {
    margin: 0 0 12px;
    font-size: 18px;
}

.webhook-url-list {
    display: grid;
    gap: 10px;
}

.webhook-url-row {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.webhook-url-row code {
    word-break: break-all;
    font-size: 13px;
}

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

.inline-action-form {
    display: inline;
}

.bot-setting-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1.4fr 1.2fr auto auto;
    gap: 8px;
    align-items: center;
}

.bot-setting-form {
    margin: 0;
}

.bot-test-output {
    margin: 0 20px 20px;
    padding: 16px;
    min-height: 280px;
    overflow: auto;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
}

@media (max-width: 900px) {
    .bot-setting-grid {
        grid-template-columns: 1fr;
    }
}

.site-footer strong {
    color: #0f172a;
}

.admin-form-grid,
.inline-filter {
    display: grid;
    gap: 14px;
}

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

.admin-form-grid.single-column,
.inline-filter {
    grid-template-columns: 1fr;
}

.admin-form-grid label,
.inline-filter label {
    display: grid;
    gap: 7px;
}

.admin-form-grid span,
.inline-filter span {
    color: #334155;
    font-size: 13px;
    font-weight: 800;
}

.admin-form-grid input,
.admin-form-grid select,
.admin-form-grid textarea,
.inline-filter select {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
}

.admin-form-grid textarea {
    padding: 10px 12px;
    resize: vertical;
}

.admin-form-grid button {
    border: 0;
}

.member-edit-panel {
    margin-bottom: 16px;
}

.member-picker {
    display: grid;
    gap: 8px;
    max-height: 260px;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.member-picker label {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    margin: 0;
}

.member-picker input {
    width: 16px;
    min-height: 16px;
}

.member-picker small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.settings-table input {
    width: min(520px, 100%);
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
}

.settings-save {
    margin-top: 16px;
    border: 0;
}

.status-dot {
    background: #7dd3fc;
}

.primary-action {
    color: #04111f;
}

.admin-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.event-odds-row button {
    border-color: #bae6fd;
    background: #eff6ff;
    color: #0f172a;
}

.login-notice {
    border-color: #bae6fd;
    background: #eff6ff;
    color: #075985;
}

@media (max-width: 860px) {
    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .score-form {
        grid-template-columns: 1fr;
    }

    .score-divider {
        justify-self: center;
    }
}
