/* =========================================================
   iHomeService Global Design System
   ========================================================= */

/* =========================================================
   01. DESIGN TOKENS
   ========================================================= */
:root {
    /* Colors */
    --navy: #0b1730;
    --navy-light: #102850;
    --violet: #6658f5;
    --violet-dark: #5546e8;
    --violet-light: #7868f8;
    --green: #16a66b;
    --green-light: #d4f4e7;
    --orange: #ed9d1a;
    --orange-light: #fff4e0;
    --red: #e6576f;
    --red-light: #fde8ec;
    --blue: #3987ea;
    --blue-light: #e3f2fd;
    --purple: #9333ea;
    --purple-light: #f3e8ff;
    --cyan: #06b6d4;
    --cyan-light: #e0f7fa;

    /* Semantic Colors */
    --color-primary: var(--violet);
    --color-primary-hover: var(--violet-dark);
    --color-success: var(--green);
    --color-warning: var(--orange);
    --color-danger: var(--red);
    --color-info: var(--blue);
    --canvas: #f5f7fb;
    --surface: #ffffff;
    --surface-hover: #fafbfd;
    --bg-page: var(--canvas);
    --bg-surface: var(--surface);
    --bg-surface-hover: var(--surface-hover);
    --text: #17213a;
    --text-light: #4a5568;
    --muted: #72809a;
    --muted-light: #a0aec0;
    --text-primary: var(--text);
    --text-secondary: var(--text-light);
    --text-muted: var(--muted);
    --line: #e7ebf3;
    --line-dark: #d1d9e6;
    --border: var(--line);
    --border-strong: var(--line-dark);
    --bg-body: var(--canvas);
    --bg-card: var(--surface);
    --bg-input: var(--surface);
    --bg-hover: var(--surface-hover);
    --bg-surface-2: #f0f3f8;
    --border-subtle: var(--line);
    --text-disabled: #9aa5b5;
    --focus-ring: rgba(102, 88, 245, 0.28);
    --table-head-bg: #f5f7fb;
    --table-hover-bg: #f7f8fc;
    --modal-backdrop-color: rgba(11, 23, 48, 0.55);
    --sidebar-bg: linear-gradient(165deg, #07142c 0%, var(--navy-light) 100%);
    --sidebar-text: #c7d3e7;
    --sidebar-muted: #8da0bf;

    /* Typography */
    --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Radius */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.10);
    --shadow-md: 0 8px 16px rgba(28, 45, 86, 0.08);
    --shadow-lg: 0 12px 24px rgba(28, 45, 86, 0.12);
    --shadow-xl: 0 20px 40px rgba(28, 45, 86, 0.15);

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 72px;
    --content-max-width: none;
}

