
/* ═══════════════════════════════════════════════════════════════════════════
   GOOGLE FONTS IMPORT
═══════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500&family=Libre+Baskerville:wght@400;700&display=swap');

/* ═══════════════════════════════════════════════════════════════════════════
   DESIGN TOKENS — BASE
═══════════════════════════════════════════════════════════════════════════ */
:root {
    color-scheme: light;

    /* ── Typography ─────────────────────────────────────────── */
    --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
    --font-serif: 'Libre Baskerville', Georgia, serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    --text-xs: 0.6875rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-md: 1.0625rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-2xl: 1.875rem;
    --text-3xl: 2.25rem;
    --text-4xl: 2.75rem;

    --leading-tight: 1.3;
    --leading-normal: 1.6;
    --leading-loose: 1.85;

    --tracking-tight: -0.02em;
    --tracking-normal: 0;
    --tracking-wide: 0.04em;
    --tracking-wider: 0.08em;
    --tracking-widest: 0.14em;

    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semi: 600;
    --font-weight-bold: 700;

    /* ── Spacing ─────────────────────────────────────────────── */
    --space-0: 0;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* ── Border Radius ──────────────────────────────────────── */
    --radius-none: 0px;
    --radius-sm: 2px;
    --radius-md: 3px;
    --radius-lg: 4px;
    --radius-xl: 6px;
    --radius-2xl: 8px;
    --radius-pill: 3px;
    --radius-full: 9999px;

    /* ── Shadows ─────────────────────────────────────────────── */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.14);
    --shadow-2xl: 0 16px 48px rgba(0, 0, 0, 0.18);
    --shadow-inner: inset 0 1px 3px rgba(0, 0, 0, 0.08);

    /* ── Transitions ─────────────────────────────────────────── */
    --transition-fast: 80ms ease;
    --transition-base: 150ms ease;
    --transition-slow: 250ms ease;
    --transition-slower: 400ms ease;

    /* ── Z-Index Scale ───────────────────────────────────────── */
    --z-base: 0;
    --z-raised: 10;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;
    --z-tooltip: 600;

    /* ── Color Palette — Navy (Portal Brand) ─────────────────── */
    --navy-50: #f0f2f8;
    --navy-100: #d9dfe9;
    --navy-200: #b3bfd3;
    --navy-300: #8d9fbc;
    --navy-400: #6680a5;
    --navy-500: #3f6089;
    --navy-600: #2a4a72;
    --navy-700: #1e3a5f;
    --navy-800: #132a4a;
    --navy-900: #0a1b32;
    --navy-950: #050e1c;

    /* ── Color Palette — Neutral ─────────────────────────────── */
    --neutral-50: #f8f8f7;
    --neutral-100: #f0eeec;
    --neutral-200: #e4e1dd;
    --neutral-300: #ccc9c3;
    --neutral-400: #aaa69f;
    --neutral-500: #88837b;
    --neutral-600: #686360;
    --neutral-700: #4e4a47;
    --neutral-800: #35322f;
    --neutral-900: #1e1c1a;

    /* ── Semantic Colors ─────────────────────────────────────── */
    --color-success: #1e7a46;
    --color-success-bg: #e6f4ec;
    --color-success-text: #1a5c35;
    --color-success-border: #52b07d;

    --color-warning: #b07010;
    --color-warning-bg: #fdf3e0;
    --color-warning-text: #7a4a0a;
    --color-warning-border: #e0a030;

    --color-danger: #b03030;
    --color-danger-bg: #fdecea;
    --color-danger-text: #7a1f1f;
    --color-danger-border: #e07070;

    --color-info: #2a5fa8;
    --color-info-bg: #e6eef9;
    --color-info-text: #1a3f7a;
    --color-info-border: #6090d0;

    /* ── Surface & Structural ────────────────────────────────── */
    --color-bg: #f5f4f2;
    --color-surface: #ffffff;
    --color-surface-2: #f8f7f5;
    --color-surface-3: #f0eeec;
    --color-surface-4: #e8e6e3;

    --color-border: #dddbd8;
    --color-border-strong: #c4c1bc;
    --color-border-subtle: #eae8e5;

    --color-text: #1e1c1a;
    --color-text-2: #4e4a47;
    --color-text-3: #88837b;
    --color-text-4: #aaa69f;
    --color-text-inv: #ffffff;

    /* ── Brand Tokens — Portal Default (Navy Unpatti) ────────── */
    --color-brand: #1e3a5f;
    --color-brand-dark: #132a4a;
    --color-brand-darker: #0a1b32;
    --color-brand-light: #e8edf5;
    --color-brand-mid: #b3bfd3;
    --color-brand-text: #1e3a5f;
    --color-brand-accent: #2563eb;
    --color-brand-rgb: 30, 58, 95;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

[hidden] { display: none !important; }

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

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-sans);
    font-weight: var(--font-weight-semi);
    line-height: var(--leading-tight);
    color: var(--color-text);
    letter-spacing: var(--tracking-tight);
}

h1 {
    font-size: var(--text-3xl);
}

h2 {
    font-size: var(--text-2xl);
}

h3 {
    font-size: var(--text-xl);
}

h4 {
    font-size: var(--text-lg);
}

h5 {
    font-size: var(--text-md);
}

h6 {
    font-size: var(--text-base);
}

p {
    line-height: var(--leading-normal);
}

