/*!
 * Aset & Stok — Design System
 * ---------------------------------------------------------------------------
 * Layered on top of Bootstrap 5.3 (CDN). Loaded AFTER bootstrap.min.css so the
 * tokens below win without needing a Sass/webpack build.
 *
 * Contents
 *   01. Tokens
 *   02. Base & typography
 *   03. App shell (sidebar + topbar + content)
 *   04. Sidebar navigation
 *   05. Topbar
 *   06. Page header
 *   07. Cards & stat cards
 *   08. Tables (incl. mobile card mode)
 *   09. Forms & filters
 *   10. Buttons, badges, alerts, lists
 *   11. Pagination
 *   12. Modals, dropdowns, misc
 *   13. Utilities
 *   14. Responsive
 *   16. Print
 */

/* ========================================================================== */
/* 01. Tokens                                                                  */
/* ========================================================================== */

:root {
    --as-bg: #eef2f7;
    --as-surface: #ffffff;
    --as-surface-2: #f8fafc;
    --as-surface-3: #f1f5f9;
    --as-border: #e5e9f0;
    --as-border-strong: #cbd5e1;
    --as-text: #0f172a;
    --as-text-soft: #475569;
    --as-text-muted: #7c8ba1;

    --as-primary: #4f46e5;
    --as-primary-dark: #4338ca;
    --as-primary-soft: #eef2ff;
    --as-success: #059669;
    --as-success-soft: #ecfdf5;
    --as-danger: #dc2626;
    --as-danger-soft: #fef2f2;
    --as-warning: #d97706;
    --as-warning-soft: #fffbeb;
    --as-info: #0284c7;
    --as-info-soft: #f0f9ff;

    --as-sidebar: #111827;
    --as-sidebar-2: #0b1220;
    --as-sidebar-text: #cbd5e1;
    --as-sidebar-text-dim: #7f8ea3;
    --as-sidebar-hover: rgba(255, 255, 255, 0.07);
    --as-sidebar-active: #4f46e5;

    --as-sidebar-width: 268px;
    --as-topbar-height: 60px;

    --as-radius: 14px;
    --as-radius-sm: 10px;
    --as-radius-pill: 999px;

    --as-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --as-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 2px 6px rgba(15, 23, 42, 0.04);
    --as-shadow: 0 4px 10px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
    --as-shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.16);

    --as-ring: 0 0 0 3px rgba(79, 70, 229, 0.18);

    --bs-body-font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --bs-body-color: var(--as-text);
    --bs-body-bg: var(--as-bg);
    --bs-border-color: var(--as-border);
    --bs-border-radius: var(--as-radius-sm);
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color-rgb: 67, 56, 202;
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-secondary-color: var(--as-text-muted);
}

/* ========================================================================== */
/* 02. Base & typography                                                       */
/* ========================================================================== */

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

body {
    background-color: var(--as-bg);
    color: var(--as-text);
    font-feature-settings: "cv02", "cv03", "cv04", "tnum";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-wrap: break-word;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--as-text);
}

a {
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    text-decoration: none;
}

code {
    background: var(--as-surface-3);
    color: #be123c;
    border-radius: 5px;
    padding: 0.1em 0.38em;
    font-size: 0.83em;
    white-space: nowrap;
}

hr {
    border-color: var(--as-border);
    opacity: 1;
}