[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #111827;
    --surface: #1b2433;
    --surface-hover: #253146;
    --bg-page: #111827;
    --bg-surface: #1b2433;
    --bg-surface-hover: #253146;
    --bg-body: #111827;
    --bg-card: #1b2433;
    --bg-input: #151e2c;
    --bg-hover: #253146;
    --bg-surface-2: #202b3c;
    --text: #edf2fb;
    --text-light: #c4cfdf;
    --muted: #9baac0;
    --muted-light: #7f8da3;
    --text-primary: #edf2fb;
    --text-secondary: #c4cfdf;
    --text-muted: #9baac0;
    --text-disabled: #718099;
    --line: #334155;
    --line-dark: #475569;
    --border: #334155;
    --border-strong: #475569;
    --green-light: #123c30;
    --orange-light: #4a3212;
    --red-light: #482330;
    --blue-light: #17365c;
    --purple-light: #34265e;
    --cyan-light: #123d4a;
    --focus-ring: rgba(139, 124, 255, 0.42);
    --table-head-bg: #263247;
    --table-hover-bg: #263247;
    --modal-backdrop-color: rgba(2, 6, 23, 0.72);
    --sidebar-bg: linear-gradient(165deg, #0a1221 0%, #15223a 100%);
    --sidebar-text: #dbe7f8;
    --sidebar-muted: #a1b1ca;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.28);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.34);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.38);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.46);
}

/* =========================================================
   02. RESET & BASE
   ========================================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: var(--font-weight-normal);
    line-height: 1.6;
}

button, input, select, textarea {
    font: inherit;
}

button, [role="button"] {
    cursor: pointer;
}

button:disabled, [aria-disabled="true"] {
    cursor: not-allowed;
}

/* =========================================================
   03. APP LAYOUT
   ========================================================= */
.app-shell {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 100vh;
    background: var(--bg-page);
}

/* Flex item utama harus bisa menyusut di bawah konten agar child yang
   lebar (tabel, filter, header action) tidak memaksa halaman melebar. */
main {
    display: flex;
    flex: 1 1 0%;
    width: 0;
    min-width: 0;
    max-width: 100%;
    flex-direction: column;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

section {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: var(--space-lg) var(--space-xl);
}

/* Standalone authentication layout; it does not use .app-shell. */
.login-page {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background: #08152c;
    color: #f6f2e9;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.login-background,
.login-background::before {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.login-background {
    overflow: hidden;
    background: radial-gradient(circle at 22% 25%, rgba(55, 101, 173, .19), transparent 29%), linear-gradient(125deg, #07142d 0%, #0b1d3d 52%, #08152c 100%);
}

.login-background::before {
    content: "";
    background: linear-gradient(90deg, transparent 49.9%, rgba(216, 178, 93, .1) 50%, transparent 50.1%);
}

.login-orb { position: absolute; border-radius: 50%; filter: blur(2px); }
.login-orb-one { top: -200px; left: -170px; width: 520px; height: 520px; background: radial-gradient(circle, rgba(210, 170, 81, .2), transparent 67%); }
.login-orb-two { right: -220px; bottom: -280px; width: 650px; height: 650px; background: radial-gradient(circle, rgba(71, 116, 190, .2), transparent 65%); }
.login-grid { position: absolute; top: 0; bottom: 0; left: 0; width: 50%; opacity: .17; background-image: linear-gradient(rgba(255, 255, 255, .1) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .1) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 75%, transparent); }

/* Reset aturan global main/section yang hanya ditujukan untuk dashboard. */
.login-page .login-shell { position: relative; z-index: 1; display: grid; width: 100%; min-width: 0; max-width: none; min-height: 100vh; margin-left: 0; grid-template-columns: minmax(0, 1fr) minmax(460px, 50%); flex: none; flex-direction: initial; }
.login-shell > .login-showcase,
.login-shell > .login-panel { width: auto; min-width: 0; max-width: none; }
.login-showcase { display: flex; flex-direction: column; min-height: 100%; padding: clamp(36px, 5vw, 76px); }
.login-showcase-brand,
.login-card-brand { display: inline-flex; align-items: center; gap: 11px; color: #fffaf0; font-size: 18px; font-weight: 700; letter-spacing: -.03em; }
.login-brand-icon { display: inline-grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(229, 193, 112, .48); border-radius: 12px; background: linear-gradient(135deg, #e9c978, #a87528); box-shadow: 0 7px 18px rgba(0, 0, 0, .2); color: #17203a; font-size: 19px; }
.login-showcase-content { width: min(100%, 600px); margin: auto 0; padding-block: 80px; }
.login-eyebrow { display: inline-flex; align-items: center; gap: 7px; color: #e7c879; font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.login-showcase h1 { max-width: 580px; margin: 19px 0; color: #fffdf8; font-family: "DM Serif Display", Georgia, serif; font-size: clamp(43px, 5vw, 71px); font-weight: 400; letter-spacing: -.045em; line-height: 1.04; }
.login-showcase h1 em { color: #e7c879; font-weight: 400; }
.login-showcase-content > p { max-width: 500px; margin: 0; color: #bac6d9; font-size: 15px; line-height: 1.8; }
.login-highlights { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.login-highlight { display: inline-flex; align-items: center; gap: 9px; padding: 10px 14px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; background: rgba(255, 255, 255, .055); color: #dbe4f1; font-size: 12px; font-weight: 600; backdrop-filter: blur(8px); }
.login-highlight i { color: #e7c879; font-size: 15px; }
.login-showcase-footer { margin: 0; color: #8291aa; font-size: 11px; letter-spacing: .02em; }

.login-panel { display: grid; padding: 32px; place-items: center; background: rgba(255, 253, 248, .98); color: #17213a; }
.login-card { width: min(100%, 410px); }
.login-card-brand { display: none; color: #162343; }
.login-heading { margin-bottom: 31px; }
.login-heading .login-eyebrow { color: #a87728; font-size: 10px; }
.login-heading h2 { margin: 10px 0 7px; color: #102142; font-family: "DM Serif Display", Georgia, serif; font-size: 37px; font-weight: 400; letter-spacing: -.035em; line-height: 1.08; }
.login-heading p { margin: 0; color: #748097; font-size: 13px; }
.login-alert { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 22px; border: 1px solid #f3c3cd; border-radius: 10px; background: #fff1f3; color: #b12442; font-size: 12px; line-height: 1.5; }
.login-alert i { margin-top: 1px; }
.login-form { display: grid; gap: 19px; }
.login-field label { display: block; margin: 0 0 8px; color: #36435b; font-size: 12px; font-weight: 700; }
.login-input-wrap { position: relative; }
.login-input-wrap > i { position: absolute; z-index: 1; top: 50%; left: 15px; color: #8490a5; font-size: 16px; transform: translateY(-50%); transition: color var(--transition-fast); }
.login-input-wrap .form-control { height: 52px; padding: 0 47px 0 43px; border: 1px solid #dce2eb; border-radius: 10px; background: #fbfcfe; color: #17213a; box-shadow: none; font-size: 13px; transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast); }
.login-input-wrap .form-control::placeholder { color: #9aa5b5; }
.login-input-wrap .form-control:focus { border-color: #b99040; background: #fff; box-shadow: 0 0 0 4px rgba(185, 144, 64, .13); }
.login-input-wrap:focus-within > i { color: #a87728; }
/* Form login selalu memakai kontras terang, terlepas dari tema dashboard yang tersimpan. */
.login-page .login-input-wrap .form-control,
[data-theme="dark"] .login-page .login-input-wrap .form-control { border-color: #dce2eb !important; background-color: #fbfcfe !important; color: #17213a !important; caret-color: #17213a; -webkit-text-fill-color: #17213a; }
.login-page .login-input-wrap .form-control:focus,
[data-theme="dark"] .login-page .login-input-wrap .form-control:focus { background-color: #fff !important; }
.login-page .login-input-wrap .form-control::placeholder,
[data-theme="dark"] .login-page .login-input-wrap .form-control::placeholder { color: #7d899d !important; -webkit-text-fill-color: #7d899d; opacity: 1; }
.login-page .login-input-wrap .form-control:-webkit-autofill,
.login-page .login-input-wrap .form-control:-webkit-autofill:hover,
.login-page .login-input-wrap .form-control:-webkit-autofill:focus { -webkit-text-fill-color: #17213a; box-shadow: 0 0 0 1000px #fff inset; caret-color: #17213a; }
.login-password-toggle { position: absolute; z-index: 2; top: 50%; right: 8px; display: grid; width: 36px; height: 36px; padding: 0; border: 0; place-items: center; border-radius: 8px; background: transparent; color: #7e8a9f; transform: translateY(-50%); transition: background var(--transition-fast), color var(--transition-fast); }
.login-password-toggle:hover { background: #f0f3f8; color: #a87728; }
.login-submit { display: inline-flex; align-items: center; justify-content: space-between; min-height: 53px; margin-top: 5px; padding: 0 18px 0 21px; border: 0; border-radius: 10px; background: linear-gradient(110deg, #172b54, #274a83); box-shadow: 0 10px 18px rgba(18, 43, 86, .2); color: #fff; font-size: 13px; font-weight: 700; transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast); }
.login-submit i { color: #e9c978; font-size: 18px; transition: transform var(--transition-fast); }
.login-submit:hover { color: #fff; filter: brightness(1.09); box-shadow: 0 13px 25px rgba(18, 43, 86, .27); transform: translateY(-2px); }
.login-submit:hover i { transform: translate(2px, -2px); }
.login-security-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 27px; color: #8a95a7; font-size: 11px; }
.login-security-note i { color: #ad8033; }

@media (max-width: 900px) {
    /* Selector dibuat setara dengan versi desktop agar kolom 460px tidak ikut terbawa ke mobile. */
    .login-page .login-shell { grid-template-columns: minmax(0, 1fr); }
    .login-showcase { display: none; }
    .login-shell > .login-panel { width: 100%; }
    .login-panel { min-height: 100vh; padding: 42px 32px; background: rgba(255, 253, 248, .95); }
    .login-card { width: min(100%, 410px); }
    .login-card-brand { display: inline-flex; margin-bottom: 48px; }
}

@media (max-width: 480px) {
    .login-page .login-shell { min-height: 100dvh; }
    .login-panel { min-height: 100dvh; padding: 34px 24px; place-items: center; }
    .login-card { width: 100%; }
    .login-card-brand { margin-bottom: 34px; }
    .login-heading { margin-bottom: 26px; }
    .login-heading h2 { font-size: 32px; }
    .login-form { gap: 16px; }
    .login-input-wrap .form-control { height: 50px; }
    .login-security-note { margin-top: 22px; }
}

/* =========================================================
   04. SIDEBAR
   ========================================================= */
.sidebar {
    position: fixed;
    z-index: 1040;
    width: var(--sidebar-width);
    height: 100vh;
    padding: var(--space-lg) var(--space-md);
    overflow-y: auto;
    background: var(--sidebar-bg);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.10);
    color: var(--sidebar-text);
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.20); border-radius: 3px; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 0 12px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-brand strong {
    display: block;
    font-size: 16px;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.05em;
    line-height: 1.2;
}

.sidebar-brand small {
    display: block;
    margin-top: 3px;
    color: #a6b7d0;
    font-size: 11px;
}

.phone-icon {
    display: grid;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #7669ff 0%, #5145e7 100%);
    box-shadow: 0 8px 20px rgba(86, 70, 239, 0.40);
    font-size: 20px;
}

.sidebar nav { margin-top: 0; }

.sidebar .nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 3px 0;
    padding: 12px 14px;
    border-radius: 11px;
    color: #bfccdf;
    font-size: 13.5px;
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    transition: color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.sidebar .nav-item i {
    width: 20px;
    flex-shrink: 0;
    font-size: 18px;
    text-align: center;
}

.sidebar .nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(3px);
}

.sidebar .nav-item.active {
    background: linear-gradient(90deg, #6355ef 0%, var(--violet-light) 100%);
    box-shadow: 0 8px 20px rgba(99, 85, 239, 0.35);
    color: #ffffff;
    font-weight: var(--font-weight-semibold);
}

.sidebar .nav-item.active::before {
    position: absolute;
    top: 50%;
    left: -16px;
    width: 4px;
    height: 24px;
    border-radius: 0 2px 2px 0;
    background: #ffffff;
    content: "";
    transform: translateY(-50%);
}

/* --- Laporan: parent collapsible + submenu --- */
.sidebar .nav-group {
    margin: 3px 0;
}

.sidebar .nav-parent .nav-chevron {
    width: 16px;
    flex-shrink: 0;
    margin-left: auto;
    font-size: 12px;
    opacity: 0.7;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.sidebar .nav-parent.is-open .nav-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

.sidebar .nav-submenu {
    display: grid;
    gap: 2px;
    margin: 2px 0 6px;
    padding: 2px 0 2px 10px;
    margin-left: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar .nav-submenu[hidden] {
    display: none;
}

.sidebar .nav-sub-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px 9px 6px;
    border-radius: 9px;
    color: var(--sidebar-text);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.sidebar button.nav-sub-item {
    width: 100%;
    border: 0;
    background: transparent;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.sidebar .nav-sub-item::before {
    content: "";
    width: 5px;
    height: 5px;
    flex-shrink: 0;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.45;
}

.sidebar .nav-sub-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    transform: translateX(2px);
}

.sidebar .nav-sub-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 600;
}

.sidebar .nav-sub-item.active::before {
    background: var(--color-primary, #7669ff);
    opacity: 1;
}

.quick-side {
    margin: 32px 2px 0;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, rgba(108, 94, 255, 0.85) 0%, rgba(65, 55, 171, 0.92) 100%);
    color: #ffffff;
}

.quick-side > i { color: #aeeeff; font-size: 24px; }
.quick-side b { display: block; margin-top: var(--space-sm); font-size: 13px; font-weight: var(--font-weight-semibold); }
.quick-side small { display: block; margin: 5px 0 14px; color: #e2e3ff; font-size: 11px; line-height: 1.5; }
.quick-side a { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: var(--space-sm); background: rgba(255, 255, 255, 0.15); color: #ffffff; font-size: 12px; font-weight: var(--font-weight-medium); text-decoration: none; transition: background var(--transition-fast), transform var(--transition-fast); }
.quick-side a:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-1px); }

/* =========================================================
   05. TOP HEADER
   ========================================================= */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height);
    padding: 12px var(--space-xl);
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    min-width: 0;
    max-width: 100%;
    gap: var(--space-md);
}

.header-left, .header-right, .user-menu { display: flex; align-items: center; }
.header-left { flex: 1 1 auto; width: 100%; max-width: 520px; min-width: 0; gap: 12px; }
.header-right { flex-shrink: 0; min-width: 0; gap: 14px; }

.sidebar-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 20px;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.sidebar-toggle:hover { border-color: var(--color-primary); background: var(--bg-surface-hover); }
.global-search { position: relative; width: 100%; min-width: 0; }
.global-search i { position: absolute; top: 50%; left: 14px; color: var(--text-muted); transform: translateY(-50%); }
.global-search input { width: 100%; min-width: 0; height: 42px; padding: 0 14px 0 40px; border: 1px solid var(--border); border-radius: var(--radius); outline: none; background: var(--bg-page); color: var(--text-primary); transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast); }
.global-search input:focus { border-color: var(--color-primary); background: var(--bg-surface); box-shadow: 0 0 0 3px rgba(102, 88, 245, 0.10); }
.global-search input::placeholder { color: var(--muted-light); }
.global-search-results, .notification-panel { position: absolute; z-index: 1100; top: calc(100% + 8px); min-width: 240px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); box-shadow: var(--shadow-lg); }
.global-search-results { left: 0; right: 0; }
.global-search-results a, .notification-panel a { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm); color: var(--text-primary); text-decoration: none; font-size: 13px; }
.global-search-results a:hover, .notification-panel a:hover { background: var(--bg-hover); color: var(--color-primary); }
.global-search-results { max-height: min(66vh, 520px); overflow-x: hidden; overflow-y: auto; padding: 6px; }
.global-search-group { padding: 5px 0; border-bottom: 1px solid var(--border); }
.global-search-group:last-child { border-bottom: 0; }
.global-search-group-title { display: flex; align-items: center; gap: 7px; padding: 6px 10px; color: var(--text-muted); font-size: 10px; font-weight: var(--font-weight-bold); letter-spacing: .07em; text-transform: uppercase; }
.global-search-result { min-width: 0; padding: 11px 10px !important; transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast); }
.global-search-result:hover, .global-search-result:focus-visible, .global-search-result.is-active { background: var(--bg-hover); color: var(--color-primary); box-shadow: inset 3px 0 0 var(--color-primary); outline: none; }
.global-search-result-icon { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: var(--radius-sm); background: var(--bg-surface-2); color: var(--color-primary); }
.global-search-result-icon i { position: static; transform: none; color: inherit; }
.global-search-result-copy { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; gap: 2px; }
.global-search-result-copy strong, .global-search-result-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-search-result-copy strong { color: var(--text-primary); font-size: 13px; font-weight: var(--font-weight-bold); letter-spacing: -.01em; }
.global-search-result:hover .global-search-result-copy strong, .global-search-result:focus-visible .global-search-result-copy strong, .global-search-result.is-active .global-search-result-copy strong { color: var(--color-primary); }
.global-search-result-copy small { color: var(--text-muted); font-size: 11px; line-height: 1.45; }
.global-search-more { justify-content: flex-end; color: var(--color-primary) !important; font-size: 12px !important; font-weight: var(--font-weight-semibold); }
.global-search-more i { position: static; transform: none; color: inherit; }
.global-search-state { display: flex; align-items: center; gap: 9px; padding: 14px 10px; color: var(--text-muted); font-size: 13px; }
.global-search-state i { position: static; transform: none; }
.global-search-spinner { animation: global-search-spin .8s linear infinite; }
@keyframes global-search-spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) {
    .global-search-results { max-height: min(60vh, 440px); }
    .global-search-result-copy strong, .global-search-result-copy small { white-space: normal; overflow-wrap: anywhere; }
}
.notification-trigger { position: relative; }
.notification-toggle { border: 0; background: transparent; cursor: pointer; }
.notification-badge { position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border: 2px solid var(--bg-surface); border-radius: 999px; background: var(--color-danger); color: #fff; font-size: 10px; font-weight: var(--font-weight-bold); line-height: 14px; }
.notification-panel { right: 0; width: min(380px, calc(100vw - 1rem)); max-height: min(70vh, 520px); padding: 0; overflow: hidden; color: var(--text-primary); }
.notification-panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notification-panel-head strong { padding: 0; border: 0; }
.notification-read-all { padding: 2px 0; border: 0; background: transparent; color: var(--color-primary); font-size: 12px; font-weight: var(--font-weight-semibold); }
.notification-read-all:hover { text-decoration: underline; }
.notification-list { max-height: min(54vh, 400px); overflow-x: hidden; overflow-y: auto; padding: 6px; }
.notification-panel .notification-item, .notification-page-list .notification-item { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 11px 10px; border-radius: var(--radius-sm); color: var(--text-primary); text-decoration: none; }
.notification-item.is-unread { background: var(--bg-surface-2); }
.notification-icon { display: grid; flex: 0 0 32px; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: var(--purple-light); color: var(--color-primary); }
.notification-copy { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; gap: 2px; }
.notification-copy strong, .notification-copy span, .notification-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notification-copy strong { font-size: 13px; font-weight: var(--font-weight-semibold); }
.notification-copy span { color: var(--text-secondary); font-size: 12px; }
.notification-copy small { color: var(--text-muted); font-size: 11px; }
.notification-panel .notification-item:hover, .notification-page-list .notification-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.notification-view-all { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 11px; border-top: 1px solid var(--border); border-radius: 0 !important; color: var(--color-primary) !important; font-size: 12px !important; font-weight: var(--font-weight-semibold); }
.notification-empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; color: var(--text-muted); text-align: center; font-size: 12px; }
.notification-empty-state > i { color: var(--color-primary); font-size: 25px; }
.notification-empty-state > strong { color: var(--text-primary); font-size: 13px; }
.notification-page-header { align-items: center; }
.notification-filter-tabs { display: flex; gap: 8px; margin-bottom: var(--space-md); }
.notification-filter-tabs a { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 13px; text-decoration: none; }
.notification-filter-tabs a.active { border-color: var(--color-primary); background: var(--purple-light); color: var(--color-primary); font-weight: var(--font-weight-semibold); }
.notification-page-list { padding: 6px; }
.notification-page-list .notification-item { border-bottom: 1px solid var(--border); border-radius: 0; }
.notification-page-list .notification-item:last-child { border-bottom: 0; }
.notification-page-list .notification-copy strong, .notification-page-list .notification-copy span, .notification-page-list .notification-copy small { white-space: normal; overflow: visible; text-overflow: clip; }
.notification-state { flex: 0 0 auto; color: var(--text-muted); font-size: 11px; }
@media (max-width: 576px) { .notification-panel { position: fixed; top: calc(var(--header-height) - 4px); right: .5rem; } .notification-page-header { align-items: flex-start; flex-direction: column; } .notification-page-header .btn { width: 100%; } }
.dashboard-filter { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); color: var(--text-secondary); }
.dashboard-filter select { padding: 9px 4px; border: 0; outline: 0; background: transparent; color: var(--text-primary); }
.header-action { position: relative; display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: var(--text-secondary); font-size: 18px; text-decoration: none; transition: color var(--transition-fast), background var(--transition-fast); }
.header-action:hover { background: var(--purple-light); color: var(--color-primary); }
.header-action .badge-dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border: 2px solid var(--bg-surface); border-radius: 50%; background: var(--color-danger); }
.user-menu { gap: 10px; padding-left: 12px; border-left: 1px solid var(--border); transition: opacity var(--transition-fast); }
.user-menu:hover { opacity: 0.82; }
.user-avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: var(--purple-light); color: var(--purple); font-size: 14px; font-weight: var(--font-weight-bold); }
.user-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-info strong { overflow: hidden; color: var(--text-primary); font-size: 12px; font-weight: var(--font-weight-semibold); text-overflow: ellipsis; white-space: nowrap; }
.user-info small { overflow: hidden; margin-top: 2px; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

/* =========================================================
   06. TYPOGRAPHY
   ========================================================= */
h1, h2, h3, h4, h5, h6 { margin-top: 0; color: var(--text-primary); font-weight: var(--font-weight-bold); line-height: 1.3; }
.page-title { margin: 0; font-size: 28px; font-weight: var(--font-weight-bold); letter-spacing: -0.03em; }
.subtitle { margin-top: 3px; color: var(--text-muted); font-size: 13px; }

/* =========================================================
   07. BUTTONS
   ========================================================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--radius-sm); font-weight: var(--font-weight-medium); line-height: 1.5; transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast); }
.btn:disabled { opacity: 0.55; box-shadow: none; }
.btn-primary { border-color: var(--color-primary); background: var(--color-primary); }
.btn-primary:hover:not(:disabled) { border-color: var(--color-primary-hover); background: var(--color-primary-hover); transform: translateY(-1px); }
.btn-success { border-color: var(--color-success); background: var(--color-success); }
.btn-success:hover:not(:disabled) { border-color: #108857; background: #108857; transform: translateY(-1px); }
.btn-danger { border-color: var(--color-danger); background: var(--color-danger); }
.btn-danger:hover:not(:disabled) { border-color: #cc4058; background: #cc4058; transform: translateY(-1px); }
.btn-warning { border-color: var(--color-warning); background: var(--color-warning); }
.btn-secondary { border-color: var(--text-secondary); background: var(--text-secondary); }
.btn-light { border-color: var(--border); background: var(--bg-surface); color: var(--text-secondary); }
.btn-light:hover:not(:disabled) { border-color: var(--border-strong); background: var(--bg-surface-hover); color: var(--text-primary); }
.btn-sm { gap: 6px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* =========================================================
   08. FORMS
   ========================================================= */
.form-label { margin-bottom: 6px; color: var(--text-secondary); font-size: 12px; font-weight: var(--font-weight-semibold); }
.form-control, .form-select { min-height: 38px; border-color: var(--border); border-radius: var(--radius-sm); color: var(--text-primary); }
.form-control:focus, .form-select:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(102, 88, 245, 0.12); }
.form-control::placeholder { color: var(--muted-light); }
textarea.form-control { min-height: 92px; resize: vertical; }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background: var(--bg-page); color: var(--text-muted); opacity: 1; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--color-danger); }
.form-control.is-valid, .form-select.is-valid { border-color: var(--color-success); }

/* =========================================================
   09. CARDS & PANELS
   ========================================================= */
.panel, .card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); box-shadow: var(--shadow-sm); }
.panel { padding: 20px; }
.panel:hover { box-shadow: var(--shadow); }
.panel-title { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; color: var(--text-primary); font-size: 15px; font-weight: var(--font-weight-bold); }
.panel-title span { color: var(--text-muted); font-size: 11px; font-weight: var(--font-weight-normal); }
.panel-title a { color: var(--color-primary); font-size: 12px; font-weight: var(--font-weight-semibold); text-decoration: none; }
.panel-title a:hover { color: var(--color-primary-hover); text-decoration: underline; }

/* Service detail: tiga panel informasi teratas. */
.service-top-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-lg);
    align-items: start;
    margin-bottom: var(--space-md);
}
.service-top-grid > .panel {
    min-width: 0;
    margin-bottom: 0;
}

/* Service detail: ringkasan keuangan dan pembayaran. */
.service-finance-panel,
.service-payment-panel,
.service-payment-history-panel { min-width: 0; }
.service-finance-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}
.service-finance-item {
    display: flex;
    min-width: 0;
    min-height: 82px;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface-2);
}
.service-finance-label { color: var(--text-muted); font-size: 11px; font-weight: var(--font-weight-semibold); letter-spacing: .02em; }
.service-finance-value { color: var(--text-primary); font-size: 16px; font-weight: var(--font-weight-bold); line-height: 1.3; overflow-wrap: anywhere; }
.service-finance-final { color: var(--color-primary); }
.service-finance-paid { color: var(--color-success); }
.service-finance-outstanding { border-color: var(--border-strong); }
.service-finance-due { color: var(--color-danger); }
.service-finance-status .badge { align-self: flex-start; padding: 5px 10px; }
.service-final-cost-block { padding-top: var(--space-md); border-top: 1px solid var(--border); }
.service-final-cost-title { margin-bottom: var(--space-sm); color: var(--text-primary); font-size: 13px; font-weight: var(--font-weight-bold); }
.service-final-cost-form { display: flex; max-width: 620px; align-items: center; gap: var(--space-sm); }
.service-final-cost-field { width: min(100%, 420px); min-width: 0; flex: 1 1 320px; }
.service-final-cost-form .btn { flex: 0 0 auto; white-space: nowrap; }
.service-form-helper { display: block; margin-top: 7px; color: var(--text-muted); font-size: 11px; }
.service-payment-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, .72fr);
    gap: var(--space-md);
    align-items: end;
}
.service-payment-field { min-width: 0; }
.service-payment-note { grid-column: 1 / -1; }
.service-payment-action { display: flex; grid-column: 1 / -1; justify-content: flex-end; padding-top: 2px; }
.service-payment-history-row { gap: var(--space-md); }
.service-payment-history-copy { min-width: 0; }
.service-payment-history-copy strong { display: block; color: var(--text-primary); font-size: 13px; font-weight: var(--font-weight-semibold); }
.service-payment-history-meta { display: block; margin-top: 4px; color: var(--text-muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.service-payment-empty { display: flex; min-height: 74px; align-items: center; justify-content: center; gap: 8px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-muted); font-size: 13px; }
.service-payment-empty i { font-size: 16px; }

@media (max-width: 640px) {
    .service-finance-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .service-finance-item { min-height: 72px; padding: 13px 14px; }
    .service-final-cost-form { max-width: none; align-items: stretch; flex-direction: column; }
    .service-final-cost-field { width: 100%; flex-basis: auto; }
    .service-final-cost-form .btn { width: 100%; }
    .service-payment-form { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .service-payment-note,
    .service-payment-action { grid-column: auto; }
    .service-payment-action { display: block; padding-top: 0; }
    .service-payment-action .btn { width: 100%; }
    .service-payment-history-row { align-items: flex-start; }
}

/* =========================================================
   10. KPI
   ========================================================= */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-md); margin-bottom: var(--space-lg); }
/* Dashboard memiliki lima metrik utama; tampilkan sejajar di desktop. */
.dashboard-kpi-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi { position: relative; min-height: 132px; padding: 18px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); box-shadow: var(--shadow-sm); }
.kpi::before { position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--color-primary); content: ""; }
.kpi-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; background: var(--purple-light); color: var(--purple); font-size: 19px; }
.kpi-icon.purple { background: var(--purple-light); color: var(--purple); }
.kpi-icon.green { background: var(--green-light); color: var(--green); }
.kpi-icon.orange { background: var(--orange-light); color: var(--orange); }
.kpi-icon.sky { background: var(--blue-light); color: var(--blue); }
.kpi-icon.red { background: var(--red-light); color: var(--red); }
.kpi label, .kpi-label { display: block; margin-top: 12px; color: var(--text-muted); font-size: 11px; font-weight: var(--font-weight-medium); }
.kpi h3, .kpi-value { margin: 2px 0 0; color: var(--text-primary); font-size: 25px; font-weight: var(--font-weight-bold); line-height: 1.25; }
.kpi .trend, .trend { display: inline-flex; align-items: center; gap: 3px; margin-top: 6px; color: var(--color-success); font-size: 11px; }
.kpi-card { height: 100%; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); box-shadow: var(--shadow-sm); }
.kpi-card small { display: block; color: var(--text-muted); font-size: 12px; }
.kpi-card h3 { margin: 4px 0 0; font-size: 24px; }

/* =========================================================
   11. TABLES
   ========================================================= */
.table-responsive { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface); }
.table-modern { width: 100%; margin: 0; border-collapse: collapse; color: var(--text-secondary); font-size: 13px; }
.table-modern thead th { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-hover); color: var(--text-muted); font-size: 10px; font-weight: var(--font-weight-bold); letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.table-modern tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition-fast); }
.table-modern tbody tr:last-child { border-bottom: 0; }
.table-modern tbody tr:hover { background: var(--surface-hover); }
.table-modern tbody td { padding: 13px 16px; vertical-align: middle; }
.table-modern tbody td b { color: var(--text-primary); font-weight: var(--font-weight-semibold); }
.table-modern tbody td small { display: block; color: var(--text-muted); font-size: 11px; }
.table-danger-light { background-color: var(--red-light) !important; }
.table-warning-light { background-color: var(--orange-light) !important; }

/* =========================================================
   12. BADGES
   ========================================================= */
.badge-soft, .badge-success, .badge-warning, .badge-warn, .badge-danger, .badge-info, .badge-primary { display: inline-flex; align-items: center; border-radius: 999px; font-size: 11px; font-weight: var(--font-weight-semibold); }
.badge-soft { padding: 4px 9px; background: var(--bg-surface-2); color: var(--text-secondary); }
.badge-success { background: var(--green-light); color: var(--green); }
.badge-warning, .badge-warn { background: var(--orange-light); color: #b7790a; }
.badge-danger { background: var(--red-light); color: var(--red); }
.badge-info { background: var(--blue-light); color: var(--blue); }
.badge-primary { background: var(--purple-light); color: var(--purple); }

/* =========================================================
   13. ALERTS
   ========================================================= */
.alert { margin-bottom: var(--space-md); border: 1px solid transparent; border-radius: var(--radius); font-size: 13px; }
.alert-success { border-color: #bcebd5; background: var(--green-light); color: #087849; }
.alert-danger { border-color: #f8c9d2; background: var(--red-light); color: #b8324b; }
.alert-warning { border-color: #ffe0a6; background: var(--orange-light); color: #a96706; }
.alert-info { border-color: #c5e5fb; background: var(--blue-light); color: #2071b8; }

/* =========================================================
   14. MODALS
   ========================================================= */
.modal-content { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); }
.modal-header { padding: 20px 24px; border-bottom-color: var(--border); }
.modal-title { color: var(--text-primary); font-size: 18px; font-weight: var(--font-weight-semibold); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top-color: var(--border); }

/* =========================================================
   15. PAGINATION
   ========================================================= */
.pagination { gap: 4px; }
.pagination a, .pagination span { min-width: 32px; border-radius: var(--radius-sm) !important; color: var(--text-secondary); text-align: center; }
.pagination a:hover { background: var(--purple-light); color: var(--color-primary); }
.pagination .active .page-link, .pagination .active { border-color: var(--color-primary); background: var(--color-primary); color: #ffffff; }

/* =========================================================
   15A. SALES HISTORY
   ========================================================= */
.sales-page-header { min-width: 0; }
.sales-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sales-list-panel { min-width: 0; }
.sales-filters { margin-bottom: var(--space-lg) !important; }
.sales-filters .form-label { margin-bottom: 6px; color: var(--text-secondary); font-size: 12px; font-weight: var(--font-weight-semibold); }
.sales-search-input { position: relative; }
.sales-search-input > i { position: absolute; top: 50%; left: 12px; z-index: 1; color: var(--text-muted); transform: translateY(-50%); }
.sales-search-input .form-control { padding-left: 38px; }
.sales-table-wrap { overflow: hidden; }
.sales-table th { white-space: nowrap; }
.sales-transaction-row.is-void { opacity: .72; }
.sales-transaction-row td > strong { color: var(--text-primary); font-weight: var(--font-weight-semibold); }
.sales-items-cell { min-width: 180px; max-width: 280px; }
.sales-items-cell > span { display: block; overflow: hidden; color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; }
.sales-total { text-align: right; white-space: nowrap; }
.sales-total strong { font-size: 14px; }
.sales-actions { display: flex; justify-content: flex-end; gap: var(--space-xs); white-space: nowrap; }
.sales-actions .btn { min-height: 34px; }
.sales-pagination { display: flex; justify-content: flex-end; }
.sales-pagination .page-link { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; }
.sales-pagination .page-item.disabled .page-link { pointer-events: none; }

/* =========================================================
   15B. USER MANAGEMENT
   ========================================================= */
.users-page-header { align-items: center; gap: var(--space-md); }
.users-stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.users-list-panel { min-width: 0; }
.users-search { margin-bottom: var(--space-md) !important; }
.users-search .form-label { margin-bottom: 6px; color: var(--text-secondary); font-size: 12px; font-weight: var(--font-weight-semibold); }
.users-search-input { position: relative; }
.users-search-input > i { position: absolute; top: 50%; left: 12px; z-index: 1; color: var(--text-muted); transform: translateY(-50%); }
.users-search-input .form-control { padding-left: 38px; }
.users-list-meta { display: flex; justify-content: space-between; gap: var(--space-md); margin-bottom: var(--space-md); color: var(--text-muted); font-size: 12px; }
.users-table-wrap { overflow: hidden; }
.users-table th { white-space: nowrap; }
.users-row.is-inactive { opacity: .72; }
.users-row td > strong { color: var(--text-primary); font-weight: var(--font-weight-semibold); }
.users-username { color: var(--text-secondary); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.users-role-badge { background: var(--purple-light); color: var(--purple); }
.users-self-badge { margin-top: 4px; }
.users-actions { display: flex; justify-content: flex-end; gap: var(--space-xs); white-space: nowrap; }
.users-actions form { margin: 0; }
.users-actions .btn { min-height: 34px; }
.users-pagination { display: flex; justify-content: flex-end; }
.users-pagination .page-link { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; }
.users-pagination .page-item.disabled .page-link { pointer-events: none; }
.users-modal-dialog { max-width: 520px; }
.users-modal-form .modal-header { align-items: flex-start; }
.users-modal-form .modal-header small { display: block; margin-top: 3px; }
.users-modal-form .modal-body { display: grid; gap: var(--space-md); }
.users-modal-form .form-label { margin-bottom: 6px; color: var(--text-secondary); font-size: 12px; font-weight: var(--font-weight-semibold); }
.ih-confirm-dialog:has(.ih-confirm-tone-danger) .ih-confirm-message { max-width: 330px; }

@media (min-width: 769px) and (max-width: 1024px) {
    .users-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .users-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .users-stats-grid .kpi { min-height: 116px; }
    .users-stats-grid .kpi-value { font-size: 20px; overflow-wrap: anywhere; }
    .users-list-meta { flex-direction: column; gap: var(--space-xs); }
    .users-table-wrap { overflow: visible; border: 0; background: transparent; }
    .users-table,
    .users-table tbody,
    .users-table tr,
    .users-table td { display: block; width: 100%; }
    .users-table thead { display: none; }
    .users-table tbody { display: grid; gap: var(--space-md); }
    .users-table tbody tr.users-row { overflow: hidden; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface); box-shadow: var(--shadow-sm); }
    .users-table tbody tr.users-row:hover { background: var(--bg-surface); }
    .users-table tbody tr.users-row td { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); padding: 9px var(--space-md); border: 0; }
    .users-table tbody tr.users-row td::before { flex: 0 0 auto; color: var(--text-muted); font-size: 11px; font-weight: var(--font-weight-semibold); content: attr(data-label); }
    .users-table tbody tr.users-row td:first-child { display: flex; padding: var(--space-md); border-bottom: 1px solid var(--border); background: var(--bg-surface-2); }
    .users-table tbody tr.users-row td:first-child::before { display: none; }
    .users-table tbody tr.users-row td:first-child strong { overflow-wrap: anywhere; font-size: 14px; }
    .users-table tbody tr.users-row td small { margin-top: 0; text-align: right; }
    .users-table tbody tr.users-row .users-username { overflow-wrap: anywhere; text-align: right; }
    .users-table tbody tr.users-row .users-actions-cell { display: block; padding: var(--space-md); border-top: 1px solid var(--border); }
    .users-table tbody tr.users-row .users-actions-cell::before { display: none; }
    .users-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
    .users-actions .btn { width: 100%; min-height: 42px; }
    .users-actions .btn span { font-size: 12px; }
    .users-empty-row td { display: block; padding: 0 !important; }
    .users-empty-row td::before { display: none !important; }
    .users-pagination { justify-content: center; overflow-x: auto; padding-bottom: 2px; }
    .users-pagination .pagination { flex-wrap: nowrap; }
    .users-pagination .page-link { white-space: nowrap; }
}

@media (max-width: 480px) {
    .users-stats-grid { grid-template-columns: minmax(0, 1fr); }
    .users-stats-grid .kpi { min-height: 0; }
    .users-pagination .page-link span { display: none; }
}

.sales-return-dialog { max-width: 760px; }
.sales-return-dialog .ih-confirm-body { align-items: stretch; text-align: left; }
.sales-return-dialog .ih-confirm-icon { align-self: center; }
.sales-return-dialog .ih-confirm-title,
.sales-return-dialog .ih-confirm-message { text-align: center; }
.sales-return-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); width: 100%; margin-top: var(--space-md); }
.sales-return-summary > div { min-width: 0; padding: 10px; border-radius: var(--radius-sm); background: var(--bg-surface-2); }
.sales-return-summary span,
.sales-return-summary strong { display: block; }
.sales-return-summary span { margin-bottom: 3px; color: var(--text-muted); font-size: 11px; }
.sales-return-summary strong { overflow-wrap: anywhere; color: var(--text-primary); font-size: 12px; }
.sales-return-items-section { width: 100%; margin-top: var(--space-md); padding-top: var(--space-md); border-top: 1px solid var(--border); }
.sales-return-items-section h6 { margin: 0 0 var(--space-sm); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; }
.sales-return-items { max-height: min(32vh, 260px); overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sales-return-items-head,
.sales-return-item { display: grid; grid-template-columns: minmax(180px, 1fr) 48px minmax(100px, .7fr) minmax(100px, .7fr); gap: var(--space-sm); align-items: center; padding: 10px 12px; }
.sales-return-items-head { position: sticky; top: 0; z-index: 1; background: var(--table-head-bg); color: var(--text-muted); font-size: 10px; font-weight: var(--font-weight-bold); letter-spacing: .04em; text-transform: uppercase; }
.sales-return-item { border-top: 1px solid var(--border); background: var(--bg-surface); font-size: 12px; }
.sales-return-item-product { min-width: 0; }
.sales-return-item-product strong,
.sales-return-item-product small { display: block; overflow-wrap: anywhere; }
.sales-return-item-product strong,
.sales-return-item-subtotal { color: var(--text-primary); }
.sales-return-item-product small { margin-top: 2px; color: var(--text-muted); font-size: 11px; }
.sales-return-item-qty,
.sales-return-item-price,
.sales-return-item-subtotal { text-align: right; white-space: nowrap; }
.sales-return-total { display: flex; justify-content: space-between; gap: var(--space-md); width: 100%; margin-top: var(--space-md); padding-top: var(--space-md); border-top: 1px solid var(--border); color: var(--text-primary); font-size: 15px; }
.sales-return-total strong { color: var(--color-primary); }
.sales-return-warning { display: flex; align-items: flex-start; gap: 8px; width: 100%; margin-top: var(--space-md); padding: 10px 12px; border: 1px solid var(--orange-light); border-radius: var(--radius-sm); background: var(--orange-light); color: var(--text-secondary); font-size: 12px; line-height: 1.45; }
.sales-return-warning i { color: var(--orange); }
.sales-return-items-empty { width: 100%; margin: var(--space-md) 0 0; color: var(--text-muted); text-align: center; }

@media (min-width: 769px) and (max-width: 1024px) {
    .sales-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .sales-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sales-summary-grid .kpi { min-height: 116px; }
    .sales-summary-grid .kpi-value { font-size: 20px; overflow-wrap: anywhere; }
    .sales-table-wrap { overflow: visible; border: 0; background: transparent; }
    .sales-table,
    .sales-table tbody,
    .sales-table tr,
    .sales-table td { display: block; width: 100%; }
    .sales-table thead { display: none; }
    .sales-table tbody { display: grid; gap: var(--space-md); }
    .sales-table tbody tr.sales-transaction-row { overflow: hidden; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface); box-shadow: var(--shadow-sm); }
    .sales-table tbody tr.sales-transaction-row:hover { background: var(--bg-surface); }
    .sales-table tbody tr.sales-transaction-row td { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); padding: 9px var(--space-md); border: 0; }
    .sales-table tbody tr.sales-transaction-row td::before { flex: 0 0 auto; color: var(--text-muted); font-size: 11px; font-weight: var(--font-weight-semibold); content: attr(data-label); }
    .sales-table tbody tr.sales-transaction-row td:first-child { display: flex; padding: var(--space-md); border-bottom: 1px solid var(--border); background: var(--bg-surface-2); }
    .sales-table tbody tr.sales-transaction-row td:first-child::before { display: none; }
    .sales-table tbody tr.sales-transaction-row td:first-child strong { overflow-wrap: anywhere; font-size: 14px; }
    .sales-table tbody tr.sales-transaction-row td:nth-child(2) { padding-top: var(--space-md); }
    .sales-table tbody tr.sales-transaction-row td small { margin-top: 0; text-align: right; }
    .sales-table tbody tr.sales-transaction-row .sales-items-cell { min-width: 0; max-width: none; }
    .sales-table tbody tr.sales-transaction-row .sales-items-cell > span { overflow: visible; text-align: right; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
    .sales-table tbody tr.sales-transaction-row .sales-total { text-align: right; }
    .sales-table tbody tr.sales-transaction-row .sales-total strong { color: var(--color-primary); font-size: 16px; }
    .sales-table tbody tr.sales-transaction-row .sales-actions-cell { display: block; padding: var(--space-md); border-top: 1px solid var(--border); }
    .sales-table tbody tr.sales-transaction-row .sales-actions-cell::before { display: none; }
    .sales-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
    .sales-actions .btn { width: 100%; min-height: 42px; }
    .sales-actions .btn span { font-size: 12px; }
    .sales-empty-row td { display: block; padding: 0 !important; }
    .sales-empty-row td::before { display: none !important; }
    .sales-pagination { justify-content: center; overflow-x: auto; padding-bottom: 2px; }
    .sales-pagination .pagination { flex-wrap: nowrap; }
    .sales-pagination .page-link { white-space: nowrap; }
    .sales-return-dialog { max-width: calc(100vw - 1rem); margin: .5rem auto; }
    .sales-return-dialog .ih-confirm-body { padding: 20px 16px 4px; }
    .sales-return-summary { grid-template-columns: minmax(0, 1fr); }
    .sales-return-items { max-height: min(34vh, 300px); }
    .sales-return-items-head { display: none; }
    .sales-return-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px var(--space-md); padding: 12px; }
    .sales-return-item-product { grid-column: 1 / -1; }
    .sales-return-item-qty { grid-column: 1; grid-row: 2; text-align: left; }
    .sales-return-item-qty::after { content: ' × '; }
    .sales-return-item-price { grid-column: 1; grid-row: 2; margin-left: 22px; text-align: left; }
    .sales-return-item-subtotal { grid-column: 2; grid-row: 2; align-self: end; }
    .sales-return-total { margin-top: var(--space-sm); }
    .sales-return-warning { margin-top: var(--space-sm); }
}

@media (max-width: 480px) {
    .sales-summary-grid { grid-template-columns: minmax(0, 1fr); }
    .sales-summary-grid .kpi { min-height: 0; }
    .sales-reset-label { display: none; }
    .sales-pagination .page-link span { display: none; }
}

/* =========================================================
   16. FILTERS
   ========================================================= */
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.filter-bar .form-control, .filter-bar .form-select { max-width: 200px; }

/* =========================================================
   17. EMPTY / LOADING / ERROR STATES
   ========================================================= */
.empty-state { padding: 42px 20px; color: var(--text-muted); text-align: center; }
.empty-state i { display: block; margin-bottom: 12px; color: var(--muted-light); font-size: 42px; }
.empty-state h4 { margin-bottom: 4px; font-size: 16px; }
.empty-state p { margin: 0; font-size: 13px; }

/* =========================================================
   18. DASHBOARD
   ========================================================= */
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: var(--space-lg); margin-bottom: var(--space-lg); }
.dashboard-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-lg); }
.chart-wrap { position: relative; height: 300px; }
.list-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row b { color: var(--text-primary); font-size: 13px; font-weight: var(--font-weight-semibold); }
.list-row small { color: var(--text-muted); font-size: 11px; }
.prod-thumb, .prod-thumb-empty { display: grid; width: 48px; height: 48px; place-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-page); }
.prod-thumb { object-fit: cover; }
.prod-thumb-empty { color: var(--text-muted); font-size: 18px; }
.product-image-button { display: inline-grid; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; cursor: zoom-in; }
.product-image-button:hover .prod-thumb, .product-image-button:focus-visible .prod-thumb { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--blue-light); }
.product-image-preview-modal .modal-body { min-height: 220px; display: grid; place-items: center; padding: var(--space-lg); }
.product-image-preview { display: block; max-width: 100%; max-height: 70vh; border-radius: var(--radius); object-fit: contain; }
.product-image-fallback { display: grid; gap: 8px; place-items: center; color: var(--text-muted); font-size: 14px; }
.product-image-fallback i { font-size: 48px; }
.product-form .modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.product-form .modal-body > .form-control,
.product-form .modal-body > .form-select,
.product-form .modal-body > textarea,
.product-form .modal-body > input[type="file"] {
    width: 100%;
    margin-bottom: 0 !important;
}
.product-form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm);
    width: 100%;
}
.product-form-row > .form-control,
.product-form-row > .form-select,
.product-form-row > .input-group {
    min-width: 0;
    width: 100%;
}
.product-form-row .input-group .form-control {
    min-width: 0;
}
.product-stat-card {
    min-height: 108px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.product-stat-amount {
    font-size: 18px !important;
}
.product-margin {
    display: block;
    font-weight: var(--font-weight-semibold);
}
.product-empty-state {
    padding: 56px 24px !important;
    text-align: center;
}
.product-empty-state i {
    display: block;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 40px;
}
.product-empty-state strong,
.product-empty-state span {
    display: block;
}
.product-empty-state strong {
    color: var(--text-primary);
    font-size: 15px;
}
.product-empty-state span {
    margin: 6px 0 16px;
    color: var(--text-muted);
}
.product-detail-layout {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: var(--space-lg);
    align-items: start;
}
.product-detail-image-wrap {
    min-height: 180px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-page);
}
.product-detail-image {
    width: 100%;
    height: 180px;
    border-radius: var(--radius);
    object-fit: cover;
}
.product-detail-image-fallback {
    display: grid;
    gap: 8px;
    place-items: center;
    color: var(--text-muted);
}
.product-detail-image-fallback i {
    font-size: 42px;
}
.product-detail-sku {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
}
.product-detail-name {
    margin: 6px 0;
    color: var(--text-primary);
    font-size: 22px;
}
.product-detail-muted {
    color: var(--text-muted);
}
.product-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.product-detail-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}
.product-detail-fields div {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface-2);
}
.product-detail-fields small,
.product-detail-fields strong {
    display: block;
}
.product-detail-fields small {
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 11px;
}
.product-detail-fields strong {
    overflow-wrap: anywhere;
    color: var(--text-primary);
    font-size: 13px;
}
.product-detail-description-wrap {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}
.purchase-stat-card {
    display: flex;
    min-height: 108px;
    flex-direction: column;
    justify-content: center;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
}
.purchase-stat-card small {
    color: var(--text-muted);
    font-size: 12px;
}
.purchase-stat-card strong {
    margin-top: 4px;
    color: var(--text-primary);
    font-size: 22px;
}
.purchase-item-entry {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface-2);
}
.purchase-item-inputs {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(90px, 0.55fr) minmax(0, 1fr) auto;
    gap: var(--space-sm);
    align-items: end;
}
.purchase-barcode {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-input);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.purchase-barcode i {
    font-size: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.purchase-barcode .form-control {
    border: none;
    box-shadow: none;
    padding: 0;
    background: transparent;
}
.purchase-barcode:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.purchase-barcode-status {
    min-height: 18px;
    margin: 6px 2px 0;
    font-size: 13px;
}
.purchase-barcode-status.success {
    color: var(--color-success);
}
.purchase-barcode-status.error {
    color: var(--color-danger);
}
.purchase-pick-label {
    margin-top: var(--space-md);
}
.purchase-item-list {
    display: grid;
    gap: 8px;
    margin-top: var(--space-md);
}
.purchase-cart-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
}
.purchase-cart-item strong,
.purchase-cart-item small {
    display: block;
}
.purchase-cart-item small {
    margin-top: 4px;
    color: var(--text-muted);
}
.purchase-cart-item button {
    width: 34px;
    height: 34px;
}
.purchase-cart-empty {
    padding: 24px;
    color: var(--text-muted);
    text-align: center;
}
.purchase-total-row,
.purchase-detail-total {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: var(--space-lg) 0;
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 16px;
}
.purchase-detail-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: var(--space-lg);
}
.purchase-detail-summary div {
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-2);
}
.purchase-detail-summary small,
.purchase-detail-summary strong {
    display: block;
}
.purchase-detail-summary small {
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 11px;
}
.purchase-detail-summary strong {
    overflow-wrap: anywhere;
    color: var(--text-primary);
    font-size: 13px;
}
/* =========================================================
   15C. PURCHASE MODAL - MODERN
   ========================================================= */