a {
    color: var(--color-brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img,
svg {
    display: block;
    max-width: 100%;
}

ul,
ol {
    list-style: none;
}

button {
    font-family: var(--font-sans);
    cursor: pointer;
}

input,
textarea,
select {
    font-family: var(--font-sans);
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY CLASSES
═══════════════════════════════════════════════════════════════════════════ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: var(--space-1);
}

.gap-2 {
    gap: var(--space-2);
}

.gap-3 {
    gap: var(--space-3);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.gap-8 {
    gap: var(--space-8);
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.hidden {
    display: none !important;
}

.visible {
    visibility: visible;
}

.invisible {
    visibility: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.select-none {
    user-select: none;
}

.font-mono {
    font-family: var(--font-mono);
}

.font-serif {
    font-family: var(--font-serif);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.5rem var(--space-4);
    height: 36px;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    line-height: 1;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    position: relative;
    overflow: hidden;
    transition:
        background var(--transition-fast),
        color var(--transition-fast),
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        transform var(--transition-fast);
}

.btn:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn:active:not(:disabled) {
    transform: scale(0.985);
}

/* Primary */
.btn-primary {
    background: var(--color-brand);
    color: #fff;
    border-color: var(--color-brand);
}

.btn-primary:hover {
    background: var(--color-brand-dark);
    border-color: var(--color-brand-dark);
}

.btn-primary:active {
    background: var(--color-brand-darker);
}

/* Secondary */
.btn-secondary {
    background: var(--color-surface);
    color: var(--color-brand);
    border-color: var(--color-brand-mid);
}

.btn-secondary:hover {
    background: var(--color-brand-light);
    border-color: var(--color-brand);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--color-text-2);
    border-color: var(--color-border);
}

.btn-ghost:hover {
    background: var(--color-surface-3);
    color: var(--color-text);
}

/* Danger */
.btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}

.btn-danger:hover {
    background: var(--color-danger-text);
}

/* Danger Ghost */
.btn-danger-ghost {
    background: transparent;
    color: var(--color-danger);
    border-color: var(--color-danger-border);
}

.btn-danger-ghost:hover {
    background: var(--color-danger-bg);
}

/* Success */
.btn-success {
    background: var(--color-success);
    color: #fff;
    border-color: var(--color-success);
}

.btn-success:hover {
    background: var(--color-success-text);
}

/* Link style */
.btn-link {
    background: transparent;
    color: var(--color-brand);
    border-color: transparent;
    padding-left: 0;
    padding-right: 0;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Sizes */
.btn-xs {
    padding: 0.25rem var(--space-2);
    font-size: var(--text-xs);
    height: 24px;
}

.btn-sm {
    padding: 0.375rem var(--space-3);
    font-size: var(--text-xs);
    height: 30px;
}

.btn-md {
    padding: 0.5rem var(--space-4);
    font-size: var(--text-sm);
    height: 36px;
}

/* default */
.btn-lg {
    padding: 0.75rem var(--space-6);
    font-size: var(--text-base);
    height: 44px;
}

.btn-xl {
    padding: 1rem var(--space-8);
    font-size: var(--text-md);
    height: 52px;
}

/* Block */
.btn-block {
    width: 100%;
}

/* Icon button */
.btn-icon {
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
}

.btn-icon.btn-xs {
    width: 24px;
    height: 24px;
}

.btn-icon.btn-sm {
    width: 30px;
    height: 30px;
}

.btn-icon.btn-md {
    width: 36px;
    height: 36px;
}

.btn-icon.btn-lg {
    width: 44px;
    height: 44px;
}

/* Loading state */
.btn.is-loading {
    pointer-events: none;
}

.btn.is-loading > * {
    visibility: hidden;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ds-spin 0.6s linear infinite;
}

.btn-ghost.is-loading::after,
.btn-secondary.is-loading::after,
.btn-link.is-loading::after {
    border-color: var(--color-border-strong);
    border-top-color: var(--color-brand);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES & CHIPS
═══════════════════════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semi);
    border-radius: var(--radius-pill);
    white-space: nowrap;
    line-height: 1.6;
    border: 1px solid transparent;
}

.badge-primary {
    background: var(--color-brand-light);
    color: var(--color-brand-text);
    border-color: var(--color-brand-mid);
}

.badge-neutral {
    background: var(--neutral-100);
    color: var(--neutral-700);
    border-color: var(--neutral-300);
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border-color: var(--color-success-border);
}

.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border-color: var(--color-warning-border);
}

.badge-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    border-color: var(--color-danger-border);
}

.badge-info {
    background: var(--color-info-bg);
    color: var(--color-info-text);
    border-color: var(--color-info-border);
}

.badge-solid-primary {
    background: var(--color-brand);
    color: #fff;
}

.badge-solid-success {
    background: var(--color-success);
    color: #fff;
}

.badge-solid-warning {
    background: var(--color-warning);
    color: #fff;
}

.badge-solid-danger {
    background: var(--color-danger);
    color: #fff;
}

.badge-dot::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Chip (dismissible badge) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-medium);
    background: var(--color-surface-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    color: var(--color-text-2);
}

.chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-border-strong);
    color: var(--color-text-2);
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    border: none;
    transition: background var(--transition-fast);
}

.chip-remove:hover {
    background: var(--color-danger);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════════════════════════ */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.form-label.required::after {
    content: ' *';
    color: var(--color-danger);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--color-text-3);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--color-danger-text);
    margin-top: var(--space-1);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* Input & Select */
.input,
.select,
.textarea {
    display: block;
    width: 100%;
    padding: 0.5rem var(--space-3);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    -webkit-appearance: none;
    appearance: none;
    line-height: 1.5;
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.input,
.select {
    height: 36px;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(var(--color-brand-rgb), 0.12);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--color-text-4);
}

.input.is-error,
.select.is-error,
.textarea.is-error {
    border-color: var(--color-danger-border);
    box-shadow: 0 0 0 3px rgba(176, 48, 48, 0.10);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
    background: var(--color-surface-3);
    color: var(--color-text-3);
    cursor: not-allowed;
}