:focus-visible {
    outline: 2px solid var(--as-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ========================================================================== */
/* 03. App shell                                                              */
/* ========================================================================== */

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

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1 1 auto;
    padding: 1.25rem 1rem 2.5rem;
}

.app-content:focus {
    outline: none;
}

.app-content > * + * {
    margin-top: 1rem;
}

/* Vertical rhythm helper used by the many "row/card" stacks in the views. */
.app-content .row {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

/* ========================================================================== */
/* 04. Sidebar navigation                                                     */
/* ========================================================================== */

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1045;
    width: var(--as-sidebar-width);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--as-sidebar) 0%, var(--as-sidebar-2) 100%);
    color: var(--as-sidebar-text);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow-y: auto;
    overscroll-behavior: contain;
    transition: transform 0.25s ease, visibility 0.25s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.app-sidebar::-webkit-scrollbar {
    width: 8px;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 99px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1.1rem 1.15rem;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-brand__mark {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #fff;
    background: linear-gradient(135deg, var(--as-sidebar-active), #7c3aed);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45);
    overflow: hidden;
}

/* Logo perusahaan uploaded: tampil penuh di dalam mark, bukan di dalam gradient. */
.sidebar-brand__mark--logo {
    background: #fff;
}

.sidebar-brand__mark--logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
}

.sidebar-brand__name {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.sidebar-brand__sub {
    font-size: 0.7rem;
    color: var(--as-sidebar-text-dim);
    line-height: 1.3;
}

.sidebar-nav {
    flex: 1 1 auto;
    padding: 0.5rem 0.75rem 1rem;
}

.sidebar-section {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--as-sidebar-text-dim);
    padding: 1rem 0.7rem 0.4rem;
}

.sidebar-section:first-child {
    padding-top: 0.35rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--as-sidebar-text);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.55rem 0.7rem;
    border-radius: var(--as-radius-sm);
    position: relative;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-nav .nav-link i {
    flex: 0 0 auto;
    width: 1.25rem;
    text-align: center;
    font-size: 1rem;
    opacity: 0.85;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link:focus-visible {
    background: var(--as-sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.95), rgba(124, 58, 237, 0.75));
    color: #fff;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.sidebar-nav .nav-link.active i {
    opacity: 1;
}

.sidebar-footer {
    padding: 0.85rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.6rem;
    border-radius: var(--as-radius-sm);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-user__name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
}

.sidebar-user__role {
    font-size: 0.72rem;
    color: var(--as-sidebar-text-dim);
    line-height: 1.2;
}

.avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--as-primary), #7c3aed);
    letter-spacing: 0;
    user-select: none;
}

.avatar--sm {
    width: 30px;
    height: 30px;
    font-size: 0.78rem;
}

.avatar--lg {
    width: 76px;
    height: 76px;
    font-size: 1.9rem;
}

.avatar--muted {
    background: linear-gradient(135deg, #64748b, #475569);
}

/* Drawer backdrop (mobile only) */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

body.sidebar-open {
    overflow: hidden;
}

/* ========================================================================== */
/* 05. Topbar                                                                 */
/* ========================================================================== */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: var(--as-topbar-height);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--as-border);
    box-shadow: var(--as-shadow-xs);
}

.app-topbar__title {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
    margin: 0;
}

.app-topbar__subtitle {
    font-size: 0.74rem;
    color: var(--as-text-muted);
    line-height: 1.2;
}

.topbar-icon-btn {
    --size: 40px;
    width: var(--size);
    height: var(--size);
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--as-radius-sm);
    background: transparent;
    color: var(--as-text-soft);
    font-size: 1.1rem;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.topbar-icon-btn:hover {
    background: var(--as-surface-3);
    color: var(--as-primary);
}

.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: var(--as-radius-pill);
    background: var(--as-surface-2);
    border: 1px solid var(--as-border);
    color: var(--as-text-soft);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.25rem 0.6rem 0.25rem 0.3rem;
    border-radius: var(--as-radius-pill);
    border: 1px solid var(--as-border);
    background: var(--as-surface);
    color: var(--as-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.topbar-user:hover,
.topbar-user:focus,
.topbar-user.show {
    border-color: var(--as-border-strong);
    box-shadow: var(--as-shadow-sm);
    color: var(--as-text);
}

.topbar-user__name {
    font-size: 0.83rem;
    font-weight: 600;
    line-height: 1.15;
}

.topbar-user__role {
    font-size: 0.68rem;
    color: var(--as-text-muted);
    line-height: 1.15;
}

.dropdown-menu {
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius-sm);
    box-shadow: var(--as-shadow-lg);
    padding: 0.35rem;
    font-size: 0.88rem;
}

.dropdown-item {
    border-radius: 7px;
    padding: 0.45rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.dropdown-item:active {
    background: var(--as-primary);
}

.dropdown-header {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--as-text-muted);
    font-weight: 700;
}

/* ========================================================================== */
/* 06. Page header                                                            */
/* ========================================================================== */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.page-head__title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.page-head__subtitle {
    font-size: 0.83rem;
    color: var(--as-text-muted);
    margin: 0.1rem 0 0;
}

.page-head__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--as-text-muted);
    margin: 0 0 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.section-title::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--as-border);
}

/* ========================================================================== */
/* 07. Cards & stat cards                                                     */
/* ========================================================================== */

.card {
    background: var(--as-surface);
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius);
    box-shadow: var(--as-shadow-sm);
}