.purchase-modal {
    border: 0;
    border-radius: var(--radius-xl);
    overflow: hidden;
}
.purchase-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}
.purchase-modal-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.purchase-modal-icon {
    display: grid;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    place-items: center;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--violet-light) 0%, var(--violet-dark) 100%);
    color: #fff;
    font-size: 22px;
    box-shadow: 0 8px 20px rgba(86, 70, 239, 0.28);
}
.purchase-modal-heading h5 {
    margin: 0;
    line-height: 1.2;
}
.purchase-modal-subtitle {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12.5px;
}
.purchase-modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: 24px;
}

.purchase-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
}
.purchase-label i {
    color: var(--color-primary);
}
.purchase-select {
    height: 44px;
}

.purchase-item-entry {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-surface-2);
}
.purchase-entry-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: 10px;
}
.purchase-entry-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}
.purchase-entry-title i {
    color: var(--color-primary);
    font-size: 16px;
}

.purchase-barcode {
    height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-input);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.purchase-pick-label {
    margin-top: var(--space-md);
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.purchase-item-inputs {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(90px, 0.5fr) minmax(0, 1fr) auto;
    gap: var(--space-sm);
    align-items: end;
    margin-top: var(--space-sm);
}
.purchase-input-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
}
.purchase-input-field .form-label {
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
}
.purchase-input-field .form-control,
.purchase-input-field .form-select {
    height: 42px;
}
.purchase-input-actions {
    justify-content: flex-end;
}
.purchase-add-btn {
    height: 42px;
    padding: 0 18px;
    border-radius: var(--radius);
    font-weight: var(--font-weight-semibold);
    box-shadow: 0 6px 14px rgba(86, 70, 239, 0.22);
}
.purchase-input-field .is-invalid {
    border-color: var(--color-danger) !important;
    box-shadow: 0 0 0 3px rgba(230, 87, 111, 0.14) !important;
}