.textarea {
    resize: vertical;
    min-height: 100px;
    line-height: var(--leading-normal);
    padding: var(--space-2) var(--space-3);
}

/* Select arrow */
.select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 2rem;
    cursor: pointer;
}

/* Input with icon */
.input-wrap {
    position: relative;
}

.input-wrap .input-icon-left {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-3);
    pointer-events: none;
    display: flex;
}

.input-wrap .input-icon-right {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-3);
    display: flex;
}

.input-wrap.has-icon-left .input,
.input-wrap.has-icon-left .select {
    padding-left: 2.25rem;
}

.input-wrap.has-icon-right .input {
    padding-right: 2.25rem;
}

.input-action {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-3);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    transition: color var(--transition-fast);
}

.input-action:hover {
    color: var(--color-brand);
}

/* Input sizes */
.input-sm {
    padding: 0.375rem var(--space-2);
    font-size: var(--text-xs);
    line-height: 1;
    height: 30px;
}

.select.input-sm,
.select-sm {
    padding: 0.375rem var(--space-2);
    padding-right: 2rem;
    font-size: var(--text-xs);
    line-height: 1;
    height: 30px;
}

.input-lg {
    padding: 0.625rem var(--space-4);
    font-size: var(--text-base);
    height: 44px;
}

/* Search Select */
.search-select {
    position: relative;
}

.search-select .input {
    width: 100%;
}

.search-select-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: var(--z-dropdown);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-height: 220px;
    overflow-y: auto;
}

.search-select-item {
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--color-text-1);
    transition: background var(--transition-fast);
}

.search-select-item:hover,
.search-select-item.active {
    background: var(--color-surface-2);
    color: var(--color-brand);
}

.search-select-empty {
    padding: var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-text-3);
    text-align: center;
    font-style: italic;
}

.search-select.disabled .input {
    opacity: 0.6;
    cursor: not-allowed;
}

.search-select.loading .input {
    cursor: wait;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 2rem;
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    cursor: pointer;
}

.form-check-input {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    position: relative;
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

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

.form-check-input:checked::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M6.5 11.5L3 8l1.06-1.06L6.5 9.38l5.44-5.44L13 5l-6.5 6.5z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.form-check-input[type="radio"]:checked::after {
    background-image: none;
    margin: 4px;
    border-radius: 50%;
    background: white;
}

.form-check-input:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

.form-check-label {
    font-size: var(--text-sm);
    color: var(--color-text);
    line-height: 1.5;
}

/* Toggle / Switch */
.toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--color-border-strong);
    border-radius: var(--radius-full);
    transition: background var(--transition-base);
    flex-shrink: 0;
    cursor: pointer;
    border: none;
    appearance: none;
    -webkit-appearance: none;
}

.toggle::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-base);
}

.toggle:checked {
    background: var(--color-brand);
}

.toggle:checked::before {
    transform: translateX(18px);
}

.toggle:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

.toggle-label {
    font-size: var(--text-sm);
    color: var(--color-text);
}

/* Range */
.range {
    width: 100%;
    height: 4px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.range::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-brand);
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

/* Form grid */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-3);
}

@media(max-width: 480px) {

    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .grid-stats { grid-template-columns: 1fr; }
    .form-modal-grid { grid-template-columns: 1fr; }
}

/* Password strength */
.pwd-track {
    height: 3px;
    background: var(--color-border);
    border-radius: 2px;
    margin-top: var(--space-2);
    overflow: hidden;
}

.pwd-bar {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
}

/* File input */
.file-drop {
    border: 2px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    color: var(--color-text-3);
    cursor: pointer;
    transition: border-color var(--transition-base), background var(--transition-base);
}

.file-drop:hover,
.file-drop.dragover {
    border-color: var(--color-brand);
    background: var(--color-brand-light);
    color: var(--color-brand);
}

.file-drop-icon {
    font-size: 2rem;
    margin-bottom: var(--space-2);
}

.file-drop p {
    font-size: var(--text-sm);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════════════════════════════════ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    margin: var(--space-4) 0;
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
}

.alert-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: var(--font-weight-semi);
    margin-bottom: 2px;
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.alert-close:hover {
    opacity: 1;
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border-color: var(--color-success-border);
}

.alert-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border-color: var(--color-warning-border);
}

.alert-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    border-color: var(--color-danger-border);
}

.alert-info {
    background: var(--color-info-bg);
    color: var(--color-info-text);
    border-color: var(--color-info-border);
}

.alert-neutral {
    background: var(--color-surface-2);
    color: var(--color-text-2);
    border-color: var(--color-border);
}

.alert-brand {
    background: var(--color-brand-light);
    color: var(--color-brand-text);
    border-color: var(--color-brand-mid);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABS
═══════════════════════════════════════════════════════════════════════════ */
.tabs {
    border-bottom: 2px solid var(--color-border);
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-2);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    font-family: var(--font-sans);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.tab:hover {
    color: var(--color-text);
}

.tab.active {
    color: var(--color-brand);
    border-bottom-color: var(--color-brand);
    font-weight: var(--font-weight-semi);
}

.tab:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: -2px;
}

/* Tab variants */
.tabs-pill {
    border-bottom: none;
    gap: var(--space-1);
    padding: var(--space-1);
    background: var(--color-surface-3);
    border-radius: var(--radius-lg);
    width: fit-content;
}

.tabs-pill .tab {
    border-bottom: none;
    border-radius: var(--radius-md);
    margin: 0;
    padding: var(--space-2) var(--space-4);
}

