:root {
    --bg: #080b12;
    --bg-2: #101827;
    --surface: rgba(255, 255, 255, 0.94);
    --surface-solid: #ffffff;
    --surface-soft: #fff8e6;
    --text: #172033;
    --muted: #687386;
    --primary: #f59e0b;
    --primary-dark: #d97706;
    --primary-soft: #fff3cf;
    --accent: #16a34a;
    --accent-soft: #dcfce7;
    --line: rgba(148, 163, 184, 0.22);
    --danger: #ef4444;
    --danger-soft: #fef2f2;
    --shadow: 0 22px 70px rgba(12, 18, 31, 0.16);
    --shadow-soft: 0 14px 38px rgba(15, 23, 42, 0.10);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --sidebar-width: 292px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(245, 158, 11, 0.22), transparent 32rem),
        radial-gradient(circle at top right, rgba(22, 163, 74, 0.18), transparent 30rem),
        linear-gradient(135deg, #fff7df 0%, #f8fafc 42%, #ecfdf5 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.35;
    background-image:
        linear-gradient(30deg, rgba(245, 158, 11, 0.12) 12%, transparent 12.5%, transparent 87%, rgba(245, 158, 11, 0.12) 87.5%, rgba(245, 158, 11, 0.12)),
        linear-gradient(150deg, rgba(245, 158, 11, 0.12) 12%, transparent 12.5%, transparent 87%, rgba(245, 158, 11, 0.12) 87.5%, rgba(245, 158, 11, 0.12)),
        linear-gradient(30deg, rgba(245, 158, 11, 0.12) 12%, transparent 12.5%, transparent 87%, rgba(245, 158, 11, 0.12) 87.5%, rgba(245, 158, 11, 0.12)),
        linear-gradient(150deg, rgba(245, 158, 11, 0.12) 12%, transparent 12.5%, transparent 87%, rgba(245, 158, 11, 0.12) 87.5%, rgba(245, 158, 11, 0.12));
    background-size: 72px 126px;
    background-position: 0 0, 0 0, 36px 63px, 36px 63px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(30px, 4vw, 52px);
    line-height: 1.02;
    letter-spacing: -1.6px;
    margin-bottom: 12px;
}

h2 {
    font-size: clamp(20px, 2vw, 26px);
    letter-spacing: -0.5px;
}

p {
    line-height: 1.6;
}

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

button,
input,
select {
    font: inherit;
}

