/* =========================================================
   SIKABUL — Sistem Informasi Keuangan Kampung Bugel
   Modern Ultra-Premium Fintech & Treasury Theme
   ========================================================= */

:root {
    /* Base Color Tokens (Light Mode - Crisp Luminous Slate matching Reference) */
    --background: 220 30% 97.5%; /* #f4f6fb soft cool grey */
    --foreground: 222 47% 11%;   /* #0f172a deep dark slate */

    --card: 0 0% 100%;           /* #ffffff pure white */
    --card-foreground: 222 47% 11%;

    --primary: 211 100% 50%;     /* #007aff vibrant electric blue */
    --primary-hover: 211 100% 45%;
    --primary-foreground: 0 0% 100%;

    --secondary: 220 20% 95%;
    --secondary-foreground: 222 47% 15%;

    --muted: 220 20% 94%;
    --muted-foreground: 215 16% 47%; /* #64748b */

    --accent: 210 100% 96%;      /* #e0f2fe light blue tint */
    --accent-foreground: 201 96% 39%; /* #0284c7 */

    --destructive: 0 84% 60%;    /* #ef4444 */
    --destructive-foreground: 0 0% 100%;

    --success: 142 76% 36%;      /* #16a34a clean green */
    --success-hover: 142 76% 30%;/* #15803d */
    --success-bg: 142 76% 95%;   /* #dcfce7 */
    --success-border: 142 76% 80%;

    --danger-bg: 0 93% 97%;      /* #fee2e2 */
    --danger-border: 0 84% 88%;  /* #fecaca */

    --warning: 38 92% 50%;
    --warning-bg: 48 100% 96%;
    --warning-border: 45 93% 82%;

    --info: 213 94% 52%;
    --info-bg: 214 95% 96%;
    --info-border: 213 94% 84%;

    --border: 220 18% 91%;       /* #eef2f6 / #e2e8f0 */
    --input: 220 16% 88%;        /* #e2e8f0 */
    --ring: 211 100% 50%;

    --sidebar: 222 55% 10%;      /* #0c1427 deep navy carbon */
    --sidebar-border: 222 35% 16%;
    --sidebar-foreground: 215 25% 92%;
    --sidebar-muted: 217 19% 65%;
    --sidebar-accent: 222 45% 17%;

    --radius: 1rem;              /* 16px */
    --radius-md: 0.75rem;        /* 12px */
    --radius-sm: 0.625rem;       /* 10px */
    --radius-lg: 1.125rem;       /* 18px */
    --sidebar-w: 268px;

    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 6px -1px rgba(15, 23, 42, 0.05), 0 1px 4px -1px rgba(15, 23, 42, 0.03);
    --shadow-md: 0 8px 22px -3px rgba(15, 23, 42, 0.07), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
    --shadow-lg: 0 18px 38px -4px rgba(15, 23, 42, 0.1), 0 8px 16px -2px rgba(15, 23, 42, 0.04);
    --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
}

:root[data-theme="dark"] {
    /* Dark Mode (Deep Navy / Carbon Luxe) */
    --background: 224 35% 8%;
    --foreground: 210 40% 96%;

    --card: 224 32% 12%;
    --card-foreground: 210 40% 96%;

    --primary: 217 91% 60%;
    --primary-hover: 217 91% 65%;
    --primary-foreground: 224 45% 8%;

    --secondary: 224 25% 18%;
    --secondary-foreground: 210 40% 92%;

    --muted: 224 24% 17%;
    --muted-foreground: 217 19% 65%;

    --accent: 224 35% 20%;
    --accent-foreground: 217 91% 72%;

    --destructive: 0 78% 62%;
    --destructive-foreground: 0 0% 100%;

    --success: 152 69% 52%;
    --success-bg: 152 45% 12%;
    --success-border: 152 45% 25%;

    --danger-bg: 0 50% 13%;
    --danger-border: 0 50% 25%;

    --warning: 41 96% 56%;
    --warning-bg: 41 50% 13%;
    --warning-border: 41 50% 25%;

    --info: 213 94% 65%;
    --info-bg: 213 50% 14%;
    --info-border: 213 50% 26%;

    --border: 224 24% 20%;
    --input: 224 24% 24%;
    --ring: 217 91% 60%;

    --sidebar: 226 45% 7%;
    --sidebar-border: 224 28% 15%;
    --sidebar-foreground: 210 40% 95%;
    --sidebar-muted: 217 19% 62%;
    --sidebar-accent: 224 35% 15%;

    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 8px -1px rgba(0, 0, 0, 0.4), 0 1px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px -3px rgba(0, 0, 0, 0.45), 0 4px 10px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 42px -4px rgba(0, 0, 0, 0.55), 0 8px 18px -2px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
}

/* ---------------- Reset & Base Styles ---------------- */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 0.875rem;
    line-height: 1.55;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: hsl(var(--muted-foreground) / 0.25);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground) / 0.45);
}

svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.viz-root svg, svg.viz-root {
    width: auto;
    height: auto;
}

::selection {
    background: hsl(var(--primary) / 0.25);
    color: hsl(var(--foreground));
}

/* ---------------- Layout ---------------- */

[hidden] {
    display: none !important;
}

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

.app[hidden],
.app[hidden] .sidebar,
#auth-portal-screen:not([hidden]) ~ #main-app,
#auth-portal-screen:not([hidden]) ~ #main-app .sidebar {
    display: none !important;
}