.card-header {
    background: var(--as-surface);
    border-bottom: 1px solid var(--as-border);
    padding: 0.8rem 1.1rem;
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: var(--as-radius) var(--as-radius) 0 0 !important;
}

.card-header i {
    color: var(--as-primary);
}

.card-body {
    padding: 1.1rem;
}

.card-footer {
    background: var(--as-surface-2);
    border-top: 1px solid var(--as-border);
    padding: 0.7rem 1.1rem;
    border-radius: 0 0 var(--as-radius) var(--as-radius);
}

/* Compact toolbar card used for filters */
.card-toolbar .card-body {
    padding: 0.9rem 1.1rem;
}

/* Form action bar: inline on desktop, sticky at the bottom on small screens */
.card-footer.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
}

.card-footer.form-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.card-footer.form-actions .form-hint {
    margin-right: auto;
    margin-bottom: 0;
}

.stat-card {
    position: relative;
    overflow: hidden;
    border-left: 4px solid var(--as-primary) !important;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--as-shadow) !important;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -30px -50px auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.045;
    pointer-events: none;
}

.stat-card .card-body {
    position: relative;
    z-index: 1;
    padding: 1rem 1.1rem;
}

.stat-card__label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--as-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.stat-card__value {
    font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.6rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0.25rem 0 0.15rem;
}

.stat-card__hint {
    font-size: 0.76rem;
    color: var(--as-text-muted);
    margin: 0;
}

.stat-card__link {
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.stat-card__link::after {
    content: "\F138"; /* bi-arrow-right */
    font-family: bootstrap-icons;
    font-size: 0.7em;
    transition: transform 0.18s ease;
}

.stat-card__link:hover::after {
    transform: translateX(3px);
}

.accent-primary   { color: var(--as-primary) !important; }
.accent-success   { color: var(--as-success) !important; }
.accent-danger    { color: var(--as-danger) !important; }
.accent-warning   { color: var(--as-warning) !important; }
.accent-info      { color: var(--as-info) !important; }
.accent-purple    { color: #7c3aed !important; }
.accent-slate     { color: var(--as-text-soft) !important; }

/* Mini metric tile (used by report summaries) */
.metric {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 100%;
    padding: 0.85rem 1rem;
    background: var(--as-surface);
    border: 1px solid var(--as-border);
    border-left: 4px solid var(--as-primary);
    border-radius: var(--as-radius-sm);
    box-shadow: var(--as-shadow-sm);
}

.metric__icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    background: var(--as-primary-soft);
    color: var(--as-primary);
}

.metric__body {
    min-width: 0;
}

.metric__label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--as-text-muted);
}

.metric__value {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

/* ========================================================================== */
/* 08. Tables                                                                 */
/* ========================================================================== */

.table-responsive {
    position: relative;
    /* Scroll affordance: gradient masks appear only while overflowing */
    background-image:
        linear-gradient(to right, var(--as-surface) 30%, rgba(255, 255, 255, 0)),
        linear-gradient(to left, var(--as-surface) 30%, rgba(255, 255, 255, 0)),
        linear-gradient(to right, rgba(15, 23, 42, 0.12), rgba(15, 23, 42, 0)),
        linear-gradient(to left, rgba(15, 23, 42, 0.12), rgba(15, 23, 42, 0));
    background-position: left center, right center, left center, right center;
    background-repeat: no-repeat;
    background-size: 32px 100%, 32px 100%, 12px 100%, 12px 100%;
    background-attachment: local, local, scroll, scroll;
    -webkit-overflow-scrolling: touch;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(248, 250, 252, 0.85);
    --bs-table-hover-bg: var(--as-primary-soft);
    margin-bottom: 0;
    color: var(--as-text);
}

.table > thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--as-surface-2);
    color: var(--as-text-soft);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--as-border);
}

.table > tbody > tr > td {
    padding: 0.65rem 0.75rem;
    vertical-align: middle;
    border-color: var(--as-border);
    font-size: 0.875rem;
}

.table > tfoot > tr > th,
.table > tfoot > tr > td {
    background: var(--as-surface-3);
    border-top: 1px solid var(--as-border-strong);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.65rem 0.75rem;
}

.table > thead th:first-child,
.table > tbody > tr > td:first-child {
    padding-left: 1.1rem;
}

.table > thead th:last-child,
.table > tbody > tr > td:last-child {
    padding-right: 1.1rem;
}