.purchase-entry-error {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(230, 87, 111, 0.35);
    border-radius: var(--radius-sm);
    background: var(--red-light);
    color: var(--red);
    font-size: 13px;
    font-weight: var(--font-weight-medium);
}
.purchase-entry-error.show {
    display: flex;
}
.purchase-entry-error i {
    color: var(--red);
    font-size: 15px;
}

.purchase-cart-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}
.purchase-cart-heading strong {
    font-size: 14px;
    color: var(--text-primary);
}
.purchase-cart-count {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--bg-surface-2);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
}

.purchase-cart-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}
.purchase-cart-index {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    background: var(--purple-light);
    color: var(--purple);
    font-size: 12px;
    font-weight: var(--font-weight-bold);
}
.purchase-cart-main {
    min-width: 0;
}
.purchase-cart-subtotal {
    text-align: right;
    white-space: nowrap;
    font-size: 14px;
}
.purchase-cart-item button {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
}
.purchase-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 28px 24px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-muted);
    text-align: center;
    font-size: 13.5px;
}
.purchase-cart-empty i {
    font-size: 26px;
    color: var(--text-disabled);
}

.purchase-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-lg);
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
}
.purchase-total-row {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 13px;
}
.purchase-total-row span {
    color: var(--text-muted);
}
.purchase-total-row strong {
    color: var(--color-primary);
    font-size: 24px;
    font-weight: var(--font-weight-extrabold);
}
.purchase-payment {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.purchase-payment .form-label {
    margin-bottom: 8px;
}
.purchase-method-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 5px;
    border-radius: var(--radius);
    background: var(--bg-surface-2);
}
.purchase-method-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: 0;
    border-radius: calc(var(--radius) - 3px);
    background: transparent;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.purchase-method-btn:hover {
    color: var(--text-primary);
}
.purchase-method-btn.active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: var(--shadow);
}
.purchase-method-btn.active i {
    color: #fff;
}