.tabs-pill .tab.active {
    background: var(--color-surface);
    color: var(--color-brand);
    box-shadow: var(--shadow-sm);
}

/* Tab panels */
.tab-panel {
    display: none;
    padding-top: var(--space-4);
}

.tab-panel.active {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SPINNER & SKELETON
═══════════════════════════════════════════════════════════════════════════ */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-brand);
    border-radius: 50%;
    animation: ds-spin 0.65s linear infinite;
    flex-shrink: 0;
}

.spinner-sm {
    width: 14px;
    height: 14px;
    border-width: 1.5px;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

.spinner-xl {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

.spinner-white {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
}

@keyframes ds-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: var(--z-raised);
    backdrop-filter: blur(2px);
}

/* Skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--color-surface-3) 25%, var(--color-surface-2) 50%, var(--color-surface-3) 75%);
    background-size: 200% 100%;
    animation: ds-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 0.875em;
    margin-bottom: 0.5em;
    border-radius: var(--radius-sm);
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-rect {
    border-radius: var(--radius-md);
}

@keyframes ds-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Progress bar */
.progress-wrap {
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--color-brand);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-bar.success {
    background: var(--color-success);
}

.progress-bar.warning {
    background: var(--color-warning);
}

.progress-bar.danger {
    background: var(--color-danger);
}

.progress-wrap.progress-lg {
    height: 10px;
}

.progress-wrap.progress-sm {
    height: 3px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════════════════════ */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.card-header {
    padding: var(--space-4) var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.card-title {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semi);
    color: var(--color-text);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-3) var(--space-5);
    background: var(--color-surface-2);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
}

/* Stat card */
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-brand);
}

.stat-label {
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semi);
    color: var(--color-text-3);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    margin-bottom: var(--space-2);
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    line-height: 1.2;
}

.stat-change {
    font-size: var(--text-xs);
    color: var(--color-text-3);
    margin-top: var(--space-1);
}

.stat-change.up {
    color: var(--color-success-text);
}

.stat-change.down {
    color: var(--color-danger-text);
}

.stat-icon {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    opacity: 0.08;
}

/* App card (portal) */
.app-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    cursor: pointer;
    transition:
        box-shadow var(--transition-base),
        border-color var(--transition-base),
        transform var(--transition-base);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Garis aksen bawah yang muncul saat hover */
.app-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent, var(--color-brand));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.app-card:hover {
    border-color: color-mix(in srgb, var(--accent, var(--color-brand)) 35%, var(--color-border));
    transform: translateY(-3px);
    text-decoration: none;
}

.app-card:hover::after {
    transform: scaleX(1);
}

.app-card.soon {
    cursor: default;
    opacity: 0.55;
}

.app-card.soon:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--color-border);
}

.app-card.soon:hover::after {
    transform: scaleX(0);
}

/* ── Header baris: ikon + badge soon ── */
.app-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.app-icon {
    width: 48px;
    height: 48px;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    transition: transform var(--transition-base);
}

.app-card:hover .app-icon {
    transform: scale(1.08);
}

/* ── Body teks ── */
.app-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.app-card h3 {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semi);
    color: var(--color-text);
    line-height: var(--leading-tight);
}

.app-card p {
    font-size: var(--text-sm);
    color: var(--color-text-3);
    line-height: var(--leading-normal);
    margin: 0;
}

/* ── Footer: URL mono ── */
.app-url {
    font-size: var(--text-xs);
    color: var(--color-text-4);
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-family: var(--font-mono);
    padding-top: var(--space-2);
    margin-top: auto;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLE
═══════════════════════════════════════════════════════════════════════════ */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    background: var(--color-surface);
}

.table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semi);
    color: var(--color-text-3);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    background: var(--color-surface-2);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    user-select: none;
}

.table th.sortable {
    cursor: pointer;
}

.table th.sortable:hover {
    color: var(--color-text);
}

.table th .sort-icon {
    display: inline;
    margin-left: var(--space-1);
    opacity: 0.5;
    font-size: 0.75em;
}

.table th.sorted-asc .sort-icon,
.table th.sorted-desc .sort-icon {
    opacity: 1;
    color: var(--color-brand);
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-subtle);
    color: var(--color-text);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--color-surface-2);
}

.table tbody tr.selected {
    background: var(--color-brand-light);
}

/* Table variants */
.table-striped tbody tr:nth-child(even) {
    background: var(--color-surface-2);
}

.table-striped tbody tr:nth-child(even):hover {
    background: var(--color-surface-3);
}

.table-compact th,
.table-compact td {
    padding: var(--space-2) var(--space-3);
}

.table-bordered td,
.table-bordered th {
    border: 1px solid var(--color-border);
}

/* Table toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-2);
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.table-toolbar-left,
.table-toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    flex-direction: column;
    align-items: center;
    padding: var(--space-4);
    overflow-y: auto;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    width: 100%;
    box-shadow: var(--shadow-xl);
    animation: ds-modal-in 0.2s ease-out;
    position: relative;
    margin: auto 0;
}

.modal-sm {
    max-width: 400px;
}

.modal-md {
    max-width: 560px;
}

.modal-lg {
    max-width: 760px;
}

.modal-xl {
    max-width: 1000px;
}

.modal-full {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
}

@keyframes ds-modal-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-6);
}

.modal-header .modal-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--color-brand-light);
    flex-shrink: 0;
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: var(--font-weight-semi);
    color: var(--color-text);
    flex: 1;
}

.modal-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-3);
    font-size: 1.25rem;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
    display: flex;
    align-items: center;
}

.modal-close:hover {
    color: var(--color-text);
    background: var(--color-surface-3);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    background: var(--color-surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DRAWER / SIDE PANEL
═══════════════════════════════════════════════════════════════════════════ */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    z-index: var(--z-overlay);
}

