/* ==========================================================================
   Datapid Drive - design system
   --------------------------------------------------------------------------
   One source of truth for colour, type, spacing, radius and elevation.
   Styled after the Sneat admin template: light surfaces, a violet primary,
   soft shadows instead of hard borders, and generous rounding.

   Everything below is presentational only. Class names other views already
   rely on (.card-custom, .btn-gradient, .file-item-card, .nav-link-custom,
   .dropzone-overlay) keep their names, so no markup or Alpine binding has
   to change.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    /* Brand (Stitch Vibrant Indigo) */
    --dp-primary: #4f46e5;
    --dp-primary-hover: #4338ca;
    --dp-primary-soft: rgba(79, 70, 229, .12);
    --dp-primary-gradient: linear-gradient(135deg, #4f46e5 0%, #4338ca 50%, #312e81 100%);

    /* Semantic */
    --dp-success: #10b981;
    --dp-info: #0ea5e9;
    --dp-warning: #f59e0b;
    --dp-danger: #ef4444;

    /* Surfaces (Stitch Soft Neomorphism-Infused Canvas) */
    --dp-body-bg: #f8f9ff;
    --dp-surface: #ffffff;
    --dp-surface-alt: #eff4ff;

    /* Ink (Stitch Slate Spectrum) */
    --dp-heading: #0b1c30;
    --dp-body: #464555;
    --dp-muted: #777587;
    --dp-border: #e2e8f0;

    /* Sidebar */
    --dp-sidebar-width: 260px;
    --dp-sidebar-bg: #ffffff;
    --dp-sidebar-ink: #464555;
    --dp-sidebar-ink-hover: #0b1c30;

    /* Elevation - Stitch ambient luminance drop shadow */
    --dp-shadow-xs: 0 1px 3px rgba(15, 23, 42, .04);
    --dp-shadow-sm: 0 4px 20px -2px rgba(15, 23, 42, .04), 0 2px 6px -1px rgba(15, 23, 42, .02);
    --dp-shadow-md: 0 10px 30px -4px rgba(79, 70, 229, .08), 0 4px 12px -2px rgba(15, 23, 42, .03);
    --dp-shadow-lg: 0 20px 40px -6px rgba(15, 23, 42, .12);

    /* Radius (Stitch generous curvature scale) */
    --dp-radius-sm: .5rem;
    --dp-radius: 1rem;
    --dp-radius-lg: 1.25rem;
    --dp-radius-xl: 1.5rem;
    --dp-radius-pill: 9999px;

    /* Motion */
    --dp-ease: .18s cubic-bezier(.4, 0, .2, 1);

    /* Legacy aliases - older markup still references these. */
    --primary-gradient: var(--dp-primary-gradient);
    --card-shadow: var(--dp-shadow-sm);
    --sidebar-bg: var(--dp-sidebar-bg);
    --sidebar-text: var(--dp-sidebar-ink);
    --sidebar-active: #ffffff;
    --sidebar-active-bg: var(--dp-primary-soft);
}

/* Bootstrap speaks the same palette, so stock components inherit the theme. */
:root {
    --bs-primary: var(--dp-primary);
    --bs-primary-rgb: 79, 70, 229;
    --bs-body-color: var(--dp-body);
    --bs-body-bg: var(--dp-body-bg);
    --bs-border-color: var(--dp-border);

    /* The whole rounded-* utility scale, remapped onto our tokens. */
    --bs-border-radius-sm: var(--dp-radius-sm);
    --bs-border-radius: var(--dp-radius);
    --bs-border-radius-lg: var(--dp-radius-lg);
    --bs-border-radius-xl: var(--dp-radius-xl);
    --bs-border-radius-xxl: var(--dp-radius-xl);
    --bs-font-sans-serif: "Plus Jakarta Sans", "Inter", "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* Bootstrap indigo for -subtle / -emphasis pairs. */
    --bs-primary-bg-subtle: rgba(79, 70, 229, .12);
    --bs-primary-border-subtle: rgba(79, 70, 229, .28);
    --bs-primary-text-emphasis: #4338ca;
}

/* --------------------------------------------------------------------------
   Dark Mode Tokens & Theme Overrides (Sleek Dark Slate & Indigo)
   -------------------------------------------------------------------------- */
[data-bs-theme="dark"], [data-theme="dark"], html.dark {
    --dp-body-bg: #0b1120;
    --dp-surface: #1e293b;
    --dp-surface-alt: #334155;

    --dp-heading: #f8fafc;
    --dp-body: #cbd5e1;
    --dp-muted: #94a3b8;
    --dp-border: #334155;

    --dp-sidebar-bg: #1e293b;
    --dp-sidebar-ink: #94a3b8;
    --dp-sidebar-ink-hover: #f8fafc;

    --dp-shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --dp-shadow-sm: 0 2px 6px rgba(0, 0, 0, .4);
    --dp-shadow-md: 0 4px 16px rgba(0, 0, 0, .5);
    --dp-shadow-lg: 0 8px 28px rgba(0, 0, 0, .6);

    color-scheme: dark;
}

[data-bs-theme="dark"] .bg-white,
[data-theme="dark"] .bg-white {
    background-color: #1e293b !important;
}

[data-bs-theme="dark"] .bg-light,
[data-theme="dark"] .bg-light {
    background-color: #334155 !important;
}

[data-bs-theme="dark"] .table,
[data-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: #cbd5e1;
    --bs-table-hover-color: #f8fafc;
    --bs-table-hover-bg: rgba(255, 255, 255, .04);
    border-color: #334155;
}

[data-bs-theme="dark"] .table-light,
[data-theme="dark"] .table-light {
    --bs-table-bg: #1e293b;
    --bs-table-color: #94a3b8;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #0f172a !important;
    border-color: var(--dp-primary) !important;
    color: #f8fafc !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .25) !important;
}

[data-bs-theme="dark"] .dropdown-menu,
[data-theme="dark"] .dropdown-menu {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .5) !important;
}