label {
    display: block;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

input,
select {
    width: 100%;
    min-height: 48px;
    margin-top: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.88);
    outline: none;
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

input:focus,
select:focus {
    border-color: rgba(245, 158, 11, 0.85);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
    background: #ffffff;
}

button {
    min-height: 48px;
    border: 0;
    border-radius: var(--radius-md);
    padding: 13px 18px;
    color: #1f1600;
    font-weight: 900;
    cursor: pointer;
    background: linear-gradient(135deg, #facc15 0%, #f59e0b 55%, #d97706 100%);
    box-shadow: 0 14px 26px rgba(217, 119, 6, 0.24);
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

button:hover {
    filter: brightness(1.02);
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(217, 119, 6, 0.28);
}

button:active {
    transform: translateY(0);
}

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

.secondary-button,
.ghost-button,
.table-action {
    min-height: 42px;
    box-shadow: none;
}

.secondary-button {
    color: #78350f;
    background: #fff7dc;
    border: 1px solid rgba(245, 158, 11, 0.28);
}

.ghost-button {
    color: #334155;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.26);
}

.danger-button {
    color: #7f1d1d;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid rgba(239, 68, 68, 0.22);
}

.table-action {
    min-height: 38px;
    border-radius: 13px;
    padding: 9px 12px;
    font-size: 12px;
}

.alert {
    padding: 13px 15px;
    border: 1px solid rgba(239, 68, 68, 0.18);
    border-radius: 18px;
    background: var(--danger-soft);
    color: #991b1b;
    margin: 18px 0;
    font-weight: 700;
}

.login-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-card {
    position: relative;
    z-index: 1;
    width: min(100%, 448px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 34px;
    padding: 34px;
    background: rgba(255, 255, 255, 0.90);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.login-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 8px;
    background: linear-gradient(90deg, #facc15, #f59e0b, #16a34a);
}

.brand-mark,
.brand-logo {
    display: grid;
    place-items: center;
    color: #1f1600;
    font-weight: 950;
    background:
        radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.75), transparent 26%),
        linear-gradient(135deg, #fde047, #f59e0b 62%, #92400e);
    box-shadow: inset 0 -8px 18px rgba(120, 53, 15, 0.18), 0 14px 30px rgba(245, 158, 11, 0.26);
}

.brand-mark {
    width: 66px;
    height: 66px;
    border-radius: 24px;
    margin-bottom: 22px;
    font-size: 20px;
}

.login-card h1 {
    font-size: 34px;
    letter-spacing: -1px;
    margin-bottom: 8px;
}

.login-card form {
    margin-top: 26px;
}

.login-card label {
    margin-top: 16px;
}

.login-card button {
    width: 100%;
    margin-top: 24px;
}

.sidebar {
    position: fixed;
    z-index: 5;
    inset: 18px auto 18px 18px;
    width: var(--sidebar-width);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 34px;
    padding: 24px;
    color: white;
    background:
        radial-gradient(circle at top left, rgba(250, 204, 21, 0.20), transparent 15rem),
        linear-gradient(165deg, #111827 0%, #0f172a 48%, #111409 100%);
    box-shadow: 0 26px 70px rgba(15, 23, 42, 0.34);
}

.sidebar::after {
    content: "";
    position: absolute;
    right: -46px;
    bottom: -42px;
    width: 154px;
    height: 154px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.12);
}

.brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 34px;
}

.brand-logo {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    border-radius: 18px;
}

.brand strong {
    display: block;
    max-width: 174px;
    font-size: 15px;
    line-height: 1.25;
}

.brand span,
.sidebar-note span {
    display: block;
    margin-top: 5px;
    color: #cbd5e1;
    font-size: 12px;
}

nav {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 10px;
}

nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d7dee9;
    text-decoration: none;
    padding: 13px 14px;
    border-radius: 18px;
    font-weight: 800;
    transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

nav a:hover,
nav a.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.11);
    transform: translateX(2px);
}

.sidebar-note {
    position: absolute;
    z-index: 1;
    left: 24px;
    right: 24px;
    bottom: 24px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
}

.sidebar-note strong {
    display: block;
    margin-top: 8px;
    font-size: 16px;
    line-height: 1.35;
}

.main {
    position: relative;
    z-index: 1;
    margin-left: calc(var(--sidebar-width) + 40px);
    padding: 34px 34px 48px;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 22px;
    align-items: start;
    margin-bottom: 24px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #7c2d12;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 7px rgba(22, 163, 74, 0.14);
}

.top-desc {
    max-width: 760px;
    margin-bottom: 0;
    font-size: 16px;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 999px;
    padding: 9px 16px 9px 10px;
    color: #1e293b;
    font-weight: 900;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(12px);
}

.user-pill::before {
    content: "";
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: linear-gradient(135deg, #facc15, #16a34a);
    box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.12);
}

.panel,
.stat-card {
    border: 1px solid rgba(255, 255, 255, 0.74);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.panel {
    border-radius: var(--radius-xl);
    padding: 24px;
}

.control-panel {
    margin-bottom: 18px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 250, 232, 0.92)),
        radial-gradient(circle at top right, rgba(245, 158, 11, 0.18), transparent 20rem);
}

.control-grid {
    display: grid;
    grid-template-columns: minmax(210px, 1.2fr) minmax(190px, 1fr) minmax(180px, 0.9fr) auto;
    gap: 16px;
    align-items: end;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 156px;
    border-radius: 28px;
    padding: 22px;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -28px;
    top: -26px;
    width: 116px;
    height: 116px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
}

.stat-card:nth-child(2)::after {
    background: rgba(22, 163, 74, 0.14);
}

.stat-card:nth-child(3)::after {
    background: rgba(51, 65, 85, 0.10);
}