.drawer-overlay.show {
    display: block;
}

.drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 400px;
    max-width: 90vw;
    background: var(--color-surface);
    box-shadow: var(--shadow-2xl);
    display: flex;
    flex-direction: column;
    z-index: calc(var(--z-overlay) + 1);
    transition: transform var(--transition-slow);
}

.drawer-right {
    right: 0;
    transform: translateX(100%);
}

.drawer-left {
    left: 0;
    transform: translateX(-100%);
}

.drawer.show {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    flex-shrink: 0;
}

.drawer-title {
    font-size: var(--text-lg);
    font-weight: var(--font-weight-semi);
    color: var(--color-text);
}

.drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-3);
    font-size: 1.25rem;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    display: flex;
    transition: color var(--transition-fast);
}

.drawer-close:hover {
    color: var(--color-text);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
}

.drawer-footer {
    flex-shrink: 0;
    padding: var(--space-4) var(--space-6);
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    background: var(--color-surface-2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DROPDOWN
═══════════════════════════════════════════════════════════════════════════ */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 180px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.dropdown-menu.right {
    left: auto;
    right: 0;
}

.dropdown-menu.top {
    top: auto;
    bottom: calc(100% + 4px);
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text);
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-sans);
    transition: background var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

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

.dropdown-item.danger {
    color: var(--color-danger);
}

.dropdown-item.danger:hover {
    background: var(--color-danger-bg);
}

.dropdown-item.active {
    background: var(--color-brand-light);
    color: var(--color-brand);
    font-weight: var(--font-weight-medium);
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border-subtle);
    margin: var(--space-1) 0;
}

.dropdown-header {
    padding: var(--space-2) var(--space-4) var(--space-1);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semi);
    color: var(--color-text-3);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOOLTIP
═══════════════════════════════════════════════════════════════════════════ */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-text);
    color: #fff;
    font-size: var(--text-xs);
    font-family: var(--font-sans);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-base);
    z-index: var(--z-tooltip);
    max-width: 240px;
    white-space: normal;
    text-align: center;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--color-text);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-base);
    z-index: var(--z-tooltip);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
}

[data-tooltip-pos="right"]::before {
    bottom: auto;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
}

[data-tooltip-pos="right"]::after {
    bottom: auto;
    left: calc(100% + 0px);
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
}

[data-tooltip-pos="left"]::before {
    bottom: auto;
    right: calc(100% + 8px);
    left: auto;
    top: 50%;
    transform: translateY(-50%);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST / NOTIFICATION
═══════════════════════════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.toast-container.bottom-right {
    bottom: var(--space-6);
    right: var(--space-6);
    align-items: flex-end;
}

.toast-container.bottom-left {
    bottom: var(--space-6);
    left: var(--space-6);
    align-items: flex-start;
}

.toast-container.top-right {
    top: var(--space-6);
    right: var(--space-6);
    align-items: flex-end;
}

.toast-container.top-left {
    top: var(--space-6);
    left: var(--space-6);
    align-items: flex-start;
}

.toast-container.top-center {
    top: var(--space-6);
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-text);
    color: #fff;
    border-radius: var(--radius-xl);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    box-shadow:
        var(--shadow-2xl),
        0 0 0 1px rgba(255, 255, 255, 0.07) inset;
    /* Lebar tetap — tidak mengikuti panjang konten */
    width: 320px;
    min-width: unset;
    max-width: unset;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast.hide {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
}

.toast-success {
    background: var(--color-success);
}

.toast-warning {
    background: var(--color-warning);
}

.toast-danger {
    background: var(--color-danger);
}

.toast-info {
    background: var(--color-info);
}

.toast-brand {
    background: var(--color-brand);
}

.toast-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
    opacity: 0.92;
}

.toast-body {
    flex: 1;
    min-width: 0;
    /* cegah teks overflow keluar container */
}

.toast-title {
    font-weight: var(--font-weight-semi);
    margin-bottom: 2px;
}

.toast-msg {
    font-size: var(--text-xs);
    opacity: 0.85;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-wrap: wrap;
}

.page-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-2);
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    font-family: var(--font-sans);
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    text-decoration: none;
    user-select: none;
}

.page-item:hover {
    background: var(--color-surface-3);
    color: var(--color-text);
}

.page-item.active {
    background: var(--color-brand);
    color: #fff;
    border-color: var(--color-brand);
}

.page-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.page-item.ellipsis {
    cursor: default;
    border: none;
}

.page-item.ellipsis:hover {
    background: none;
}

.pagination-info {
    font-size: var(--text-xs);
    color: var(--color-text-3);
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR & NAVIGATION
═══════════════════════════════════════════════════════════════════════════ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
    transition: width var(--transition-slow);
    z-index: var(--z-sticky);
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-4);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    overflow: hidden;
}

.sidebar-brand img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-brand-text {
    overflow: hidden;
}

.sidebar-brand-name {
    font-size: var(--text-sm);
    font-weight: var(--font-weight-bold);
    color: var(--color-brand);
    white-space: nowrap;
}

.sidebar-brand-sub {
    font-size: var(--text-xs);
    color: var(--color-text-3);
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-3) 0;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: var(--space-4);
}

.sidebar-section-label {
    padding: 0 var(--space-4);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semi);
    color: var(--color-text-4);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    margin-bottom: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-2);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-sans);
    transition: background var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin: 1px var(--space-2);
    width: calc(100% - var(--space-4));
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--color-surface-2);
    color: var(--color-text);
    text-decoration: none;
}

.nav-item.active {
    background: var(--color-brand-light);
    color: var(--color-brand);
    font-weight: var(--font-weight-semi);
}