[data-bs-theme="dark"] .dropdown-item,
[data-theme="dark"] .dropdown-item {
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .modal-content,
[data-theme="dark"] .modal-content {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .text-dark,
[data-theme="dark"] .text-dark {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .text-muted,
[data-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .card,
[data-theme="dark"] .card {
    background-color: #1e293b;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-start,
[data-bs-theme="dark"] .border-end,
[data-theme="dark"] .border,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-start,
[data-theme="dark"] .border-end {
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .gdrive-grid-card,
[data-theme="dark"] .gdrive-grid-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .gdrive-search-input,
[data-theme="dark"] .gdrive-search-input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .gdrive-chip,
[data-theme="dark"] .gdrive-chip {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}
[data-bs-theme="dark"] .gdrive-chip:hover,
[data-theme="dark"] .gdrive-chip:hover {
    background: #334155 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .license-stat-card,
[data-theme="dark"] .license-stat-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .gdrive-table thead th,
[data-theme="dark"] .gdrive-table thead th {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}

[x-cloak] { display: none !important; }

/* Always leave room for the scrollbar. Without this, moving from a short page
   to a long one adds a scrollbar and shifts the entire layout sideways, which
   reads as the interface lurching every time a menu item is clicked. */
html {
    scrollbar-gutter: stable;
}

/* --------------------------------------------------------------------------
   2. Base and typography
   -------------------------------------------------------------------------- */
body {
    font-family: var(--bs-font-sans-serif);
    font-size: .9375rem;
    line-height: 1.53;
    background-color: var(--dp-body-bg);
    color: var(--dp-body);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--dp-heading);
    font-weight: 600;
    letter-spacing: -.01em;
}

h1, .h1 { font-size: 1.625rem; }
h2, .h2 { font-size: 1.375rem; }
h3, .h3 { font-size: 1.1875rem; }
h4, .h4 { font-size: 1.0625rem; }
h5, .h5 { font-size: 1rem; }
h6, .h6 { font-size: .9375rem; }

.text-muted { color: var(--dp-muted) !important; }
.text-slate-800 { color: var(--dp-heading) !important; }

/* Dipakai puluhan kali di explorer, modal berbagi, dan toolbar, tapi bukan
   bawaan Bootstrap - tanpa ini baris berkas dan label pilihan tampil dengan
   kursor teks meski jelas bisa diklik. */
.cursor-pointer { cursor: pointer; }
.transition-all { transition: all .2s ease; }

.section-eyebrow {
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--dp-muted);
}

a { text-decoration: none; }

/* Bootstrap has no .min-w-0, yet the shell relies on it: without it a long
   page title refuses to shrink and pushes the topbar actions off screen. */
.min-w-0 { min-width: 0 !important; }
.flex-none { flex: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d2d5dd; border-radius: var(--dp-radius-pill); }
::-webkit-scrollbar-thumb:hover { background: #b9bdc9; }

/* --------------------------------------------------------------------------
   3. Shell - sidebar, topbar, content
   -------------------------------------------------------------------------- */
.app-sidebar {
    width: var(--dp-sidebar-width);
    background-color: var(--dp-sidebar-bg);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1045;
    box-shadow: var(--dp-shadow-sm);
    transition: transform var(--dp-ease);
}

.app-main {
    margin-left: var(--dp-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.5rem 1rem;
}

.app-brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: var(--dp-radius);
    background: var(--dp-primary-gradient);
    color: #fff;
    box-shadow: 0 3px 10px rgba(105, 108, 255, .35);
}

.app-brand-name {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--dp-heading);
    line-height: 1.2;
    margin: 0;
}

.app-brand-sub {
    font-size: .6875rem;
    color: var(--dp-muted);
}

/* Scrollable menu region: the brand stays put, the links scroll. */
.app-sidebar-menu {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0 .875rem 1rem;
}

.menu-heading {
    padding: 1.125rem .75rem .375rem;
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--dp-muted);
}

.nav-link-custom {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .875rem;
    margin-bottom: .125rem;
    border-radius: var(--dp-radius);
    color: var(--dp-sidebar-ink);
    font-size: .9375rem;
    /* Constant weight across states. Going 400 -> 500 on the active item made
       the label a few pixels wider, so the text nudged sideways as you moved
       between pages. The active state is already unmistakable from the filled
       pill and white text. */
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--dp-ease), color var(--dp-ease);
}

.nav-link-custom .lucide { flex: none; color: inherit; }

.nav-link-custom:hover {
    background-color: rgba(67, 89, 113, .06);
    color: var(--dp-sidebar-ink-hover);
}

/* Sneat signature: the active item is a filled gradient pill. */
.nav-link-custom.active {
    background: var(--dp-primary-gradient);
    color: #fff;
    box-shadow: 0 2px 6px rgba(105, 108, 255, .4);
}

.nav-link-custom.active .lucide,
.nav-link-custom.active [class*="text-"] { color: #fff !important; }

/* Sidebar Collapsible Accordion Navigation */
.menu-accordion-item {
    margin-bottom: 0.35rem;
}
.nav-link-collapse {
    cursor: pointer;
    user-select: none;
    font-weight: 600;
}
.nav-link-collapse .collapse-icon {
    width: 15px;
    height: 15px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.55;
    flex-shrink: 0;
}
.nav-link-collapse:not(.collapsed) .collapse-icon {
    transform: rotate(180deg);
}
.nav-link-collapse:not(.collapsed) {
    color: var(--dp-primary);
}
.submenu-container {
    padding-left: 0.5rem;
    margin-top: 0.2rem;
    margin-bottom: 0.4rem;
    margin-left: 1.15rem;
    border-left: 2px solid rgba(105, 108, 255, 0.2);
}
.nav-sublink {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.75rem;
    margin-bottom: 0.15rem;
    border-radius: var(--dp-radius);
    color: var(--dp-sidebar-ink);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}
.nav-sublink .lucide {
    width: 15px;
    height: 15px;
    opacity: 0.75;
    flex-shrink: 0;
}
.nav-sublink:hover {
    background-color: rgba(67, 89, 113, 0.08);
    color: var(--dp-sidebar-ink-hover);
}
.nav-sublink.active {
    background: var(--dp-primary-gradient);
    color: #fff !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(105, 108, 255, 0.35);
}
.nav-sublink.active .lucide,
.nav-sublink.active [class*="text-"] {
    color: #fff !important;
    opacity: 1;
}

.app-sidebar-footer {
    padding: .875rem 1.5rem;
    border-top: 1px solid var(--dp-border);
    font-size: .75rem;
    color: var(--dp-muted);
    text-align: center;
}

/* Topbar - floats as a rounded card over the content, Sneat style. */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    margin: 1rem 1.5rem 0;
    padding: .625rem 1.25rem;
    border-radius: var(--dp-radius);
    background-color: var(--dp-surface);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--dp-shadow-sm);
    border: 1px solid var(--dp-border);
    transition: background-color var(--dp-ease), border-color var(--dp-ease);
}

.app-page-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--dp-heading);
    margin: 0;
    line-height: 1.3;
}

.app-page-subtitle {
    font-size: .8125rem;
    color: var(--dp-muted);
}

.app-content { padding: 1.5rem; }

/* Off-canvas sidebar on small screens. */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(56, 69, 81, .5);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dp-ease), visibility var(--dp-ease);
}

.sidebar-backdrop.is-visible { opacity: 1; visibility: visible; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.is-open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .app-topbar { margin: .75rem .875rem 0; }
    .app-content { padding: .875rem; }
}

/* --------------------------------------------------------------------------
   4. Components
   -------------------------------------------------------------------------- */
.card,
.card-custom {
    border: 0;
    border-radius: var(--dp-radius);
    background-color: var(--dp-surface);
    box-shadow: var(--dp-shadow-sm);
}

.card-custom { transition: box-shadow var(--dp-ease), transform var(--dp-ease); }

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--dp-border);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--dp-heading);
}

.btn {
    border-radius: var(--dp-radius);
    font-weight: 500;
    font-size: .9375rem;
    padding: .5rem 1.125rem;
    transition: box-shadow var(--dp-ease), transform var(--dp-ease), background-color var(--dp-ease);
}

.btn-primary {
    background-color: var(--dp-primary);
    border-color: var(--dp-primary);
    box-shadow: 0 2px 4px rgba(105, 108, 255, .4);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--dp-primary-hover);
    border-color: var(--dp-primary-hover);
    box-shadow: 0 2px 6px rgba(105, 108, 255, .5);
}

.btn-outline-primary { color: var(--dp-primary); border-color: var(--dp-primary); }
.btn-outline-primary:hover { background-color: var(--dp-primary); border-color: var(--dp-primary); }

.btn-gradient {
    background: var(--dp-primary-gradient);
    color: #fff;
    border: 0;
    font-weight: 500;
    border-radius: var(--dp-radius);
    padding: .5rem 1.125rem;
    box-shadow: 0 2px 6px rgba(105, 108, 255, .4);
}

.btn-gradient:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(105, 108, 255, .5);
}

/* Custom Action Buttons */
.btn-purple {
    background-color: #696cff !important;
    border-color: #696cff !important;
    background-color: var(--dp-primary) !important;
    border-color: var(--dp-primary) !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(79, 70, 229, .35);
    transition: all var(--dp-ease);
}

.btn-purple:hover, .btn-purple:focus {
    background-color: var(--dp-primary-hover) !important;
    border-color: var(--dp-primary-hover) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, .45);
    transform: translateY(-1px);
}

.btn-purple:active {
    background-color: #3730a3 !important;
    transform: translateY(0);
}

.btn-purple .lucide {
    color: #ffffff !important;
}

.btn-outline-purple {
    background-color: transparent !important;
    border: 1px solid var(--dp-primary) !important;
    color: var(--dp-primary) !important;
    font-weight: 600;
}

.btn-outline-purple:hover {
    background-color: var(--dp-primary) !important;
    color: #ffffff !important;
}

/* Square icon-only button used in the topbar. */
.btn-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: var(--dp-radius);
    background: transparent;
    color: var(--dp-body);
    transition: background-color var(--dp-ease), color var(--dp-ease);
}

.btn-icon:hover { background-color: rgba(67, 89, 113, .08); color: var(--dp-heading); }

/* Perfectly round icon button.
   `rounded-circle` alone does not produce a circle: the width comes from the
   padding plus the glyph, but the height comes from the line-height, so the
   two rarely match and the result is a slightly squashed oval. Fixing both
   axes and centring with grid is the only way to guarantee a circle. */
.btn-round {
    display: inline-grid;
    place-items: center;
    width: 2.375rem;
    height: 2.375rem;
    padding: 0;
    flex: none;
    border-radius: 50%;
    line-height: 1;
}

.btn-round.btn-round-sm { width: 2rem; height: 2rem; }
.btn-round.btn-round-lg { width: 2.75rem; height: 2.75rem; }

/* Bootstrap's size utilities would otherwise re-introduce the mismatch. */
.btn-round.btn-sm,
.btn-round.btn-lg { padding: 0; }

.btn-round > .lucide,
.btn-round > i { display: block; }

.notification-dot {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--dp-danger);
    border: 2px solid var(--dp-surface);
}

.form-label {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--dp-heading);
    margin-bottom: .375rem;
}

.form-text { color: var(--dp-muted); }

.form-control,
.form-select {
    border-radius: var(--dp-radius);
    border-color: var(--dp-border);
    padding: .5rem .875rem;
    font-size: .9375rem;
    color: var(--dp-heading);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--dp-primary);
    box-shadow: 0 0 .25rem .05rem var(--dp-primary-soft);
}

.form-check-input:checked {
    background-color: var(--dp-primary);
    border-color: var(--dp-primary);
}

.form-check-input:focus { box-shadow: 0 0 .25rem .05rem var(--dp-primary-soft); }

.table { color: var(--dp-body); }

.table > thead th {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--dp-muted);
    border-bottom-color: var(--dp-border);
    background-color: transparent;
    padding: .75rem 1.25rem;
}

.table > tbody td {
    padding: .8125rem 1.25rem;
    border-bottom-color: var(--dp-border);
    vertical-align: middle;
}

.table-hover > tbody > tr:hover > * { background-color: var(--dp-surface-alt); }

.badge {
    border-radius: var(--dp-radius-sm);
    font-weight: 500;
    font-size: .75rem;
    padding: .3rem .55rem;
}

.dropdown-menu {
    border: 0;
    border-radius: var(--dp-radius);
    box-shadow: var(--dp-shadow-md);
    padding: .35rem;
    font-size: .9375rem;
}

.dropdown-item {
    border-radius: var(--dp-radius-sm);
    padding: .5rem .75rem;
    color: var(--dp-body);
}

.dropdown-item:hover,
.dropdown-item:focus { background-color: var(--dp-surface-alt); color: var(--dp-heading); }

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