/* ---------------- Sidebar Navigation ---------------- */

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: hsl(var(--sidebar));
    border-right: 1px solid hsl(var(--sidebar-border));
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    color: hsl(var(--sidebar-foreground));
    box-shadow: 6px 0 30px rgba(0, 0, 0, 0.12);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid hsl(var(--sidebar-border));
    min-height: 82px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(235 86% 65%));
    color: #ffffff;
    box-shadow: 0 4px 14px hsl(var(--primary) / 0.4);
    position: relative;
    overflow: hidden;
}
.brand-mark svg {
    width: 24px;
    height: 24px;
}
.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.brand-name {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-sub {
    font-size: 0.72rem;
    color: hsl(var(--sidebar-muted));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: hsl(var(--sidebar-muted));
    padding: 0 0.75rem;
    margin-bottom: 0.4rem;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.65rem 0.875rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: hsl(var(--sidebar-muted));
    font: inherit;
    font-size: 0.865rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    position: relative;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.tab-btn svg {
    color: hsl(var(--sidebar-muted));
    width: 19px;
    height: 19px;
    transition: color 0.18s ease;
}
.tab-btn:hover {
    background: hsl(var(--sidebar-accent));
    color: #ffffff;
}
.tab-btn:hover svg {
    color: hsl(var(--primary));
}

.tab-btn.active {
    background: hsl(var(--primary));
    color: #ffffff;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.4);
}
.tab-btn.active svg {
    color: #ffffff;
}

.nav-badge {
    margin-left: auto;
    min-width: 22px;
    height: 20px;
    padding: 0 0.45rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: hsl(var(--sidebar-accent));
    color: hsl(var(--sidebar-foreground));
    font-size: 0.6875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.tab-btn.active .nav-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.settings-subnav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0.15rem 0 0.35rem 1.75rem;
    padding-left: 0.75rem;
    border-left: 1.5px solid hsl(var(--sidebar-border));
}
.settings-sub-btn {
    padding: 0.4rem 0.625rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: hsl(var(--sidebar-muted));
    font: inherit;
    font-size: 0.775rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}
.settings-sub-btn:hover,
.settings-sub-btn.active {
    background: hsl(var(--sidebar-accent));
    color: #ffffff;
}
.settings-sub-btn.active {
    color: hsl(var(--primary));
    font-weight: 600;
}

.sidebar-footer {
    padding: 0.875rem;
    border-top: 1px solid hsl(var(--sidebar-border));
    background: hsl(var(--sidebar) / 0.95);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    background: #17233f;
    border: 1px solid hsl(var(--sidebar-border));
    transition: background 0.15s ease;
}
.user-chip:hover {
    background: hsl(var(--sidebar-accent));
}

.avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(199 89% 48%));
    color: #ffffff;
    font-size: 0.775rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.user-name {
    font-size: 0.835rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.18);
    color: #38bdf8;
    font-size: 0.675rem;
    font-weight: 700;
    width: fit-content;
    margin-top: 0.15rem;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 0.875rem;
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    font: inherit;
    font-size: 0.835rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.sidebar-logout-btn svg {
    width: 16px;
    height: 16px;
}
.sidebar-logout-btn:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: #ef4444;
    color: #ffffff;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 40;
}

/* ---------------- Content & Topbar ---------------- */

.content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background: hsl(var(--background));
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.875rem;
    min-height: 68px;
    padding: 0.75rem 2rem;
    background: hsl(var(--card) / 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid hsl(var(--border));
    box-shadow: var(--shadow-xs);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: hsl(var(--muted-foreground));
    min-width: 0;
    flex: 1;
    overflow: hidden;
}
.crumb-root {
    white-space: nowrap;
    font-weight: 600;
}
.breadcrumb svg, .crumb-sep {
    width: 14px;
    height: 14px;
    opacity: 0.5;
    flex-shrink: 0;
}
.crumb-current {
    color: hsl(var(--foreground));
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.25rem 0.75rem;
    background: hsl(var(--muted));
    border-radius: var(--radius-sm);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    flex-shrink: 0;
}

/* Topbar Pill Widgets (Period & Date) */
.period-pill-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border: 1.5px solid hsl(var(--border));
    border-radius: 999px;
    background: hsl(var(--card));
    box-shadow: var(--shadow-xs);
}
.period-nav-btn {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}
.period-nav-btn:hover {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
}
.period-nav-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.4rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    white-space: nowrap;
}
.period-nav-label svg {
    width: 15px;
    height: 15px;
    color: hsl(var(--primary));
}

.today-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 38px;
    padding: 0 0.875rem;
    border: 1.5px solid hsl(var(--border));
    border-radius: 999px;
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--shadow-xs);
}
.today-date-badge svg {
    width: 15px;
    height: 15px;
    color: hsl(var(--primary));
}

.topbar-power-btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1.5px solid hsl(var(--danger-border));
    border-radius: 50%;
    background: hsl(var(--danger-bg));
    color: hsl(var(--destructive));
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: all 0.15s ease;
}
.topbar-power-btn svg {
    width: 17px;
    height: 17px;
}
.topbar-power-btn:hover {
    background: hsl(var(--destructive));
    color: #ffffff;
    border-color: hsl(var(--destructive));
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ---------------- Profile Dropdown ---------------- */

.profile-dropdown-wrap {
    position: relative;
}

.profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    height: 42px;
    padding: 0.25rem 0.875rem 0.25rem 0.35rem;
    border: 1.5px solid hsl(var(--border));
    border-radius: 999px;
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    font: inherit;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.profile-btn:hover {
    background: hsl(var(--accent));
    border-color: hsl(var(--primary) / 0.35);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.profile-btn[aria-expanded="true"] {
    background: hsl(var(--accent));
    border-color: hsl(var(--primary));
}

.profile-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(199 89% 48%));
    color: #ffffff;
    font-size: 0.775rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 6px hsl(var(--primary) / 0.35);
}

.profile-name {
    font-size: 0.835rem;
    font-weight: 700;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-chevron {
    width: 14px;
    height: 14px;
    color: hsl(var(--muted-foreground));
    transition: transform 0.2s ease;
}
.profile-btn[aria-expanded="true"] .profile-chevron {
    transform: rotate(180deg);
}

/* Dropdown Menu Box */
.profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 100;
    min-width: 230px;
    padding: 0.625rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-md);
    background: hsl(var(--card));
    box-shadow: var(--shadow-lg);
    animation: modalScaleIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}
.profile-menu[hidden] {
    display: none;
}

.profile-menu-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
}

.profile-menu-avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(152 76% 45%));
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 800;
    flex-shrink: 0;
}