.nav-item .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item .nav-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item .nav-badge {
    margin-left: auto;
    flex-shrink: 0;
}

.nav-item .nav-arrow {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.5;
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.nav-item.has-sub.open .nav-arrow {
    transform: rotate(90deg);
}

/* Sub-nav */
.nav-sub {
    overflow: hidden;
    max-height: 0;
    transition: max-height var(--transition-slow);
}

.nav-sub.open {
    max-height: 500px;
}

.nav-sub-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4) var(--space-2) 3rem;
    font-size: var(--text-xs);
    color: var(--color-text-2);
    cursor: pointer;
    text-decoration: none;
    transition: color var(--transition-fast);
    font-family: var(--font-sans);
}

.nav-sub-item:hover {
    color: var(--color-brand);
}

.nav-sub-item.active {
    color: var(--color-brand);
    font-weight: var(--font-weight-medium);
}

/* Sidebar footer */
.sidebar-footer {
    flex-shrink: 0;
    padding: var(--space-3) 0;
}

/* Collapsed sidebar */
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-arrow,
.sidebar.collapsed .sidebar-brand-text {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: var(--space-3);
    margin: 2px var(--space-2);
    width: calc(100% - var(--space-4));
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

/* App content area */
.app-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    height: 56px;
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: var(--z-raised);
    gap: var(--space-4);
    box-shadow: var(--shadow-xs);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    min-width: 0;
}

#upps-switcher {
    width: 180px;
    flex-shrink: 1;
}

#upps-switcher-select {
    width: 100%;
}

/* Sidebar UPPS switcher — desktop only */
.sidebar-upps {
    padding: var(--space-3) var(--space-4) var(--space-5);
    display: none;
}

.sidebar-upps-wrap .select {
    width: 100%;
    font-size: var(--text-sm);
}

@media (min-width: 1025px) {
    #upps-switcher {
        display: none !important;
    }

    .sidebar-upps {
        display: block;
    }
}

.topbar-title {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semi);
    color: var(--color-text);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-3);
}

.topbar-breadcrumb a {
    color: var(--color-text-3);
    text-decoration: none;
}

.topbar-breadcrumb a:hover {
    color: var(--color-brand);
}

.topbar-breadcrumb-sep {
    opacity: 0.4;
}

.topbar-breadcrumb-current {
    color: var(--color-text-2);
    font-weight: var(--font-weight-medium);
}

.page-content {
    flex: 1;
    padding: var(--space-6);
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH OVERLAY
═══════════════════════════════════════════════════════════════════════════ */
.auth-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    z-index: var(--z-modal);
    align-items: flex-start;
    justify-content: center;
    padding: var(--space-4);
    overflow-y: auto;
}

.auth-overlay.show {
    display: flex;
}

.auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 480px;
    margin: auto;
    box-shadow: var(--shadow-xl);
    animation: ds-modal-in 0.25s ease-out;
}

.auth-head {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-6) var(--space-6) var(--space-4);
}

.auth-head img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    flex-shrink: 0;
}

.auth-head h2 {
    font-size: var(--text-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
}

.auth-head p {
    font-size: var(--text-xs);
    color: var(--color-text-3);
    margin-top: 2px;
}

.auth-body {
    padding: var(--space-5) var(--space-6);
}

.auth-footer {
    padding: var(--space-4) var(--space-6);
    background: var(--color-surface-2);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.auth-hint {
    font-size: var(--text-xs);
    color: var(--color-text-3);
    text-align: center;
    margin-top: var(--space-4);
}

.auth-hint a {
    color: var(--color-brand);
    text-decoration: none;
    font-weight: var(--font-weight-semi);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PORTAL LAYOUT
═══════════════════════════════════════════════════════════════════════════ */
.btn-glass {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--color-surface-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text-2);
    font-size: 1rem;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.btn-glass:hover {
    background: var(--color-surface-4);
}

[data-sidebar-mobile-toggle] {
    display: none;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: calc(var(--z-sticky) - 1);
}

.sidebar-backdrop.show {
    display: block;
}

/* ── Wrapper utama ── */
.portal-main {
    min-height: calc(100vh - 48px);
    padding: var(--space-10) var(--space-8);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* ── Welcome block ── */
.portal-welcome {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-6);
    margin-bottom: var(--space-10);
    padding-bottom: var(--space-8);
}

.portal-welcome-text {
    flex: 1;
    min-width: 0;
}

/* Eyebrow — label kecil di atas judul */
.portal-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semi);
    letter-spacing: var(--tracking-widest);
    text-transform: uppercase;
    color: var(--color-brand);
    margin-bottom: var(--space-3);
}

.portal-eyebrow::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    flex-shrink: 0;
}

.portal-welcome h2 {
    font-size: var(--text-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-3);
}

.portal-desc {
    font-size: var(--text-base);
    color: var(--color-text-2);
    max-width: 520px;
}

/* Stat strip — kanan welcome (opsional, diisi JS) */
.portal-stats {
    display: flex;
    gap: var(--space-6);
    flex-shrink: 0;
}

.portal-stat {
    text-align: right;
}

.portal-stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    letter-spacing: var(--tracking-tight);
    line-height: 1;
}