.modal-content {
    border: 0;
    border-radius: var(--dp-radius-lg);
    box-shadow: var(--dp-shadow-lg);
}

.modal-header,
.modal-footer { border-color: var(--dp-border); padding: 1.125rem 1.5rem; }

.modal-body { padding: 1.5rem; }

.alert { border: 0; border-radius: var(--dp-radius); box-shadow: var(--dp-shadow-xs); }

.breadcrumb-item a { color: var(--dp-muted); font-weight: 400; }
.breadcrumb-item a:hover { color: var(--dp-primary); }
.breadcrumb-item.active { color: var(--dp-heading); font-weight: 500; }

.avatar-initial {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    font-size: .8125rem;
    font-weight: 600;
    color: #fff;
}

/* --------------------------------------------------------------------------
   5. Explorer surfaces (shared shell styling only)
   -------------------------------------------------------------------------- */
.file-item-card {
    border: 1px solid var(--dp-border);
    border-radius: var(--dp-radius);
    padding: 1rem;
    background: var(--dp-surface);
    cursor: pointer;
    position: relative;
    transition: border-color var(--dp-ease), box-shadow var(--dp-ease), transform var(--dp-ease);
}

.file-item-card:hover {
    border-color: var(--dp-primary);
    box-shadow: var(--dp-shadow-md);
    transform: translateY(-2px);
}

.file-item-card.selected {
    border-color: var(--dp-primary);
    background-color: rgba(105, 108, 255, .06);
}

.dropzone-overlay {
    border: 2px dashed var(--dp-primary);
    background-color: rgba(105, 108, 255, .05);
    border-radius: var(--dp-radius-lg);
}

.lucide { width: 18px; height: 18px; stroke-width: 2px; }

/* Reserve the icon's box before JavaScript fills it.
   Lucide replaces every <i data-lucide> with an <svg> on DOMContentLoaded.
   Until it does, the placeholder is an empty inline element of zero width, so
   the moment the swap happens every label jumps sideways - the whole sidebar
   visibly shifts on each page load. Giving the placeholder the same box the
   svg will take keeps the layout still.
   Elements carrying their own inline width/height override this, as before. */
[data-lucide] {
    display: inline-block;
    width: 18px;
    height: 18px;
    flex: none;
    vertical-align: middle;
}

/* --------------------------------------------------------------------------
   6. Toasts
   -------------------------------------------------------------------------- */
/* Bottom-left. Top-right sat directly on top of the sticky topbar, covering
   the notification bell and the profile menu while a toast was showing. */
.toast-stack {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 1090;
    display: flex;
    flex-direction: column-reverse;
    gap: .625rem;
    width: min(380px, calc(100vw - 2rem));
    pointer-events: none;
}

@media (max-width: 575.98px) {
    .toast-stack { bottom: 1rem; left: 1rem; right: 1rem; width: auto; }
}

.app-toast {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .875rem 1rem;
    border-radius: var(--dp-radius);
    background: var(--dp-surface);
    box-shadow: var(--dp-shadow-lg);
    border-left: 3px solid var(--dp-primary);
    pointer-events: auto;
    animation: dp-toast-in .22s cubic-bezier(.4, 0, .2, 1);
}

@keyframes dp-toast-in {
    from { opacity: 0; transform: translateX(-1rem); }
    to   { opacity: 1; transform: translateX(0); }
}

.app-toast-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: var(--dp-radius-sm);
}

.app-toast-title {
    font-size: .875rem;
    font-weight: 600;
    color: var(--dp-heading);
    line-height: 1.3;
}

.app-toast-message {
    font-size: .8125rem;
    color: var(--dp-body);
    word-break: break-word;
}

.app-toast-close {
    border: 0;
    background: transparent;
    color: var(--dp-muted);
    font-size: 1.25rem;
    line-height: 1;
    padding: 0 .125rem;
    flex: none;
}

.app-toast-close:hover { color: var(--dp-heading); }

.toast-success { border-left-color: var(--dp-success); }
.toast-success .app-toast-icon { background: rgba(113, 221, 55, .16); color: var(--dp-success); }

.toast-danger { border-left-color: var(--dp-danger); }
.toast-danger .app-toast-icon { background: rgba(255, 62, 29, .16); color: var(--dp-danger); }

.toast-warning { border-left-color: var(--dp-warning); }
.toast-warning .app-toast-icon { background: rgba(255, 171, 0, .16); color: var(--dp-warning); }

.toast-info { border-left-color: var(--dp-info); }
.toast-info .app-toast-icon { background: rgba(3, 195, 236, .16); color: var(--dp-info); }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* /* --------------------------------------------------------------------------
   Dashboard: tinted metric tiles, pastel badges and luxury hero card
   -------------------------------------------------------------------------- */

/* A soft wash of the tile's own colour plus a top accent, so a row of metrics
   is scannable by colour rather than four identical white boxes. */
.stat-card-tinted {
    background: linear-gradient(180deg,
        rgba(var(--stat-rgb), .10) 0%,
        rgba(var(--stat-rgb), .03) 42%,
        var(--dp-surface) 100%);
    border: 1px solid rgba(var(--stat-rgb), .20);
    border-radius: 1rem;
    box-shadow: 0 4px 20px -2px rgba(var(--stat-rgb), .10), 0 2px 6px rgba(0, 0, 0, .04);
    transition: transform .22s cubic-bezier(.4, 0, .2, 1), box-shadow .22s cubic-bezier(.4, 0, .2, 1);
}

.stat-card-tinted:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px -4px rgba(var(--stat-rgb), .22);
}

.stat-card-tinted::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3.5px;
    background: var(--stat-color);
    box-shadow: 0 0 10px var(--stat-color);
}

.stat-card-tinted .stat-card-label {
    color: var(--stat-color);
    font-weight: 600;
    letter-spacing: .02em;
}

.stat-card-icon-badge {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(var(--stat-rgb), .14);
    color: var(--stat-color);
    border: 1.5px solid rgba(var(--stat-rgb), .28);
    box-shadow: 0 4px 12px rgba(var(--stat-rgb), .18);
    transition: transform .22s ease, box-shadow .22s ease;
    flex-shrink: 0;
}

.stat-card-tinted:hover .stat-card-icon-badge {
    transform: scale(1.1) rotate(4deg);
    box-shadow: 0 6px 16px rgba(var(--stat-rgb), .28);
}

/* Ring chart. Drawn with conic-gradient so no charting library is loaded and
   the page still renders on a machine with no internet access. */
.dp-donut {
    position: relative;
    display: grid;
    place-items: center;
    width: var(--donut-size, 148px);
    height: var(--donut-size, 148px);
    border-radius: 50%;
    flex: none;
}

.dp-donut-hole {
    display: grid;
    place-items: center;
    width: 68%;
    height: 68%;
    border-radius: 50%;
    background: var(--dp-surface);
    color: var(--dp-heading);
    box-shadow: inset 0 2px 6px rgba(67, 89, 113, .08);
}

/* Nama kelas di bawah ini harus sama persis dengan yang dipancarkan
   resources/views/components/donut.blade.php. Sebelumnya tidak: CSS menulis
   .dp-donut-label / -legend-row / -name / -val sementara komponen memancarkan
   .dp-donut-caption / <li> / -legend-label / -legend-value. Tidak satu pun
   aturan yang cocok, sehingga legenda dirender sebagai daftar bullet mentah
   dengan jarak baris bawaan - persis kesan menumpuk pada kartu
   "Komposisi Aktivitas". */

.dp-donut-caption {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    color: var(--dp-heading);
}

.dp-donut-sub {
    font-size: .6875rem;
    color: var(--dp-muted);
    margin-top: .125rem;
}

.dp-donut-legend {
    /* <ul> membawa bullet, padding kiri, dan margin bawah bawaan peramban.
       Ketiganya harus dilucuti sebelum apa pun tampak rapi. */
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;

    display: flex;
    flex-direction: column;
    gap: .375rem;

    /* Lebar penuh agar nilai dapat dirapatkan ke kanan dan angkanya
       sejajar satu kolom, bukan mengekor di belakang label. */
    width: 100%;
    max-width: 15rem;
}

.dp-donut-legend li {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .8125rem;
    line-height: 1.4;
}

.dp-donut-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: none;
}

.dp-donut-legend-label {
    color: var(--dp-body);
    flex: 1;
    min-width: 0;

    /* Label sepanjang "Folder baru" tidak boleh membungkus dan mendorong
       barisnya menjadi dua baris di kartu yang sempit. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dp-donut-legend-value {
    font-weight: 600;
    color: var(--dp-heading);
    flex: none;

    /* Angka rata kanan dengan lebar minimum, supaya 7 dan 459 berbaris pada
       tepi yang sama. */
    min-width: 2.5rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Dashboard Compact Summary Panel & Enterprise Layout
   -------------------------------------------------------------------------- */
.dash-hero {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    color: var(--dp-heading);
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--dp-border);
    margin-bottom: 1.25rem;
}

[data-bs-theme="dark"] .dash-hero,
[data-theme="dark"] .dash-hero {
    background: #1e293b;
    border-color: #334155;
}

.dash-hero h1 { 
    color: var(--dp-heading); 
    font-size: 1.25rem; 
    font-weight: 700;
    margin: 0 0 .25rem; 
    letter-spacing: -.01em;
}

.dash-hero p { 
    color: var(--dp-body); 
    margin: 0; 
    font-size: .875rem; 
    line-height: 1.4;
}

