@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/11.2.0/sweetalert2.min.css');

:root {
    --font-panel: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition-fast: 160ms ease;
}

:root[data-theme="light"],
html[data-theme="light"] {
    color-scheme: light;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-2: #eef3f8;
    --surface-3: #e4ebf3;
    --text: #101827;
    --text-muted: #64748b;
    --border: #d7e0ea;
    --input-bg: #ffffff;
    --accent: #2563eb;
    --accent-2: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --shadow: 0 18px 50px rgba(15, 23, 42, .11);
}

:root[data-theme="dark"],
html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1218;
    --surface: #171c24;
    --surface-2: #1f2630;
    --surface-3: #252d38;
    --text: #f5f7fb;
    --text-muted: #9aa8b8;
    --border: #303947;
    --input-bg: #111827;
    --accent: #38bdf8;
    --accent-2: #86efac;
    --danger: #fb7185;
    --warning: #fbbf24;
    --shadow: 0 18px 50px rgba(0, 0, 0, .30);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    background: var(--bg);
}

body {
    color: var(--text);
    font-family: var(--font-panel) !important;
    font-size: 15px;
    letter-spacing: 0;
    background:
        radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 28rem),
        linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 28%, transparent), transparent 24rem),
        var(--bg);
}

a {
    color: var(--accent);
}

.container {
    max-width: 1180px;
}

.panel-main {
    padding-bottom: 92px;
}

.panel-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
}

.panel-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text) !important;
    font-weight: 800;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 28%, transparent);
}

.navbar-toggler {
    width: 42px;
    height: 42px;
    padding: 0;
    border-color: var(--border);
}

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

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding-inline: 12px !important;
    color: var(--text-muted) !important;
    font-weight: 700;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.nav-link:hover,
.nav-link:focus,
.user-menu-toggle[aria-expanded="true"] {
    color: var(--text) !important;
    background: var(--surface-2);
    transform: translateY(-1px);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.theme-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
}

:root[data-theme="light"] .theme-icon-light,
html[data-theme="light"] .theme-icon-light,
:root[data-theme="dark"] .theme-icon-dark,
html[data-theme="dark"] .theme-icon-dark {
    display: none;
}

.dropdown-menu {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 8px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--surface-2);
    color: var(--text);
}

.dropdown-divider {
    border-top-color: var(--border);
}

.card,
.modal-content,
.list-group-item,
.swal2-popup {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow);
}

.card-header,
.modal-header,
.modal-footer,
.bg-dark {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.text-white {
    color: var(--text) !important;
}

.card-body {
    color: var(--text);
}

.table-responsive {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.table {
    color: var(--text);
    margin-bottom: 0;
    min-width: 720px;
}

.table > :not(caption) > * > * {
    background: transparent;
    color: var(--text);
    border-bottom-color: var(--border);
}

.table thead th {
    background: var(--surface-2);
    color: var(--text);
    font-weight: 800;
}

.form-control,
.form-select,
input,
textarea,
select {
    background-color: var(--input-bg) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
    border-radius: var(--radius-sm) !important;
}

.form-control:focus,
.form-select:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--accent) 22%, transparent) !important;
}

.form-text,
.text-muted,
.small {
    color: var(--text-muted) !important;
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 800;
    min-height: 38px;
    white-space: normal;
}

.btn-dark,
.btn-default,
.btn-primary {
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 66%, var(--accent-2))) !important;
    border-color: transparent !important;
    color: #fff !important;
}

.btn-outline-dark,
.btn-outline-light {
    color: var(--text) !important;
    border-color: var(--border) !important;
    background: var(--surface) !important;
}

.btn-outline-dark:hover,
.btn-outline-light:hover {
    color: #fff !important;
    background: var(--accent) !important;
    border-color: var(--accent) !important;
}

.badge {
    border-radius: 999px;
    font-weight: 800;
}

.badge.text-dark {
    color: var(--text) !important;
    background: var(--surface-2);
}