.profile-menu-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.profile-menu-info strong {
    font-size: 0.885rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-menu-role {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: hsl(var(--primary) / 0.15);
    color: hsl(var(--primary));
    font-size: 0.7rem;
    font-weight: 700;
    margin-top: 0.25rem;
    width: fit-content;
}

.profile-menu-divider {
    height: 1px;
    background: hsl(var(--border));
    margin: 0.5rem 0;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: hsl(var(--foreground));
    font: inherit;
    font-size: 0.835rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.profile-menu-item svg {
    width: 16px;
    height: 16px;
    color: hsl(var(--muted-foreground));
}
.profile-menu-item:hover {
    background: hsl(var(--danger-bg));
    color: hsl(var(--destructive));
}
.profile-menu-item:hover svg {
    color: hsl(var(--destructive));
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: 1.5px solid hsl(var(--border));
    border-radius: var(--radius-sm);
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: all 0.18s ease;
}
.icon-btn:hover {
    background: hsl(var(--accent));
    border-color: hsl(var(--primary) / 0.35);
    color: hsl(var(--primary));
    transform: translateY(-1px);
}
.icon-btn:active {
    transform: translateY(0);
}

.ikon-gelap { display: none; }
:root[data-theme="dark"] .ikon-terang { display: none; }
:root[data-theme="dark"] .ikon-gelap { display: block; }

.menu-btn { display: none; }

/* ---------------- Main Content Area ---------------- */

main {
    padding: 2rem 2.25rem;
    flex: 1;
    max-width: 1560px;
    width: 100%;
}

.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
    animation: tabFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}
.page-head h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: hsl(var(--foreground));
}
.page-head > div > p {
    font-size: 0.885rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tanda-publik {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.625rem;
    border: 1px solid hsl(var(--success-border));
    border-radius: 999px;
    background: hsl(var(--success-bg));
    color: hsl(var(--success));
    font-size: 0.725rem;
    font-weight: 600;
}

.stempel {
    font-size: 0.775rem;
    color: hsl(var(--muted-foreground));
    white-space: nowrap;
    padding: 0.35rem 0.75rem;
    background: hsl(var(--muted) / 0.5);
    border-radius: var(--radius-sm);
    border: 1px solid hsl(var(--border));
}

/* ---------------- Cards System ---------------- */

.card {
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.card:hover {
    box-shadow: var(--shadow-md);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 2rem 1.25rem;
    border-bottom: 1px solid hsl(var(--border) / 0.7);
}

.head-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.head-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.head-icon svg {
    width: 20px;
    height: 20px;
}
.head-icon.masuk {
    background: hsl(var(--success-bg));
    color: hsl(var(--success));
}
.head-icon.keluar {
    background: hsl(var(--accent));
    color: hsl(var(--primary));
}
.head-icon.icon-list {
    background: hsl(var(--accent));
    color: hsl(var(--primary));
}

.card-head h2 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: hsl(var(--foreground));
}
.card-head p {
    font-size: 0.835rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.15rem;
}

.sub-pill-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.badge-count {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.875rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0284c7;
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
:root[data-theme="dark"] .badge-count {
    background: rgba(14, 165, 233, 0.2);
    color: #38bdf8;
}

.pill-blue {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0284c7;
    font-size: 0.75rem;
    font-weight: 700;
}
:root[data-theme="dark"] .pill-blue {
    background: rgba(14, 165, 233, 0.2);
    color: #38bdf8;
}

.pill-muted {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.card-body {
    padding: 1.75rem 2rem;
    width: 100%;
    box-sizing: border-box;
}
.card-body.pad-0 {
    padding: 0;
}

/* ---------------- Dashboard Stat Cards ---------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.card.stat {
    padding: 1.35rem 1.5rem;
    position: relative;
    overflow: hidden;
    border-top: 4px solid hsl(var(--primary));
    background: hsl(var(--card));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card.stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card.stat:nth-child(1) {
    border-top-color: hsl(var(--success));
    background: linear-gradient(180deg, hsl(var(--success-bg) / 0.3) 0%, hsl(var(--card)) 45%);
}
.card.stat:nth-child(2) {
    border-top-color: hsl(var(--destructive));
    background: linear-gradient(180deg, hsl(var(--danger-bg) / 0.3) 0%, hsl(var(--card)) 45%);
}
.card.stat:nth-child(3) {
    border-top-color: hsl(var(--primary));
    background: linear-gradient(180deg, hsl(var(--accent) / 0.3) 0%, hsl(var(--card)) 45%);
}
.card.stat:nth-child(4) {
    border-top-color: hsl(var(--warning));
    background: linear-gradient(180deg, hsl(var(--warning-bg) / 0.3) 0%, hsl(var(--card)) 45%);
}

.stat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.stat-head span {
    font-size: 0.8125rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.stat-head svg {
    color: hsl(var(--muted-foreground));
    width: 20px;
    height: 20px;
}
.card.stat:nth-child(1) .stat-head svg { color: hsl(var(--success)); }
.card.stat:nth-child(2) .stat-head svg { color: hsl(var(--destructive)); }
.card.stat:nth-child(3) .stat-head svg { color: hsl(var(--primary)); }
.card.stat:nth-child(4) .stat-head svg { color: hsl(var(--warning)); }

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum", "cv02";
    line-height: 1.2;
    color: hsl(var(--foreground));
}

.stat-delta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.45rem;
    font-size: 0.775rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.stat-delta.naik { color: hsl(var(--success)); }
.stat-delta.turun { color: hsl(var(--destructive)); }
.stat-delta .delta-catatan { color: hsl(var(--muted-foreground)); font-weight: 400; }

.stat-kaki {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.stat-sub {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}
.spark {
    flex-shrink: 0;
    line-height: 0;
}

/* ---------------- Dashboard Layout Grid ---------------- */

.dasbor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    align-items: start;
}

.dasbor-kanan {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.kepala-alat {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

/* Segmented Control Buttons */
.segmen {
    display: inline-flex;
    gap: 0.2rem;
    padding: 0.25rem;
    background: hsl(var(--muted));
    border-radius: var(--radius-sm);
    border: 1px solid hsl(var(--border));
}
.segmen-btn {
    padding: 0.35rem 0.75rem;
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    background: transparent;
    color: hsl(var(--muted-foreground));
    font: inherit;
    font-size: 0.775rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.segmen-btn:hover {
    color: hsl(var(--foreground));
}
.segmen-btn.active {
    background: hsl(var(--card));
    color: hsl(var(--primary));
    box-shadow: var(--shadow-xs);
}

/* ---------------- Charts & Visualizations ---------------- */

.viz-root {
    --viz-masuk: #10b981;
    --viz-keluar: #ef4444;
    --viz-saldo: #3b82f6;
    --viz-k1: #3b82f6;
    --viz-k2: #f59e0b;
    --viz-k3: #10b981;
    --viz-k4: #8b5cf6;
    --viz-grid: #e2e8f0;
    --viz-baseline: #cbd5e1;
    --viz-label: #64748b;
    --viz-permukaan: #ffffff;
}

:root[data-theme="dark"] .viz-root {
    --viz-masuk: #34d399;
    --viz-keluar: #f87171;
    --viz-saldo: #60a5fa;
    --viz-k1: #60a5fa;
    --viz-k2: #fbbf24;
    --viz-k3: #34d399;
    --viz-k4: #a78bfa;
    --viz-grid: #1e293b;
    --viz-baseline: #334155;
    --viz-label: #94a3b8;
    --viz-permukaan: #0f172a;
}

#grafik-aruskas {
    position: relative;
    min-height: 240px;
}
#grafik-aruskas svg {
    display: block;
    width: 100%;
}

.viz-tooltip {
    position: absolute;
    z-index: 25;
    min-width: 160px;
    padding: 0.625rem 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-sm);
    background: hsl(var(--card) / 0.95);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-lg);
    font-size: 0.775rem;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.viz-tooltip.tampil {
    opacity: 1;
    transform: translateY(0);
}
.viz-tooltip b {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    color: hsl(var(--foreground));
}
.viz-tooltip .tt-baris {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: hsl(var(--muted-foreground));
    margin-top: 0.2rem;
}
.viz-tooltip .tt-baris span:last-child {
    color: hsl(var(--foreground));
    font-weight: 600;
}
.viz-tooltip .tt-baris i {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
    margin-right: 0.375rem;
}
.viz-tooltip .tt-pisah {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid hsl(var(--border));
}

.viz-kosong {
    display: grid;
    place-items: center;
    min-height: 220px;
    color: hsl(var(--muted-foreground));
    font-size: 0.835rem;
    text-align: center;
    border: 1.5px dashed hsl(var(--border));
    border-radius: var(--radius-md);
    background: hsl(var(--muted) / 0.2);
}

.legenda {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.legenda-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.775rem;
    color: hsl(var(--muted-foreground));
    white-space: nowrap;
}
.kunci {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.kunci-masuk { background: #10b981; }
.kunci-keluar { background: #ef4444; }

/* Donat Breakdown */
.donat-baris {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
#donat-asal {
    flex-shrink: 0;
    line-height: 0;
}
.donat-legenda {
    list-style: none;
    flex: 1;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.donat-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
}
.donat-item .kunci {
    border-radius: 999px;
    width: 10px;
    height: 10px;
}
.donat-nama {
    flex: 1;
    color: hsl(var(--muted-foreground));
    font-weight: 500;
}
.donat-nilai {
    text-align: right;
}
.donat-nilai b {
    display: block;
    font-weight: 700;
    color: hsl(var(--foreground));
    font-variant-numeric: tabular-nums;
}
.donat-nilai span {
    display: block;
    font-size: 0.7rem;
    color: hsl(var(--muted-foreground));
    font-variant-numeric: tabular-nums;
}

/* Event Progress Meter */
.meter-daftar { display: flex; flex-direction: column; gap: 1.125rem; }
.meter-baris { display: flex; flex-direction: column; gap: 0.5rem; }
.meter-atas {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.625rem;
}
.meter-nama { font-size: 0.845rem; font-weight: 600; color: hsl(var(--foreground)); }
.meter-persen {
    font-size: 0.775rem;
    font-weight: 700;
    color: hsl(var(--primary));
    font-variant-numeric: tabular-nums;
}
.meter-kaki-baris {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.625rem;
    font-size: 0.725rem;
    color: hsl(var(--muted-foreground));
    font-variant-numeric: tabular-nums;
}

.bar {
    height: 8px;
    border-radius: 999px;
    background: hsl(var(--muted));
    overflow: hidden;
    position: relative;
}
.bar > i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, hsl(var(--primary)), hsl(152 76% 45%));
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.bar.penuh > i {
    background: linear-gradient(90deg, hsl(var(--success)), hsl(152 76% 55%));
}

.rekon-acara {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid hsl(var(--info-border));
    border-radius: var(--radius-sm);
    background: hsl(var(--info-bg));
    color: hsl(var(--foreground));
    font: inherit;
    font-size: 0.775rem;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}
.rekon-acara:hover {
    border-color: hsl(var(--info));
    transform: translateY(-1px);
}
.rekon-acara strong {
    color: hsl(var(--info));
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ---------------- Form Controls & Grid System ---------------- */

.layout-form {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    width: 100%;
}

.card.form-card,
.form-card {
    width: 100%;
    max-width: none;
    border-radius: var(--radius-lg);
    overflow: visible !important;
    position: relative;
    z-index: 30;
}
.form-card .card-body {
    padding: 1.75rem 2rem;
    overflow: visible !important;
}

/* Modern 4-Column Form Grid (matching Desktop Reference) */
.form-grid-4,
#form-masuk,
#form-keluar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem 1.25rem;
    align-items: end;
    width: 100%;
    box-sizing: border-box;
}

#form-acara,
#form-anggota {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem 1.5rem;
    align-items: start;
    width: 100%;
    box-sizing: border-box;
}

#form-masuk .field,
#form-keluar .field,
#form-acara .field,
#form-anggota .field {
    margin-bottom: 0;
    min-width: 0;
}

.field-span-2 { grid-column: span 2; }
.field-span-3 { grid-column: span 3; }
.field-span-4, .field-full { grid-column: 1 / -1; }

.form-actions-inline {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    justify-content: flex-end;
}

#form-masuk .form-actions,
#form-keluar .form-actions {
    grid-column: span 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.625rem;
    padding-top: 0;
    border-top: none;
    margin-top: 0;
    width: 100%;
}

#form-acara .form-actions,
#form-acara .tarif-set,
#form-anggota .form-actions,
#form-anggota .field-grid {
    grid-column: 1 / -1;
}