.table-sm > tbody > tr > td,
.table-sm > thead > tr > th {
    padding: 0.5rem 0.6rem;
}

/* Compact key/value tables used on detail pages */
.table-kv > tbody > tr > td {
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
    border-bottom: 1px dashed var(--as-border);
}

.table-kv > tbody > tr:last-child > td {
    border-bottom: 0;
}

.table-kv > tbody > tr > td:first-child {
    color: var(--as-text-muted);
    font-weight: 500;
    width: 42%;
}

.table-kv > tbody > tr > td:last-child {
    text-align: right;
    font-weight: 600;
    color: var(--as-text);
}

.table-actions {
    white-space: nowrap;
}

.table-actions .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
}

.table-empty {
    text-align: center;
    padding: 2.25rem 1rem;
    color: var(--as-text-muted);
}

.table-empty i {
    display: block;
    font-size: 1.9rem;
    color: var(--as-border-strong);
    margin-bottom: 0.4rem;
}

/* --- Mobile card mode ---------------------------------------------------- */
/* Applied below the lg breakpoint by `.table-js` + the label injection done
   in public/js/app.js (each <td> receives a data-label from its <th>).      */

@media (max-width: 991.98px) {
    .table-js {
        display: block;
    }

    .table-js > caption {
        caption-side: top;
    }

    .table-js > thead,
    .table-js > tfoot {
        display: none;
    }

    .table-js > tbody {
        display: block;
        padding: 0.15rem 0.35rem;
    }

    .table-js > tbody > tr {
        display: block;
        background: var(--as-surface);
        border: 1px solid var(--as-border);
        border-radius: var(--as-radius-sm);
        box-shadow: var(--as-shadow-xs);
        margin-bottom: 0.6rem;
        padding: 0.45rem 0.15rem;
    }

    .table-js > tbody > tr:hover {
        background: var(--as-surface);
    }

    .table-js > tbody > tr > td {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.85rem;
        padding: 0.32rem 0.8rem;
        border: 0;
        font-size: 0.855rem;
        text-align: right;
    }

    .table-js > tbody > tr > td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        max-width: 45%;
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--as-text-muted);
        text-align: left;
    }

    /* Cells without a label (colspans, action bars) span the full width. */
    .table-js > tbody > tr > td:empty,
    .table-js > tbody > tr > td[data-label=""] {
        display: block;
        text-align: left;
    }

    .table-js > tbody > tr > td[data-label=""]::before {
        display: none;
    }

    /* The entity name cell becomes the card title. */
    .table-js > tbody > tr > td[data-label=""],
    .table-js > tbody > tr > td.text-nowrap:first-child,
    .table-js > tbody > tr > td:first-child:not([data-label]) {
        justify-content: flex-start;
    }

    .table-actions,
    .table-js td.table-actions {
        justify-content: flex-end;
        width: 100%;
        padding-top: 0.55rem;
        padding-bottom: 0.35rem;
    }

    .table-actions::before {
        max-width: none;
    }

    .table-js td.text-end,
    .table-js td.text-center {
        text-align: right;
    }

    .table-js tbody tr.table-warning,
    .table-js tbody tr.table-danger,
    .table-js tbody tr.table-light {
        background: var(--as-surface);
    }

    .table-js tbody tr.table-warning {
        border-left: 3px solid var(--as-warning);
    }

    .table-js tbody tr.table-danger {
        border-left: 3px solid var(--as-danger);
    }

    .table-kv > tbody > tr > td {
        padding: 0.5rem 0.8rem;
    }
}

/* --------------------------------------------------------------------------
   Horizontal-scroll fallback for card mode on very small screens
   -------------------------------------------------------------------------- */

@media (max-width: 991.98px) {
    .table-js-off > thead,
    .table-js-off > tfoot {
        display: table-header-group;
    }

    .table-js-off > tfoot {
        display: table-footer-group;
    }

    .table-js-off > tbody,
    .table-js-off > tbody > tr {
        display: table-row-group;
        display: revert;
    }

    .table-js-off > tbody > tr > td {
        display: table-cell;
        text-align: left;
    }
}

/* ========================================================================== */
/* 09. Forms & filters                                                        */
/* ========================================================================== */

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--as-text-soft);
    margin-bottom: 0.3rem;
}

.form-label-sm,
.form-label.small {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--as-text-muted);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.form-control,
.form-select {
    border-color: var(--as-border-strong);
    border-radius: var(--as-radius-sm);
    font-size: 0.875rem;
    padding: 0.5rem 0.7rem;
    color: var(--as-text);
    background-color: var(--as-surface);
}