.purchase-modal-footer {
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
}
.purchase-modal-footer .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.purchase-save-btn {
    padding: 10px 22px;
    border-radius: var(--radius);
    font-weight: var(--font-weight-semibold);
    box-shadow: 0 6px 14px rgba(86, 70, 239, 0.22);
}
.purchase-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1080;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(380px, calc(100vw - 40px));
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--toast-accent, var(--color-info));
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: var(--font-weight-medium);
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}
.purchase-toast.show {
    opacity: 1;
    transform: translateY(0);
}
.purchase-toast i {
    color: var(--toast-accent, var(--color-info));
    font-size: 18px;
}
.purchase-toast-close {
    margin-left: auto;
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.purchase-toast-close:hover {
    color: var(--text-primary);
}

@media (max-width: 767.98px) {
    .purchase-modal-body {
        padding: 16px;
        gap: var(--space-md);
    }
    .purchase-item-inputs {
        grid-template-columns: 1fr 1fr;
    }
    .purchase-input-actions {
        grid-column: 1 / -1;
    }
    .purchase-input-actions .form-label {
        display: none;
    }
    .purchase-add-btn {
        width: 100%;
    }
    .purchase-summary {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    .purchase-cart-item {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }
    .purchase-cart-item .purchase-cart-subtotal {
        grid-column: 2;
        grid-row: 2;
        text-align: left;
    }
    .purchase-cart-item button {
        grid-column: 3;
        grid-row: 1 / span 2;
    }
}


/* =========================================================
   15D. GLOBAL TOAST & CONFIRM MODAL (reusable)
   ========================================================= */
.ih-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}
.ih-toast {
    --ih-accent: var(--color-info);
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--ih-accent);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    opacity: 0;
    transform: translateX(12px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}
.ih-toast.show {
    opacity: 1;
    transform: translateX(0);
}
.ih-toast > i {
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--ih-accent);
    font-size: 20px;
}
.ih-toast-success { --ih-accent: var(--color-success); }
.ih-toast-danger,
.ih-toast-error { --ih-accent: var(--color-danger); }
.ih-toast-warning { --ih-accent: var(--color-warning); }
.ih-toast-info { --ih-accent: var(--color-info); }
.ih-toast-content {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}
.ih-toast-title {
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: var(--font-weight-semibold);
}
.ih-toast-message {
    overflow-wrap: anywhere;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
}
.ih-toast-close {
    align-self: flex-start;
    margin-left: auto;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.ih-toast-close:hover {
    color: var(--text-primary);
}

.ih-confirm-dialog {
    max-width: 440px;
}
.ih-confirm-content {
    border: 0;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}
.ih-confirm-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 24px 8px;
    text-align: center;
}
.ih-confirm-icon {
    display: grid;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    place-items: center;
    margin-bottom: 16px;
    border-radius: 50%;
    font-size: 26px;
}
.ih-confirm-tone-info { background: var(--blue-light); color: var(--blue); }
.ih-confirm-tone-warning { background: var(--orange-light); color: var(--orange); }
.ih-confirm-tone-danger { background: var(--red-light); color: var(--red); }
.ih-confirm-tone-success { background: var(--green-light); color: var(--green); }
.ih-confirm-title {
    margin: 0 0 8px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: var(--font-weight-bold);
}
.ih-confirm-message {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.55;
}
.ih-confirm-actions {
    display: flex;
    gap: 10px;
    padding: 16px 24px 24px;
}
.ih-confirm-actions .btn {
    display: inline-flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-weight: var(--font-weight-semibold);
}

@media (max-width: 575.98px) {
    .ih-toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }
    .ih-confirm-body {
        padding: 24px 16px 4px;
    }
    .ih-confirm-actions {
        flex-direction: column;
        padding: 12px 16px 20px;
    }
    .ih-confirm-actions .btn {
        width: 100%;
        flex: none;
    }
}


.purchase-empty-state {
    padding: 52px 24px !important;
    text-align: center;
}
.purchase-empty-state i,
.purchase-empty-state strong,
.purchase-empty-state span {
    display: block;
}
.service-stat-card {
    display: flex;
    min-height: 104px;
    flex-direction: column;
    justify-content: center;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
}
.service-stat-card small {
    color: var(--text-muted);
    font-size: 12px;
}
.service-stat-card strong {
    margin-top: 4px;
    color: var(--text-primary);
    font-size: 24px;
}
.service-stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.service-stats-grid .service-stat-card { min-width: 0; }
.purchase-empty-state i {
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 40px;
}
.purchase-empty-state strong {
    color: var(--text-primary);
}
.purchase-empty-state span {
    margin: 6px 0 16px;
    color: var(--text-muted);
}
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.quick-action { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 104px; gap: 9px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface-hover); color: var(--text-secondary); font-size: 12px; font-weight: var(--font-weight-semibold); text-align: center; text-decoration: none; transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast); }
.quick-action i { font-size: 23px; }
.quick-action.purple i { color: var(--purple); }
.quick-action.green i { color: var(--green); }
.quick-action.orange i { color: var(--orange); }
.quick-action.sky i { color: var(--blue); }
.quick-action.red i { color: var(--red); }
.quick-action:hover { border-color: var(--violet-light); box-shadow: var(--shadow-md); color: var(--text-primary); transform: translateY(-2px); }
.kpi-link { display: block; color: inherit; text-decoration: none; }
.kpi-link:hover { color: inherit; transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* =========================================================
   19. POS
   Legacy global POS selectors. Page-specific selectors remain
   in assets/css/pos.css, which is loaded after this stylesheet.
   ========================================================= */
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--space-lg); }
.product-card { cursor: pointer; }
.product-card .card { height: 100%; padding: var(--space-md); border: 2px solid var(--border); transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast); }
.product-card .card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.product-card img { width: 100%; height: 120px; margin-bottom: 12px; border-radius: var(--radius); object-fit: cover; }
.cart-panel { position: sticky; top: 90px; max-height: calc(100vh - 120px); overflow-y: auto; }
.cart-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-item-qty { display: flex; align-items: center; gap: var(--space-sm); }
.cart-item-qty button { width: 28px; height: 28px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-surface); font-size: 14px; transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast); }
.cart-item-qty button:hover { border-color: var(--color-primary); background: var(--color-primary); color: #ffffff; }

/* =========================================================
   20. UTILITY CLASSES
   Bootstrap 5 is loaded by the application. These legacy
   utilities are intentionally retained for compatibility.
   ========================================================= */
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center !important; }
.text-start { text-align: left !important; }
.text-end { text-align: right !important; }
.text-primary { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.flex-wrap { flex-wrap: wrap !important; }
.gap-3, .g-3 { gap: var(--space-md) !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--space-xs) !important; }
.mb-2 { margin-bottom: var(--space-sm) !important; }
.mb-3 { margin-bottom: var(--space-md) !important; }
.mb-4 { margin-bottom: var(--space-lg) !important; }
.mt-2 { margin-top: var(--space-sm) !important; }
.mt-3 { margin-top: var(--space-md) !important; }
.me-1 { margin-right: var(--space-xs) !important; }
.me-2 { margin-right: var(--space-sm) !important; }
.p-3 { padding: var(--space-md) !important; }
.py-4 { padding-top: var(--space-lg) !important; padding-bottom: var(--space-lg) !important; }
.py-5 { padding-top: var(--space-xl) !important; padding-bottom: var(--space-xl) !important; }
.w-100 { width: 100% !important; }
.mw-100 { max-width: 100% !important; }
.fs-3 { font-size: 1.75rem !important; }
.fs-4 { font-size: 1.5rem !important; }
.border { border: 1px solid var(--border) !important; }
.rounded { border-radius: var(--radius) !important; }

/* Legacy grid fallback; Bootstrap 5 supplies the complete grid system. */
.row { display: flex; flex-wrap: wrap; margin-right: -12px; margin-left: -12px; }
.col-lg-8 { width: 66.666667%; padding-right: 12px; padding-left: 12px; }
.col-lg-4, .col-md-4 { width: 33.333333%; padding-right: 12px; padding-left: 12px; }

/* =========================================================
   21. THEME-AWARE COMPONENTS
   ========================================================= */
.sidebar-brand small { color: var(--sidebar-muted); }
.sidebar .nav-item { color: var(--sidebar-text); }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.theme-toggle:hover { border-color: var(--color-primary); background: var(--purple-light); color: var(--color-primary); }
.theme-toggle i { font-size: 14px; }

.card, .panel, .list-row, .kpi, .kpi-card, .modal-content, .dropdown-menu {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}
.panel, .kpi, .kpi-card, .card { border-color: var(--border); }
.list-row { border-color: var(--border); }

.table, .table-modern { --bs-table-bg: var(--bg-card); --bs-table-color: var(--text-primary); --bs-table-border-color: var(--border); --bs-table-striped-bg: var(--bg-surface-2); --bs-table-striped-color: var(--text-primary); --bs-table-hover-bg: var(--table-hover-bg); --bs-table-hover-color: var(--text-primary); color: var(--text-primary); }
.table > :not(caption) > * > *, .table-modern td, .table-modern th { color: inherit; border-color: var(--border); }
.table thead th, .table-modern thead th, .table-light, .table-light > th, .table-light > td { background: var(--table-head-bg); color: var(--text-secondary); border-color: var(--border); }
.table tbody tr:hover, .table-modern tbody tr:hover { background: var(--table-hover-bg); }
.table-bordered, .table-bordered > :not(caption) > * { border-color: var(--border); }
.table-dark { --bs-table-bg: var(--bg-surface-2); --bs-table-color: var(--text-primary); --bs-table-border-color: var(--border); }
.table-responsive { color: var(--text-primary); }

.form-control, .form-select, textarea, input:not([type="checkbox"]):not([type="radio"]) {
    background-color: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border);
}
.form-control::placeholder, textarea::placeholder, input::placeholder { color: var(--text-muted); opacity: 1; }
.form-control:focus, .form-select:focus, textarea:focus, input:focus {
    background-color: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
input[type="date"], input[type="time"], input[type="datetime-local"] { color-scheme: light; }
[data-theme="dark"] input[type="date"], [data-theme="dark"] input[type="time"], [data-theme="dark"] input[type="datetime-local"] { color-scheme: dark; }
.form-control:disabled, .form-select:disabled, input:disabled, textarea:disabled { background: var(--bg-surface-2); color: var(--text-disabled); }
.form-check-input { background-color: var(--bg-input); border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--color-primary); border-color: var(--color-primary); }
option { background: var(--bg-input); color: var(--text-primary); }