.stat-card > span {
    position: relative;
    z-index: 1;
    display: block;
    color: #475569;
    font-size: 13px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-card strong {
    position: relative;
    z-index: 1;
    display: block;
    margin-top: 12px;
    color: #0f172a;
    font-size: clamp(34px, 4vw, 46px);
    line-height: 1;
    letter-spacing: -1.5px;
}

.stat-card small {
    position: relative;
    z-index: 1;
    display: block;
    margin-top: 12px;
    color: var(--muted);
    line-height: 1.45;
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(350px, 0.75fr);
    gap: 18px;
    align-items: stretch;
}

.chart-panel {
    min-height: 536px;
}

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

.panel-head p {
    margin: 7px 0 0;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    white-space: nowrap;
    border: 1px solid rgba(245, 158, 11, 0.20);
    border-radius: 999px;
    padding: 7px 12px;
    color: #7c2d12;
    font-size: 12px;
    font-weight: 900;
    background: var(--primary-soft);
}

canvas {
    width: 100% !important;
    max-height: 424px;
}

.table-wrap {
    max-height: 420px;
    overflow: auto;
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.74);
}

.small-table {
    max-height: 360px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    position: sticky;
    top: 0;
    z-index: 2;
    text-align: left;
    color: #64748b;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.96);
}

td,
th {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

td {
    color: #334155;
    font-size: 14px;
    line-height: 1.45;
}

tbody tr:hover td {
    background: rgba(255, 248, 230, 0.60);
}

.manage-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
}

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

.form-grid button {
    justify-self: start;
    min-width: 180px;
}

.form-message {
    min-height: 22px;
    margin: 0;
    color: #15803d;
    font-weight: 800;
}

.form-message.error {
    color: #b91c1c;
}

.api-key-box {
    display: grid;
    gap: 8px;
    border: 1px solid rgba(245, 158, 11, 0.30);
    border-radius: 18px;
    padding: 14px;
    color: #78350f;
    background: var(--primary-soft);
}

.api-key-box code {
    display: block;
    overflow-x: auto;
    border-radius: 12px;
    padding: 12px;
    color: #111827;
    background: #ffffff;
}

.secret-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.secret-field input {
    margin-top: 8px;
}

.secret-field button {
    margin-top: 8px;
    white-space: nowrap;
}

.api-key-box-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.api-key-box .secret-field input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}

.api-status {
    display: inline-flex;
    border: 1px solid rgba(22, 163, 74, 0.16);
    border-radius: 999px;
    padding: 5px 9px;
    color: #166534;
    font-size: 12px;
    font-weight: 900;
    background: var(--accent-soft);
}

.mini-code {
    display: inline-block;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 9px;
    padding: 5px 7px;
    color: #111827;
    background: #f8fafc;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.80);
}

.check-row input {
    width: 18px;
    min-height: 18px;
    margin: 0;
}

.mobile-bottom-nav {
    display: none;
}

.table-wrap::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.table-wrap::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 10px;
}

.table-wrap::-webkit-scrollbar-thumb {
    border: 2px solid #f8fafc;
    border-radius: 10px;
    background: #d6a241;
}

@media (max-width: 1180px) {
    .sidebar {
        position: static;
        width: auto;
        margin: 16px;
    }

    .sidebar-note {
        position: static;
        margin-top: 20px;
    }

    .main {
        margin-left: 0;
        padding: 20px;
    }

    .topbar {
        grid-template-columns: 1fr;
    }

    .control-grid,
    .grid,
    .manage-grid {
        grid-template-columns: 1fr;
    }

    .control-grid button {
        width: 100%;
    }
}

