:root {
    --sc-navy-950: #07172c;
    --sc-navy-900: #0a1d36;
    --sc-navy-800: #102a4b;
    --sc-blue-600: #1682ff;
    --sc-blue-700: #006bea;
    --sc-green-500: #24bd61;
    --sc-yellow-500: #ffb800;
    --sc-red-500: #ff5b6b;
    --sc-purple-500: #7c4dff;
    --sc-slate-500: #64748b;
    --sc-slate-900: #0f172a;
    --sc-surface: #f4f7fb;
    --sc-card: #ffffff;
    --sc-border: #e7edf5;
}

body {
    margin: 0;
    background: var(--sc-surface);
    color: var(--sc-slate-900);
    font-family: "Noto Sans Thai", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, var(--sc-navy-950), var(--sc-navy-900));
    color: #e7eefb;
    display: flex;
    flex-direction: column;
    padding: 24px 14px;
}

.brand {
    align-items: center;
    display: flex;
    font-size: 22px;
    font-weight: 800;
    gap: 10px;
    margin: 0 8px 26px;
}

.brand-mark {
    align-items: center;
    background: var(--sc-blue-600);
    border-radius: 10px;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.nav-section {
    color: #7f91aa;
    font-size: 12px;
    font-weight: 700;
    margin: 20px 10px 8px;
}

.nav-link {
    align-items: center;
    border-radius: 8px;
    color: #d9e4f5;
    display: flex;
    font-weight: 600;
    gap: 12px;
    padding: 12px 14px;
    text-decoration: none;
}

.nav-link.active,
.nav-link:hover {
    background: linear-gradient(135deg, var(--sc-blue-600), var(--sc-blue-700));
    color: #ffffff;
}

.main {
    min-width: 0;
}

.topbar {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid var(--sc-border);
    display: flex;
    height: 68px;
    justify-content: space-between;
    padding: 0 28px;
}

.content {
    padding: 28px;
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    margin: 0;
}

.page-subtitle {
    color: var(--sc-slate-500);
    margin: 4px 0 22px;
}

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

.metric-card,
.panel {
    background: var(--sc-card);
    border: 1px solid var(--sc-border);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.metric-card {
    align-items: center;
    display: flex;
    gap: 18px;
    min-height: 110px;
    padding: 20px;
}

.metric-icon {
    align-items: center;
    border-radius: 14px;
    color: #ffffff;
    display: flex;
    font-size: 24px;
    height: 58px;
    justify-content: center;
    width: 58px;
}

.metric-label {
    color: var(--sc-slate-500);
    font-weight: 700;
}

.metric-value {
    font-size: 26px;
    font-weight: 800;
    margin-top: 4px;
}

.dashboard-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: 1.55fr 1fr;
    margin-bottom: 18px;
}

.panel {
    padding: 20px;
}

.panel-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 18px;
}

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

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

.table-actions {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-light-primary {
    background: #eaf4ff;
    border: 1px solid #cfe6ff;
    border-radius: 8px;
    color: var(--sc-blue-700);
    font-weight: 800;
    padding: 9px 14px;
    text-decoration: none;
}

.btn-soft-danger {
    background: #fff0f2;
    border: 1px solid #ffd4db;
    border-radius: 8px;
    color: #dc2645;
    font-weight: 800;
    padding: 8px 12px;
}

.btn-soft-success {
    background: #e9fbf0;
    border: 1px solid #c7f3d7;
    border-radius: 8px;
    color: #14924b;
    font-weight: 800;
    padding: 8px 12px;
}

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

.secret-field {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.credential-preview {
    background: #f8fafc;
    border: 1px solid var(--sc-border);
    border-radius: 6px;
    color: var(--sc-slate-900);
    display: inline-block;
    font-size: 12px;
    max-width: 220px;
    overflow-wrap: anywhere;
    padding: 6px 8px;
    white-space: normal;
}

.key-preview {
    background: #f8fafc;
    border: 1px solid var(--sc-border);
    border-radius: 6px;
    color: var(--sc-slate-900);
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    max-width: 260px;
    overflow-wrap: anywhere;
    padding: 6px 8px;
}

.setting-banner {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--sc-border);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 18px 20px;
}

.setting-banner strong {
    display: block;
    font-size: 17px;
}

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

.mapping-option {
    align-items: flex-start;
    background: #f8fafc;
    border: 1px solid var(--sc-border);
    border-radius: 8px;
    display: flex;
    gap: 10px;
    padding: 12px;
}

.mapping-option input {
    margin-top: 4px;
}

.mapping-option span span {
    color: var(--sc-slate-500);
    display: block;
    font-size: 13px;
    margin-top: 2px;
}

.chart-placeholder {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(8, 1fr);
    height: 230px;
}

.chart-bar {
    background: linear-gradient(180deg, rgba(22, 130, 255, 0.88), rgba(36, 189, 97, 0.26));
    border-radius: 8px 8px 0 0;
}

.table {
    margin: 0;
}

.table th {
    background: #f2f5fa;
    color: var(--sc-slate-500);
    font-size: 13px;
}

.badge-soft {
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 10px;
}

.badge-success {
    background: #dcfce7;
    color: #14924b;
}

.badge-danger {
    background: #ffe4e8;
    color: #e11d48;
}

.badge-warning {
    background: #fff2d7;
    color: #b77900;
}

.date-filter {
    border: 1px solid var(--sc-border);
    border-radius: 8px;
    color: var(--sc-slate-900);
    font-weight: 700;
    padding: 10px 14px;
}

.logout-button {
    background: #ffffff;
    border: 1px solid var(--sc-border);
    border-radius: 8px;
    color: var(--sc-slate-500);
    font-weight: 700;
    padding: 8px 12px;
}

.auth-page {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(7, 23, 44, 0.96), rgba(10, 29, 54, 0.92)),
        var(--sc-navy-950);
    display: flex;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
    margin: 0 auto;
    max-width: 440px;
    padding: 34px;
    width: 100%;
}

.auth-brand {
    align-items: center;
    color: var(--sc-slate-900);
    display: flex;
    font-size: 24px;
    font-weight: 800;
    gap: 10px;
    margin-bottom: 28px;
}

.auth-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--sc-slate-500);
    margin-bottom: 24px;
}

.form-label {
    font-weight: 700;
}

.field-hint {
    color: var(--sc-slate-500);
    font-size: 12px;
    margin-top: 6px;
}

.log-payload {
    background: #0f172a;
    border-radius: 8px;
    color: #dbeafe;
    font-size: 12px;
    margin: 0;
    max-height: 360px;
    overflow: auto;
    padding: 14px;
    white-space: pre-wrap;
}

.form-control {
    border-color: var(--sc-border);
    border-radius: 8px;
    padding: 11px 12px;
}

.btn-primary {
    background: var(--sc-blue-600);
    border-color: var(--sc-blue-600);
    border-radius: 8px;
    font-weight: 800;
    padding: 11px 14px;
}

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

    .sidebar {
        display: none;
    }

    .metric-grid,
    .dashboard-grid,
    .form-grid,
    .mapping-grid {
        grid-template-columns: 1fr;
    }
}
