@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --accent: #06b6d4;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #4f46e5;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
    --radius: 14px;
    --radius-sm: 10px;
    --transition: 0.2s ease;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    color: var(--primary-dark);
}

/* ===== AUTH LAYOUT ===== */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth-shell:has(.auth-card-wide) {
    grid-template-columns: minmax(240px, 0.55fr) minmax(0, 1.45fr);
}

.auth-brand {
    background: linear-gradient(135deg, #312e81 0%, #4f46e5 45%, #06b6d4 100%);
    color: #fff;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-brand::before,
.auth-brand::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.auth-brand::before {
    width: 320px;
    height: 320px;
    top: -80px;
    right: -80px;
}

.auth-brand::after {
    width: 200px;
    height: 200px;
    bottom: -40px;
    left: -40px;
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.auth-logo i {
    font-size: 2rem;
}

.auth-brand h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.auth-brand p {
    font-size: 1.05rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.auth-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.85rem;
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.auth-features i {
    color: #a5f3fc;
}

.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    border: 1px solid var(--border);
}

.auth-card-wide {
    max-width: 100%;
}

.auth-pricing-grid {
    margin-top: 0.5rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 0;
}

.auth-pricing-grid .pricing-card {
    padding: 1.35rem 1.1rem;
}

.auth-pricing-grid .pricing-card h3 {
    font-size: 1.1rem;
}

.auth-pricing-grid .pricing-amount .price {
    font-size: 1.75rem;
}

.auth-pricing-grid .btn-app {
    width: 100%;
    margin-top: 0.5rem;
}

@media (max-width: 1100px) {
    .auth-shell:has(.auth-card-wide) {
        grid-template-columns: 1fr;
    }

    .auth-shell:has(.auth-card-wide) .auth-brand {
        display: none;
    }
}

@media (max-width: 768px) {
    .auth-pricing-grid {
        grid-template-columns: 1fr;
    }
}

.auth-card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.auth-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.auth-footer-link {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
}

/* ===== LOGIN: industry showcase ===== */
.auth-shell-rich .auth-brand-content {
    max-width: 520px;
}

.auth-brand-login .auth-logo-enter,
.auth-brand-login .auth-headline-enter,
.auth-brand-login .auth-lead-enter,
.auth-brand-login .auth-industry-nav,
.auth-brand-login .auth-industry-panel {
    animation: authFadeUp 0.55s ease both;
}

.auth-brand-login .auth-headline-enter { animation-delay: 0.08s; }
.auth-brand-login .auth-lead-enter { animation-delay: 0.16s; }
.auth-brand-login .auth-industry-nav { animation-delay: 0.24s; }
.auth-brand-login .auth-industry-panel { animation-delay: 0.32s; }

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

.auth-brand-login h1 {
    font-size: clamp(1.6rem, 3.5vw, 2.25rem);
    margin-bottom: 0.75rem;
}

.auth-brand-login > p {
    margin-bottom: 1.35rem;
    max-width: 40ch;
}

.auth-industry-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.15rem;
}

.auth-industry-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.auth-industry-chip i {
    font-size: 1rem;
}

.auth-industry-chip:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}

.auth-industry-chip.is-active {
    background: #fff;
    color: #1e3a5f;
    border-color: #fff;
}

.auth-industry-panel {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    padding: 1.1rem 1.2rem;
    backdrop-filter: blur(6px);
}

.auth-industry-panel.is-swap {
    animation: authPanelSwap 0.35s ease;
}

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

.auth-industry-panel-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-industry-panel-icon i {
    font-size: 1.45rem;
}

.auth-industry-panel-body h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
}

.auth-industry-panel-body p {
    margin: 0 0 0.75rem;
    font-size: 0.92rem;
    opacity: 0.92;
    line-height: 1.45;
}

.auth-industry-points {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.4rem;
}

.auth-industry-points li {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.85rem;
    opacity: 0.95;
}

.auth-industry-points i {
    color: #a5f3fc;
    margin-top: 0.1rem;
}

.auth-industry-doc {
    margin: 0.85rem 0 0;
    font-size: 0.88rem;
}

.auth-industry-doc a {
    color: #a5f3fc;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.auth-industry-doc a:hover {
    color: #fff;
    text-decoration: underline;
}