#form-anggota .field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 0;
    width: 100%;
}

.tarif-set {
    grid-column: 1 / -1;
    border: 1.5px solid hsl(var(--border));
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem 1.35rem;
    background: hsl(var(--muted) / 0.25);
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
}
.tarif-set legend {
    padding: 0 0.625rem;
    font-size: 0.825rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}
.tarif-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 0.5rem;
    width: 100%;
}
.tarif-grid .field {
    margin-bottom: 0;
    min-width: 0;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.75rem;
    max-width: 100%;
    width: 100%;
}
#form-pengaturan-akun,
#form-pengaturan-identitas,
.settings-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    width: 100%;
}
#form-pengaturan-akun .account-status,
#form-pengaturan-akun .form-actions,
.settings-form .logo-settings,
.settings-form .form-actions {
    grid-column: 1 / -1;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 0;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.field-grid .field {
    margin-bottom: 0;
    min-width: 0;
}

.autolengkap {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

label {
    font-size: 0.84rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    line-height: 1.3;
}

input, select, textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 48px;
    padding: 0 1.125rem;
    border: 1.5px solid hsl(var(--input));
    border-radius: 0.75rem;
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    font: inherit;
    font-size: 0.925rem;
    box-sizing: border-box;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
input::placeholder {
    color: hsl(var(--muted-foreground) / 0.65);
    font-size: 0.9rem;
}

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 15px;
    padding-right: 2.5rem;
    cursor: pointer;
}

:root[data-theme="dark"] select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3.5px hsl(var(--ring) / 0.18);
    background: hsl(var(--card));
}