.form-control::placeholder {
    color: #a8b3c2;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--as-primary);
    box-shadow: var(--as-ring);
    background-color: var(--as-surface);
}

.form-control[readonly] {
    background-color: var(--as-surface-3);
    color: var(--as-text-muted);
}

.form-control-sm,
.form-select-sm {
    font-size: 0.82rem;
    padding: 0.4rem 0.6rem;
}

.form-text {
    font-size: 0.75rem;
    color: var(--as-text-muted);
}

.form-check-input {
    border-color: var(--as-border-strong);
    cursor: pointer;
}

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

.form-check-input:focus {
    box-shadow: var(--as-ring);
    border-color: var(--as-primary);
}

.form-check-label {
    font-size: 0.83rem;
    cursor: pointer;
}

.invalid-feedback {
    font-size: 0.75rem;
    font-weight: 500;
}

.input-group-text {
    background: var(--as-surface-3);
    border-color: var(--as-border-strong);
    font-size: 0.83rem;
    color: var(--as-text-muted);
}

textarea.form-control {
    min-height: 80px;
}

/* Text input with a leading icon (auth screens, quick search) */
.input-icon {
    position: relative;
}

.input-icon > i {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    transform: translateY(-50%);
    color: var(--as-text-soft);
    font-size: 0.95rem;
    pointer-events: none;
    z-index: 2;
}

.input-icon > .form-control {
    padding-left: 2.5rem;
}

/* Filter toolbar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.filter-bar__spacer {
    flex: 1 1 auto;
}

@media (max-width: 991.98px) {
    .filter-collapse {
        overflow: hidden;
        transition: max-height 0.25s ease;
    }
}

/* ========================================================================== */
/* 10. Buttons, badges, alerts, lists                                         */
/* ========================================================================== */

.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: var(--as-radius-sm);
    letter-spacing: 0.005em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: transform 0.12s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-sm {
    --bs-btn-padding-y: 0.32rem;
    --bs-btn-padding-x: 0.6rem;
    --bs-btn-font-size: 0.8rem;
    --bs-btn-border-radius: 8px;
}

.btn-primary {
    --bs-btn-bg: var(--as-primary);
    --bs-btn-border-color: var(--as-primary);
    --bs-btn-hover-bg: var(--as-primary-dark);
    --bs-btn-hover-border-color: var(--as-primary-dark);
    --bs-btn-active-bg: var(--as-primary-dark);
    --bs-btn-active-border-color: var(--as-primary-dark);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.22);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.btn-success {
    --bs-btn-bg: var(--as-success);
    --bs-btn-border-color: var(--as-success);
    --bs-btn-hover-bg: #047857;
    --bs-btn-hover-border-color: #047857;
}

.btn-outline-secondary {
    --bs-btn-color: var(--as-text-soft);
    --bs-btn-border-color: var(--as-border-strong);
    --bs-btn-hover-bg: var(--as-surface-3);
    --bs-btn-hover-border-color: var(--as-border-strong);
    --bs-btn-hover-color: var(--as-text);
    --bs-btn-active-bg: var(--as-surface-3);
    --bs-btn-active-color: var(--as-text);
}

.btn-outline-primary {
    --bs-btn-color: var(--as-primary);
    --bs-btn-border-color: #c7d2fe;
    --bs-btn-hover-bg: var(--as-primary);
    --bs-btn-hover-border-color: var(--as-primary);
}

.btn-outline-dark {
    --bs-btn-color: var(--as-text-soft);
    --bs-btn-border-color: var(--as-border-strong);
    --bs-btn-hover-bg: #1f2937;
    --bs-btn-hover-border-color: #1f2937;
}

.btn-outline-danger {
    --bs-btn-color: var(--as-danger);
    --bs-btn-border-color: #fecaca;
    --bs-btn-hover-bg: var(--as-danger);
    --bs-btn-hover-border-color: var(--as-danger);
}

.badge {
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.35em 0.6em;
    border-radius: var(--as-radius-pill);
    font-size: 0.72rem;
}

.text-bg-primary {
    background-color: var(--as-primary) !important;
}

.alert {
    border: 1px solid transparent;
    border-radius: var(--as-radius-sm);
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    box-shadow: var(--as-shadow-sm);
}