@media (max-width: 760px) {
    body {
        background:
            radial-gradient(circle at top, rgba(245, 158, 11, 0.18), transparent 23rem),
            linear-gradient(180deg, #fff8e1 0%, #f8fafc 58%, #ecfdf5 100%);
    }

    h1 {
        letter-spacing: -1px;
    }

    .sidebar {
        display: none;
    }

    .main {
        padding: 18px 14px 106px;
    }

    .topbar {
        margin-bottom: 18px;
    }

    .user-pill {
        width: 100%;
        justify-content: flex-start;
    }

    .panel,
    .stat-card,
    .login-card {
        border-radius: 24px;
    }

    .control-grid,
    .stats,
    .grid,
    .manage-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .panel {
        padding: 18px;
    }

    .stat-card {
        min-height: 134px;
        padding: 18px;
    }

    .panel-head {
        flex-direction: column;
        gap: 10px;
    }

    .badge {
        width: fit-content;
    }

    .chart-panel {
        min-height: 440px;
    }

    canvas {
        max-height: 330px;
    }

    .table-wrap {
        max-height: 360px;
        border-radius: 18px;
    }

    td,
    th {
        padding: 12px;
        white-space: nowrap;
    }

    .form-grid button {
        width: 100%;
        justify-self: stretch;
    }


    .secret-field {
        grid-template-columns: 1fr;
    }

    .secret-field button {
        width: 100%;
    }

    .mobile-bottom-nav {
        position: fixed;
        z-index: 20;
        left: 12px;
        right: 12px;
        bottom: 12px;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 24px;
        padding: 8px;
        background: rgba(15, 23, 42, 0.94);
        box-shadow: 0 18px 42px rgba(15, 23, 42, 0.28);
        backdrop-filter: blur(16px);
    }

    .mobile-bottom-nav a {
        display: grid;
        place-items: center;
        min-height: 52px;
        border-radius: 18px;
        color: #dbe4ef;
        text-align: center;
        text-decoration: none;
        font-size: 11px;
        font-weight: 900;
        line-height: 1.15;
    }

    .mobile-bottom-nav a:active,
    .mobile-bottom-nav a:hover {
        color: white;
        background: rgba(255, 255, 255, 0.12);
    }
}

.page-grid {
    display: grid;
    gap: 18px;
    align-items: start;
}

.page-grid-two {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.page-section {
    margin-top: 18px;
}

.helper-card,
.download-card {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 248, 230, 0.94)),
        radial-gradient(circle at top right, rgba(245, 158, 11, 0.18), transparent 18rem);
}

.step-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding-left: 22px;
    color: #334155;
    line-height: 1.55;
}

.step-list li::marker {
    color: var(--primary-dark);
    font-weight: 900;
}

.table-toolbar {
    margin-bottom: 16px;
}

.info-box {
    border: 1px solid rgba(22, 163, 74, 0.20);
    border-radius: 18px;
    padding: 14px 16px;
    color: #14532d;
    line-height: 1.55;
    background: var(--accent-soft);
}

.warning-box {
    border-color: rgba(245, 158, 11, 0.28);
    color: #7c2d12;
    background: var(--primary-soft);
}

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

.download-card {
    display: grid;
    gap: 12px;
    border: 1px solid rgba(245, 158, 11, 0.24);
    border-radius: 22px;
    padding: 18px;
    margin-bottom: 18px;
}

.download-card p {
    margin-bottom: 0;
    color: var(--muted);
}

.download-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 16px;
    padding: 12px 16px;
    color: #ffffff;
    text-align: center;
    text-decoration: none;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 12px 24px rgba(217, 119, 6, 0.20);
}

.secondary-download {
    color: #7c2d12;
    border: 1px solid rgba(245, 158, 11, 0.28);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: none;
}

nav a.active,
.mobile-bottom-nav a.active {
    color: white;
    background: rgba(255, 255, 255, 0.16);
}

@media (max-width: 1180px) {
    .page-grid-two,
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .page-grid,
    .page-grid-two,
    .info-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

.export-panel {
    margin-bottom: 18px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(236, 253, 245, 0.90)),
        radial-gradient(circle at top right, rgba(22, 163, 74, 0.14), transparent 18rem);
}

.export-head {
    margin-bottom: 14px;
}

.export-grid {
    display: grid;
    grid-template-columns: minmax(190px, 0.95fr) minmax(180px, 0.85fr) minmax(180px, 0.85fr) auto;
    gap: 16px;
    align-items: end;
}

.export-grid button {
    min-width: 172px;
}

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

    .export-grid button {
        width: 100%;
    }
}