input[type="date"] {
    cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease;
    padding: 4px;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    padding-top: 1.25rem;
    border-top: 1px solid hsl(var(--border));
    margin-top: 0.75rem;
    width: 100%;
}

/* ---------------- Buttons ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 44px;
    padding: 0 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.btn:active {
    transform: translateY(0);
    opacity: 0.92;
}
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3.5px hsl(var(--ring) / 0.28);
}

.btn-primary {
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-hover)));
    color: hsl(var(--primary-foreground));
    box-shadow: 0 4px 14px hsl(var(--primary) / 0.28);
}
.btn-primary:hover {
    box-shadow: 0 6px 20px hsl(var(--primary) / 0.38);
}

.btn-success {
    background: hsl(var(--success));
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
    border-radius: 10px;
    height: 48px;
    width: 100%;
}
.btn-success:hover {
    background: hsl(var(--success-hover));
    box-shadow: 0 6px 18px rgba(22, 163, 74, 0.4);
}

.btn-batal-edit {
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    border: 1.5px solid hsl(var(--border));
    border-radius: 10px;
    height: 48px;
    padding: 0 1rem;
    white-space: nowrap;
}
.btn-batal-edit:hover {
    background: hsl(var(--muted));
    border-color: hsl(var(--input));
}

.btn-outline {
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    border-color: hsl(var(--border));
}
.btn-outline:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    border-color: hsl(var(--primary) / 0.3);
}

.btn-ghost {
    background: transparent;
    color: hsl(var(--foreground));
    box-shadow: none;
}
.btn-ghost:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-destructive {
    background: linear-gradient(135deg, hsl(var(--destructive)), hsl(0 75% 50%));
    color: hsl(var(--destructive-foreground));
    box-shadow: 0 4px 14px hsl(var(--destructive) / 0.25);
}
.btn-destructive:hover {
    box-shadow: 0 6px 18px hsl(var(--destructive) / 0.35);
}

.btn-kecil {
    height: 32px;
    padding: 0 0.75rem;
    font-size: 0.75rem;
}

/* ---------------- Table System ---------------- */

.card-head-table {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    padding: 1.35rem 2rem 1.25rem;
    border-bottom: 1px solid hsl(var(--border) / 0.7);
}

.table-tools-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.search-box-wrap {
    position: relative;
    min-width: 240px;
}
.search-box-wrap svg {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: hsl(var(--muted-foreground));
    pointer-events: none;
    width: 16px;
    height: 16px;
}
.search-box-wrap input {
    height: 40px;
    border-radius: 999px;
    padding-left: 2.4rem;
    padding-right: 1rem;
    font-size: 0.835rem;
    background: hsl(var(--background));
    border: 1.5px solid hsl(var(--border));
}
.search-box-wrap input:focus-visible {
    background: hsl(var(--card));
    border-color: hsl(var(--ring));
}

.table-filter-select {
    height: 40px;
    border-radius: 999px;
    font-size: 0.835rem;
    font-weight: 600;
    padding: 0 2.25rem 0 1rem;
    background-color: hsl(var(--background));
    border: 1.5px solid hsl(var(--border));
    cursor: pointer;
    min-width: 140px;
}
.table-filter-select:focus-visible {
    background: hsl(var(--card));
    border-color: hsl(var(--ring));
}

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.855rem;
    text-align: left;
}

thead th {
    padding: 0.875rem 1.25rem;
    font-weight: 700;
    font-size: 0.725rem;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: hsl(var(--muted) / 0.45);
    border-bottom: 1px solid hsl(var(--border));
    white-space: nowrap;
}

tbody td {
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid hsl(var(--border));
    vertical-align: middle;
    transition: background-color 0.12s ease;
}
tbody tr:last-child td {
    border-bottom: none;
}
tbody tr:hover td {
    background: hsl(var(--accent) / 0.35);
}

.ta-right { text-align: right; }
.ta-center { text-align: center; }
.num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    white-space: nowrap;
}
.uraian { font-weight: 600; color: hsl(var(--foreground)); }
.masuk { color: hsl(var(--success)); font-weight: 700; }
.keluar { color: hsl(var(--destructive)); font-weight: 700; }
.kosong { color: hsl(var(--muted-foreground)); }

/* ---------------- Badges & Pills ---------------- */

.badge-kapsul {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0284c7;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid rgba(2, 132, 199, 0.18);
}
:root[data-theme="dark"] .badge-kapsul {
    background: rgba(14, 165, 233, 0.18);
    color: #38bdf8;
    border-color: rgba(14, 165, 233, 0.3);
}

.badge-metode {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.725rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ---------------- Action Buttons in Tables ---------------- */

.btn-icon-edit {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(2, 132, 199, 0.2);
    background: #e0f2fe;
    color: #0284c7;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-icon-edit svg {
    width: 15px;
    height: 15px;
}
.btn-icon-edit:hover {
    background: #0284c7;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.btn-icon-delete {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    background: #fee2e2;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-icon-delete svg {
    width: 15px;
    height: 15px;
}
.btn-icon-delete:hover {
    background: #ef4444;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

:root[data-theme="dark"] .btn-icon-edit {
    background: rgba(14, 165, 233, 0.18);
    color: #38bdf8;
    border-color: rgba(14, 165, 233, 0.3);
}
:root[data-theme="dark"] .btn-icon-edit:hover {
    background: #0284c7;
    color: #ffffff;
}

:root[data-theme="dark"] .btn-icon-delete {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}
:root[data-theme="dark"] .btn-icon-delete:hover {
    background: #ef4444;
    color: #ffffff;
}

.badge-lunas {
    background: hsl(var(--success-bg));
    border-color: hsl(var(--success-border));
    color: hsl(var(--success));
}
.badge-lunas::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: hsl(var(--success));
}

.badge-kurang {
    background: hsl(var(--info-bg));
    border-color: hsl(var(--info-border));
    color: hsl(var(--info));
}
.badge-kurang::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: hsl(var(--info));
}