.btn-light, .btn-outline-secondary, .btn-outline-dark { background-color: var(--bg-surface); color: var(--text-primary); border-color: var(--border-strong); }
.btn-light:hover, .btn-outline-secondary:hover, .btn-outline-dark:hover { background-color: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary { background-color: var(--bg-surface-2); color: var(--text-primary); border-color: var(--border-strong); }
.btn-success:hover:not(:disabled) { border-color: #108857; background: #108857; }
.btn-danger:hover:not(:disabled) { border-color: #cc4058; background: #cc4058; }
.btn-warning { color: #241700; }
.btn-info { color: #ffffff; }
.btn-outline-primary, .btn-outline-success, .btn-outline-danger, .btn-outline-warning, .btn-outline-info { background-color: transparent; }

.badge-soft { background: var(--bg-surface-2); color: var(--text-secondary); }
.badge-warning, .badge-warn { color: var(--color-warning); }
.alert-success { border-color: var(--color-success); background: var(--green-light); color: var(--text-primary); }
.alert-danger { border-color: var(--color-danger); background: var(--red-light); color: var(--text-primary); }
.alert-warning { border-color: var(--color-warning); background: var(--orange-light); color: var(--text-primary); }
.alert-info { border-color: var(--color-info); background: var(--blue-light); color: var(--text-primary); }

.modal-content { border: 1px solid var(--border); }
.modal-header, .modal-footer { background: var(--bg-card); border-color: var(--border); }
.modal-backdrop { --bs-backdrop-bg: var(--modal-backdrop-color); }
.btn-close { filter: var(--close-icon-filter, none); }
[data-theme="dark"] .btn-close { --close-icon-filter: invert(1) grayscale(1) brightness(2); }

.dropdown-menu { border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.dropdown-item { color: var(--text-primary); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-divider { border-color: var(--border); }

.pagination .page-link { background: var(--bg-surface); color: var(--text-secondary); border-color: var(--border); }
.pagination .page-link:hover { background: var(--purple-light); color: var(--color-primary); border-color: var(--color-primary); }
.pagination .page-item.disabled .page-link { background: var(--bg-surface-2); color: var(--text-disabled); border-color: var(--border); }

.nav-tabs { border-color: var(--border); }
.nav-tabs .nav-link { color: var(--text-secondary); }
.nav-tabs .nav-link:hover { border-color: var(--border) var(--border) transparent; color: var(--text-primary); }
.nav-tabs .nav-link.active { background: var(--bg-card); color: var(--text-primary); border-color: var(--border) var(--border) var(--bg-card); }

/* Product tabs: equal width distribution, no overflow */
.product-view-tabs {
    display: flex;
    width: 100%;
    flex-wrap: nowrap;
    gap: 0;
    margin: 0 0 1rem;
}
.product-view-tabs > .nav-item {
    flex: 1 1 0;
    min-width: 0;
    display: block;
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: none;
    gap: 0;
}
.product-view-tabs > .nav-item > .nav-link {
    display: block;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    text-align: center;
    white-space: nowrap;
}

.nav-pills .nav-link { color: var(--text-secondary); }

.bg-light { background-color: var(--bg-surface-2) !important; }
.bg-white { background-color: var(--bg-card) !important; }
.text-dark, .link-dark { color: var(--text-primary) !important; }
.border, hr { border-color: var(--border) !important; }
.text-black-50 { color: var(--text-muted) !important; }

[data-theme="dark"] .table-danger-light { background-color: #492530 !important; }
[data-theme="dark"] .table-warning-light { background-color: #493313 !important; }

/* =========================================================
   21.5 PRODUCT PAGE HEADER
   ========================================================= */
.product-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-lg);
}

.product-page-header-left {
    flex: 1;
    min-width: 0;
}

.product-page-header-left .page-title {
    margin-bottom: var(--space-xs);
}

.product-page-header-left .subtitle {
    max-width: 600px;
}

.product-page-actions {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
    align-items: center;
}

/* =========================================================
   22. RESPONSIVE
   ========================================================= */
@media (max-width: 1200px) {
    .dashboard-grid, .pos-grid { grid-template-columns: 1fr; }
    .cart-panel { position: relative; top: 0; max-height: none; }
}

@media (max-width: 1024px) {
    /* Sidebar off-canvas di seluruh rentang tablet (≤1024px): tersembunyi secara
       default dan hanya tampil saat kelas .open / .show diaktifkan. */
    .sidebar { transform: translateX(-100%); transition: transform var(--transition-normal); }
    .sidebar.open, .sidebar.show { transform: translateX(0); }
    main { margin-left: 0; }
    .sidebar-toggle { display: grid; }
    section { padding: 20px var(--space-md); }
    .top-header { padding: 12px var(--space-md); }
    .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
    .col-lg-8, .col-lg-4 { width: 100%; }
}

@media (max-width: 1180px) {
    .report-kpis,
    .report-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-financial-grid,
    .report-aging-grid,
    .report-operational-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .report-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-filter-action .btn {
        width: 100%;
        min-width: 0;
    }
}

/* =========================================================
   22.0 TABLET LANDSCAPE (769–1024px) — GLOBAL PATTERNS
   Target utama: 1024×768. Semua halaman list mengikuti pola
   yang sama: page header boleh wrap, panel tidak melebihi
   viewport, tabel hanya scroll di wrapper, modal tidak keluar layar.
   ========================================================= */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Page header: judul + action boleh turun ke baris berikutnya. */
    .product-page-header,
    .stock-page-header,
    .customer-page-header,
    .supplier-page-header,
    .purchase-page-header,
    .service-page-header,
    .ppob-page-header,
    .users-page-header,
    .settings-page-header,
    .finance-page-header { flex-wrap: wrap; gap: var(--space-md); }

    .product-page-actions,
    .stock-page-actions,
    .customer-page-actions,
    .supplier-page-actions,
    .service-page-actions,
    .finance-page-actions { flex-wrap: wrap; flex-shrink: 0; }

    /* Panel: tidak boleh lebih lebar dari viewport. */
    .product-list-panel,
    .stock-list-panel,
    .customer-list-panel,
    .supplier-list-panel,
    .purchase-list-panel,
    .sales-list-panel,
    .service-list-panel,
    .ppob-list-panel,
    .users-list-panel,
    .finance-list-panel { min-width: 0; max-width: 100%; }

    /* Stats/KPI: 4–6 kartu -> maksimal 3 kolom per baris. */
    .stock-stats-grid,
    .customer-stats-grid,
    .supplier-stats-grid,
    .purchase-stats-grid,
    .users-stats-grid,
    .product-stats-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
    .stock-stats-grid .kpi-card,
    .customer-stats-grid .kpi-card,
    .supplier-stats-grid .kpi-card,
    .purchase-stats-grid .kpi-card,
    .users-stats-grid .kpi-card { min-width: 0; }

    /* Filter/search: field 2–3 per baris, aksi 50% supaya tombol
       Filter/Reset tidak terpotong. */
    .product-filters > .product-filter-field,
    .stock-filters > .stock-filter-field,
    .customer-filters > .customer-filter-field,
    .supplier-filters > .supplier-filter-field,
    .purchase-search > .purchase-search-field,
    .sales-filters > .sales-filter-field,
    .service-search > .service-search-field,
    .users-search > .users-search-field { flex: 0 0 33.333333%; max-width: 33.333333%; }

    .product-filters > .product-filter-action,
    .stock-filters > .stock-filter-action,
    .customer-filters > .customer-filter-action,
    .supplier-filters > .supplier-filter-action,
    .purchase-search > .purchase-search-action,
    .sales-filters > .sales-filter-action,
    .service-search > .service-search-action,
    .users-search > .users-search-action { flex: 0 0 50%; max-width: 50%; }

    .product-filter-action .btn,
    .stock-filter-action .btn,
    .customer-filter-action .btn,
    .supplier-filter-action .btn,
    .purchase-search-action .btn,
    .sales-filter-action .btn,
    .service-search-action .btn,
    .users-search-action .btn { width: 100%; }

    /* Tabel: hanya wrapper yang boleh scroll horizontal. */
    .product-table-wrap,
    .stock-table-wrap,
    .customer-table-wrap,
    .supplier-table-wrap,
    .purchase-table-wrap,
    .sales-table-wrap,
    .service-table-wrap,
    .ppob-table-wrap,
    .users-table-wrap,
    .finance-table-wrap,
    .stock-opname-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Modal: tidak boleh melebihi viewport, body scroll internal. */
    .modal-dialog { margin: var(--space-sm) auto; max-width: calc(100vw - 2rem); }
    .modal-dialog .modal-content { max-height: calc(100vh - var(--space-md)); }
    .modal-dialog .modal-body { overflow-y: auto; }
}

/* =========================================================
   22.1 PRODUCT PAGE - TABLET (769px - 1024px)
   Reference layout: halaman Stok (stok.php)
   ========================================================= */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Sidebar mengikuti perilaku global tablet (off-canvas): tersembunyi secara
       default dan hanya muncul saat kelas .open / .show diaktifkan. */

    /* Wrapper main/section tidak boleh keluar viewport dan tidak boleh scroll. */
    main:has(.product-list-panel),
    main:has(.product-list-panel) section { min-width: 0; max-width: 100%; }

    /* Header tetap satu baris, compact agar tidak mendorong elemen turun. */
    main:has(.product-list-panel) .top-header { flex-wrap: nowrap; gap: var(--space-sm); padding-right: var(--space-md); padding-left: var(--space-md); }
    main:has(.product-list-panel) .header-left { flex: 1 1 auto; min-width: 0; }
    main:has(.product-list-panel) .global-search,
    main:has(.product-list-panel) .global-search-input { min-width: 0; }
    main:has(.product-list-panel) .header-right { flex-shrink: 0; gap: 10px; }

    /* Judul Produk: tetap ada, tidak menyebabkan overflow (boleh wrap bila sempit). */
    .product-page-header { flex-wrap: wrap; gap: var(--space-md); }
    .product-page-header-left { min-width: 0; }
    .product-page-actions { flex-wrap: wrap; flex-shrink: 0; }

    /* KPI Produk: 6 kartu -> 2 baris x 3 kolom, tetap rapi di viewport. */
    .product-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .product-stats-grid .product-stat-card { min-width: 0; }

    /* Panel Produk: tidak memotong isi, tidak melebar dari viewport. */
    .product-list-panel { min-width: 0; max-width: 100%; }

    /* Filter di dalam panel: search penuh, field 3 per baris, aksi 50/50. */
    .product-filters > .product-filter-search { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
    .product-filters > .product-filter-field { width: 33.333333% !important; max-width: 33.333333% !important; flex: 0 0 33.333333% !important; }
    .product-filters > .product-filter-action { width: 50% !important; max-width: 50% !important; flex: 0 0 50% !important; }
    .product-filters .form-control,
    .product-filters .form-select { min-width: 0; max-width: 100%; }
    .product-filter-action .btn { width: 100%; }

    /* Tabel Produk = satu-satunya area yang boleh horizontal scroll. */
    .product-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; }
    .product-table-wrap .table-modern { min-width: 1040px; }
    .product-table-wrap .table-modern th,
    .product-table-wrap .table-modern td { padding-right: 12px; padding-left: 12px; }

    /* Bulk actions tetap compact dan membungkus bila perlu. */
    .product-bulk-actions { flex-wrap: wrap; }
    .product-bulk-actions .btn-group { flex-wrap: wrap; }

    /* Modal besar menyesuaikan viewport tablet. */
    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl { max-width: calc(100vw - 2rem); }
    .modal-dialog .modal-content { max-height: calc(100vh - 16px); }
    .modal-dialog .modal-body { overflow-y: auto; }
}

@media (max-width: 768px) {
    .global-search, .header-left { max-width: 100%; }
    .user-info { display: none; }
    .theme-toggle-label { display: none; }
    .service-top-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi h3, .kpi-value { font-size: 24px; }
    .dashboard-cols { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    
    /* Dashboard responsive */
    .top-header { flex-wrap: wrap; }
    .dashboard-filter { width: 100%; max-width: 100%; }
    .chart-wrap { height: 260px; }
    .panel { min-width: 0; max-width: 100%; }
    .dashboard-grid, .dashboard-cols { min-width: 0; }

    .finance-page-header {
        align-items: stretch !important;
        flex-direction: column !important;
        gap: var(--space-md);
    }
    .finance-page-actions {
        width: 100%;
        flex-direction: column;
    }
    .finance-page-actions .btn {
        width: 100%;
    }

    /* Stock movements mobile responsive */
    .stock-movements-actions {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-sm);
    }
    .stock-movements-actions .btn {
        flex: 1 1 100%;
        min-width: 100%;
        justify-content: center;
    }
    
    /* Transform table into card layout on mobile */
    .stock-movements-table {
        border: none;
        background: transparent;
    }
    
    .stock-movements-table .table-modern {
        border: none;
        display: block;
    }
    
    .stock-movements-table .table-modern thead {
        display: none;
    }
    
    .stock-movements-table .table-modern tbody {
        display: block;
    }
    
    .stock-movements-table .table-modern tbody tr {
        display: block;
        margin-bottom: var(--space-md);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: var(--space-md);
        background: var(--bg-surface);
        box-shadow: var(--shadow-sm);
    }
    
    .stock-movements-table .table-modern tbody tr:last-child {
        margin-bottom: 0;
    }
    
    .stock-movements-table .table-modern tbody td {
        display: block;
        border: none;
        padding: 0;
        text-align: left;
        position: relative;
    }
    
    /* First row: Product and Qty side by side */
    .stock-movements-table .table-modern tbody td[data-label="Produk"] {
        font-size: 15px;
        font-weight: var(--font-weight-semibold);
        color: var(--text-primary);
        margin-bottom: var(--space-sm);
        padding-right: 60px;
    }
    
    .stock-movements-table .table-modern tbody td[data-label="Qty"] {
        position: absolute;
        top: 0;
        right: 0;
        font-size: 18px;
        font-weight: var(--font-weight-bold);
    }
    
    .stock-movements-table .table-modern tbody td[data-label="Qty"] b {
        font-size: 18px;
    }
    
    /* Second row: Date and Type */
    .stock-movements-table .table-modern tbody td[data-label="Tanggal"] {
        display: inline-block;
        font-size: 12px;
        color: var(--text-muted);
        margin-bottom: var(--space-sm);
    }
    
    .stock-movements-table .table-modern tbody td[data-label="Tanggal"]::after {
        content: " • ";
        margin: 0 4px;
        color: var(--text-muted);
    }
    
    .stock-movements-table .table-modern tbody td[data-label="Jenis"] {
        display: inline-block;
        font-size: 12px;
        margin-bottom: var(--space-sm);
    }
    
    /* Reference and Note with labels */
    .stock-movements-table .table-modern tbody td[data-label="Referensi"],
    .stock-movements-table .table-modern tbody td[data-label="Catatan"] {
        font-size: 13px;
        color: var(--text-secondary);
        margin-top: var(--space-xs);
        padding-left: 0;
    }
    
    .stock-movements-table .table-modern tbody td[data-label="Referensi"]::before,
    .stock-movements-table .table-modern tbody td[data-label="Catatan"]::before {
        content: attr(data-label);
        display: inline-block;
        font-weight: var(--font-weight-semibold);
        color: var(--text-muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-right: var(--space-sm);
        min-width: 75px;
    }
    
    /* Empty state on mobile */
    .stock-movements-table .table-modern tbody tr td[colspan] {
        display: block;
        text-align: center;
        position: static;
    }
    .finance-list-panel {
        min-width: 0;
        overflow: hidden;
    }
    .finance-filters > div {
        width: 100% !important;
        max-width: 100%;
        flex: 0 0 100%;
    }
    .finance-filters .btn {
        width: 100%;
    }
    .finance-table-wrap {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .finance-table-wrap .table-modern {
        min-width: 920px;
    }
    .finance-table-wrap .table-modern th,
    .finance-table-wrap .table-modern td {
        padding-right: 12px;
        padding-left: 12px;
    }
    /* Product page: preserve operability on narrow touch screens. */
    main:has(.product-list-panel),
    main:has(.product-list-panel) section,
    main:has(.stock-list-panel),
    main:has(.stock-list-panel) section,
    main:has(.customer-list-panel),
    main:has(.customer-list-panel) section,
    main:has(.supplier-list-panel),
    main:has(.supplier-list-panel) section,
    main:has(.purchase-list-panel),
    main:has(.purchase-list-panel) section,
    main:has(.sales-list-panel),
    main:has(.sales-list-panel) section,
    main:has(.service-list-panel),
    main:has(.service-list-panel) section,
    main:has(.ppob-list-panel),
    main:has(.ppob-list-panel) section,
    main:has(.users-list-panel),
    main:has(.users-list-panel) section,
    main:has(.report-filter-panel),
    main:has(.report-filter-panel) section,
    main:has(.finance-page),
    main:has(.finance-page) section { min-width: 0; }
    .product-page-header { align-items: stretch !important; flex-direction: column !important; gap: var(--space-md); }
    .product-page-actions { 
        display: flex !important; 
        width: 100% !important; 
        max-width: 100%; 
        flex: 0 0 100%; 
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: var(--space-sm) !important;
    }
    .product-page-actions .btn:not(.btn-primary) { 
        flex: 1 1 calc(50% - var(--space-sm) / 2);
        min-width: 0;
    }
    .product-page-actions .btn-primary { 
        flex: 1 1 100%;
        width: 100%;
    }
    .product-list-panel { min-width: 0; padding: var(--space-md); }
    .product-filters > .product-filter-search,
    .product-filters > .product-filter-field,
    .product-filters > .product-filter-action { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
    .product-filter-action .btn { width: 100%; }
    .product-bulk-actions { display: flex; align-items: flex-start; flex-direction: column; gap: var(--space-sm); }
    .product-bulk-actions .btn-group { display: flex; width: 100%; margin-left: 0 !important; }
    .product-bulk-actions .btn { flex: 1; }
    .product-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .product-table-wrap .table-modern { min-width: 1040px; }
    .product-table-wrap .table-modern th,
    .product-table-wrap .table-modern td { padding-right: 12px; padding-left: 12px; }
    .modal-dialog { margin: var(--space-sm); }
    .modal-dialog .modal-content { max-height: calc(100vh - 16px); }
    .modal-dialog .modal-body { overflow-y: auto; }
    .product-form-row { grid-template-columns: minmax(0, 1fr); }
    .product-detail-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .product-detail-image-wrap {
        max-width: 220px;
        margin: 0 auto;
    }
    .product-detail-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .purchase-page-header {
        align-items: stretch !important;
        flex-direction: column !important;
        gap: var(--space-md);
    }
    .purchase-page-action {
        width: 100%;
    }
    .purchase-list-panel {
        min-width: 0;
        overflow: hidden;
    }
    .purchase-search > .purchase-search-field,
    .purchase-search > .purchase-search-action {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    .purchase-search-action .btn {
        width: 100%;
    }
    .purchase-table-wrap {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .purchase-table-wrap .table-modern {
        min-width: 820px;
    }
    .purchase-item-inputs {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .purchase-item-inputs button {
        width: 100%;
    }
    .purchase-detail-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Stock page: keep the page narrow while the inventory table scrolls locally. */
    .stock-page-header { align-items: stretch !important; flex-direction: column !important; gap: var(--space-md); }
    .stock-page-actions { display: flex !important; width: 100%; flex-direction: column; }
    .stock-page-actions .btn { width: 100%; }
    .stock-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stock-stats-grid .kpi-card { min-width: 0; }
    .stock-list-panel { min-width: 0; overflow: hidden; }
    .stock-filters > .stock-filter-field,
    .stock-filters > .stock-filter-action { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
    .stock-filter-action .btn { width: 100%; }
    .stock-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .stock-table-wrap .table-modern { min-width: 820px; }
    .stock-table-wrap .table-modern th,
    .stock-table-wrap .table-modern td { padding-right: 12px; padding-left: 12px; }
    .stock-modal-dialog { width: auto; margin: var(--space-sm) auto; }
    .stock-modal-dialog.modal-dialog-scrollable { height: calc(100% - 16px); }
    .stock-modal-dialog .modal-content { max-height: calc(100vh - 16px); }
    .stock-modal-dialog .modal-body { overflow-y: auto; }
    .stock-opname-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .stock-opname-table-wrap .table-modern { min-width: 420px; }

    /* Customer page: retain all customer columns in a local scroll container. */
    .customer-page-header { align-items: stretch !important; flex-direction: column !important; gap: var(--space-md); }
    .customer-page-actions { display: flex !important; width: 100%; flex-direction: column; }
    .customer-page-actions .btn { width: 100%; }
    .customer-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .customer-stats-grid .kpi-card { min-width: 0; }
    .customer-list-panel { min-width: 0; overflow: hidden; }
    .customer-filters > .customer-filter-field,
    .customer-filters > .customer-filter-action { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
    .customer-filter-action .btn { width: 100%; }
    .customer-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .customer-table-wrap .table-modern { min-width: 940px; }
    .customer-table-wrap .table-modern th,
    .customer-table-wrap .table-modern td { padding-right: 12px; padding-left: 12px; }
    .customer-modal-dialog { width: auto; margin: var(--space-sm) auto; }
    .customer-modal-dialog .modal-content { max-height: calc(100vh - 16px); }
    .customer-modal-dialog .modal-body { overflow-y: auto; }

    /* Supplier page: keep supplier contacts and actions inside a local table scroll area. */
    .supplier-page-header { align-items: stretch !important; flex-direction: column !important; gap: var(--space-md); }
    .supplier-page-action { width: 100%; }
    .supplier-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .supplier-stats-grid .kpi-card { min-width: 0; }
    .supplier-list-panel { min-width: 0; overflow: hidden; }
    .supplier-filters > .supplier-filter-field,
    .supplier-filters > .supplier-filter-action { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
    .supplier-filter-action .btn { width: 100%; }
    .supplier-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .supplier-table-wrap .table-modern { min-width: 720px; }
    .supplier-table-wrap .table-modern th,
    .supplier-table-wrap .table-modern td { padding-right: 12px; padding-left: 12px; }
    .supplier-modal-dialog { width: auto; margin: var(--space-sm) auto; }
    .supplier-modal-dialog .modal-content { max-height: calc(100vh - 16px); }
    .supplier-modal-dialog .modal-body { overflow-y: auto; }

    /* Purchase page: local table scrolling and mobile-safe item entry modal. */
    .purchase-page-header { align-items: stretch !important; flex-direction: column !important; gap: var(--space-md); }
    .purchase-page-action { width: 100%; }
    .purchase-list-panel { min-width: 0; overflow: hidden; }
    .purchase-search > .purchase-search-field,
    .purchase-search > .purchase-search-action { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
    .purchase-search-action .btn { width: 100%; }
    .purchase-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .purchase-table-wrap .table-modern { min-width: 720px; }
    .purchase-table-wrap .table-modern th,
    .purchase-table-wrap .table-modern td { padding-right: 12px; padding-left: 12px; }
    .purchase-modal-dialog { width: auto; margin: var(--space-sm) auto; }
    .purchase-modal-dialog .modal-content { max-height: calc(100vh - 16px); }
    .purchase-modal-dialog .modal-body { overflow-y: auto; }
    .purchase-item-inputs { flex-direction: column; }
    .purchase-item-inputs > .col,
    .purchase-item-inputs > .col-auto { width: 100%; max-width: 100%; flex: 0 0 100%; }
    .purchase-item-inputs .btn { width: 100%; }

    /* Sales history: filters stack and transactions switch to cards. */
    .sales-list-panel { min-width: 0; overflow: hidden; }
    .sales-filters > .sales-filter-field,
    .sales-filters > .sales-filter-action { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
    .sales-filter-action .btn { width: 100%; }
    .sales-table-wrap { width: 100%; overflow: visible; }
    .sales-table-wrap .table-modern { min-width: 0; }

    /* Service center: list/table and two-column service form remain usable on phones. */
    .service-page-header { align-items: stretch !important; flex-direction: column !important; gap: var(--space-md); }
    .service-page-action { width: 100%; }
    .service-list-panel { min-width: 0; overflow: hidden; }
    .service-search > .service-search-field,
    .service-search > .service-search-action { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
    .service-search-action .btn { width: 100%; }
    .service-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .service-table-wrap .table-modern { min-width: 1100px; }
    .service-table-wrap .table-modern th,
    .service-table-wrap .table-modern td { padding-right: 12px; padding-left: 12px; }
    .service-modal-dialog { width: auto; margin: var(--space-sm) auto; }
    .service-modal-dialog .modal-content { max-height: calc(100vh - 16px); }
    .service-modal-dialog .modal-body { overflow-y: auto; }
    .service-modal-fields { flex-direction: column; }
    .service-modal-fields > .col-md-6 { width: 100%; max-width: 100%; flex: 0 0 100%; }

    /* PPOB: keep status controls in a local transaction-table scroller. */
    .ppob-page-header { align-items: stretch !important; flex-direction: column !important; gap: var(--space-md); }
    .ppob-page-action { width: 100%; }
    .ppob-list-panel { min-width: 0; overflow: hidden; }
    .ppob-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .ppob-table-wrap .table-modern { min-width: 760px; }
    .ppob-table-wrap .table-modern th,
    .ppob-table-wrap .table-modern td { padding-right: 12px; padding-left: 12px; }
    .ppob-modal-dialog { width: auto; margin: var(--space-sm) auto; }
    .ppob-modal-dialog .modal-content { max-height: calc(100vh - 16px); }
    .ppob-modal-dialog .modal-body { overflow-y: auto; }

    /* User management: filters stack and users switch to cards. */
    .users-page-header { align-items: stretch !important; flex-direction: column !important; gap: var(--space-md); }
    .users-page-action { width: 100%; }
    .users-list-panel { min-width: 0; overflow: hidden; }
    .users-search > .users-search-field,
    .users-search > .users-search-action { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
    .users-search-action .btn { width: 100%; }
    .users-table-wrap { width: 100%; overflow: visible; }
    .users-table-wrap .table-modern { min-width: 0; }
    .users-modal-dialog { width: auto; margin: var(--space-sm) auto; }
    .users-modal-dialog .modal-content { max-height: calc(100vh - 16px); }
    .users-modal-dialog .modal-body { overflow-y: auto; }

    /* Reports: keep period controls and dashboard panels usable on narrow screens. */
    .report-page-header { align-items: stretch !important; flex-direction: column !important; gap: var(--space-md); }
    .report-filter-panel { min-width: 0; }
    .report-filters,
    .report-kpis,
    .report-financial-grid,
    .report-aging-grid,
    .report-operational-grid,
    .report-preview-grid { grid-template-columns: minmax(0, 1fr); }
    .report-preview-grid .table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .report-preview-grid .table-modern { min-width: 520px; }
}

@media (max-width: 420px) {
    .product-detail-fields {
        grid-template-columns: minmax(0, 1fr);
    }
    .purchase-detail-summary {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 480px) {
    .page-title { font-size: 22px; }
    .service-top-grid { grid-template-columns: minmax(0, 1fr); }
    .kpi-grid { grid-template-columns: 1fr; }
    .top-header { gap: 10px; }
    .header-right { gap: 6px; }
    
    /* Dashboard mobile optimizations */
    .chart-wrap { height: 240px; }
    .panel { padding: 14px; }
    .kpi { min-width: 0; padding: 14px; }
    .kpi h3, .kpi-value { font-size: 22px; }
    .dashboard-grid .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .dashboard-grid .table-modern { min-width: 600px; }
    
    .product-page-actions .btn { min-height: 38px; padding-right: 10px; padding-left: 10px; font-size: 12px; }
    .product-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-stats-grid .panel { padding: 14px 8px; }
    .product-stats-grid .panel h3 { font-size: 22px; }
    .product-list-panel { padding: 12px; }
    .product-view-tabs .nav-link { 
        padding-right: 8px; 
        padding-left: 8px; 
        font-size: 11px;
    }
    .stock-stats-grid { grid-template-columns: 1fr; }
    .stock-stats-grid .kpi-card { padding: 14px; }
    .customer-stats-grid { grid-template-columns: 1fr; }
    .customer-stats-grid .kpi-card { padding: 14px; }
}

/* Very small screens (≤360px) */
@media (max-width: 360px) {
    .page-title { font-size: 20px; }
    .subtitle { font-size: 12px; }
    .chart-wrap { height: 220px; }
    .panel { padding: 12px; }
    .kpi { padding: 12px; }
    .kpi h3, .kpi-value { font-size: 20px; }
    .kpi-icon { width: 36px; height: 36px; font-size: 16px; }
    .dashboard-filter { padding: 0 10px; font-size: 13px; }
    .dashboard-filter select { font-size: 13px; }
    .panel-title { font-size: 14px; margin-bottom: 14px; }
    .table-modern { font-size: 12px; }
    .table-modern thead th { padding: 10px 12px; font-size: 9px; }
    .table-modern tbody td { padding: 10px 12px; }
}

/* =========================================================
   22. ACCESSIBILITY / PRINT
   ========================================================= */
:focus-visible {
    outline: 3px solid rgba(102, 88, 245, 0.45);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    body:has(.report-page) .sidebar,
    body:has(.report-page) .top-header,
    body:has(.report-page) .report-header-actions,
    body:has(.report-page) .report-filter-panel,
    body:has(.report-page) .report-section-kicker {
        display: none !important;
    }
    body:has(.report-page) main {
        margin-left: 0;
    }
    body:has(.report-page) section {
        padding: 12px 0;
    }
    body:has(.report-page) .report-page {
        max-width: none;
    }
    body:has(.report-page) .report-kpi-card,
    body:has(.report-page) .report-chart-panel,
    body:has(.report-page) .report-profit-panel,
    body:has(.report-page) .report-aging-panel,
    body:has(.report-page) .report-operational-panel,
    body:has(.report-page) .report-preview-panel {
        box-shadow: none;
        break-inside: avoid;
    }
    body:has(#barcodeModal.show) * {
        visibility: hidden !important;
    }
    body:has(#barcodeModal.show) .product-barcode-print,
    body:has(#barcodeModal.show) .product-barcode-print * {
        visibility: visible !important;
    }
    body:has(#barcodeModal.show) .product-barcode-print {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        border: 0;
        box-shadow: none;
    }
    body:has(#barcodeModal.show) .product-barcode-print .modal-header,
    body:has(#barcodeModal.show) .product-barcode-print .modal-footer {
        display: none !important;
    }
    body:has(#barcodeModal.show) .product-barcode-print .modal-body {
        padding: 24px;
    }

    /* Laporan: tabel & grafik dicetak utuh, bukan di-scroll container. */
    body:has(.report-page) .report-page .table-responsive,
    body:has(.report-page) .report-page .report-svg-wrap {
        overflow: visible !important;
    }

    body:has(.report-page) .report-page .table-modern {
        min-width: 0 !important;
        font-size: 11px;
    }

    body:has(.report-page) .report-page .report-trend-chart {
        min-width: 0 !important;
        width: 100% !important;
        height: 220px;
    }

    body:has(.report-page) .report-page .report-insight-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* =========================================================
   REPORT DASHBOARD
   ========================================================= */
.report-page {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
}

/* Manfaatkan ruang desktop lebih optimal tanpa mengubah container global. */
@media (min-width: 1025px) {
    .report-page {
        width: calc(100% + var(--space-lg));
        margin-inline: calc(var(--space-lg) / -2);
    }

    .report-page .report-section {
        padding-inline: var(--space-md);
    }
}

.report-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.report-eyebrow,
.report-section-kicker {
    color: var(--color-primary);
    font-size: 11px;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.report-eyebrow {
    margin-bottom: 6px;
}

.report-page-header .subtitle {
    margin-top: 4px;
}

.report-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.report-export-menu {
    min-width: 220px;
    max-height: 420px;
    overflow-y: auto;
}

.report-filter-panel {
    margin-bottom: var(--space-xl);
}

.report-section {
    margin-bottom: var(--space-lg);
}

.report-section-heading,
.report-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
}

.report-section-heading {
    align-items: flex-end;
    margin-bottom: 14px;
}

.report-section-heading h2,
.report-card-heading h3 {
    margin: 3px 0 0;
    color: var(--text-primary);
}

.report-section-heading h2 {
    font-size: 20px;
}

.report-card-heading h3 {
    font-size: 16px;
}

.report-card-heading span,
.report-card-heading small {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.report-card-heading > i {
    color: var(--color-primary);
    font-size: 20px;
}

.report-period-label {
    color: var(--text-muted);
    font-size: 13px;
}

.report-kpi-card {
    display: flex;
    min-height: 136px;
    flex-direction: column;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.report-kpi-card > span {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: var(--font-weight-semibold);
}

.report-kpi-card > strong {
    margin-top: 5px;
    color: var(--text-primary);
    font-size: 26px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.report-kpi-card > small {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.report-kpi-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 12px;
    font-size: 19px;
}

.report-kpi-icon-primary { background: var(--purple-light); color: var(--color-primary); }
.report-kpi-icon-blue { background: var(--blue-light); color: var(--blue); }
.report-kpi-icon-green { background: var(--green-light); color: var(--green); }
.report-kpi-icon-purple { background: var(--cyan-light); color: var(--purple); }

.report-warning {
    margin-bottom: var(--space-lg);
}

.report-filter-panel {
    padding: var(--space-md);
}

.report-filter-panel .report-section-heading {
    margin-bottom: 12px;
}

.report-filters,
.report-kpis,
.report-financial-grid,
.report-aging-grid,
.report-operational-grid,
.report-preview-grid {
    display: grid;
    gap: var(--space-md);
    min-width: 0;
}

.report-filters {
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
    align-items: end;
}

.report-filter-field,
.report-filter-action {
    min-width: 0;
}

.report-filter-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
}

.report-filter-action .btn {
    min-width: 104px;
}

.report-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.report-financial-grid {
    grid-template-columns: minmax(0, 65fr) minmax(280px, 35fr);
}

.report-aging-grid,
.report-operational-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-preview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-chart-panel,
.report-profit-panel,
.report-aging-panel,
.report-operational-panel,
.report-preview-panel {
    height: 100%;
    padding: var(--space-md);
}

.report-comparison {
    display: grid;
    gap: var(--space-md);
    margin-top: 20px;
}

.report-bar-row {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-md);
}

.report-bar-row > span {
    color: var(--text-secondary);
    font-size: 13px;
}

.report-bar-row > div,
.report-method-row > div:last-child > i {
    display: block;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--bg-surface-2);
}

.report-bar-row > div > i,
.report-method-row > div:last-child > i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--color-primary);
}

.report-bar-row-secondary > div > i {
    background: var(--blue);
}

.report-bar-row > strong,
.report-method-row strong {
    color: var(--text-primary);
    font-size: 13px;
    white-space: nowrap;
}

.report-method-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.report-method-row {
    display: grid;
    grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr);
    align-items: center;
    gap: var(--space-md);
}

.report-method-row span,
.report-method-row small {
    display: block;
}

.report-method-row span {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: var(--font-weight-semibold);
}

.report-method-row small {
    color: var(--text-muted);
    font-size: 11px;
}

.report-method-row > div:last-child {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-sm);
}

.report-method-row > div:last-child > i {
    grid-column: 1 / -1;
    width: 100%;
}

.report-method-row > div:last-child > i::before {
    display: block;
    width: 0;
    height: 100%;
    content: '';
}

.report-profit-panel {
    max-width: none;
    padding: 18px var(--space-lg);
}

.report-profit-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    color: var(--text-primary);
}

.report-profit-sub {
    margin-top: 10px;
    color: var(--text-secondary);
}

.report-profit-divider {
    margin: 10px 0;
    border-top: 1px solid var(--border);
}

.report-profit-total {
    font-weight: var(--font-weight-semibold);
}

.report-profit-net {
    font-size: 18px;
}

.report-profit-panel > small {
    display: block;
    margin-top: 10px;
}

.report-aging-panel .report-card-heading strong {
    display: block;
    margin-top: 4px;
    color: var(--text-primary);
    font-size: 20px;
}

.report-aging-panel .table-responsive,
.report-operational-panel .table-responsive,
.report-preview-panel .table-responsive {
    margin-top: var(--space-md);
}

.report-preview-panel .table-modern td:first-child strong,
.report-preview-panel .table-modern td:first-child small {
    display: block;
}

.report-preview-panel .table-modern td:first-child small {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11px;
}

@media (max-width: 768px) {
    .report-page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .report-header-actions {
        width: 100%;
    }

    .report-header-actions > .dropdown,
    .report-header-actions > .dropdown > .btn,
    .report-header-actions > .btn {
        width: 100%;
    }

    .report-header-actions > .dropdown {
        flex: 1;
    }

    .report-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .report-period-label {
        font-size: 12px;
    }

    .report-filter-panel {
        padding: var(--space-md);
    }

    .report-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-kpi-card > strong {
        font-size: 22px;
    }

    .report-preview-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .report-bar-row {
        grid-template-columns: 1fr auto;
    }

    .report-bar-row > div {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .report-method-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .report-page-header .page-title {
        font-size: 22px;
    }

    .report-kpi-card {
        min-height: 128px;
        padding: var(--space-md);
    }

    .report-filters,
    .report-kpis,
    .report-financial-grid,
    .report-aging-grid,
    .report-operational-grid,
    .report-preview-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .report-kpi-card > strong {
        font-size: 22px;
    }

    .report-chart-panel,
    .report-profit-panel,
    .report-aging-panel,
    .report-operational-panel,
    .report-preview-panel {
        padding: var(--space-md);
    }
}

/* =========================================================
   23. REPORT VIEW HELPERS
   Dipindah dari <style> inline laporan.php agar seluruh CSS
   laporan terkonsentrasi di satu tempat.
   ========================================================= */
.report-page .report-period-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.report-page .report-preset-chip { padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-secondary); font-size: 12px; font-weight: 600; text-decoration: none; }
.report-page .report-preset-chip:hover,
.report-page .report-preset-chip.is-active { border-color: var(--color-primary); background: var(--purple-light); color: var(--color-primary); }
.report-page .report-kpi-change { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-weight: 700; }
.report-page .report-kpi-change-up { color: var(--green); }
.report-page .report-kpi-change-down { color: var(--red); }
.report-page .report-kpi-change-neutral { color: var(--text-muted); }
.report-page .report-insight-panel,
.report-page .report-trend-panel { padding: var(--space-md); }
.report-page .report-insight-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 0; padding: 0; list-style: none; }
.report-page .report-insight-list li { display: flex; gap: 8px; align-items: flex-start; color: var(--text-primary); font-size: 13px; }
.report-page .report-insight-list i { color: var(--color-primary); }
.report-page .report-svg-wrap { width: 100%; margin-top: 16px; overflow-x: auto; }
.report-page .report-trend-chart { display: block; width: 100%; min-width: 640px; height: 260px; }
.report-page .report-chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--text-secondary); font-size: 12px; }
.report-page .report-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.report-page .report-dot-sales { background: var(--color-primary); }
.report-page .report-dot-purchase { background: var(--blue); }
.report-page .report-dot-profit { background: var(--green); }
.report-page .report-analytics-grid,
.report-page .report-cash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); }
.report-page .report-mini-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-md); margin-bottom: var(--space-md); }
.report-page .report-mini-kpi { padding: var(--space-md); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); }
.report-page .report-mini-kpi span,
.report-page .report-mini-kpi small { display: block; color: var(--text-muted); font-size: 12px; }
.report-page .report-mini-kpi strong { display: block; margin-top: 4px; color: var(--text-primary); font-size: 20px; overflow-wrap: anywhere; }
.report-page .report-cash-list { display: grid; gap: 10px; margin-top: 14px; }
.report-page .report-cash-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.report-profit-group { display: block; margin: 16px 0 4px; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.report-profit-group:first-child { margin-top: 0; }

/* Laba Bersih — hierarki visual paling menonjol di Laba & Rugi. */
.report-profit-net {
    margin-top: 12px;
    padding: 12px var(--space-md);
    border-radius: var(--radius-sm);
    background: var(--bg-surface-2);
    font-size: 20px;
}

/* =========================================================
   24. REPORT RESPONSIVE — CASCADE FIX
   Media query grid laporan harus berada SETELAH rule dasar
   report agar tidak dikalahkan aturan dasar yang ditulis
   belakangan di file. Urutan breakpoint: kasar → halus.
   ========================================================= */
@media (max-width: 1180px) {
    .report-kpis,
    .report-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .report-financial-grid,
    .report-aging-grid,
    .report-operational-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
    .report-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-filter-action .btn { width: 100%; min-width: 0; }

    .report-page .report-insight-list,
    .report-page .report-analytics-grid,
    .report-page .report-cash-grid,
    .report-page .report-mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .report-financial-grid,
    .report-aging-grid,
    .report-operational-grid { grid-template-columns: minmax(0, 1fr); }

    .report-preview-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
    .report-page .report-insight-list,
    .report-page .report-analytics-grid,
    .report-page .report-cash-grid,
    .report-page .report-mini-kpis { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
    .report-filters,
    .report-kpis,
    .report-financial-grid,
    .report-aging-grid,
    .report-operational-grid,
    .report-preview-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Header laporan di tablet: judul + action boleh wrap rapi. */
@media (min-width: 769px) and (max-width: 1024px) {
    .report-page-header { flex-wrap: wrap; gap: var(--space-md); }
    .report-header-actions { margin-left: auto; }
}

/* =========================================================
   25. DARK MODE POLISH
   ========================================================= */
[data-theme="dark"] .alert-success { border-color: #1f5c44; background: var(--green-light); color: #8fe3bd; }
[data-theme="dark"] .alert-danger { border-color: #6d3546; background: var(--red-light); color: #f3a7b8; }
[data-theme="dark"] .alert-warning { border-color: #6b5427; background: var(--orange-light); color: #f3c97a; }
[data-theme="dark"] .alert-info { border-color: #2b5478; background: var(--blue-light); color: #a3d3f7; }

/* =========================================================
   26. SERVICE QUALITY CONTROL (QC)
   ========================================================= */
.qc-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: var(--space-md);
}
.qc-summary-box {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface-2);
    padding: var(--space-md);
    min-width: 0;
}
.qc-summary-box small {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    margin-bottom: 4px;
}
.qc-summary-box strong {
    font-size: 18px;
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}
.qc-table tbody td:first-child {
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    white-space: nowrap;
}
.qc-table tbody td {
    padding-top: 10px;
    padding-bottom: 10px;
}
.qc-option {
    margin-bottom: 0;
    margin-right: var(--space-md);
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.qc-option:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
}
.qc-option .form-check-input {
    margin-top: 0;
    margin-right: 6px;
    width: 1.15em;
    height: 1.15em;
}
.qc-option .form-check-label {
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}
.qc-battery {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 200px;
}
.qc-battery .form-control {
    text-align: right;
    min-width: 90px;
}
.qc-battery span {
    color: var(--text-secondary);
    font-weight: var(--font-weight-semibold);
}
.qc-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    font-size: 13px;
    min-height: 0;
}
.qc-meta div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    overflow-wrap: anywhere;
}

/* Responsive QC */
@media (max-width: 767px) {
    .qc-table {
        min-width: 430px;
    }
    .qc-table tbody td:first-child {
        white-space: normal;
        min-width: 130px;
    }
    .qc-option {
        margin-right: var(--space-sm);
        padding: var(--space-sm) var(--space-md);
        flex: 1 1 0;
        justify-content: center;
    }
    .qc-battery {
        max-width: none;
        width: 100%;
    }
    .qc-battery .form-control {
        flex: 1;
        min-width: 0;
    }
    .qc-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Panel QC intake pada form "Tambah Service" (service.php). */
.qc-intake-panel {
    border: 1px solid rgba(255, 193, 7, 0.45);
    border-radius: 8px;
    padding: 12px;
    background: rgba(255, 193, 7, 0.06);
}

.qc-intake-table {
    max-height: 320px;
    overflow: auto;
}

/* Intake service lengkap pada service.php. */
.service-intake-heading {
    margin: 0;
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: var(--font-weight-bold);
}
.service-intake-items {
    display: grid;
    gap: var(--space-sm);
}
.service-intake-item-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(88px, .65fr) minmax(130px, 1fr) minmax(110px, .8fr) auto;
    gap: var(--space-sm);
    align-items: end;
    min-width: 0;
    padding: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface-2);
}
.service-intake-item-row > div { min-width: 0; }
.service-intake-item-subtotal-wrap small,
.service-intake-item-subtotal-wrap strong { display: block; }
.service-intake-item-subtotal-wrap small { color: var(--text-muted); font-size: 12px; }
.service-intake-item-subtotal-wrap strong { color: var(--text-primary); font-size: 13px; }
.intake-item-remove { align-self: end; }
.service-intake-total {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface-2);
}
.service-intake-total small,
.service-intake-total strong { display: block; }
.service-intake-total small { color: var(--text-muted); font-size: 12px; }
.service-intake-total strong { margin-top: 3px; color: var(--text-primary); font-size: 16px; }
.service-intake-total.emphasis { border-color: rgba(102, 88, 245, .35); background: var(--purple-light); }

@media (max-width: 768px) {
    .service-intake-item-row {
        grid-template-columns: minmax(0, 1fr) minmax(80px, .45fr) minmax(120px, .8fr);
    }
    .service-intake-item-subtotal-wrap { grid-column: 1 / span 2; }
    .intake-item-remove { grid-column: 3; grid-row: 2; justify-self: end; }
}

@media (max-width: 480px) {
    .service-intake-item-row { grid-template-columns: minmax(0, 1fr) minmax(80px, .5fr); }
    .service-intake-item-row > div:first-child { grid-column: 1 / -1; }
    .service-intake-item-subtotal-wrap { grid-column: 1; }
    .intake-item-remove { grid-column: 2; grid-row: 3; }
}