.period-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(190px, 1fr)) minmax(240px, 1.2fr);
    gap: 16px;
    align-items: end;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.20);
}

.period-hint {
    min-height: 48px;
    display: flex;
    align-items: center;
    border: 1px solid rgba(245, 158, 11, 0.20);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    color: #7c2d12;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.45;
    background: rgba(255, 247, 220, 0.72);
}

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

    .period-hint {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .period-grid {
        grid-template-columns: 1fr;
    }

    .period-hint {
        grid-column: auto;
    }
}

:root {
    --bg: #f4f6f8;
    --bg-2: #111827;
    --surface: #ffffff;
    --surface-solid: #ffffff;
    --surface-soft: #fffaf0;
    --text: #172033;
    --muted: #667085;
    --primary: #d97706;
    --primary-dark: #b45309;
    --primary-soft: #fff7ed;
    --accent: #15803d;
    --accent-soft: #f0fdf4;
    --line: #dfe3e8;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 1px 3px rgba(15, 23, 42, 0.08);
    --radius-xl: 10px;
    --radius-lg: 8px;
    --radius-md: 6px;
    --sidebar-width: 252px;
}

body {
    color: var(--text);
    background: var(--bg);
}

body::before,
.sidebar::after,
.stat-card::after,
.user-pill::before {
    display: none;
}

h1 {
    font-size: clamp(28px, 3vw, 38px);
    line-height: 1.12;
    letter-spacing: -0.8px;
}

h2 {
    font-size: clamp(19px, 2vw, 23px);
    letter-spacing: -0.25px;
}

label {
    color: #344054;
    font-weight: 700;
    letter-spacing: 0;
}

input,
select {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    background: #ffffff;
    box-shadow: none;
}

input:focus,
select:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

button {
    min-height: 44px;
    border-radius: 6px;
    padding: 11px 16px;
    color: #ffffff;
    font-weight: 750;
    background: var(--primary);
    box-shadow: none;
    transition: background 160ms ease, border-color 160ms ease;
}

button:hover {
    background: var(--primary-dark);
    box-shadow: none;
    filter: none;
    transform: none;
}

button:active {
    transform: none;
}

.secondary-button {
    color: #92400e;
    border: 1px solid #fed7aa;
    background: #fff7ed;
}

.secondary-button:hover {
    color: #78350f;
    background: #ffedd5;
}

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

.ghost-button:hover {
    background: #f8fafc;
}

.danger-button {
    color: #991b1b;
    border: 1px solid #fecaca;
    background: #fef2f2;
}

.danger-button:hover {
    background: #fee2e2;
}

.table-action,
.alert,
.api-key-box,
.api-key-box code,
.check-row,
.info-box,
.download-card,
.download-link,
.period-hint {
    border-radius: 6px;
}

.login-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: var(--shadow);
    backdrop-filter: none;
}

.login-card::before {
    height: 4px;
    background: var(--primary);
}

.brand-mark,
.brand-logo {
    color: #ffffff;
    border-radius: 6px;
    background: var(--primary);
    box-shadow: none;
}

.brand-mark {
    border-radius: 8px;
}

.sidebar {
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    border: 0;
    border-right: 1px solid #202938;
    border-radius: 0;
    padding: 24px 18px;
    background: #111827;
    box-shadow: none;
}

.brand {
    gap: 12px;
    margin-bottom: 30px;
}

.brand-logo {
    width: 42px;
    height: 42px;
}

nav {
    gap: 5px;
}

nav a {
    gap: 10px;
    border-radius: 6px;
    padding: 11px 12px;
    font-weight: 700;
}

nav a:hover,
nav a.active {
    background: #253044;
    transform: none;
}

.sidebar-note {
    left: 18px;
    right: 18px;
    bottom: 20px;
    border: 1px solid #303a4b;
    border-radius: 6px;
    padding: 14px;
    background: #1b2433;
    backdrop-filter: none;
}

.main {
    margin-left: var(--sidebar-width);
    padding: 28px 32px 44px;
}

.topbar {
    margin-bottom: 22px;
}