.badge-belum {
    background: hsl(var(--danger-bg));
    border-color: hsl(var(--danger-border));
    color: hsl(var(--destructive));
}
.badge-belum::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: hsl(var(--destructive));
}

.badge-kategori, .badge-aktif {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border-color: hsl(var(--border));
}

.badge-rencana {
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
}
.badge-berlangsung {
    background: hsl(var(--info-bg));
    border-color: hsl(var(--info-border));
    color: hsl(var(--info));
}
.badge-selesai {
    background: hsl(var(--success-bg));
    border-color: hsl(var(--success-border));
    color: hsl(var(--success));
}

/* ---------------- Action Icon Buttons ---------------- */

.aksi-grup {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
}

.aksi-btn, .hapus-btn {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    transition: all 0.15s ease;
}
.aksi-btn svg, .hapus-btn svg {
    width: 15px;
    height: 15px;
}
.aksi-btn:hover {
    background: hsl(var(--accent));
    color: hsl(var(--foreground));
}
.aksi-btn.hapus:hover, .hapus-btn:hover {
    background: hsl(var(--danger-bg));
    color: hsl(var(--destructive));
}

.empty-row td {
    padding: 3rem 1.5rem;
    text-align: center;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}
.empty-row:hover td {
    background: transparent;
}

/* ---------------- Group Tab & Filter Toolbar ---------------- */

.grup-tab {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    padding: 0.3rem;
    margin-bottom: 1rem;
    background: hsl(var(--muted));
    border-radius: var(--radius-md);
    border: 1px solid hsl(var(--border));
}

.grup-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.875rem;
    border: none;
    border-radius: calc(var(--radius-md) - 3px);
    background: transparent;
    color: hsl(var(--muted-foreground));
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.grup-btn span {
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: hsl(var(--foreground) / 0.08);
}
.grup-btn:hover {
    color: hsl(var(--foreground));
}
.grup-btn.active {
    background: hsl(var(--card));
    color: hsl(var(--primary));
    box-shadow: var(--shadow-xs);
}

.toolbar-card {
    margin-bottom: 1.25rem;
}
.toolbar-card .toolbar {
    padding: 1.125rem 1.35rem;
}

.search-wrap {
    position: relative;
}
.search-wrap svg {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: hsl(var(--muted-foreground));
    pointer-events: none;
    width: 16px;
    height: 16px;
}
.search-wrap input {
    padding-left: 2.4rem;
}

.pilih-inline {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0 0.875rem;
    height: 42px;
    border: 1.5px solid hsl(var(--border));
    border-radius: var(--radius-sm);
    background: hsl(var(--card));
}
.pilih-inline label {
    font-size: 0.775rem;
    color: hsl(var(--muted-foreground));
    white-space: nowrap;
}
.pilih-inline select {
    width: auto;
    height: 32px;
    padding: 0 1.75rem 0 0;
    border: none;
    background-color: transparent;
    font-size: 0.835rem;
    font-weight: 600;
}

.head-actions {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ---------------- Cards for Tagihan & Acara ---------------- */

.kategori-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.kategori-kartu {
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    border-top: 3px solid hsl(var(--primary));
}
.kategori-atas {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.kategori-atas h3 {
    font-size: 1rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}
.kategori-tarif {
    font-size: 0.775rem;
    color: hsl(var(--muted-foreground));
    font-variant-numeric: tabular-nums;
}
.kategori-angka {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.775rem;
    color: hsl(var(--muted-foreground));
}
.kategori-angka strong {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    font-variant-numeric: tabular-nums;
    margin-top: 0.15rem;
}
.kategori-angka .terkumpul strong { color: hsl(var(--success)); }
.kategori-angka .kurang strong { color: hsl(var(--destructive)); }

.acara-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}

.acara-kartu {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
}
.acara-atas {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}
.acara-atas h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}
.acara-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    font-size: 0.775rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.35rem;
}
.acara-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.acara-meta svg {
    width: 14px;
    height: 14px;
}

.acara-angka {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
    padding: 0.875rem 0;
    border-top: 1px solid hsl(var(--border));
    border-bottom: 1px solid hsl(var(--border));
}
.acara-angka div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.acara-angka span {
    font-size: 0.7rem;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.acara-angka strong {
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    color: hsl(var(--foreground));
}

.acara-target {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.acara-target-teks {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.775rem;
    color: hsl(var(--muted-foreground));
}
.acara-target-teks strong {
    color: hsl(var(--foreground));
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.acara-bawah {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.775rem;
    color: hsl(var(--muted-foreground));
}

.sub-acara {
    display: block;
    font-size: 0.72rem;
    color: hsl(var(--muted-foreground));
    font-weight: 400;
    margin-top: 2px;
}

/* ---------------- Autocomplete & Dropdowns ---------------- */

.autolengkap {
    position: relative;
    width: 100%;
    z-index: 40;
}
.autolengkap:focus-within {
    z-index: 60;
}

.autolengkap input {
    padding-right: 2.35rem;
}

.btn-toggle-saran {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}
.btn-toggle-saran:hover {
    color: hsl(var(--foreground));
    background: hsl(var(--accent));
}
.btn-toggle-saran svg {
    width: 15px;
    height: 15px;
    pointer-events: none;
}

.saran {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 260px;
    overflow-y: auto;
    padding: 0.35rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-md);
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
}
.saran-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.65rem 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid hsl(var(--border) / 0.6);
    margin-bottom: 0.25rem;
}
.saran-kosong {
    padding: 0.75rem 0.65rem;
    font-size: 0.825rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.4;
    text-align: center;
}
.saran-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.625rem;
    padding: 0.5625rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.835rem;
    transition: background 0.12s ease;
}
.saran-item:hover, .saran-item.aktif {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}
.saran-item strong {
    font-weight: 600;
}
.saran-item mark {
    background: hsl(var(--primary) / 0.2);
    color: inherit;
    border-radius: 2px;
    padding: 0 2px;
}
.saran-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
}

/* ---------------- Total Chip in Page Headers ---------------- */