.alert-success {
    background: var(--as-success-soft);
    border-color: #a7f3d0;
    color: #065f46;
}

.alert-danger {
    background: var(--as-danger-soft);
    border-color: #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: var(--as-warning-soft);
    border-color: #fde68a;
    color: #92400e;
}

.alert-info {
    background: var(--as-info-soft);
    border-color: #bae6fd;
    color: #075985;
}

.alert > ul {
    margin-bottom: 0;
}

.alert .btn-close {
    margin-left: auto;
}

.list-group-item {
    background: var(--as-surface);
    border-color: var(--as-border);
    padding: 0.7rem 1.1rem;
    font-size: 0.875rem;
}

.list-group-item-action:hover {
    background: var(--as-primary-soft);
    color: var(--as-text);
    border-color: var(--as-border);
}

.list-group-item-action:focus {
    background: var(--as-primary-soft);
    color: var(--as-text);
}

.progress {
    background: var(--as-surface-3);
    border-radius: 99px;
    overflow: hidden;
}

/* ========================================================================== */
/* 11. Pagination                                                             */
/* ========================================================================== */

.pagination {
    --bs-pagination-font-size: 0.83rem;
    --bs-pagination-padding-x: 0.6rem;
    --bs-pagination-padding-y: 0.4rem;
    gap: 0.2rem;
    flex-wrap: wrap;
    margin: 0;
}

.page-link {
    color: var(--as-text-soft);
    background: var(--as-surface);
    border: 1px solid var(--as-border);
    border-radius: 8px !important;
    min-width: 2.1rem;
    text-align: center;
    font-weight: 600;
}

.page-link:hover {
    color: var(--as-primary);
    background: var(--as-primary-soft);
    border-color: #c7d2fe;
}

.page-item.active .page-link {
    background: var(--as-primary);
    border-color: var(--as-primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.page-item.disabled .page-link {
    background: var(--as-surface-2);
    color: var(--as-text-muted);
    border-color: var(--as-border);
}

.pagination-summary {
    font-size: 0.78rem;
    color: var(--as-text-muted);
}

/* ========================================================================== */
/* 12. Modals, dropdowns, misc                                                */
/* ========================================================================== */

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

.modal-header,
.modal-footer {
    border-color: var(--as-border);
    padding: 0.9rem 1.1rem;
}

.modal-body {
    padding: 1.1rem;
}

.modal-title {
    font-size: 1.02rem;
    font-weight: 700;
}

/* Confirmation dialog driven by data-confirm */
.as-confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: as-fade-in 0.15s ease;
}

.as-confirm {
    width: min(420px, 100%);
    background: var(--as-surface);
    border-radius: var(--as-radius);
    box-shadow: var(--as-shadow-lg);
    overflow: hidden;
    animation: as-pop-in 0.18s ease;
}

.as-confirm__body {
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    gap: 0.85rem;
}

.as-confirm__icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    background: var(--as-danger-soft);
    color: var(--as-danger);
}

.as-confirm__title {
    font-size: 0.98rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
}

.as-confirm__text {
    font-size: 0.85rem;
    color: var(--as-text-soft);
    margin: 0;
}

.as-confirm__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    background: var(--as-surface-2);
    border-top: 1px solid var(--as-border);
}

@keyframes as-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes as-pop-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

/* Off-canvas (mobile sidebar) */
@media (max-width: 991.98px) {
    .app-sidebar {
        width: min(84vw, var(--as-sidebar-width));
        transform: translateX(-100%);
        visibility: hidden;
        box-shadow: var(--as-shadow-lg);
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
        visibility: visible;
    }

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

@media (min-width: 992px) {
    .app-sidebar {
        transform: none !important;
        visibility: visible !important;
    }

    .app-main {
        margin-left: var(--as-sidebar-width);
    }
}

/* ========================================================================== */
/* 13. Utilities                                                              */
/* ========================================================================== */

.text-secondary {
    color: var(--as-text-muted) !important;
}

.text-muted-2 {
    color: var(--as-text-soft) !important;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.divider-y {
    width: 1px;
    height: 26px;
    background: var(--as-border);
}

.hover-shadow:hover {
    box-shadow: var(--as-shadow) !important;
}

.cursor-pointer {
    cursor: pointer;
}

.min-w-0 {
    min-width: 0;
}

/* ========================================================================== */
/* 14. Company profile (logo + kop surat)                                      */
/* ========================================================================== */

/* Preview logo di halaman pengaturan. */
.logo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 168px;
    padding: 1.25rem;
    border: 1px dashed var(--as-border-strong);
    border-radius: var(--as-radius);
    background:
        linear-gradient(180deg, var(--as-surface-2) 0%, var(--as-surface-3) 100%);
}

.logo-preview__img {
    max-width: 100%;
    max-height: 132px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.08));
}