.alert {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.alert-success {
    background: color-mix(in srgb, var(--accent-2) 14%, var(--surface)) !important;
    color: var(--text) !important;
    border-color: color-mix(in srgb, var(--accent-2) 42%, var(--border)) !important;
}

.panel-footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1020;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(16px);
}

.key-sensi {
    filter: blur(3px);
}

.dashboard-shell {
    display: grid;
    gap: 24px;
    animation: panelFadeUp .55s ease both;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 15%, var(--surface)), var(--surface));
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.eyebrow,
.dashboard-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .08em;
}

.dashboard-hero h1,
.dashboard-title {
    margin: 6px 0 0;
    font-size: 32px;
    line-height: 1.1;
    font-weight: 800;
}

.dashboard-hero p,
.dashboard-subtitle {
    color: var(--text-muted);
    margin: 10px 0 0;
}

.hero-badge,
.hero-icon {
    display: inline-grid;
    place-items: center;
    gap: 8px;
    min-width: 116px;
    min-height: 72px;
    padding: 14px 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-weight: 800;
    box-shadow: 0 20px 42px color-mix(in srgb, var(--accent) 25%, transparent);
}

.hero-badge i,
.hero-icon i {
    font-size: 24px;
}

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

.stat-card {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    animation: panelFadeUp .5s ease both;
}

.stat-card small {
    display: block;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-card strong {
    display: block;
    margin-top: 3px;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
}

.stat-card:nth-child(2) {
    animation-delay: .08s;
}

.stat-card:nth-child(3) {
    animation-delay: .16s;
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 13px;
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    color: var(--accent);
}

.stat-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
}

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

.dashboard-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: panelFadeUp .55s ease both;
}

.card-title-row,
.dashboard-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.card-title-row h2,
.dashboard-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.card-title-row > span {
    color: var(--text-muted);
    font-weight: 700;
}

.expiry-card .countdown,
.history-card .table-responsive,
.info-card .info-list {
    padding: 20px;
}

.dashboard-card-body {
    padding: 20px;
}

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

.countdown > span,
.countdown-unit {
    padding: 18px 12px;
    text-align: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.countdown strong,
.countdown-number {
    display: block;
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
    color: var(--accent);
}

.countdown small,
.countdown-label {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.countdown.expired {
    grid-template-columns: 1fr;
}

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

.info-list > div,
.info-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

.info-list span,
.info-name {
    color: var(--text-muted);
    font-weight: 800;
}

.info-list strong,
.info-value {
    font-weight: 800;
    text-align: right;
}

.history-table {
    min-width: 760px;
}

.history-table td {
    padding: 14px 12px;
}

.muted-pill,
.key-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 800;
}

.key-chip {
    color: var(--accent);
}

.empty-state {
    padding: 34px !important;
    color: var(--text-muted);
    text-align: center;
}

.empty-state i {
    display: block;
    margin-bottom: 8px;
    font-size: 24px;
}

.btn-danger-soft {
    border: 1px solid color-mix(in srgb, #ef4444 35%, var(--border));
    background: color-mix(in srgb, #ef4444 10%, var(--surface));
    color: #ef4444;
    font-weight: 800;
}

.btn-danger-soft:hover {
    border-color: #ef4444;
    background: #ef4444;
    color: #fff;
}

@keyframes panelFadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1200px) {
    .container {
        max-width: 100%;
    }
}

@media (max-width: 992px) {
    body {
        font-size: 14px;
    }

    .dashboard-grid,
    .dashboard-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .panel-content {
        padding-inline: 14px !important;
    }

    .navbar-collapse {
        padding-top: 12px;
    }

    .navbar-actions {
        align-items: stretch;
        width: 100%;
    }

    .nav-link {
        width: 100%;
    }

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

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 576px) {
    .panel-main {
        padding-bottom: 104px;
    }

    .panel-brand span:last-child {
        max-width: 170px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dashboard-title {
        font-size: 26px;
    }

    .stat-grid,
    .countdown {
        grid-template-columns: 1fr;
    }

    .hero-icon {
        width: 58px;
        height: 58px;
        font-size: 24px;
    }

    .btn,
    .form-control,
    .form-select {
        width: 100%;
    }
}