.total-chip {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.625rem 1rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-md);
    background: hsl(var(--card));
    box-shadow: var(--shadow-xs);
}
.total-chip span {
    font-size: 0.7rem;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.total-chip strong {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.total-chip.masuk {
    border-left: 4px solid hsl(var(--success));
}
.total-chip.masuk strong {
    color: hsl(var(--success));
}
.total-chip.keluar {
    border-left: 4px solid hsl(var(--destructive));
}
.total-chip.keluar strong {
    color: hsl(var(--destructive));
}

/* ---------------- Organization Structure ---------------- */

.struktur-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.jabatan {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-top: 3px solid hsl(var(--primary));
}
.jabatan-ikon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, hsl(var(--primary) / 0.15), hsl(var(--primary) / 0.05));
    color: hsl(var(--primary));
    margin-bottom: 0.5rem;
}
.jabatan-ikon svg {
    width: 22px;
    height: 22px;
}
.jabatan h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}
.jabatan p {
    font-size: 0.835rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.5;
}

/* ---------------- Backup & Restore Widgets ---------------- */

.hitung-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}
.hitung-kotak {
    padding: 1rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-md);
    background: hsl(var(--muted) / 0.4);
}
.hitung-kotak strong {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: hsl(var(--foreground));
}
.hitung-kotak span {
    font-size: 0.725rem;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    font-weight: 600;
}

.jatuhkan {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 2.5rem 1.5rem;
    border: 2px dashed hsl(var(--border));
    border-radius: var(--radius-lg);
    background: hsl(var(--muted) / 0.25);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}
.jatuhkan svg {
    width: 36px;
    height: 36px;
    color: hsl(var(--primary));
    margin-bottom: 0.35rem;
}
.jatuhkan:hover, .jatuhkan:focus-visible {
    outline: none;
    border-color: hsl(var(--primary));
    background: hsl(var(--accent) / 0.3);
}

/* ---------------- Settings & Profile View ---------------- */

.pengaturan-tabs {
    max-width: 1000px;
    margin-bottom: 1.25rem;
}
.settings-grid {
    max-width: 1000px;
}
.settings-card {
    border-top: 4px solid hsl(var(--primary));
}
.settings-card:last-child {
    border-top-color: hsl(var(--success));
}

.account-status {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-sm);
    background: hsl(var(--muted) / 0.45);
}
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: hsl(var(--success));
    box-shadow: 0 0 0 4px hsl(var(--success) / 0.2);
}
.role-badge {
    margin-left: auto;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: hsl(var(--primary) / 0.15);
    color: hsl(var(--primary));
    font-size: 0.725rem;
    font-weight: 700;
}

.logo-settings {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}
.logo-preview {
    display: grid;
    place-items: center;
    width: 110px;
    height: 110px;
    overflow: hidden;
    border: 2px solid hsl(var(--border));
    border-radius: 24px;
    background: linear-gradient(135deg, hsl(var(--info-bg)), hsl(var(--success-bg)));
    color: hsl(var(--primary));
    font-size: 1.75rem;
    font-weight: 800;
    box-shadow: var(--shadow-md);
}
.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------------- Modals & Dialogs ---------------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.modal-backdrop[hidden] {
    display: none;
}

.modal-dialog {
    width: min(100%, 440px);
    padding: 1.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    background: hsl(var(--card));
    box-shadow: var(--shadow-lg);
    animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: hsl(var(--danger-bg));
    color: hsl(var(--destructive));
}
.modal-icon svg {
    width: 24px;
    height: 24px;
}
.login-dialog .modal-icon {
    background: hsl(var(--accent));
    color: hsl(var(--primary));
}

.modal-dialog h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}
.modal-dialog p {
    margin-top: 0.5rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.85rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    margin-top: 1.5rem;
}
.modal-terbuka {
    overflow: hidden;
}