.portal-stat-label {
    font-size: var(--text-xs);
    color: var(--color-text-3);
    margin-top: var(--space-1);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

/* ── Section wrapper (grup per kategori) ── */
.apps-section {
    margin-bottom: var(--space-10);
}

.apps-section:last-child {
    margin-bottom: 0;
}

/* Label seksi — garis + teks */
.apps-section-label {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.apps-section-label h3 {
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semi);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    color: var(--color-text-3);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Footer ── */
.portal-footer {
    padding: var(--space-5) var(--space-8);
    text-align: center;
    font-size: var(--text-xs);
    color: var(--color-text-3);
    letter-spacing: var(--tracking-wide);
}

/* ═══════════════════════════════════════════════════════════════════════════
   NOTIFICATION BELL / POPOVER
═══════════════════════════════════════════════════════════════════════════ */
.notif-badge-wrap {
    position: relative;
    display: inline-flex;
}

.notif-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    background: var(--color-danger);
    color: #fff;
    font-size: 9px;
    font-weight: var(--font-weight-bold);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid var(--color-surface);
    line-height: 1;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   DIVIDER
═══════════════════════════════════════════════════════════════════════════ */
.divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-4) 0;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-text-3);
    font-size: var(--text-xs);
    margin: var(--space-4) 0;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--color-border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-16) var(--space-6);
    text-align: center;
    color: var(--color-text-3);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.4;
}

.empty-state h3 {
    font-size: var(--text-lg);
    font-weight: var(--font-weight-semi);
    color: var(--color-text-2);
    margin-bottom: var(--space-2);
}

.empty-state p {
    font-size: var(--text-sm);
    max-width: 320px;
    line-height: var(--leading-normal);
}

.empty-state .btn {
    margin-top: var(--space-5);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCORDION
═══════════════════════════════════════════════════════════════════════════ */
.accordion {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.accordion-item {
    border-bottom: 1px solid var(--color-border-subtle);
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-sans);
    transition: background var(--transition-fast);
    gap: var(--space-3);
}

.accordion-trigger:hover {
    background: var(--color-surface-2);
}

.accordion-trigger.open {
    background: var(--color-surface-2);
    color: var(--color-brand);
}

.accordion-icon {
    font-size: 0.875rem;
    flex-shrink: 0;
    transition: transform var(--transition-base);
}

.accordion-trigger.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.accordion-body.open {
    max-height: 1000px;
}

.accordion-content {
    padding: 0 var(--space-5) var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text-2);
    line-height: var(--leading-normal);
}

/* ═══════════════════════════════════════════════════════════════════════════
   STEPS / STEPPER
═══════════════════════════════════════════════════════════════════════════ */
.stepper {
    display: flex;
    align-items: flex-start;
    gap: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    right: -50%;
    height: 2px;
    background: var(--color-border);
}

.step.completed:not(:last-child)::after {
    background: var(--color-brand);
}

.step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-surface-3);
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-3);
    position: relative;
    z-index: 1;
    transition: background var(--transition-base), border-color var(--transition-base);
}

.step.active .step-dot {
    background: var(--color-brand);
    border-color: var(--color-brand);
    color: #fff;
}

.step.completed .step-dot {
    background: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
}

.step-label {
    font-size: var(--text-xs);
    color: var(--color-text-3);
    margin-top: var(--space-2);
    text-align: center;
    white-space: nowrap;
}

.step.active .step-label {
    color: var(--color-brand);
    font-weight: var(--font-weight-medium);
}

.step.completed .step-label {
    color: var(--color-success-text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   AVATAR
═══════════════════════════════════════════════════════════════════════════ */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-brand-light);
    border: 1px solid var(--color-brand-mid);
    color: var(--color-brand);
    font-weight: var(--font-weight-semi);
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-xs {
    width: 24px;
    height: 24px;
    font-size: 9px;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--text-xs);
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: var(--text-sm);
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: var(--text-base);
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: var(--text-xl);
}

.avatar-group {
    display: flex;
}

.avatar-group .avatar {
    border: 2px solid var(--color-surface);
    margin-left: -8px;
}

.avatar-group .avatar:first-child {
    margin-left: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DATA LIST / DESCRIPTION
═══════════════════════════════════════════════════════════════════════════ */
.data-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--space-1) var(--space-6);
    align-items: baseline;
}

.data-list dt {
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semi);
    color: var(--color-text-3);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    white-space: nowrap;
    padding: var(--space-2) 0;
}

.data-list dd {
    font-size: var(--text-sm);
    color: var(--color-text);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border-subtle);
}

.data-list dd:last-child {
    border-bottom: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SEARCH BAR
═══════════════════════════════════════════════════════════════════════════ */
.search-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-bar:focus-within {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(var(--color-brand-rgb), 0.12);
}

.search-bar-icon {
    padding: 0 var(--space-3);
    color: var(--color-text-3);
    display: flex;
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 0.5rem var(--space-2) 0.5rem 0;
    font-size: var(--text-sm);
    color: var(--color-text);
    font-family: var(--font-sans);
}

.search-bar input::placeholder {
    color: var(--color-text-4);
}

.search-bar-btn {
    padding: var(--space-2) var(--space-3);
    background: var(--color-brand);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: var(--text-sm);
    transition: background var(--transition-fast);
    display: flex;
    align-items: center;
}

.search-bar-btn:hover {
    background: var(--color-brand-dark);
}

/* ═══════════════════════════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════════════════════════ */

/* ── App Brand Icon ───────────────────────────────────────────────── */
.app-brand-icon {
    width: 32px;
    height: 32px;
    background: var(--color-brand);
    color: #fff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* ── User Pill ────────────────────────────────────────────────────── */
.user-pill {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.25rem 0.75rem;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--color-text);
    font-weight: var(--font-weight-medium);
}

/* ── App Clock ────────────────────────────────────────────────────── */
.app-clock {
    font-size: var(--text-xs);
    color: var(--color-text-3);
}

/* ── Page Header ──────────────────────────────────────────────────── */
.page-header {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
}

.page-header-label {
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semi);
    letter-spacing: var(--tracking-widest);
    text-transform: uppercase;
    color: var(--color-brand);
    margin-bottom: var(--space-1);
}