.auth-card-login .subtitle {
    margin-bottom: 1.1rem;
}

.auth-industry-mini {
    display: none;
    gap: 0.45rem;
    margin-bottom: 1.35rem;
}

.auth-industry-mini-item {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f8fafc;
    color: #0f766e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

@media (max-width: 991px) {
    .auth-shell-rich .auth-brand {
        padding: 2rem 1.5rem;
    }

    .auth-industry-panel {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .auth-shell-rich {
        grid-template-columns: 1fr;
    }

    .auth-shell-rich .auth-brand {
        min-height: auto;
        padding: 1.75rem 1.25rem 1.5rem;
    }

    .auth-brand-login h1 {
        font-size: 1.45rem;
    }

    .auth-brand-login > p {
        font-size: 0.92rem;
        margin-bottom: 1rem;
    }

    .auth-industry-chip span {
        display: none;
    }

    .auth-industry-chip {
        width: 42px;
        height: 42px;
        padding: 0;
        justify-content: center;
        border-radius: 12px;
    }

    .auth-industry-panel-body p {
        font-size: 0.88rem;
    }

    .auth-industry-mini {
        display: flex;
    }
}

/* ===== APP SHELL ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    transition: transform var(--transition);
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--primary-light);
}

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

.nav-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 0.75rem 0.75rem 0.35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.92rem;
    transition: all var(--transition);
    margin-bottom: 0.15rem;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.sidebar-link i {
    font-size: 1.15rem;
    width: 1.25rem;
    text-align: center;
}

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

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 0.5rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-info {
    min-width: 0;
}

.user-info .name {
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .role {
    font-size: 0.75rem;
    color: #94a3b8;
}

.app-main {
    flex: 1;
    min-width: 0;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-user {
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    font-size: 0.9rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    color: var(--text);
    cursor: pointer;
}

.app-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
}

.app-footer {
    padding: 1rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1035;
}

/* ===== PAGE COMPONENTS ===== */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.page-header .breadcrumb-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

.page-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.page-card + .page-card {
    margin-top: 1.25rem;
}

.card-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-section-title i {
    color: var(--primary);
}

/* ===== BUTTONS ===== */
.btn-app {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.15rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-app-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-app-primary:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

.btn-app-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-app-secondary:hover {
    background: #e2e8f0;
    color: var(--text);
}

.btn-app-danger {
    background: var(--danger);
    color: #fff;
}

.btn-app-danger:hover {
    color: #fff;
    background: #dc2626;
}

.btn-app-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-app-outline:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary-dark);
}

.btn-app-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
}

.btn-app-xs {
    padding: 0.28rem 0.5rem;
    font-size: 0.72rem;
    gap: 0.25rem;
}

.btn-app-xs i {
    font-size: 0.85em;
}

.btn-app-lg {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    width: 100%;
}

/* ===== FORMS ===== */
.report-filter-form .form-control,
.report-filter-form .btn-app {
    height: 44px;
}