.dash-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}

@media (max-width: 991.98px) {
    .dash-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575.98px) {
    .dash-summary-grid {
        grid-template-columns: 1fr;
    }
}

.dash-summary-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: #f8fafc;
    border: 1px solid var(--dp-border);
    border-radius: 10px;
    transition: all 0.15s ease;
}

.dash-summary-item:hover {
    background: #ffffff;
    border-color: #c7d2fe;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

[data-bs-theme="dark"] .dash-summary-item {
    background: #0f172a;
    border-color: #334155;
}

.dash-summary-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-summary-icon.icon-green { background: #ecfdf5; color: #10b981; }
.dash-summary-icon.icon-blue { background: #eff6ff; color: #3b82f6; }
.dash-summary-icon.icon-purple { background: #f5f3ff; color: #696cff; }
.dash-summary-icon.icon-amber { background: #fffbeb; color: #f59e0b; }

.status-dot-green {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    margin-right: 4px;
}

.stat-card-icon-badge {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(var(--stat-rgb, 105, 108, 255), 0.12);
    color: var(--stat-color, var(--dp-primary));
    flex-shrink: 0;
}

/* Donut container side-by-side flex layout */
.donut-flex-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.donut-legend-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-grow: 1;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.donut-legend-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Leaderboard rows on the administrator dashboard. */
.rank-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--dp-border);
}
.rank-row:last-child { border-bottom: 0; }

.rank-badge {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex: none;
    border-radius: 6px;
    background: #f1f5f9;
    color: var(--dp-body);
    font-size: .75rem;
    font-weight: 700;
}

[data-bs-theme="dark"] .rank-badge {
    background: #334155;
    color: #cbd5e1;
}

.rank-row:first-child .rank-badge {
    background: var(--dp-primary-soft);
    color: var(--dp-primary);
}

.rank-bar {
    height: 4px;
    border-radius: var(--dp-radius-pill);
    background: var(--dp-surface-alt);
    overflow: hidden;
}

.rank-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--dp-primary);
}

/* Cross-document transitions are intentionally disabled. Full-page fading
   caused a visible light flash during menu navigation. Component-level motion
   remains active for useful feedback such as modals, toasts, and loading. */

/* --------------------------------------------------------------------------
   13. Skeleton placeholders
   --------------------------------------------------------------------------
   Used where a wait is unavoidable - the Explorer's round trip to Google Drive
   above all. A placeholder in the shape of the coming content keeps the layout
   from collapsing and snapping back, which is what makes a slow response feel
   like a broken one.

   The sweep is a moving gradient rather than a pulsing opacity: it reads as
   progress instead of as something blinking. Stopped entirely for anyone who
   has asked for reduced motion, leaving a plain grey block that still holds
   the space.
   -------------------------------------------------------------------------- */
.dp-skeleton {
    display: inline-block;
    border-radius: var(--dp-radius-pill, 999px);
    background-color: #eceef3;
    background-image: linear-gradient(90deg, #eceef3 0%, #f6f7fa 40%, #eceef3 80%);
    background-size: 300% 100%;
    animation: dp-skeleton-sweep 1.3s ease-in-out infinite;
    /* Placeholders are decoration; a screen reader should hear the status
       message next to them, not a list of empty boxes. */
    user-select: none;
}

@keyframes dp-skeleton-sweep {
    0% { background-position: 150% 0; }
    100% { background-position: -50% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .dp-skeleton {
        animation: none;
        background-image: none;
    }
}

/* ==========================================================================
   14. Enterprise UI refresh
   --------------------------------------------------------------------------
   Presentation-only overrides. Legacy --dp-* variables remain available so
   feature views keep their existing contracts while sharing one design system.
   ========================================================================== */
:root {
    --brand-primary: #5b50e6;
    --brand-primary-hover: #493fce;
    --brand-secondary: #252952;
    --brand-accent: #7168f2;
    --brand-soft: #efefff;

    --bg-app: #f5f7fb;
    --bg-sidebar: #171b3f;
    --bg-sidebar-elevated: #222653;
    --bg-card: #ffffff;
    --bg-subtle: #f8f9fc;

    --text-primary: #17213b;
    --text-secondary: #526079;
    --text-muted: #8590a5;
    --text-on-brand: #f8f9ff;

    --border-default: #e3e7ef;
    --border-soft: #edf0f5;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-xs: 0 1px 2px rgba(17, 24, 39, .035);
    --shadow-sm: 0 4px 14px rgba(23, 33, 59, .045);
    --shadow-md: 0 12px 30px rgba(23, 33, 59, .075);

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;

    --dp-primary: var(--brand-primary);
    --dp-primary-hover: var(--brand-primary-hover);
    --dp-primary-soft: rgba(91, 80, 230, .11);
    --dp-primary-gradient: linear-gradient(135deg, #655bf0 0%, #5549dc 100%);
    --dp-body-bg: var(--bg-app);
    --dp-surface: var(--bg-card);
    --dp-surface-alt: var(--bg-subtle);
    --dp-heading: var(--text-primary);
    --dp-body: var(--text-secondary);
    --dp-muted: var(--text-muted);
    --dp-border: var(--border-default);
    --dp-sidebar-width: 252px;
    --dp-sidebar-bg: var(--bg-sidebar);
    --dp-sidebar-ink: #aeb6d3;
    --dp-sidebar-ink-hover: #ffffff;
    --dp-radius-sm: var(--radius-sm);
    --dp-radius: var(--radius-md);
    --dp-radius-lg: var(--radius-lg);
    --dp-shadow-xs: var(--shadow-xs);
    --dp-shadow-sm: var(--shadow-sm);
    --dp-shadow-md: var(--shadow-md);
    --bs-primary: var(--brand-primary);
    --bs-primary-rgb: 91, 80, 230;
    --bs-body-font-size: .875rem;
    --bs-body-line-height: 1.55;
}

html { background: var(--bg-app); }

body.app-shell {
    min-width: 320px;
    color: var(--text-secondary);
    background:
        radial-gradient(circle at 82% 0%, rgba(91, 80, 230, .055), transparent 24rem),
        var(--bg-app);
    font-size: .875rem;
    -webkit-font-smoothing: antialiased;
}

a, button, input, select, textarea { transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease, color .16s ease, transform .16s ease; }

:focus-visible {
    outline: 3px solid rgba(91, 80, 230, .22) !important;
    outline-offset: 2px;
}

.app-sidebar {
    width: var(--dp-sidebar-width);
    padding: 0 12px;
    color: var(--dp-sidebar-ink);
    background:
        radial-gradient(circle at 35% 94%, rgba(113, 104, 242, .2), transparent 17rem),
        linear-gradient(180deg, #1b2048 0%, var(--bg-sidebar) 58%, #141735 100%);
    border: 0;
    box-shadow: 8px 0 28px rgba(16, 20, 49, .09);
}

.app-brand {
    min-height: 76px;
    margin: 0 4px;
    padding: 14px 8px;
    gap: 11px;
    color: var(--text-on-brand);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.app-brand:hover { color: #fff; }

.app-brand-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 12px;
    background: linear-gradient(145deg, #766df6, #4e43d4);
    box-shadow: 0 7px 18px rgba(75, 64, 208, .35);
}

.app-brand-mark svg { width: 20px; height: 20px; stroke-width: 2; }
.app-brand-copy { min-width: 0; }
.app-brand-name { color: #fff; font-size: .9375rem; font-weight: 700; letter-spacing: -.015em; }
.app-brand-sub { display: block; max-width: 158px; overflow: hidden; color: #969fca; font-size: .6875rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }

.app-sidebar-menu { display: flex; flex-direction: column; padding: 16px 0 !important; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.16) transparent; }
.sidebar-section-label {
    padding: 2px 12px 8px;
    color: #6f789f;
    font-size: .625rem;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
}
.menu-accordion-item { margin-bottom: 6px; }
.nav-link-custom {
    min-height: 42px;
    padding: 10px 12px;
    color: #aeb6d3;
    border-radius: 10px;
    font-size: .8125rem;
    font-weight: 600;
    transform: none !important;
    transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.nav-link-custom:hover, .nav-link-custom[aria-expanded="true"] { color: #fff; background: rgba(255,255,255,.06); }
.nav-primary-link { margin: 2px 0; }
.nav-primary-link.active {
    color: #fff;
    font-weight: 600;
    background: linear-gradient(105deg, rgba(113,104,242,.92), rgba(91,80,230,.72));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.nav-link-custom svg { width: 17px; height: 17px; stroke-width: 1.8; }
.nav-link-custom .collapse-icon { width: 14px; height: 14px; color: #737da8; }
.submenu-container { padding: 5px 0 2px; }
.nav-sublink {
    position: relative;
    box-sizing: border-box;
    height: 38px;
    min-height: 38px;
    margin: 2px 0;
    padding: 9px 12px 9px 38px;
    color: #949dc3;
    border-radius: 9px;
    font-size: .79rem;
    font-weight: 500;
    line-height: 20px;
    transform: none !important;
    transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.nav-sublink > i[data-lucide],
.nav-sublink > svg {
    position: absolute;
    top: 50%;
    left: 14px;
    display: block;
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    transform: translateY(-50%) !important;
}
.nav-sublink:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-sublink.active {
    color: #fff;
    font-weight: 500;
    background: linear-gradient(105deg, rgba(113,104,242,.92), rgba(91,80,230,.72));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.nav-sublink:hover,
.nav-sublink:active,
.nav-sublink:focus,
.nav-sublink.active { padding: 9px 12px 9px 38px; transform: none !important; }

.app-sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 58px;
    margin: 0 4px;
    padding: 12px 10px;
    color: #929bc3;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: .72rem;
}
.app-sidebar-status { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74,222,128,.11); }

.app-main { margin-left: var(--dp-sidebar-width); min-width: 0; }
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1025;
    min-height: 70px;
    margin: 0;
    padding: 11px clamp(16px, 2.1vw, 32px);
    border: 0;
    border-bottom: 1px solid rgba(227,231,239,.88);
    border-radius: 0;
    background: rgba(255,255,255,.9);
    box-shadow: 0 1px 12px rgba(23,33,59,.03);
    backdrop-filter: blur(16px);
}
.app-topbar > div { min-height: 47px; }
.app-page-title { color: var(--text-primary); font-weight: 700; letter-spacing: -.025em; }
.app-page-subtitle { margin-top: 2px; color: var(--text-muted); font-size: .75rem; }
.app-quick-search {
    order: -1;
    width: min(26vw, 330px);
    height: 38px;
    margin-right: 6px;
    padding: 0 11px;
    color: var(--text-muted);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: #f7f8fb;
    text-decoration: none;
    font-size: .75rem;
}
.app-quick-search:hover { color: var(--text-secondary); border-color: #d9ddea; background: #fff; box-shadow: var(--shadow-xs); }
.app-quick-search svg { width: 15px; height: 15px; }
.app-quick-search span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-quick-search kbd { padding: 2px 5px; color: #788399; border: 1px solid #e0e4ec; border-radius: 5px; background: #fff; box-shadow: none; font-family: inherit; font-size: .625rem; }

.btn-icon {
    width: 38px;
    height: 38px;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
}
.btn-icon:hover { color: var(--brand-primary); border-color: var(--border-soft); background: var(--brand-soft); }
.avatar-initial { width: 32px; height: 32px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }

.app-content { width: 100%; max-width: 1680px; margin-inline: auto; padding: clamp(18px, 2.2vw, 32px); }
.app-breadcrumb {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 28px;
    margin: -7px 0 16px;
    color: var(--text-muted);
    font-size: .72rem;
}
.app-breadcrumb a { display: inline-grid; place-items: center; width: 26px; height: 26px; color: var(--text-muted); border-radius: 7px; }
.app-breadcrumb a:hover { color: var(--brand-primary); background: var(--brand-soft); }
.app-breadcrumb svg { width: 13px; height: 13px; }
.app-breadcrumb-separator { width: 11px !important; color: #b7bfcd; }
.app-breadcrumb strong { max-width: 320px; color: var(--text-secondary); font-weight: 600; }

.card, .card-custom {
    border: 1px solid var(--border-soft) !important;
    border-radius: var(--radius-lg) !important;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm) !important;
}
.card-custom:hover { border-color: #dde2ec !important; }
.card h2, .card h3, .card h4, .card h5, .card h6 { color: var(--text-primary); letter-spacing: -.015em; }

.btn { min-height: 38px; border-radius: 9px; font-size: .8125rem; font-weight: 600; }
.btn-sm { min-height: 34px; }
.btn-primary { border-color: var(--brand-primary); background: var(--brand-primary); box-shadow: 0 3px 8px rgba(91,80,230,.16); }
.btn-primary:hover { border-color: var(--brand-primary-hover); background: var(--brand-primary-hover); transform: translateY(-1px); }
.form-control, .form-select { min-height: 40px; border-color: var(--border-default); border-radius: 9px; font-size: .8125rem; }
.form-control:focus, .form-select:focus { border-color: rgba(91,80,230,.55); box-shadow: 0 0 0 3px rgba(91,80,230,.1); }
.dropdown-menu { padding: 7px; border-color: var(--border-soft); border-radius: 12px; box-shadow: var(--shadow-md); }
.dropdown-item { border-radius: 7px; }
.modal-content { border: 1px solid var(--border-soft) !important; border-radius: var(--radius-lg) !important; box-shadow: 0 24px 65px rgba(23,33,59,.17) !important; }
.table { --bs-table-hover-bg: #fafaff; color: var(--text-secondary); }
.table > thead > tr > th { padding: 12px 14px; color: #69758b; border-bottom-color: var(--border-default); background: #f8f9fc; font-size: .7rem; font-weight: 700; letter-spacing: .035em; text-transform: uppercase; }
.table > tbody > tr > td { padding: 13px 14px; border-bottom-color: var(--border-soft); vertical-align: middle; }
.table-responsive > .table > thead > tr > th { position: sticky; top: 0; z-index: 3; }
.badge { padding: .42em .68em; font-weight: 600; }
.btn.is-loading { position: relative; pointer-events: none; opacity: .78; }
.btn.is-loading::before {
    content: "";
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: dp-submit-spin .65s linear infinite;
}
@keyframes dp-submit-spin { to { transform: rotate(360deg); } }

/* Dashboard */
.dashboard-welcome {
    position: relative;
    overflow: hidden;
    padding: clamp(18px, 2vw, 28px);
    border: 1px solid rgba(91,80,230,.1);
    border-radius: var(--radius-xl);
    background: linear-gradient(120deg, #fff 0%, #fbfbff 65%, #f2f0ff 100%);
    box-shadow: var(--shadow-sm);
}
.dashboard-welcome::after { content: ""; position: absolute; right: -70px; top: -100px; width: 240px; height: 240px; border: 42px solid rgba(91,80,230,.045); border-radius: 50%; pointer-events: none; }
.dashboard-welcome > * { position: relative; z-index: 1; }
.dashboard-welcome h1 { color: var(--text-primary); font-size: clamp(1.25rem, 2vw, 1.65rem); font-weight: 700; letter-spacing: -.035em; }
.dash-summary-grid { gap: 12px; margin-top: 22px; }
.dash-summary-item { min-height: 64px; padding: 12px 14px; border: 1px solid rgba(227,231,239,.82); border-radius: 12px; background: rgba(255,255,255,.76); box-shadow: var(--shadow-xs); }
.dash-summary-icon { width: 38px; height: 38px; border-radius: 10px; }
.dashboard-kpis .stat-card { min-height: 148px; }
.stat-card { isolation: isolate; }
.stat-card::after { content: ""; position: absolute; right: -25px; bottom: -38px; width: 100px; height: 100px; border-radius: 50%; background: radial-gradient(circle, var(--dp-primary-soft), transparent 68%); opacity: .7; z-index: -1; }
.stat-card .h3 { color: var(--text-primary); font-size: clamp(1.35rem, 2vw, 1.7rem); font-weight: 700; letter-spacing: -.035em; }
.stat-card-icon-badge { width: 42px; height: 42px; border-radius: 11px; }
.rank-row { min-height: 48px; }
.rank-bar { height: 5px; background: #eef0f5; }
.rank-bar span { background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent)); }

@media (min-width: 1200px) {
    .app-topbar-title { min-width: 250px; }
    .is-dashboard .app-topbar-title { min-width: 225px; }
}

@media (max-width: 1199.98px) {
    .app-content { padding: 24px; }
}

@media (max-width: 991.98px) {
    .app-sidebar { width: min(292px, 86vw); padding-inline: 12px; box-shadow: 18px 0 50px rgba(14,17,42,.26); }
    .app-main { margin-left: 0; }
    .app-topbar { min-height: 64px; padding: 8px 16px; }
    .app-content { padding: 20px; }
    .sidebar-backdrop { background: rgba(11,15,35,.48); backdrop-filter: blur(2px); }
}

@media (max-width: 767.98px) {
    .app-content { padding: 16px; }
    .dashboard-welcome { padding: 18px; border-radius: 16px; }
    .dashboard-welcome > .d-flex > .d-flex { width: 100%; align-items: flex-start !important; }
    .dash-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
    .dashboard-kpis .stat-card { min-height: 138px; padding: 16px !important; }
    .dashboard-kpis .stat-card .d-flex { margin-bottom: 12px !important; }
    .stat-card-icon-badge { width: 38px; height: 38px; }
    .table-responsive { border-radius: 12px; }
    .modal-dialog { margin: 10px; }
    .modal-dialog:not(.modal-fullscreen) { max-width: calc(100% - 20px); }
}

@media (max-width: 575.98px) {
    .app-topbar { padding-inline: 10px; }
    .app-topbar-title { max-width: min(44vw, 180px); }
    .app-page-title { font-size: .9375rem !important; }
    .app-content { padding: 14px 12px 22px; }
    .btn-icon { width: 40px; height: 40px; }
    .dashboard-welcome h1 { font-size: 1.2rem; }
    .dash-summary-grid { grid-template-columns: 1fr; gap: 8px; }
    .dash-summary-item { min-height: 58px; padding: 10px 12px; }
    .dashboard-kpis { --bs-gutter-x: 10px; --bs-gutter-y: 10px; }
    .dashboard-kpis .stat-card { min-height: 154px; padding: 14px !important; }
    .dashboard-kpis .stat-card .d-flex { align-items: flex-start !important; }
    .dashboard-kpis .stat-card .fw-semibold.small { max-width: 76px; line-height: 1.3; }
    .dashboard-kpis .stat-card small { display: block; font-size: .7rem; line-height: 1.35; }
    .stat-card .h3 { font-size: 1.32rem; }
    .dropdown-menu[style*="min-width: 320px"] { width: calc(100vw - 24px); min-width: 0 !important; }
    .card-custom.p-4 { padding: 16px !important; }
}

@media (max-width: 389.98px) {
    .dashboard-kpis > .col-6 { width: 100%; }
    .dashboard-kpis .stat-card { min-height: 128px; }
    .app-topbar-title { max-width: 38vw; }
}

/* Accounts & integrations */
.accounts-intro {
    padding: 4px 2px;
}
.accounts-intro h2 {
    color: var(--text-primary);
    font-size: clamp(1.35rem, 2.1vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -.035em;
}
.page-eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--brand-primary);
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.accounts-kpis .stat-card { min-height: 150px; }
.accounts-kpis .progress { height: 5px; background: #eceef4; }
.accounts-kpis .progress-bar { border-radius: 999px; background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent)); }
.oauth-status-card { position: relative; overflow: hidden; padding: 18px !important; box-shadow: none !important; }
.oauth-status-card.is-verified { border-color: rgba(25,135,84,.2) !important; background: linear-gradient(110deg, rgba(25,135,84,.065), #fff 48%); }
.oauth-status-card.needs-setup { border-color: rgba(255,171,0,.25) !important; background: linear-gradient(110deg, rgba(255,171,0,.08), #fff 48%); }
.account-directory-toolbar { background: #fbfbfd; }
.account-search { width: min(100%, 310px); }
.account-search > svg { position: absolute; z-index: 2; left: 14px; top: 50%; width: 15px; height: 15px; color: var(--text-muted); transform: translateY(-50%); pointer-events: none; }
.account-search .form-control { height: 38px; border-radius: 9px !important; background: #fff; }
.account-row { min-height: 68px; background: #fff; border-color: var(--border-soft) !important; }
.account-row:hover { background: #fafaff; }
.account-row .rounded-circle { box-shadow: inset 0 0 0 1px rgba(255,255,255,.24), 0 3px 8px rgba(23,33,59,.08); }
.account-row .progress { overflow: visible; height: 5px !important; border-radius: 999px; }
.account-row .progress-bar { border-radius: inherit; }
.account-row .btn.rounded-circle { display: inline-grid; place-items: center; width: 34px; min-height: 34px; padding: 0 !important; border: 1px solid var(--border-soft); background: #fff; }
.account-row .btn.rounded-circle:hover { color: var(--brand-primary); border-color: rgba(91,80,230,.2); background: var(--brand-soft); transform: translateY(-1px); }

@media (max-width: 767.98px) {
    .accounts-intro { padding-top: 0; }
    .accounts-intro > .d-flex { align-items: flex-start !important; }
    .accounts-primary-actions { width: 100%; }
    .accounts-primary-actions form, .accounts-primary-actions .btn { flex: 1 1 0; }
    .accounts-primary-actions .btn { justify-content: center; white-space: nowrap; }
    .accounts-kpis { --bs-gutter-x: 10px; --bs-gutter-y: 10px; }
    .accounts-kpis .stat-card { min-height: 146px; padding: 15px !important; }
    .oauth-status-card > .d-flex { align-items: flex-start !important; }
    .oauth-status-card > .d-flex > .d-flex:first-child { align-items: flex-start !important; }
    .oauth-status-card > .d-flex > .d-flex:last-child { width: 100%; }
    .oauth-status-card > .d-flex > .d-flex:last-child .btn { flex: 1 1 auto; justify-content: center; }
    .accounts-secondary-actions { justify-content: stretch !important; }
    .accounts-secondary-actions > form, .accounts-secondary-actions > .dropdown, .accounts-secondary-actions > button { flex: 1 1 calc(50% - 4px); }
    .accounts-secondary-actions .btn { width: 100%; justify-content: center; }
    .account-directory-toolbar { align-items: stretch !important; }
    .account-search { width: 100%; max-width: none !important; }
    .account-row { position: relative; flex-wrap: wrap; padding-right: 12px !important; }
    .account-row > .flex-grow-1 { width: calc(100% - 54px); flex: 1 1 calc(100% - 54px) !important; }
    .account-row > .d-flex:last-child { width: 100%; justify-content: flex-end; padding-top: 8px; border-top: 1px solid var(--border-soft); }
}

@media (max-width: 575.98px) {
    .accounts-intro p { font-size: .78rem; }
    .accounts-primary-actions { flex-direction: column; align-items: stretch !important; }
    .accounts-primary-actions form { width: 100%; }
    .accounts-primary-actions .btn { width: 100%; }
    .accounts-kpis .stat-card { min-height: 156px; }
    .oauth-status-card { padding: 14px !important; }
    .oauth-status-card .d-flex.align-items-center.gap-2 { flex-wrap: wrap; }
    .accounts-secondary-actions > form, .accounts-secondary-actions > .dropdown, .accounts-secondary-actions > button { flex-basis: 100%; }
    .account-directory-toolbar { padding: 14px !important; }
}

@media (max-width: 389.98px) {
    .accounts-kpis > .col-6 { width: 100%; }
    .accounts-kpis .stat-card { min-height: 128px; }
}

/* Reports, security, and administration share the same calm work surface. */
.page-reports .app-content,
.page-security .app-content,
.page-admin .app-content,
.page-integrations .app-content,
.page-workspace .app-content { max-width: 1560px; }
.page-integrations .card-custom,
.page-workspace .card-custom { overflow: hidden; }
.page-integrations .table-responsive,
.page-workspace .table-responsive { border-radius: 11px; }
.page-reports .nav-tabs,
.page-security .nav-tabs,
.page-admin .nav-tabs { gap: 4px; padding: 4px; border: 1px solid var(--border-soft); border-radius: 11px; background: #f4f6fa; }
.page-reports .nav-tabs .nav-link,
.page-security .nav-tabs .nav-link,
.page-admin .nav-tabs .nav-link { min-height: 34px; padding: 7px 13px; color: var(--text-secondary); border: 0; border-radius: 8px; font-size: .78rem; font-weight: 600; }
.page-reports .nav-tabs .nav-link.active,
.page-security .nav-tabs .nav-link.active,
.page-admin .nav-tabs .nav-link.active { color: var(--brand-primary); background: #fff; box-shadow: var(--shadow-xs); }
.page-reports .card-custom,
.page-security .card-custom,
.page-admin .card-custom { overflow: hidden; }
.page-reports .progress,
.page-security .progress,
.page-admin .progress { overflow: hidden; height: 7px; border-radius: 999px; background: #eceff5; }
.page-reports .progress-bar,
.page-security .progress-bar,
.page-admin .progress-bar { border-radius: inherit; }
.page-security .accordion-item,
.page-admin .accordion-item { overflow: hidden; border: 1px solid var(--border-soft); border-radius: 12px !important; background: #fff; }
.page-security .accordion-button,
.page-admin .accordion-button { min-height: 52px; color: var(--text-primary); background: #fff; font-size: .85rem; font-weight: 650; box-shadow: none; }
.page-security .accordion-button:not(.collapsed),
.page-admin .accordion-button:not(.collapsed) { color: var(--brand-primary); background: #fafaff; }
.page-admin .form-check-input,
.page-security .form-check-input { width: 1.08rem; height: 1.08rem; border-color: #ccd2df; }
.page-admin .form-check-input:checked,
.page-security .form-check-input:checked { border-color: var(--brand-primary); background-color: var(--brand-primary); }
.page-admin .pagination,
.page-reports .pagination,
.page-security .pagination { gap: 5px; }
.page-admin .page-link,
.page-reports .page-link,
.page-security .page-link { display: grid; place-items: center; min-width: 34px; min-height: 34px; padding: 5px 9px; color: var(--text-secondary); border-color: var(--border-soft); border-radius: 8px !important; }
.page-admin .active > .page-link,
.page-reports .active > .page-link,
.page-security .active > .page-link { color: #fff; border-color: var(--brand-primary); background: var(--brand-primary); }
.page-admin .license-hero { border-radius: var(--radius-lg); background: linear-gradient(125deg, #252952, #5549dc); box-shadow: var(--shadow-md); }
.page-admin .license-stat-card { border-color: var(--border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

@media (max-width: 767.98px) {
    .page-reports .app-content > .d-flex:first-child,
    .page-security .app-content > .d-flex:first-child,
    .page-admin .app-content > .d-flex:first-child { align-items: stretch !important; }
    .page-reports .app-content > .d-flex:first-child > .d-flex,
    .page-security .app-content > .d-flex:first-child > .d-flex,
    .page-admin .app-content > .d-flex:first-child > .d-flex { flex-wrap: wrap; }
    .page-reports .nav-tabs,
    .page-security .nav-tabs,
    .page-admin .nav-tabs { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    .page-reports .nav-tabs .nav-link,
    .page-security .nav-tabs .nav-link,
    .page-admin .nav-tabs .nav-link { white-space: nowrap; }
    .page-reports form.row > [class*="col-"],
    .page-security form.row > [class*="col-"],
    .page-admin form.row > [class*="col-"] { width: 100%; }
    .page-reports .table-responsive,
    .page-security .table-responsive,
    .page-admin .table-responsive { margin-inline: -1px; border: 1px solid var(--border-soft); border-radius: 11px; }
    .page-reports table,
    .page-security table,
    .page-admin table { min-width: 720px; }
    .page-admin .license-hero { padding: 20px; }
    .page-integrations form.row > [class*="col-"],
    .page-workspace form.row > [class*="col-"] { width: 100%; }
    .page-integrations .table-responsive,
    .page-workspace .table-responsive { border: 1px solid var(--border-soft); }
    .page-integrations table,
    .page-workspace table { min-width: 700px; }
}

@media (max-width: 575.98px) {
    .page-reports .row > .col-6,
    .page-security .row > .col-6,
    .page-admin .row > .col-6 { width: 100%; }
    .page-reports .card-custom,
    .page-security .card-custom,
    .page-admin .card-custom { border-radius: 13px !important; }
    .page-reports .btn-group,
    .page-security .btn-group,
    .page-admin .btn-group { max-width: 100%; }
}

/* Final mobile hardening: every authenticated work area, 390–430px. */
@media (max-width: 430px) {
    html, body { max-width: 100%; overflow-x: hidden; }
    body.app-shell { font-size: .84375rem; }
    .app-main, .app-content, .app-content > * { min-width: 0; }
    .app-topbar { min-height: 60px; }
    .app-topbar-title { max-width: calc(100vw - 218px); }
    .app-page-subtitle { display: none !important; }
    .app-sidebar { width: min(304px, 88vw); }
    .app-brand { min-height: 68px; }
    .nav-link-custom { min-height: 44px; }
    .nav-sublink { height: 42px; min-height: 42px; padding-block: 10px; }
    .app-breadcrumb { margin-top: -3px; margin-bottom: 12px; overflow: hidden; white-space: nowrap; }

    button, .btn, .btn-icon, .dropdown-item, .form-check-input, [role="button"] {
        touch-action: manipulation;
    }
    .btn:not(.btn-sm), .form-control:not(.form-control-sm), .form-select:not(.form-select-sm) { min-height: 44px; }
    .btn-icon { flex: 0 0 40px; }
    .btn-group { display: flex; width: 100%; }
    .btn-group > .btn { flex: 1 1 auto; min-width: 0; }

    .row { --bs-gutter-x: 16px; }
    .card-custom.p-3, .card-custom.p-4 { padding: 14px !important; }
    .card-custom > .d-flex.justify-content-between { gap: 12px; }
    .card-custom > .d-flex.justify-content-between:not(.flex-nowrap) { align-items: flex-start !important; }
    .card-custom h2, .card-custom h3, .card-custom h4, .card-custom h5, .card-custom h6 { line-height: 1.3; }

    .modal { padding: 0 !important; }
    .modal-dialog { width: auto; max-width: none !important; margin: 8px; }
    .modal-dialog-centered { min-height: calc(100% - 16px); }
    .modal-content { max-height: calc(100dvh - 16px); border-radius: 14px !important; }
    .modal-body { overflow-y: auto; padding: 16px; }
    .modal-header, .modal-footer { padding: 14px 16px; }
    .modal-footer { flex-wrap: wrap; }
    .modal-footer > .btn { flex: 1 1 auto; }

    .dropdown-menu { max-width: calc(100vw - 20px); }
    .toast-stack { left: 10px; right: 10px; bottom: 10px; width: auto; }
    .toast-stack .toast { width: 100%; max-width: none; }
    .alert { padding: 12px; border-radius: 11px; }

    .page-reports .app-content > .d-flex:first-child,
    .page-security .app-content > .d-flex:first-child,
    .page-admin .app-content > .d-flex:first-child,
    .page-workspace .app-content > .d-flex:first-child,
    .page-integrations .app-content > .d-flex:first-child { flex-direction: column; align-items: stretch !important; }
    .page-reports .app-content > .d-flex:first-child .btn,
    .page-security .app-content > .d-flex:first-child .btn,
    .page-admin .app-content > .d-flex:first-child .btn,
    .page-workspace .app-content > .d-flex:first-child .btn { justify-content: center; }

    .table-responsive { max-width: 100%; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
    .table > thead > tr > th, .table > tbody > tr > td { padding: 11px 12px; }
    .pagination { flex-wrap: wrap; justify-content: center; }
    .pagination .page-link { min-width: 40px; min-height: 40px; }

    .form-label { margin-bottom: 6px; }
    .input-group { flex-wrap: nowrap; }
    textarea.form-control { min-height: 96px; }
    .form-check.form-switch { padding-left: 3rem; }
    .form-switch .form-check-input { width: 2.25rem; min-height: 1.2rem; margin-left: -3rem; }

    .dashboard-welcome::after { display: none; }
    .dashboard-welcome > .d-flex { align-items: flex-start !important; }
    .accounts-primary-actions, .accounts-secondary-actions { gap: 8px !important; }
    .account-row > .d-flex:last-child { overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
}

@media (max-width: 390px) {
    .app-topbar-title { max-width: calc(100vw - 202px); }
    .app-content { padding-inline: 10px; }
    .modal-footer > .btn { flex-basis: 100%; }
    .card-custom > .d-flex.justify-content-between:not(.flex-nowrap) { flex-direction: column; }
    .card-custom > .d-flex.justify-content-between:not(.flex-nowrap) > * { width: 100%; }
}

/* --------------------------------------------------------------------------
   USER ACTIVITY & LIVE MONITORING (SIDEBAR & DASHBOARD WIDGETS)
   -------------------------------------------------------------------------- */
.sidebar-online-card {
    margin-top: auto;
    padding: 12px 6px 6px;
}
.sidebar-online-inner {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease-in-out;
}
.sidebar-online-inner:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18) !important;
}
.sidebar-online-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f1f5f9;
    font-size: 0.72rem;
    font-weight: 500;
    transition: all 0.15s ease;
}
.sidebar-online-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}

/* Pulsating Realtime Indicator */
.online-pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: online-pulse 2s infinite cubic-bezier(0.66, 0, 0, 1);
    flex-shrink: 0;
}
.online-pulse-dot-sm {
    width: 6px;
    height: 6px;
}
@keyframes online-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* Avatar Stack */
.avatar-stack {
    display: flex;
    align-items: center;
}
.avatar-stack .avatar-item {
    margin-left: -7px;
    transition: transform 0.15s ease, z-index 0.15s ease;
    cursor: default;
    position: relative;
}
.avatar-stack .avatar-item:first-child {
    margin-left: 0;
}
.avatar-stack .avatar-item:hover {
    transform: translateY(-2px) scale(1.1);
    z-index: 10;
}
.avatar-circle {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 700;
    border: 2px solid #1c224a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    text-transform: uppercase;
    user-select: none;
}
.avatar-circle.avatar-lg {
    width: 38px;
    height: 38px;
    font-size: 0.85rem;
    border-width: 2px;
}
.avatar-circle.avatar-md {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
    border-width: 2px;
}
.avatar-more {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 600;
    border: 2px solid #1c224a;
}

/* Dashboard Activity Table & Cards */
.activity-user-row {
    transition: background-color 0.15s ease;
}
.activity-user-row:hover {
    background-color: var(--dp-table-hover, rgba(99, 102, 241, 0.04));
}
.badge-unit-polda {
    background-color: rgba(14, 165, 233, 0.1);
    color: #0284c7;
    border: 1px solid rgba(14, 165, 233, 0.25);
    font-weight: 500;
}
[data-bs-theme="dark"] .badge-unit-polda {
    background-color: rgba(14, 165, 233, 0.2);
    color: #38bdf8;
    border-color: rgba(14, 165, 233, 0.35);
}
.activity-module-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    background-color: rgba(100, 116, 139, 0.08);
    color: var(--dp-muted, #64748b);
    border: 1px solid rgba(100, 116, 139, 0.15);
}
[data-bs-theme="dark"] .activity-module-pill {
    background-color: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    border-color: rgba(255, 255, 255, 0.1);
}
.activity-user-card-mobile {
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    background: var(--dp-card-bg, #fff);
    padding: 10px 12px;
    margin-bottom: 8px;
}
[data-bs-theme="dark"] .activity-user-card-mobile {
    background: #181d38;
    border-color: rgba(255, 255, 255, 0.08);
}

/* Pagination SVG safety guards */
nav[role="navigation"] svg,
.pagination svg,
svg.w-5,
svg.h-5 {
    width: 1.25rem !important;
    height: 1.25rem !important;
    max-width: 1.25rem !important;
    max-height: 1.25rem !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

/* ==========================================================================
   Stitch Design System Extensions (Multi Drive Divhumas Polri)
   Compatible across Web and Mobile with fluid responsiveness.
   ========================================================================== */

/* Universal card-custom reinforcement to Stitch specs */
.card-custom, .card {
    border-radius: var(--dp-radius-lg) !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    box-shadow: var(--dp-shadow-sm) !important;
    background-color: var(--dp-surface);
}

/* 1. Status Banner & Pulse */
.stitch-banner {
    background-color: var(--dp-surface);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: var(--dp-radius-lg);
    box-shadow: var(--dp-shadow-sm);
    padding: 1.25rem 1.5rem;
    transition: box-shadow var(--dp-ease);
}
.stitch-banner:hover {
    box-shadow: var(--dp-shadow-md);
}

.stitch-pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: stitchPulse 2s infinite;
}
@keyframes stitchPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* 2. Hero Storage Overview Card */
.stitch-hero-card {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 50%, #312e81 100%);
    color: #ffffff;
    border-radius: 1.5rem;
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px -4px rgba(79, 70, 229, 0.28), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
}
.stitch-hero-glow-1 {
    position: absolute;
    right: -40px;
    top: -40px;
    width: 240px;
    height: 240px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    filter: blur(36px);
    pointer-events: none;
    transition: background 0.7s ease;
}
.stitch-hero-card:hover .stitch-hero-glow-1 {
    background: rgba(255, 255, 255, 0.18);
}
.stitch-hero-glow-2 {
    position: absolute;
    right: 120px;
    bottom: -60px;
    width: 200px;
    height: 200px;
    background: rgba(56, 189, 248, 0.16);
    border-radius: 50%;
    filter: blur(32px);
    pointer-events: none;
}
.stitch-hero-number {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 800;
    font-size: 2.75rem;
    line-height: 1.1;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 575.98px) {
    .stitch-hero-number {
        font-size: 2.15rem;
    }
}
.stitch-segmented-track {
    width: 100%;
    height: 14px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 9999px;
    padding: 2px;
    display: flex;
    gap: 3px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}
.stitch-segment {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.stitch-seg-video { background: #fbbf24; }
.stitch-seg-foto { background: #38bdf8; }
.stitch-seg-arsip { background: #34d399; }
.stitch-seg-sistem { background: #f472b6; }
.stitch-seg-cadangan { background: rgba(255, 255, 255, 0.3); }

.stitch-legend-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}
.stitch-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.btn-stitch-hero-primary {
    background-color: #ffffff;
    color: #4f46e5;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 0.75rem;
    padding: 0.55rem 1.15rem;
    border: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.15s ease, background 0.15s ease;
    text-decoration: none;
}
.btn-stitch-hero-primary:hover {
    background-color: #f8fafc;
    color: #4338ca;
    transform: translateY(-1px);
}
.btn-stitch-hero-secondary {
    background-color: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 0.75rem;
    padding: 0.55rem 1.15rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s ease, transform 0.15s ease;
    text-decoration: none;
}
.btn-stitch-hero-secondary:hover {
    background-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    transform: translateY(-1px);
}

/* 3. Bento KPI Cards (Stitch Specs) */
.stitch-bento-card {
    background-color: var(--dp-surface);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 1.25rem;
    padding: 1.25rem;
    box-shadow: var(--dp-shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform var(--dp-ease), box-shadow var(--dp-ease), border-color var(--dp-ease);
}
.stitch-bento-card:hover {
    box-shadow: var(--dp-shadow-md);
    transform: translateY(-2px);
    border-color: rgba(79, 70, 229, 0.25);
}
.stitch-icon-squircle {
    width: 44px;
    height: 44px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stitch-bento-val {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 800;
    font-size: 1.85rem;
    letter-spacing: -0.02em;
    color: var(--dp-heading);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

/* 4. Mobile Quick Actions Drawer Grid */
.stitch-quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.625rem;
}
.stitch-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 0.35rem;
    border-radius: 1rem;
    background: var(--dp-surface);
    border: 1px solid rgba(226, 232, 240, 0.85);
    box-shadow: var(--dp-shadow-xs);
    text-decoration: none;
    color: var(--dp-heading);
    transition: transform 0.15s ease, background 0.15s ease;
}
.stitch-quick-btn:hover {
    transform: translateY(-2px);
    background: var(--dp-surface-alt);
    color: var(--dp-primary);
}
.stitch-quick-icon-box {
    width: 46px;
    height: 46px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}
.stitch-quick-btn:hover .stitch-quick-icon-box {
    transform: scale(1.08);
}
.stitch-quick-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* 5. Top Drive Accounts Cards */
.stitch-account-card {
    border-radius: 1rem;
    padding: 1.15rem;
    border: 1px solid rgba(226, 232, 240, 0.85);
    background: var(--dp-surface);
    transition: border-color var(--dp-ease), box-shadow var(--dp-ease);
}
.stitch-account-card:hover {
    border-color: rgba(79, 70, 229, 0.35);
    box-shadow: var(--dp-shadow-xs);
}
.stitch-account-card.is-warning {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(254, 242, 242, 0.45);
}
.stitch-account-track {
    width: 100%;
    height: 8px;
    border-radius: 9999px;
    background: rgba(226, 232, 240, 0.7);
    overflow: hidden;
}
.stitch-account-bar {
    height: 100%;
    border-radius: 9999px;
    background: var(--dp-primary);
    transition: width 0.6s ease;
}
.stitch-account-bar.bar-danger {
    background: #ef4444;
}
.stitch-btn-ghost-sm {
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.625rem;
    padding: 0.35rem 0.75rem;
    background: #eff4ff;
    color: #0b1c30;
    border: 0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}
.stitch-btn-ghost-sm:hover {
    background: #e0e7ff;
    color: #4f46e5;
}

/* 6. Satker Leaderboard */
.stitch-rank-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    border-radius: 0.875rem;
    background: var(--dp-surface-alt);
    border: 1px solid rgba(226, 232, 240, 0.6);
    margin-bottom: 0.5rem;
    transition: background 0.15s ease;
}
.stitch-rank-row:hover {
    background: #e5eeff;
}
.stitch-rank-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.rank-gold { background: #fef08a; color: #854d0e; }
.rank-silver { background: #e2e8f0; color: #334155; }
.rank-bronze { background: #fed7aa; color: #9a3412; }

/* 7. Stitch Mobile Floating Bottom Navigation Dock */
.stitch-bottom-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: rgba(248, 249, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(226, 232, 240, 0.85);
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 0px);
    box-shadow: 0 -2px 16px rgba(15, 23, 42, 0.05);
}
.stitch-dock-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 0.5rem;
}
.stitch-dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #777587;
    text-decoration: none;
    font-size: 0.6875rem;
    font-weight: 600;
    min-width: 58px;
    height: 50px;
    border-radius: 0.75rem;
    transition: color 0.15s ease, transform 0.15s ease;
}
.stitch-dock-item .stitch-dock-icon {
    width: 20px;
    height: 20px;
}
.stitch-dock-item:hover,
.stitch-dock-item.active {
    color: #4f46e5 !important;
}
.stitch-dock-item.active .stitch-dock-icon {
    transform: scale(1.1);
}

/* Ensure mobile main content does not get occluded by dock */
@media (max-width: 991.98px) {
    .app-content {
        padding-bottom: 5.5rem !important;
    }
}

/* 8. Modern Table with Stitch Styling */
.stitch-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
}
.stitch-table thead th {
    background-color: var(--dp-surface-alt);
    color: var(--dp-body);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}
.stitch-table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    vertical-align: middle;
}
.stitch-table tbody tr {
    transition: background-color 0.15s ease;
}
.stitch-table tbody tr:hover {
    background-color: rgba(239, 244, 255, 0.6);
}

/* 9. Dark Mode Overrides for Stitch Elements */
[data-bs-theme="dark"] .stitch-banner,
[data-theme="dark"] .stitch-banner {
    background-color: #1e293b;
    border-color: #334155;
}
[data-bs-theme="dark"] .stitch-bento-card,
[data-theme="dark"] .stitch-bento-card {
    background-color: #1e293b;
    border-color: #334155;
}
[data-bs-theme="dark"] .stitch-quick-btn,
[data-theme="dark"] .stitch-quick-btn {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}
[data-bs-theme="dark"] .stitch-quick-btn:hover,
[data-theme="dark"] .stitch-quick-btn:hover {
    background: #334155;
    color: #818cf8;
}
[data-bs-theme="dark"] .stitch-account-card,
[data-theme="dark"] .stitch-account-card {
    background: #1e293b;
    border-color: #334155;
}
[data-bs-theme="dark"] .stitch-account-card.is-warning,
[data-theme="dark"] .stitch-account-card.is-warning {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
}
[data-bs-theme="dark"] .stitch-account-track,
[data-theme="dark"] .stitch-account-track {
    background: #334155;
}
[data-bs-theme="dark"] .stitch-btn-ghost-sm,
[data-theme="dark"] .stitch-btn-ghost-sm {
    background: #334155;
    color: #f8fafc;
}
[data-bs-theme="dark"] .stitch-btn-ghost-sm:hover,
[data-theme="dark"] .stitch-btn-ghost-sm:hover {
    background: #475569;
    color: #ffffff;
}
[data-bs-theme="dark"] .stitch-rank-row,
[data-theme="dark"] .stitch-rank-row {
    background: #182234;
    border-color: #334155;
}
[data-bs-theme="dark"] .stitch-rank-row:hover,
[data-theme="dark"] .stitch-rank-row:hover {
    background: #1e293b;
}
[data-bs-theme="dark"] .stitch-bottom-dock,
[data-theme="dark"] .stitch-bottom-dock {
    background: rgba(15, 23, 42, 0.94);
    border-top-color: #334155;
}
[data-bs-theme="dark"] .stitch-dock-item,
[data-theme="dark"] .stitch-dock-item {
    color: #94a3b8;
}
[data-bs-theme="dark"] .stitch-dock-item:hover,
[data-bs-theme="dark"] .stitch-dock-item.active,
[data-theme="dark"] .stitch-dock-item.active {
    color: #818cf8 !important;
}
[data-bs-theme="dark"] .stitch-table thead th,
[data-theme="dark"] .stitch-table thead th {
    background-color: #1e293b;
    border-bottom-color: #334155;
    color: #94a3b8;
}
[data-bs-theme="dark"] .stitch-table tbody td,
[data-theme="dark"] .stitch-table tbody td {
    border-bottom-color: #334155;
}
[data-bs-theme="dark"] .stitch-table tbody tr:hover,
[data-theme="dark"] .stitch-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}