.page-header h1 {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: var(--tracking-tight);
}

.page-header p {
    margin-top: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-3);
}

/* ── Stats Grid ───────────────────────────────────────────────────── */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
}

.grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

/* ── Chart Grid ───────────────────────────────────────────────────── */
.chart-grid .card-body {
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-grid canvas {
    max-height: 100%;
    max-width: 100%;
}

/* ── App Footer ───────────────────────────────────────────────────── */
.app-footer {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-xs);
    color: var(--color-text-3);
    text-align: center;
    background: var(--color-surface-2);
    flex-shrink: 0;
}

/* ── Loader Overlay ───────────────────────────────────────────────── */
.loader-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(4px);
    z-index: var(--z-toast);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
}

.loader-overlay.show { display: flex; }

.loader-overlay p {
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-brand);
}

/* ── Form Modal Grid ──────────────────────────────────────────────── */
.form-modal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

.form-modal-grid .form-group.full-width { grid-column: 1 / -1; }

/* ── Role Visibility ──────────────────────────────────────────────── */
.role-hide { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE HELPERS
═══════════════════════════════════════════════════════════════════════════ */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 60px;
    }

    .sidebar .sidebar-section-label,
    .sidebar .nav-text,
    .sidebar .nav-badge,
    .sidebar .nav-arrow,
    .sidebar .sidebar-brand-text {
        display: none;
    }

    .sidebar .nav-item {
        justify-content: center;
        padding: var(--space-3);
    }

    .sidebar .sidebar-header {
        justify-content: center;
        padding: var(--space-4) 0;
    }

    .sidebar .sidebar-footer {
        padding: var(--space-2) 0;
    }

    .app-clock { display: none; }
}

@media (max-width: 768px) {
    .portal-main {
        padding: var(--space-6) var(--space-4);
    }

    .portal-footer {
        padding: var(--space-4);
    }

    .portal-welcome {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }

    .portal-stats {
        width: 100%;
        justify-content: flex-start;
        gap: var(--space-8);
    }

    .portal-stat {
        text-align: left;
    }

    .portal-welcome h2 {
        font-size: var(--text-2xl);
    }

    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: var(--space-3);
    }

    .modal-body,
    .modal-header,
    .modal-footer {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    .page-content {
        padding: var(--space-4);
    }

    .app-topbar {
        padding: 0 var(--space-4);
    }

    #upps-switcher,
    #upps-switcher-select {
        max-width: 140px;
    }

    .grid-stats { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-2 { grid-template-columns: 1fr; }
    .user-pill { display: none; }

    .table-toolbar-left {
        flex: 1;
        min-width: 0;
    }

    .table-toolbar-left .input-wrap {
        flex: 1;
    }

    .card-body {
        padding: var(--space-3);
    }

    .page-header h1 {
        font-size: var(--text-xl);
    }
}

@media (max-width: 640px) {
    .hide-mobile {
        display: none !important;
    }

    .show-mobile {
        display: block !important;
    }

    .app-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }

    .portal-welcome {
        margin-bottom: var(--space-6);
        padding-bottom: var(--space-6);
        gap: var(--space-3);
    }

    .portal-stats {
        gap: var(--space-5);
    }

    .portal-stat-value {
        font-size: var(--text-xl);
    }

    .portal-welcome h2 {
        font-size: var(--text-xl);
    }

    .apps-section {
        margin-bottom: var(--space-8);
    }

    [data-sidebar-mobile-toggle] {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -240px;
        height: 100dvh;
        width: 240px;
        z-index: var(--z-sticky);
        transition: left var(--transition-slow);
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .sidebar .sidebar-section-label,
    .sidebar .nav-text,
    .sidebar .nav-badge,
    .sidebar .nav-arrow,
    .sidebar .sidebar-brand-text {
        display: block;
    }

    .sidebar .nav-item {
        justify-content: flex-start;
        padding: var(--space-2) var(--space-4);
    }

    .sidebar .sidebar-header {
        justify-content: flex-start;
        padding: var(--space-4);
    }

    .sidebar .sidebar-footer {
        padding: var(--space-3) 0;
    }

    .app-content {
        margin-left: 0;
    }

    .stepper {
        flex-direction: column;
        gap: var(--space-3);
    }

    .step::after {
        display: none;
    }

    /* Modal — centered dengan padding di mobile */
    .modal-overlay {
        padding: var(--space-4);
        align-items: center;
    }

    .modal {
        border-radius: var(--radius-lg);
        max-height: 92dvh;
        display: flex;
        flex-direction: column;
    }

    .modal-sm,
    .modal-md,
    .modal-lg,
    .modal-xl {
        max-width: 100%;
    }

    .modal-header {
        padding: var(--space-4);
        flex-shrink: 0;
    }

    .modal-body {
        overflow-y: auto;
        flex: 1;
        padding: var(--space-4);
    }

    .modal-footer {
        flex-shrink: 0;
        padding: var(--space-3) var(--space-4);
    }

    /* Page content */
    .page-content {
        padding: var(--space-3);
    }

    /* Table toolbar — satu baris, tombol icon-only */
    .table-toolbar {
        padding: var(--space-2) var(--space-3);
        gap: var(--space-2);
    }

    .table-toolbar .btn-label {
        display: none;
    }

    .table-toolbar-right .btn.btn-sm {
        padding: var(--space-2);
        min-width: 32px;
    }
}

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

@media print {
    .sidebar, .app-topbar, .btn, .table-toolbar { display: none !important; }
    .app-content { margin-left: 0; }
    .page-content { padding: 0; }
    .card { break-inside: avoid; }
}