.report-filter-form .btn-app {
    padding-top: 0;
    padding-bottom: 0;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 0.45rem;
    color: var(--text);
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.searchable-select-input {
    width: 100%;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px 12px;
}

.searchable-select-list {
    display: none;
    position: absolute;
    z-index: 40;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.searchable-select.is-open .searchable-select-list {
    display: block;
}

.searchable-select-option {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.55rem 0.85rem;
    font: inherit;
    color: var(--text);
    cursor: pointer;
}

.searchable-select-option:hover,
.searchable-select-option:focus {
    background: #eef2ff;
    outline: none;
}

.searchable-select-option.is-selected {
    background: #e0e7ff;
    font-weight: 600;
}

.searchable-select-empty {
    padding: 0.75rem 0.85rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap i {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.input-icon-wrap .form-control,
.input-icon-wrap .form-select {
    padding-left: 2.6rem;
}

.input-icon-wrap .form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M4.5 6l3.5 3.5L11.5 6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.95rem center;
    background-color: #fff;
    padding-right: 2.4rem;
}

.form-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.field-validation-error,
.text-danger {
    color: var(--danger) !important;
    font-size: 0.82rem;
    margin-top: 0.35rem;
    display: block;
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 1.2rem;
}

/* ===== TABLES ===== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.data-table thead {
    background: #f8fafc;
}

.data-table th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.data-table tbody tr:hover {
    background: #f8fafc;
}

.product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.product-thumb-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
}

.action-btns {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.action-btns-compact {
    flex-wrap: nowrap;
    flex-direction: row;
    gap: 0.3rem;
}

.action-btns-compact .btn-app {
    white-space: nowrap;
    flex: 0 0 auto;
}

.data-table .col-actions {
    width: 1%;
    white-space: nowrap;
}

.data-table .col-actions .action-btns,
.data-table td:has(.action-btns-compact) .action-btns {
    flex-wrap: nowrap;
    flex-direction: row;
    white-space: nowrap;
}

.badge-amount {
    font-weight: 700;
    color: var(--primary-dark);
}

.quotation-status-select {
    width: auto;
    min-width: 170px;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.quotation-status-select.is-valid {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
    display: block;
}

/* ===== DASHBOARD ===== */
.dashboard-hero {
    background: linear-gradient(135deg, #312e81 0%, #4f46e5 50%, #6366f1 100%);
    border-radius: var(--radius);
    padding: 2.5rem;
    color: #fff;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.dashboard-hero::after {
    content: '';
    position: absolute;
    width: 250px;
    height: 250px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    top: -60px;
    right: -60px;
}

.dashboard-hero h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
}

.dashboard-hero p {
    opacity: 0.9;
    margin: 0;
    position: relative;
    max-width: 520px;
}

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

.dashboard-metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}

.dashboard-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    color: inherit;
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.metric-icon.blue { background: #e0f2fe; color: #0284c7; }
.metric-icon.orange { background: #ffedd5; color: #ea580c; }
.metric-icon.purple { background: #ede9fe; color: #7c3aed; }
.metric-icon.green { background: #dcfce7; color: #16a34a; }
.metric-icon.red { background: #fee2e2; color: #dc2626; }

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}

.metric-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.metric-sub {
    font-size: 0.8rem;
    color: #dc2626;
    font-weight: 600;
    margin-top: 0.2rem;
}

.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dashboard-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    transition: border-color var(--transition), background var(--transition);
}

.dashboard-list-item:hover {
    border-color: var(--primary-light);
    background: rgba(79, 70, 229, 0.04);
    color: inherit;
}

.dashboard-list-item strong {
    font-size: 0.9rem;
    display: block;
}

.list-filter-card {
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

/* Accordion filter card (quotation/order) — not the master search bar */
.list-filter-card:has(.list-filter-toggle) {
    padding: 0;
}

.master-search-row {
    display: flex;
    align-items: end;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
}

.master-search-field {
    flex: 1 1 220px;
    min-width: 0;
}

.master-search-card .list-filter-buttons {
    flex: 0 0 auto;
    padding-bottom: 1px;
}

@media (max-width: 575px) {
    .master-search-card .list-filter-buttons {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .master-search-card .list-filter-buttons .btn-app {
        width: 100%;
        justify-content: center;
    }
}

.list-filter-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1.15rem;
    border: 0;
    background: transparent;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
}

.list-filter-toggle:hover {
    background: #f8fafc;
}

.list-filter-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.list-filter-toggle-label > i {
    color: var(--primary);
}

.list-filter-active-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary-dark);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.list-filter-chevron {
    color: var(--text-muted);
    transition: transform 0.28s ease;
}

.list-filter-card.is-open .list-filter-chevron {
    transform: rotate(180deg);
}

/* Smooth accordion via grid (no Bootstrap height measuring) */
.list-filter-panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.28s ease;
}

.list-filter-card.is-open .list-filter-panel {
    grid-template-rows: 1fr;
}

.list-filter-panel-inner {
    overflow: hidden;
    min-height: 0;
}

.list-filter-body {
    border-top: 1px solid var(--border);
    padding: 1rem 1.15rem 1.15rem;
}

.list-filter-grid {
    display: grid;
    grid-template-columns: minmax(180px, 2fr) repeat(5, minmax(110px, 1fr)) auto;
    gap: 0.75rem 1rem;
    align-items: end;
}

.list-filter-field .form-label {
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    white-space: nowrap;
}

.list-filter-field .form-control,
.list-filter-field .form-select {
    min-width: 0;
}

.list-filter-field-amount {
    min-width: 100px;
}

.list-filter-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: nowrap;
    padding-bottom: 1px;
}

.list-filter-buttons .btn-app {
    white-space: nowrap;
}

@media (max-width: 1400px) {
    .list-filter-grid {
        grid-template-columns: repeat(4, minmax(140px, 1fr));
    }

    .list-filter-field-wide {
        grid-column: 1 / -1;
    }

    .list-filter-buttons {
        grid-column: 1 / -1;
        justify-content: flex-start;
        margin-top: 0.25rem;
    }
}

@media (max-width: 768px) {
    .list-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .list-filter-field-wide {
        grid-column: 1 / -1;
    }

    .list-filter-buttons {
        grid-column: 1 / -1;
    }
}

@media (max-width: 575px) {
    .list-filter-grid {
        grid-template-columns: 1fr;
    }

    .list-filter-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .list-filter-buttons .btn-app {
        width: 100%;
        justify-content: center;
    }
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: transform var(--transition), box-shadow var(--transition);
    text-decoration: none;
    color: inherit;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    color: inherit;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.blue { background: #e0f2fe; color: #0284c7; }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }

.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.report-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

.report-stat-card.highlight {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #a7f3d0;
}

.report-stat-card .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
}

.report-stat-card .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.report-stat-card .sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.stat-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}

/* ===== QUOTATION ===== */
.totals-panel {
    background: linear-gradient(180deg, #f8fafc, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 0.55rem 0;
    font-size: 0.92rem;
}

.totals-row.final {
    border-top: 2px solid var(--border);
    margin-top: 0.5rem;
    padding-top: 0.85rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.totals-row .value {
    font-weight: 600;
}

.line-items-table .form-control {
    padding: 0.5rem 0.65rem;
    font-size: 0.88rem;
}

.quotation-line-items-grid {
    min-height: 420px;
}

/* ===== ALERTS ===== */
.alert-app {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
    font-weight: 500;
}

.alert-app.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-app.danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-app.is-hiding {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.alert-app .btn-close-custom {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
}

/* ===== DELETE CONFIRM ===== */
.delete-card {
    max-width: 480px;
    text-align: center;
}

.delete-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fef2f2;
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 1.25rem;
}

.image-preview-grid {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.image-preview-grid img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.product-picker {
    position: relative;
    min-width: 220px;
}

.product-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.product-picker-item {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.65rem 0.85rem;
    font-size: 0.92rem;
    color: var(--text);
    cursor: pointer;
}

.product-picker-item:hover,
.product-picker-item:focus,
.product-picker-item.is-active {
    background: #f1f5f9;
    outline: none;
}

.product-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.product-picker-item .ppi-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-picker-item .ppi-rate {
    flex: 0 0 auto;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.product-picker-empty {
    padding: 0.75rem 0.85rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.product-images-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-width: 180px;
}

.product-image-thumb {
    cursor: zoom-in;
    transition: transform var(--transition), box-shadow var(--transition);
}

.product-image-thumb:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

.line-items-table .product-images-cell {
    min-width: 120px;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.image-lightbox.active {
    display: flex;
}

.image-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.82);
}

.image-lightbox-panel {
    position: relative;
    z-index: 1;
    max-width: min(92vw, 900px);
    max-height: 90vh;
}

.image-lightbox-panel img {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    background: #fff;
}

.image-lightbox-close {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.menu-assign-card {
    max-width: 640px;
}

.menu-assign-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.menu-assign-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 0;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.menu-assign-item:hover {
    border-color: var(--primary-light);
    background: #f8fafc;
}

.menu-assign-item.is-locked {
    background: #f8fafc;
    cursor: default;
}

.menu-assign-item .form-check-input {
    width: 1.2rem;
    height: 1.2rem;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
}

.menu-assign-item-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.menu-assign-item-name {
    font-weight: 600;
    color: var(--text);
}

.menu-assign-item-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ===== PAGINATION ===== */
.pagination-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.pagination-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.pagination-list {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    transition: all var(--transition);
}

.page-link:hover:not(.disabled):not(.active) {
    border-color: var(--primary-light);
    color: var(--primary);
    background: #f8fafc;
}

.page-link.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.page-link.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ===== LICENSE & PRICING ===== */
.license-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.license-banner-text {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.license-trial {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.license-active {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.license-expired {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.license-alert-expired {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

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

.pricing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.75rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    display: flex;
    flex-direction: column;
}

.pricing-card-featured {
    border-color: var(--primary-light);
    box-shadow: 0 12px 40px rgba(79, 70, 229, 0.15);
    transform: translateY(-2px);
}

.pricing-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
    background: #f1f5f9;
    color: var(--text-muted);
}

.pricing-badge.popular {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.pricing-card h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.pricing-amount {
    margin-bottom: 1rem;
}

.pricing-amount .price {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.pricing-amount .period {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.pricing-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 1.25rem;
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    flex: 1;
}

.pricing-features li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    font-size: 0.9rem;
}

.pricing-features i {
    color: var(--success);
}

.pricing-status {
    text-align: center;
    padding: 0.65rem;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.pricing-status.active-plan {
    background: #ecfdf5;
    color: #065f46;
}

.pricing-status.expired-plan {
    background: #fef2f2;
    color: #991b1b;
}

.pricing-trial-end,
.pricing-note {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.pricing-contact-box {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    border: 1px solid var(--border);
    text-align: center;
}

.pricing-contact-box p {
    margin-bottom: 0.35rem;
    color: var(--text);
    font-size: 0.92rem;
}

.pricing-contact-phone {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff !important;
    font-weight: 600;
    text-decoration: none;
}

.pricing-contact-phone:hover {
    background: var(--primary-dark);
    color: #fff !important;
}

.quotation-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.quotation-status-progress {
    background: #dbeafe;
    color: #1d4ed8;
}

.quotation-status-confirmed {
    background: #dcfce7;
    color: #15803d;
}

.quotation-status-materials {
    background: #fef3c7;
    color: #b45309;
}

.quotation-status-booked {
    background: #ede9fe;
    color: #6d28d9;
}

.quotation-status-cancel {
    background: #fee2e2;
    color: #b91c1c;
}

.order-status-pending {
    background: #dbeafe;
    color: #1d4ed8;
}

.order-status-production {
    background: #ffedd5;
    color: #c2410c;
}

.order-status-ready {
    background: #fef9c3;
    color: #a16207;
}

.order-status-dispatched {
    background: #e0e7ff;
    color: #4338ca;
}

.order-status-transit {
    background: #cffafe;
    color: #0e7490;
}

.order-status-delivered {
    background: #dcfce7;
    color: #15803d;
}

.order-status-cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

.w-100 { width: 100%; }

/* ===== JQUERY UI AUTOCOMPLETE ===== */
.ui-autocomplete {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.9rem !important;
    max-height: 220px;
    overflow-y: auto;
    z-index: 2000 !important;
}

.ui-menu-item-wrapper {
    padding: 0.6rem 0.85rem !important;
}

.ui-state-active {
    background: rgba(79, 70, 229, 0.1) !important;
    border-color: transparent !important;
    color: var(--primary-dark) !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        padding: 2rem;
        min-height: auto;
    }

    .auth-brand h1 {
        font-size: 1.5rem;
    }

    .auth-features {
        display: none;
    }

    .app-sidebar {
        transform: translateX(-100%);
    }

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

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

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

    .sidebar-toggle {
        display: inline-flex;
    }

    .app-content {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .data-table th,
    .data-table td {
        padding: 0.7rem 0.75rem;
    }
}

@media (max-width: 575px) {
    .auth-card {
        padding: 1.75rem 1.25rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn-app {
        width: 100%;
    }

    .action-btns:not(.action-btns-compact) {
        flex-direction: column;
    }

    .action-btns-compact {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .action-btns:not(.action-btns-compact) .btn-app {
        width: 100%;
    }

    .action-btns-compact .btn-app {
        width: auto;
    }

    .data-table .action-btns,
    .data-table .action-btns-compact {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .data-table .action-btns .btn-app,
    .data-table .action-btns-compact .btn-app {
        width: auto;
    }

    .dashboard-metrics {
        grid-template-columns: 1fr;
    }

    .dashboard-list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-list-item .text-end {
        text-align: left !important;
        width: 100%;
    }
}

/* ===== DATA-ENTRY UX (quotation / order forms) ===== */
.btn-inline-toggle {
    background: none;
    border: 0;
    padding: 0.25rem 0;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-inline-toggle:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.qty-stepper {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-width: 120px;
}

.qty-stepper .qty-input {
    text-align: center;
    border-radius: 0;
    min-width: 56px;
}

.qty-stepper .qty-step {
    flex: 0 0 32px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    user-select: none;
}

.qty-stepper .qty-step:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    border-right: 0;
}

.qty-stepper .qty-step:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border-left: 0;
}

.qty-stepper .qty-step:hover {
    background: #e2e8f0;
}

/* Sticky action / save bar */
.form-sticky-bar {
    position: sticky;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    padding: 0.85rem 1.25rem;
    margin-top: 0.5rem;
}

.form-sticky-total {
    font-size: 1rem;
    color: var(--text-muted);
}

.form-sticky-total strong {
    color: var(--text);
    font-size: 1.15rem;
    margin-left: 0.35rem;
}

.form-sticky-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* Mobile: render line-item / payment table rows as stacked cards */
@media (max-width: 768px) {
    .line-items-table table,
    .line-items-table tbody,
    .line-items-table tr,
    .line-items-table td {
        display: block;
        width: 100%;
    }

    .line-items-table thead {
        display: none;
    }

    .line-items-table tr {
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.85rem;
        background: #fff;
    }

    .line-items-table td {
        border: 0;
        padding: 0.35rem 0;
    }

    .line-items-table td::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: 0.78rem;
        color: var(--text-muted);
        margin-bottom: 0.25rem;
    }

    .line-items-table td[data-label=""]::before {
        display: none;
    }

    .line-items-table .product-picker {
        min-width: 0;
    }

    .line-items-table td.line-total {
        text-align: left;
    }

    .form-sticky-bar {
        position: sticky;
        bottom: 0;
        margin-left: -1rem;
        margin-right: -1rem;
        margin-bottom: -1rem;
        border-radius: 16px 16px 0 0;
        padding: 0.55rem 0.85rem;
        gap: 0.5rem;
        flex-wrap: nowrap;
        align-items: center;
        box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.14);
    }

    .form-sticky-total {
        font-size: 0.72rem;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    .form-sticky-total .form-sticky-label {
        display: block;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .form-sticky-total strong {
        font-size: 1rem;
        margin-left: 0;
    }

    .form-sticky-actions {
        width: auto;
        flex: 1 1 auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 0.4rem;
    }

    .form-sticky-actions .btn-app {
        flex: 0 1 auto;
        padding: 0.5rem 0.7rem;
        font-size: 0.82rem;
        min-height: 40px;
        white-space: nowrap;
    }
}

/* Collapse verbose button labels on the smallest phones (app-style bar) */
@media (max-width: 575px) {
    .form-sticky-actions .btn-app .btn-text {
        display: none;
    }

    .form-sticky-actions .btn-app {
        padding: 0.5rem 0.85rem;
    }
}

/* ===== MOBILE: app-like listing screens ===== */
@media (max-width: 768px) {
    /* Inputs at >=16px stop mobile browsers from auto-zooming on focus.
       More specific selectors needed so line-item / filter rules don't win. */
    .form-control,
    .form-select,
    .searchable-select-input,
    .line-items-table .form-control,
    .line-items-table .form-select,
    .list-filter-field .form-control,
    .list-filter-field .form-select,
    .product-search,
    .qty-input,
    .rate-input,
    .payment-amount,
    .payment-remark,
    .payment-mop {
        font-size: 16px !important;
    }

    /* Listing tables become stacked cards (labels injected via site.js) */
    .table-wrap:not(.line-items-table) {
        border: 0;
        overflow: visible;
        background: transparent;
    }

    .table-wrap:not(.line-items-table) .data-table thead {
        display: none;
    }

    .table-wrap:not(.line-items-table) .data-table,
    .table-wrap:not(.line-items-table) .data-table tbody,
    .table-wrap:not(.line-items-table) .data-table tr,
    .table-wrap:not(.line-items-table) .data-table td {
        display: block;
        width: 100%;
    }

    .table-wrap:not(.line-items-table) .data-table tr {
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 0.35rem 0.9rem;
        margin-bottom: 0.85rem;
        background: var(--bg-card);
        box-shadow: var(--shadow-sm);
    }

    .table-wrap:not(.line-items-table) .data-table tbody tr:hover {
        background: var(--bg-card);
    }

    .table-wrap:not(.line-items-table) .data-table td {
        border: 0;
        border-bottom: 1px solid #f1f5f9;
        padding: 0.6rem 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        text-align: right;
        min-height: 42px;
    }

    .table-wrap:not(.line-items-table) .data-table tr td:last-child {
        border-bottom: 0;
    }

    .table-wrap:not(.line-items-table) .data-table td::before {
        content: attr(data-label);
        flex: 0 0 36%;
        text-align: left;
        font-weight: 600;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--text-muted);
    }

    .table-wrap:not(.line-items-table) .data-table td[data-label=""]::before {
        display: none;
    }

    /* Cells with buttons or a status dropdown: label on top, full-width content */
    .table-wrap:not(.line-items-table) .data-table td:has(.action-btns),
    .table-wrap:not(.line-items-table) .data-table td:has(.quotation-status-select) {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
        gap: 0.4rem;
    }

    .table-wrap:not(.line-items-table) .data-table td:has(.action-btns)::before,
    .table-wrap:not(.line-items-table) .data-table td:has(.quotation-status-select)::before {
        flex: none;
    }

    .table-wrap:not(.line-items-table) .data-table .action-btns,
    .table-wrap:not(.line-items-table) .data-table .action-btns-compact {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.35rem;
        width: 100%;
        justify-content: flex-start;
    }

    .table-wrap:not(.line-items-table) .data-table .action-btns .btn-app,
    .table-wrap:not(.line-items-table) .data-table .action-btns-compact .btn-app,
    .table-wrap:not(.line-items-table) .data-table .btn-group {
        flex: 0 0 auto;
    }

    .quotation-status-select {
        width: 100%;
        min-width: 0;
    }

    /* App-like header + touch targets */
    .app-topbar {
        padding: 0.65rem 1rem;
    }

    .page-header {
        margin-bottom: 1rem;
    }

    .page-header h1 {
        font-size: 1.35rem;
    }

    .page-card {
        padding: 1.1rem;
    }

    .btn-app {
        min-height: 42px;
    }
}

/* ===== Quotation Kanban Board ===== */
.kanban-page {
    width: 100%;
    max-width: none;
}

.app-content:has(.kanban-page) {
    max-width: none;
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
}

.kanban-hint-mobile {
    display: none;
}

.kanban-mobile-tabs {
    display: none;
}

.kanban-empty {
    padding: 1.25rem 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.kanban-board {
    display: flex;
    gap: 0.85rem;
    align-items: stretch;
    width: 100%;
    padding-bottom: 0.75rem;
}

.kanban-column {
    flex: 1 1 0;
    min-width: 0;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    min-height: 420px;
    max-height: calc(100vh - 180px);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--border);
    background: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.kanban-count {
    min-width: 1.6rem;
    height: 1.6rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-height: 120px;
    transition: background 0.15s ease;
    -webkit-overflow-scrolling: touch;
}

.kanban-cards.is-over {
    background: rgba(13, 110, 110, 0.08);
}

.kanban-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.8rem;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.is-dragging {
    opacity: 0.45;
}

.kanban-card-placeholder {
    min-height: 56px;
    border: 2px dashed #94a3b8;
    border-radius: var(--radius-sm);
    background: rgba(148, 163, 184, 0.15);
    pointer-events: none;
}

.kanban-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.kanban-card-client {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
    margin-bottom: 0.2rem;
    word-break: break-word;
}

.kanban-card-work {
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.kanban-card-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.badge-balance {
    display: inline-block;
    font-weight: 700;
    font-size: 0.82rem;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 0.15rem 0.45rem;
    white-space: nowrap;
}

.kanban-card-ref {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.35rem;
}

.kanban-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
}

.kanban-card-status-row {
    display: none;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.55rem;
}

.kanban-status-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
}

.kanban-status-select {
    width: 100%;
    min-height: 44px;
    font-size: 16px; /* prevents iOS zoom on focus */
}

.kanban-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.kanban-card-actions a {
    cursor: pointer;
}

/* Phone + tablet: CSS-first (works before JS — critical for iOS Safari) */
@media (max-width: 991px) {
    body:has(.kanban-page) .app-content {
        max-width: none;
        width: 100%;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        padding-bottom: 2rem;
        overflow: visible;
    }

    .kanban-hint-desktop {
        display: none;
    }

    .kanban-hint-mobile {
        display: block;
    }

    .kanban-page-header {
        margin-bottom: 0.75rem;
        gap: 0.65rem;
    }

    .kanban-page-header h1 {
        font-size: 1.25rem;
    }

    .kanban-page-actions .btn-app {
        min-height: 44px;
    }

    .kanban-mobile-tabs {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
        margin-bottom: 0.75rem;
        /* Avoid position:sticky here — iOS Safari + app topbar causes scroll lock */
        background: var(--bg);
        padding: 0.15rem 0 0.55rem;
    }

    .kanban-mobile-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        min-height: 52px;
        padding: 0.45rem 0.3rem;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: #fff;
        color: var(--text-muted);
        font-size: 0.72rem;
        font-weight: 600;
        line-height: 1.2;
        text-align: center;
        cursor: pointer;
        -webkit-appearance: none;
        appearance: none;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .kanban-mobile-tab.is-active {
        background: #0d6e6e;
        border-color: #0d6e6e;
        color: #fff;
        box-shadow: 0 4px 12px rgba(13, 110, 110, 0.22);
    }

    .kanban-mobile-tab-count {
        min-width: 1.4rem;
        padding: 0.05rem 0.4rem;
        border-radius: 999px;
        background: rgba(15, 23, 42, 0.08);
        font-size: 0.7rem;
        font-weight: 700;
    }

    .kanban-mobile-tab.is-active .kanban-mobile-tab-count {
        background: rgba(255, 255, 255, 0.22);
        color: #fff;
    }

    .kanban-board {
        display: block;
        overflow: visible;
        padding-bottom: 0;
    }

    /* Hide inactive columns via CSS only — no JS class required on board */
    .kanban-column {
        display: none !important;
        flex: none;
        width: 100%;
        min-width: 0;
        min-height: 0;
        max-height: none !important;
        margin-bottom: 0;
        border: none;
        background: transparent;
    }

    .kanban-column.is-mobile-active {
        display: flex !important;
    }

    .kanban-column-header {
        display: none;
    }

    .kanban-cards {
        max-height: none !important;
        min-height: 0;
        overflow: visible !important;
        padding: 0;
        gap: 0.7rem;
        background: transparent;
    }

    .kanban-card {
        cursor: default;
        -webkit-user-select: text;
        user-select: text;
        touch-action: manipulation;
        padding: 0.9rem;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }

    .kanban-card-status-row {
        display: flex;
    }

    .kanban-card-actions .btn-app {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .kanban-card-actions {
        gap: 0.5rem;
    }
}

@media (max-width: 420px) {
    .kanban-mobile-tab-label {
        font-size: 0.66rem;
    }

    .kanban-page-actions .btn-text {
        display: none;
    }
}

/* Advocate quotation */
.advocate-subject-editor {
    min-height: 120px;
    background: #fff;
    border-radius: 0 0 0.5rem 0.5rem;
}

.advocate-subject-editor .ql-editor {
    min-height: 100px;
    font-size: 1rem;
}

.desc-picker {
    position: relative;
    min-width: 220px;
}

.desc-picker-dropdown-float {
    position: fixed;
    z-index: 2000;
    max-height: 260px;
    overflow-x: hidden;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 0.5rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    padding: 0.25rem 0;
}

.desc-picker-dropdown-float[hidden] {
    display: none !important;
}

.desc-picker-option {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text, #111827);
}

.desc-picker-option-text {
    flex: 1;
    min-width: 0;
    white-space: normal;
    line-height: 1.35;
}

.desc-picker-option:hover,
.desc-picker-option.is-active {
    background: #f1f5f9;
}

.desc-picker-option small {
    flex: 0 0 auto;
    color: var(--primary, #2563eb);
    font-weight: 600;
    white-space: nowrap;
}