.eyebrow {
    gap: 8px;
    margin-bottom: 9px;
    color: #92400e;
    letter-spacing: 0.08em;
}

.eyebrow::before {
    width: 3px;
    height: 14px;
    border-radius: 0;
    background: var(--primary);
    box-shadow: none;
}

.top-desc {
    max-width: 760px;
    font-size: 15px;
}

.user-pill {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 13px;
    background: #ffffff;
    box-shadow: none;
    backdrop-filter: none;
}

.panel,
.stat-card {
    border: 1px solid var(--line);
    background: #ffffff;
    box-shadow: var(--shadow-soft);
    backdrop-filter: none;
}

.panel {
    border-radius: 8px;
    padding: 20px;
}

.control-panel,
.export-panel,
.helper-card,
.download-card {
    background: #ffffff;
}

.control-grid,
.export-grid,
.period-grid {
    gap: 14px;
}

.stats {
    gap: 14px;
}

.stat-card {
    min-height: 132px;
    border-radius: 8px;
    padding: 19px;
}

.stat-card > span {
    color: #667085;
    font-weight: 750;
    letter-spacing: 0.04em;
}

.stat-card strong {
    margin-top: 10px;
    font-size: clamp(32px, 4vw, 40px);
    letter-spacing: -1px;
}

.stat-card small {
    margin-top: 10px;
}

.grid,
.manage-grid,
.page-grid {
    gap: 14px;
}

.panel-head {
    margin-bottom: 16px;
}

.badge,
.api-status {
    border-radius: 5px;
}

.badge {
    min-height: 30px;
    padding: 6px 9px;
    color: #92400e;
    background: #fff7ed;
}

.table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

th {
    background: #f8fafc;
}

tbody tr:hover td {
    background: #fffaf2;
}

.api-key-box,
.info-box,
.download-card {
    box-shadow: none;
}

.api-status {
    padding: 4px 7px;
}

.mini-code {
    border-radius: 4px;
}

.mobile-bottom-nav {
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: none;
}

.mobile-bottom-nav a {
    border-radius: 5px;
}

.period-grid {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.period-hint {
    min-height: 44px;
    border: 1px solid #fed7aa;
    color: #92400e;
    font-weight: 650;
    background: #fff7ed;
}

.download-link {
    background: var(--primary);
    box-shadow: none;
}

.download-link:hover {
    background: var(--primary-dark);
}

@media (max-width: 1180px) {
    .sidebar {
        position: static;
        width: auto;
        margin: 0;
        border-right: 0;
        border-bottom: 1px solid #202938;
    }

    .sidebar-note {
        position: static;
        margin-top: 20px;
    }

    .main {
        margin-left: 0;
        padding: 24px;
    }
}

@media (max-width: 760px) {
    body {
        background: var(--bg);
    }

    .main {
        padding: 16px 12px 92px;
    }

    .panel,
    .stat-card,
    .login-card {
        border-radius: 8px;
    }

    .panel {
        padding: 16px;
    }

    .table-wrap {
        border-radius: 6px;
    }

    .mobile-bottom-nav {
        left: 8px;
        right: 8px;
        bottom: 8px;
        border-radius: 8px;
        padding: 6px;
    }

    .mobile-bottom-nav a {
        min-height: 48px;
        border-radius: 5px;
    }
}

/* Kelulut ESP32 Mesh monitor */
.mesh-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:18px 0; }
.mesh-stat { background:#f8fafc; border:1px solid #e2e8f0; border-radius:13px; padding:15px; }
.mesh-stat span { display:block; font-size:.79rem; color:#64748b; margin-bottom:8px; }
.mesh-stat strong { display:block; font-size:1.7rem; color:#0f172a; }
.mesh-pill { font-size:.76rem; display:inline-block; padding:5px 9px; border-radius:30px; white-space:nowrap; }
.mesh-pill.mesh-ok { background:#dcfce7; color:#166534; }
.mesh-pill.mesh-idle { background:#f1f5f9; color:#475569; }
@media(max-width:900px) { .mesh-stats { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:450px) { .mesh-stats { grid-template-columns:1fr; } }