/* Kop surat untuk pratinjau di layar. */
.letterhead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.letterhead__brand {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    min-width: 0;
}

.letterhead__logo {
    width: 68px;
    height: 68px;
    object-fit: contain;
    flex: 0 0 auto;
}

.letterhead__mark {
    flex: 0 0 auto;
    width: 68px;
    height: 68px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    color: #fff;
    background: linear-gradient(135deg, var(--as-primary), #7c3aed);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.letterhead__meta {
    min-width: 0;
}

.letterhead__name {
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--as-text);
}

.letterhead__tagline {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--as-text-muted);
    margin-top: 0.1rem;
}

.letterhead__lines {
    margin-top: 0.45rem;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--as-text-soft);
}

.letterhead__meta > .d-flex {
    margin-top: 0.6rem;
    font-size: 0.82rem;
    color: var(--as-text-soft);
}

.letterhead__divider {
    height: 3px;
    margin: 1rem 0 0;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--as-primary) 0%, #7c3aed 45%, transparent 100%);
}

@media (max-width: 575.98px) {
    .logo-preview {
        min-height: 132px;
    }

    .logo-preview__img {
        max-height: 104px;
    }

    .letterhead__logo,
    .letterhead__mark {
        width: 52px;
        height: 52px;
        font-size: 1.3rem;
    }

    .letterhead__name {
        font-size: 1rem;
    }
}

/* ========================================================================== */
/* 15. Responsive                                                             */
/* ========================================================================== */

@media (max-width: 991.98px) {
    .app-content {
        padding: 1rem 0.85rem 2rem;
    }

    .card-body {
        padding: 0.9rem;
    }

    .card-header,
    .card-footer {
        padding-left: 0.9rem;
        padding-right: 0.9rem;
    }

    .page-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.6rem;
    }

    .page-head__actions {
        width: 100%;
    }

    .page-head__actions > .btn,
    .page-head__actions > form > .btn {
        flex: 1 1 auto;
    }

    /* Comfortable touch targets on phones */
    .btn {
        min-height: 38px;
    }

    .btn-sm {
        min-height: 34px;
    }

    .table-actions .btn,
    .btn-icon-sm {
        width: 36px;
        height: 36px;
    }

    .form-control,
    .form-select,
    .form-control-sm,
    .form-select-sm {
        font-size: 1rem;
    }

    .table > tbody > tr > td {
        font-size: 0.86rem;
    }

    /* Keep the submit button reachable while scrolling long forms */
    .card-footer.form-actions {
        position: sticky;
        bottom: 0;
        z-index: 6;
        box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.12);
    }

    .card-footer.form-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .card-footer.form-actions .form-hint {
        flex: 1 0 100%;
        order: -1;
        margin-right: 0;
        margin-bottom: 0.15rem;
    }
}

@media (max-width: 575.98px) {
    :root {
        --as-topbar-height: 56px;
    }

    .app-topbar {
        padding: 0.5rem 0.7rem;
        gap: 0.5rem;
    }

    .app-topbar__title {
        font-size: 0.95rem;
    }

    .topbar-user__meta {
        display: none;
    }

    .topbar-user {
        padding: 0.25rem;
        border-radius: 50%;
    }

    .page-head__title {
        font-size: 1.15rem;
    }

    .stat-card__value {
        font-size: 1.2rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }
}

/* ========================================================================== */
/* 16. Print                                                                  */
/* ========================================================================== */

@media print {
    .app-sidebar,
    .sidebar-backdrop,
    .app-topbar,
    .filter-toggle,
    .no-print,
    .page-head__actions,
    .pagination,
    .card-footer {
        display: none !important;
    }

    .app-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    body {
        background: #fff;
    }

    .card {
        border: 1px solid #ccc;
        box-shadow: none;
        break-inside: avoid;
    }

    .table > thead th {
        background: #f0f0f0 !important;
        color: #000 !important;
    }

    .table {
        font-size: 11px;
    }

    @page {
        margin: 12mm;
    }
}

/* ========================================================================== */
/* Accessibility                                                              */
/* ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}