/* ---------------- Toast Notifications ---------------- */

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    max-width: calc(100vw - 3rem);
    padding: 0.875rem 1.25rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-md);
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    box-shadow: var(--shadow-lg);
    font-size: 0.84rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    pointer-events: none;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.tampil {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.toast.sukses {
    border-left: 4px solid hsl(var(--success));
}
.toast.galat {
    border-left: 4px solid hsl(var(--destructive));
}

/* ---------------- Responsive Media Queries ---------------- */

@media (max-width: 1100px) {
    .dasbor-grid { grid-template-columns: 1fr; }
    .stat-grid.empat { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
    .form-grid-4,
    #form-masuk,
    #form-keluar,
    #form-acara,
    #form-anggota,
    .tarif-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .field-span-3 {
        grid-column: 1 / -1;
    }
    #form-masuk .form-actions,
    #form-keluar .form-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.buka {
        transform: none;
    }
    .sidebar-overlay.tampil {
        display: block;
    }
    .content {
        margin-left: 0;
    }
    .menu-btn {
        display: grid;
    }
    .topbar {
        padding: 0.625rem 1rem;
        gap: 0.5rem;
        min-height: 58px;
    }
    .period-pill-nav,
    .today-date-badge {
        display: none;
    }
    main {
        padding: 1.25rem 1rem;
    }
    .card-body {
        padding: 1.5rem 1.5rem;
    }
    .card-head,
    .card-head-table {
        padding: 1.35rem 1.5rem 0.85rem;
    }
    .page-head {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }
    .page-head h1 {
        font-size: 1.45rem;
    }
    .total-chip {
        width: 100%;
    }
    .stat-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .topbar {
        padding: 0.5rem 0.75rem;
        gap: 0.45rem;
        min-height: 54px;
    }
    .crumb-root, .crumb-sep {
        display: none;
    }
    .crumb-current {
        max-width: 125px;
        font-size: 0.8rem;
        padding: 0.15rem 0.45rem;
    }
    .topbar-actions {
        gap: 0.35rem;
    }
    .install-btn {
        padding: 0 0.55rem;
        height: 36px;
    }
    .install-btn .install-teks {
        display: none;
    }
    .auth-btn {
        max-width: 110px;
        height: 36px;
        padding: 0 0.55rem;
        font-size: 0.75rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .icon-btn {
        width: 36px;
        height: 36px;
    }
    main {
        padding: 1rem 0.875rem;
    }
    .card {
        border-radius: 1rem;
    }
    .card-body {
        padding: 1.5rem 1.25rem;
    }
    .form-card .card-body {
        padding: 1.5rem 1.25rem;
    }
    .card-head,
    .card-head-table {
        padding: 1.25rem 1.25rem 0.85rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .table-tools-wrap {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }
    .search-box-wrap,
    .table-filter-select {
        width: 100%;
        min-width: 0;
    }
    .kepala-alat {
        flex-wrap: wrap;
        justify-content: space-between;
    }
    .segmen {
        flex: 1 1 auto;
    }
    .segmen-btn {
        flex: 1;
        text-align: center;
    }
    .form-grid-4,
    #form-masuk,
    #form-keluar,
    #form-acara,
    #form-anggota {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
        width: 100%;
    }
    .field-span-2,
    .field-span-3,
    .field-span-4 {
        width: 100%;
    }
    #form-anggota .field-grid,
    .tarif-grid,
    .settings-grid,
    #form-pengaturan-akun,
    #form-pengaturan-identitas,
    .settings-form {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
        width: 100%;
    }
    .field {
        display: flex;
        flex-direction: column;
        gap: 0.45rem;
        width: 100%;
        min-width: 0;
        margin-bottom: 0;
    }
    .form-actions,
    #form-masuk .form-actions,
    #form-keluar .form-actions {
        display: flex;
        flex-direction: column-reverse;
        gap: 0.625rem;
        width: 100%;
        padding-top: 0.5rem;
    }
    .form-actions .btn,
    .form-actions .btn-success,
    .form-actions .btn-batal-edit {
        width: 100%;
        height: 46px;
        justify-content: center;
    }
    .stat-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .kategori-grid {
        grid-template-columns: 1fr;
    }
    .acara-grid {
        grid-template-columns: 1fr;
    }
    .struktur-grid {
        grid-template-columns: 1fr;
    }
    .hitung-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================================
   PORTAL LANDING & LOGIN PAGE (SIKABUL AUTH PORTAL)
   ========================================================= */

.auth-portal-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    background: radial-gradient(circle at 10% 20%, rgba(0, 122, 255, 0.08) 0%, transparent 45%),
                radial-gradient(circle at 90% 80%, rgba(22, 163, 74, 0.08) 0%, transparent 45%),
                hsl(var(--background));
    position: relative;
    box-sizing: border-box;
    width: 100%;
}
.auth-portal-screen[hidden] {
    display: none !important;
}

.auth-portal-container {
    width: 100%;
    max-width: 1060px;
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
    margin: auto;
}

.auth-brand-head {
    display: flex;
    align-items: center;
    gap: 1.125rem;
    justify-content: center;
    text-align: left;
}

.auth-brand-mark {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(235 86% 65%));
    color: #ffffff;
    box-shadow: 0 8px 24px hsl(var(--primary) / 0.4);
    flex-shrink: 0;
    overflow: hidden;
}
.auth-brand-mark svg {
    width: 32px;
    height: 32px;
}
.auth-brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-brand-info {
    display: flex;
    flex-direction: column;
}
.auth-app-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: hsl(var(--foreground));
    line-height: 1.2;
}
.auth-app-sub {
    font-size: 0.925rem;
    color: hsl(var(--muted-foreground));
    font-weight: 500;
    margin-top: 0.15rem;
}

/* Cards Grid */
.auth-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.75rem;
    align-items: stretch;
}

.auth-card {
    background: hsl(var(--card));
    border: 1.5px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 2.25rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.auth-card:hover {
    box-shadow: var(--shadow-lg);
}

/* Public Portal Card */
.portal-card {
    background: linear-gradient(160deg, hsl(var(--card)) 0%, hsl(var(--accent) / 0.35) 100%);
    border-color: rgba(0, 122, 255, 0.25);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.portal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.875rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0284c7;
    font-size: 0.775rem;
    font-weight: 700;
    width: fit-content;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(2, 132, 199, 0.2);
}
.portal-badge svg {
    width: 15px;
    height: 15px;
}
:root[data-theme="dark"] .portal-badge {
    background: rgba(14, 165, 233, 0.2);
    color: #38bdf8;
    border-color: rgba(14, 165, 233, 0.3);
}

.portal-card h2 {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: hsl(var(--foreground));
    margin-bottom: 0.75rem;
    line-height: 1.25;
}

.portal-desc {
    font-size: 0.9rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.portal-features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.portal-feat-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.865rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}
.portal-feat-item svg {
    width: 18px;
    height: 18px;
    color: hsl(var(--success));
    flex-shrink: 0;
}

.btn-portal-public {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    height: 52px;
    width: 100%;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(211 100% 42%));
    color: #ffffff;
    font-family: inherit;
    font-size: 0.975rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.35);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: auto;
}
.btn-portal-public svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}
.btn-portal-public:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 122, 255, 0.45);
}
.btn-portal-public:hover svg {
    transform: translateX(3px);
}

/* Admin Login Card */
.login-card {
    border-top: 4px solid hsl(var(--primary));
}

.login-card-head {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.login-head-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: hsl(var(--accent));
    color: hsl(var(--primary));
    flex-shrink: 0;
}
.login-head-icon svg {
    width: 22px;
    height: 22px;
}

.login-card-head h2 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: hsl(var(--foreground));
}
.login-card-head p {
    font-size: 0.835rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.2rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.input-with-icon {
    position: relative;
    width: 100%;
}
.input-with-icon svg {
    position: absolute;
    left: 1.125rem;
    top: 50%;
    transform: translateY(-50%);
    color: hsl(var(--muted-foreground));
    pointer-events: none;
    width: 18px;
    height: 18px;
}
.input-with-icon input {
    padding-left: 2.85rem !important;
}

.login-error-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: hsl(var(--danger-bg));
    border: 1px solid hsl(var(--danger-border));
    color: hsl(var(--destructive));
    font-size: 0.835rem;
    font-weight: 600;
}
.login-error-alert[hidden] {
    display: none;
}

.btn-login-submit {
    height: 48px;
    width: 100%;
    font-size: 0.925rem;
    font-weight: 700;
    border-radius: 12px;
    margin-top: 0.5rem;
}

.auth-card-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid hsl(var(--border) / 0.7);
}

.secure-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    font-weight: 500;
}
.secure-badge svg {
    width: 14px;
    height: 14px;
    color: hsl(var(--primary));
}

@media (max-width: 820px) {
    .auth-cards-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .auth-card {
        padding: 1.75rem 1.35rem;
    }
    .auth-brand-head {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
}
