/* ============================================================================
   Muhiim Technology — Complete Brand & Enterprise ERP Design System
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
    /* Muhiim Technology Brand Colors */
    --brand-teal-dark: #062e29;
    --brand-teal: #005248;
    --brand-teal-mid: #0d6e61;
    --brand-teal-light: #e3f1ef;
    --brand-orange: #f7941d;
    --brand-orange-hover: #e07f0b;
    --brand-orange-soft: #fff2df;

    /* Workspace Surfaces */
    --bg-canvas: #f5f6f8;
    --bg-card: #ffffff;
    --bg-subtle: #f8fafc;
    --table-head-bg: #005248;
    --border-color: #e2e8f0;
    --border-strong: #cbd5e1;
    --card-shadow: 0 1px 4px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.03);
    --card-shadow-hover: 0 8px 24px rgba(6, 46, 41, 0.08);

    /* Typography Colors */
    --text-heading: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;

    /* Legacy variable aliases */
    --glass-border: #e2e8f0;
    --accent-violet: #6366f1;
    --accent-indigo: #4f46e5;
    --accent-cyan: #005248;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #ef4444;

    --sidebar-width: 224px;
    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    min-height: 100vh;
    background-color: var(--bg-canvas);
    color: var(--text-body);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

/* ============================================================================
   App Layout Shell (Fixed Left Sidebar + Main Workspace)
   ============================================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-canvas);
}

.glass-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--brand-teal-dark);
    color: rgba(255, 255, 255, 0.78);
    display: flex;
    flex-direction: column;
    padding: 14px 12px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    z-index: 60;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow-y: auto;
    transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), padding 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 6px 14px;
    margin-bottom: 4px;
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 0;
    margin: 0;
}

.sidebar-logo-img {
    max-width: 155px;
    max-height: 34px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.sidebar-rail-toggle {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.sidebar-rail-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-rail-toggle svg {
    width: 17px;
    height: 17px;
}

.sidebar-rail-toggle .icon-menu {
    display: none;
}

/* Collapsed Icon-Rail Sidebar State */
body.sidebar-collapsed .glass-sidebar {
    width: 64px;
    padding: 14px 8px;
    overflow: visible;
}

body.sidebar-collapsed .sidebar-top-row {
    justify-content: center;
    padding: 2px 0 14px;
}

body.sidebar-collapsed .brand-header {
    display: none;
}

body.sidebar-collapsed .sidebar-rail-toggle .icon-close {
    display: none;
}

body.sidebar-collapsed .sidebar-rail-toggle .icon-menu {
    display: block;
}

body.sidebar-collapsed .sidebar-nav {
    overflow: visible;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 10px 0;
}

body.sidebar-collapsed .nav-item > span:not(.nav-item-toggle-left),
body.sidebar-collapsed .nav-item-toggle-left > span,
body.sidebar-collapsed .nav-toggle-sign {
    display: none;
}

body.sidebar-collapsed .nav-item-toggle-left {
    gap: 0;
}

body.sidebar-collapsed .nav-group {
    position: relative;
}

body.sidebar-collapsed .nav-group .nav-submenu {
    position: absolute;
    left: calc(100% + 10px);
    top: 0;
    min-width: 195px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
    padding: 8px;
    margin: 0 !important;
    max-height: none !important;
    opacity: 0;
    overflow: visible;
    pointer-events: none;
    transform: translateX(-6px);
    z-index: 200;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

body.sidebar-collapsed .nav-group:hover .nav-submenu,
body.sidebar-collapsed .nav-group:focus-within .nav-submenu {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

body.sidebar-collapsed .nav-group .nav-submenu::before {
    content: attr(data-group-title);
    position: static;
    display: block;
    width: auto;
    height: auto;
    background: transparent;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 4px 10px 7px;
    margin-bottom: 4px;
    border-bottom: 1px solid #f1f5f9;
}

body.sidebar-collapsed .nav-group .nav-subitem {
    opacity: 1;
    color: #334155;
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
}

body.sidebar-collapsed .nav-group .nav-subitem::before {
    display: none;
}

body.sidebar-collapsed .nav-group .nav-subitem:hover,
body.sidebar-collapsed .nav-group .nav-subitem.active {
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
}

html[data-theme="dark"] body.sidebar-collapsed .nav-group .nav-submenu {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] body.sidebar-collapsed .nav-group .nav-submenu::before {
    border-bottom-color: #334155;
}

html[data-theme="dark"] body.sidebar-collapsed .nav-group .nav-subitem {
    color: #e2e8f0;
}

html[data-theme="dark"] body.sidebar-collapsed .nav-group .nav-subitem:hover,
html[data-theme="dark"] body.sidebar-collapsed .nav-group .nav-subitem.active {
    background: #334155;
    color: #ffffff;
}

.brand-title {
    font-size: 16.5px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 10.5px;
    color: var(--brand-orange);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 500;
    font-size: 12.5px;
    transition: var(--transition);
}

.nav-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.85;
    flex-shrink: 0;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 600;
}

.nav-item.active svg {
    opacity: 1;
    color: var(--brand-orange);
}

/* Sidebar Sub-Navigation Tree (Communication Sub-Tabs) */
.nav-group {
    display: flex;
    flex-direction: column;
}

.nav-item-toggle {
    justify-content: space-between;
    cursor: pointer;
    width: 100%;
    border: none;
    background: transparent;
    font-family: inherit;
    text-align: left;
}

.nav-item-toggle-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-toggle-sign {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.7;
    line-height: 1;
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.nav-group.open .nav-toggle-sign {
    opacity: 1;
    transform: rotate(90deg);
}

.nav-submenu {
    position: relative;
    display: flex;
    flex-direction: column;
    margin: 0 0 0 14px;
    padding-left: 22px;
    gap: 2px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: max-height 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.26s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                margin 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-submenu::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    bottom: 2px;
    width: 1px;
    background: rgba(255, 255, 255, 0.16);
}

.nav-group.open .nav-submenu {
    max-height: 360px;
    opacity: 1;
    margin: 4px 0 6px 14px;
    pointer-events: auto;
    transform: translateY(0);
}

.nav-subitem {
    position: relative;
    padding: 5.5px 9px;
    font-size: 11.8px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    border-radius: 7px;
    opacity: 0;
    transition: color 0.2s ease,
                background 0.2s ease,
                opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-group.open .nav-subitem {
    opacity: 1;
}

.nav-subitem::before {
    content: '';
    position: absolute;
    left: -15.5px;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    z-index: 1;
    transition: var(--transition);
}

.nav-subitem:hover {
    color: #ffffff;
}

.nav-subitem.active {
    color: #ffffff;
    font-weight: 700;
}

.nav-subitem.active::before {
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

/* Communication & SMS Module Specific Components */
.sms-balance-banner {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #059669;
}

.sms-send-grid {
    display: grid;
    grid-template-columns: 1.65fr 1fr;
    gap: 20px;
    align-items: start;
}

.sms-seg-group {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 9px;
    gap: 3px;
}

.sms-seg-btn {
    padding: 6px 13px;
    border-radius: 7px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.sms-seg-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.sms-audience-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.sms-audience-btn {
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}

.sms-audience-btn.active {
    background: var(--brand-teal);
    border-color: var(--brand-teal);
    color: #ffffff;
}

.sms-recipient-list {
    max-height: 290px;
    overflow-y: auto;
    border-top: 1px solid #f1f5f9;
    margin-top: 10px;
}

.sms-recipient-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 6px;
    border-bottom: 1px solid #f8fafc;
    gap: 10px;
    cursor: pointer;
}

.sms-recipient-item:hover {
    background: #f8fafc;
}

.sms-var-box {
    border: 1px solid #eef2f6;
    border-radius: 10px;
    padding: 14px;
    background: #ffffff;
    margin-top: 12px;
}

.sms-var-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.sms-var-pill {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    border: none;
    background: #f1f5f9;
    color: #334155;
    cursor: pointer;
    transition: var(--transition);
}

.sms-var-pill:hover {
    background: #e2e8f0;
}

.sms-var-pill.pill-amber {
    background: #fef3c7;
    color: #b45309;
}

.sms-preview-box {
    border: 1px solid #eef2f6;
    border-radius: 12px;
    padding: 18px;
    background: #fafbfc;
}

.sms-preview-bubble {
    background: var(--brand-teal-dark);
    color: #ffffff;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    margin: 12px 0;
    min-height: 54px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
}

.db-status-box {
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.db-status-title {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
}

.db-status-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.db-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

/* ============================================================================
   Main Workspace & Uploaded Top Header Bar (Matching Image 2)
   ============================================================================ */
.main-workspace {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

body.sidebar-collapsed .main-workspace {
    margin-left: 64px;
}

.app-topbar {
    background: #ffffff;
    border-bottom: 1px solid #e8ecf2;
    height: 50px;
    padding: 0 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 45;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-toggle-btn:hover {
    background: #f8fafc;
    color: #0f172a;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.header-search-wrap {
    position: relative;
    width: 290px;
}

.header-search-wrap svg {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: #94a3b8;
}

.header-search-input {
    width: 100%;
    height: 32px;
    padding: 0 12px 0 34px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-family: inherit;
    font-size: 12px;
    color: #0f172a;
    outline: none;
    transition: var(--transition);
}

.header-search-input::placeholder {
    color: #94a3b8;
}

.header-search-input:focus {
    background: #ffffff;
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 3px rgba(0, 82, 72, 0.08);
}

.header-icon-btn {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.header-icon-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.header-icon-btn svg {
    width: 18px;
    height: 18px;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: #ffffff;
    font-size: 9.5px;
    font-weight: 700;
    min-width: 15px;
    height: 15px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.header-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 4px 8px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: var(--transition);
}

.header-user-pill:hover {
    background: #f1f5f9;
}

.header-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--brand-teal);
    color: #ffffff;
    font-weight: 700;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.header-user-chevron {
    width: 14px;
    height: 14px;
    color: #94a3b8;
}

/* ============================================================================
   Workspace Container & Page Title Header
   ============================================================================ */
.workspace-body {
    padding: 18px 22px 34px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.page-breadcrumb {
    font-size: 11.5px;
    color: #94a3b8;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-title-group h1 {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-heading);
    line-height: 1.2;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 11.8px;
    margin-top: 2px;
}

.quick-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-action-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 9px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-heading);
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    cursor: pointer;
    transition: var(--transition);
}

.quick-action-pill svg {
    width: 14px;
    height: 14px;
    color: var(--brand-teal);
}

.quick-action-pill:hover {
    border-color: var(--brand-teal);
    background: var(--brand-teal-light);
}

/* ============================================================================
   ERP Table Card, Filter Bar, Dark Header Table & 3-Dots Dropdown Menu
   (Matching Uploaded Images 3 & 4)
   ============================================================================ */
.glass-card,
.glass-panel,
.erp-table-card {
    background: #ffffff;
    border: 1px solid #e8ecf2;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 16px 18px;
}

.erp-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.erp-card-title {
    font-size: 16.5px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.erp-card-subtitle {
    font-size: 11.5px;
    color: #94a3b8;
    margin-top: 2px;
}

.erp-filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr;
    gap: 12px;
    margin-bottom: 14px;
}

.erp-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.erp-filter-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
}

.erp-table-wrap {
    width: 100%;
    overflow-x: visible;
}

.glass-table,
.erp-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.glass-table thead tr,
.erp-table thead tr {
    background: var(--table-head-bg);
    color: #ffffff;
}

.glass-table th,
.erp-table th {
    padding: 9px 11px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #ffffff;
    background: var(--table-head-bg);
    border: none;
    white-space: nowrap;
}

.glass-table th:first-child,
.erp-table th:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.glass-table th:last-child,
.erp-table th:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    text-align: right;
}

.glass-table td,
.erp-table td {
    padding: 9px 11px;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 12px;
}

.glass-table tbody tr:hover,
.erp-table tbody tr:hover {
    background: #f8fafc;
}

.row-check-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 12.5px;
}

.row-checkbox {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    accent-color: var(--brand-teal);
    cursor: pointer;
}

.entity-cell {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.entity-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e2f1ef;
    color: var(--brand-teal);
    font-weight: 700;
    font-size: 11.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cell-primary {
    color: #0f172a !important;
    font-weight: 600;
}

.cell-sub {
    font-size: 11.5px;
    color: #94a3b8;
    margin-top: 1px;
}

.amount-col {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: #0f172a;
}

/* 3 Vertical Dots Action Menu (Matching Image 4) */
.dots-menu-wrap {
    position: relative;
    display: inline-flex;
    justify-content: flex-end;
}

.dots-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.dots-btn:hover,
.dots-menu-wrap.open .dots-btn {
    background: #f1f5f9;
    color: #0f172a;
}

.dots-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 205px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
    padding: 6px;
    z-index: 120;
    display: none;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

.dots-menu-wrap.open .dots-dropdown {
    display: flex;
    animation: fadeMenu 0.15s ease-out;
}

@keyframes fadeMenu {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.dots-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 11px;
    border-radius: 8px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}

.dots-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.dots-item:hover {
    background: #f8fafc;
}

.dots-item.item-emerald { color: #059669; }
.dots-item.item-emerald svg { color: #10b981; }
.dots-item.item-amber { color: #d97706; }
.dots-item.item-amber svg { color: #f59e0b; }
.dots-item.item-purple { color: #7c3aed; }
.dots-item.item-purple svg { color: #8b5cf6; }
.dots-item.item-rose { color: #e11d48; }
.dots-item.item-rose svg { color: #f43f5e; }

.dots-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 3px 0;
}

/* ============================================================================
   Table Bottom Pagination & "Show X entries" Footer (Matching Uploaded Format)
   ============================================================================ */
.erp-table-footer {
    padding-top: 16px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.erp-footer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.erp-entries-info {
    font-size: 12.5px;
    color: #94a3b8;
    font-weight: 500;
}

.erp-pagination {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.erp-page-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 7px;
    border: 1px solid #eef2f6;
    background: #ffffff;
    color: #64748b;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.erp-page-btn:hover:not(:disabled):not(.active) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.erp-page-btn.active {
    background: var(--brand-teal);
    border-color: var(--brand-teal);
    color: #ffffff;
}

.erp-page-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.erp-footer-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #94a3b8;
}

.erp-length-select {
    padding: 5px 26px 5px 10px;
    border-radius: 7px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #334155;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.erp-length-select:focus {
    border-color: var(--brand-teal);
}

/* ============================================================================
   Multi-Section Form Layout (Matching Image 1: "New Admission" Form Format)
   ============================================================================ */
.form-section-block {
    margin-bottom: 24px;
}

.form-section-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
    padding-bottom: 10px;
    margin-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}

.form-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.span-2 {
    grid-column: span 2;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
}

.form-control {
    width: 100%;
    padding: 7px 10px;
    border-radius: 7px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    font-family: inherit;
    font-size: 12px;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 3px rgba(0, 82, 72, 0.08);
}

.form-control[readonly],
.form-control.auto-assigned {
    background: #f8fafc;
    color: #94a3b8;
    font-style: italic;
}

/* ============================================================================
   Client Profile View (Matching Images 5 & 6)
   ============================================================================ */
.profile-shell {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e8ecf2;
    box-shadow: var(--card-shadow);
    overflow: visible;
}

.profile-banner {
    height: 118px;
    background: linear-gradient(95deg, #062e29 0%, #005248 58%, #f7941d 100%);
    border-radius: 16px 16px 0 0;
    position: relative;
    z-index: 30;
    padding: 18px 24px;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

.profile-banner .dots-dropdown {
    padding: 4px 6px;
    gap: 0;
}

.profile-banner .dots-dropdown .dots-item,
.profile-banner .dots-dropdown form {
    border-bottom: 1px solid #f1f5f9;
}

.profile-banner .dots-dropdown form .dots-item {
    border-bottom: none;
}

.profile-banner .dots-dropdown form:last-child,
.profile-banner .dots-dropdown > .dots-item:last-child {
    border-bottom: none;
}

.profile-banner-dots {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #ffffff;
    border: none;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.profile-body {
    padding: 0 28px 28px;
    position: relative;
}

.profile-avatar-frame {
    width: 96px;
    height: 96px;
    border-radius: 18px;
    background: #ffffff;
    padding: 5px;
    margin-top: -52px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.10);
    position: relative;
    z-index: 35;
}

.profile-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand-teal-dark), var(--brand-teal-mid));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
}

.profile-identity {
    margin-top: 14px;
    margin-bottom: 20px;
}

.profile-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-name {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.profile-submeta {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

.profile-mini-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.profile-mini-card {
    border: 1px solid #eef2f6;
    border-radius: 12px;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
}

.mini-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mini-card-icon svg {
    width: 18px;
    height: 18px;
}

.mini-card-label {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

.mini-card-val {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
}

/* Profile Horizontal Tabs */
.profile-tabs {
    display: flex;
    align-items: center;
    gap: 24px;
    border-bottom: 1px solid #eef2f6;
    margin-bottom: 22px;
    overflow-x: auto;
}

.profile-tab-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 4px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.profile-tab-link svg {
    width: 15px;
    height: 15px;
}

.profile-tab-link:hover {
    color: #0f172a;
}

.profile-tab-link.active {
    color: #0f172a;
    border-bottom-color: #0f172a;
}

/* Profile Personal/Company 2-Column Metadata Grid (Image 5) */
.profile-info-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
}

.profile-col-header {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-info-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f8fafc;
    gap: 12px;
}

.info-row-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-row-icon svg {
    width: 14px;
    height: 14px;
}

.info-row-label {
    width: 130px;
    font-size: 12.5px;
    color: #94a3b8;
    flex-shrink: 0;
}

.info-row-value {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

/* Profile Finance Tab 4 Colored Left-Border Cards (Image 6) */
.finance-strip-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.finance-strip-card {
    border-radius: 11px;
    padding: 14px 18px;
    display: flex;
    align-items: flex-start;
    gap: 11px;
}

.finance-strip-card.card-regular {
    background: #f8fafc;
    border-left: 4px solid #94a3b8;
}

.finance-strip-card.card-discount {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
}

.finance-strip-card.card-paid {
    background: #ecfdf5;
    border-left: 4px solid #10b981;
}

.finance-strip-card.card-outstanding {
    background: #fef2f2;
    border-left: 4px solid #ef4444;
}

.rv-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
}

.rv-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* ============================================================================
   Dashboard 2x5 KPI Grid & Charts
   ============================================================================ */
.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.stat-tile {
    background: #ffffff;
    border: 1px solid #e8ecf2;
    border-radius: 13px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.stat-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(0, 82, 72, 0.22);
}

.stat-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-box svg {
    width: 18px;
    height: 18px;
}

.stat-icon-teal { background: var(--brand-teal); color: #ffffff; }
.stat-icon-orange { background: #fff1db; color: #f7941d; }
.stat-icon-mint { background: #e1f6ec; color: #10b981; }
.stat-icon-amber { background: #fef3d6; color: #d97706; }
.stat-icon-rose { background: #fde8e8; color: #e11d48; }

.stat-content { min-width: 0; }
.stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-number {
    font-size: 18.5px;
    font-weight: 800;
    color: var(--text-heading);
    line-height: 1.2;
    margin-top: 2px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.kpi-card {
    padding: 15px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}

.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.kpi-value { font-size: 21px; font-weight: 800; color: var(--text-heading); line-height: 1.15; }
.kpi-foot { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-asymmetric { display: grid; grid-template-columns: 1.75fr 1fr; gap: 20px; }
.grid-bottom-dash { display: grid; grid-template-columns: 1fr 1.55fr; gap: 20px; }

.completion-list { display: flex; flex-direction: column; gap: 18px; }
.completion-item { display: flex; flex-direction: column; gap: 8px; }
.completion-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.completion-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.initials-badge {
    width: 30px; height: 30px; border-radius: 50%;
    background: #dcece9; color: var(--brand-teal);
    font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.completion-name { font-size: 13.5px; font-weight: 600; color: var(--text-heading); }
.completion-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.progress-track { width: 100%; height: 7px; border-radius: 999px; background: #ece9e2; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--brand-teal); }

.legend-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 16px; margin-top: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); font-weight: 500; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }

.section-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.section-title { font-size: 15.5px; font-weight: 700; color: var(--text-heading); }
.table-responsive { width: 100%; overflow-x: visible; }

/* ============================================================================
   Status Badges & Buttons
   ============================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.badge-emerald { background: #dcfce7; color: #15803d; }
.badge-cyan { background: #e0f2fe; color: #0369a1; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-rose { background: #ffe4e6; color: #be123c; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-slate { background: #f1f5f9; color: #475569; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6.5px 12px;
    border-radius: 7px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.btn svg { width: 14px; height: 14px; }

.btn-primary {
    background: var(--brand-teal);
    border-color: var(--brand-teal);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 82, 72, 0.18);
}
.btn-primary:hover {
    background: var(--brand-teal-dark);
    border-color: var(--brand-teal-dark);
    transform: translateY(-1px);
}

.btn-cyan {
    background: var(--brand-orange);
    border-color: var(--brand-orange);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(247, 148, 29, 0.22);
}
.btn-cyan:hover {
    background: var(--brand-orange-hover);
    border-color: var(--brand-orange-hover);
    transform: translateY(-1px);
}

.btn-emerald {
    background: #10b981;
    color: #ffffff;
}

.btn-glass {
    background: #ffffff;
    border-color: #d5e3e0;
    color: var(--brand-teal);
}
.btn-glass:hover {
    background: var(--brand-teal-light);
    border-color: var(--brand-teal);
    color: var(--brand-teal-dark);
}

.btn-danger {
    background: #ffe4e6;
    border-color: #fecdd3;
    color: #e11d48;
}

.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.action-group { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ============================================================================
   Modals, Line Items & Print Sheets
   ============================================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(3px);
    z-index: 150;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-backdrop.open { display: flex; }

.glass-modal {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    width: 100%;
    max-width: 780px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 26px 30px;
    position: relative;
}

.glass-modal.modal-lg { max-width: 960px; }
.glass-modal.modal-dialog-sm {
    max-width: 420px;
    padding: 24px 26px;
    animation: dialogPopIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dialogPopIn {
    from { opacity: 0; transform: scale(0.95) translateY(6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.dialog-header-wrap {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.dialog-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dialog-icon-wrap.is-danger {
    background: #fee2e2;
    color: #dc2626;
}
.dialog-icon-wrap.is-primary {
    background: #ccfbf1;
    color: var(--brand-teal);
}
.dialog-title {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}
.dialog-message {
    font-size: 13px;
    line-height: 1.5;
    color: #475569;
}
html[data-theme="dark"] .dialog-title { color: #f8fafc; }
html[data-theme="dark"] .dialog-message { color: #94a3b8; }
html[data-theme="dark"] .dialog-icon-wrap.is-danger { background: rgba(220, 38, 38, 0.18); color: #f87171; }
html[data-theme="dark"] .dialog-icon-wrap.is-primary { background: rgba(20, 184, 166, 0.18); color: #2dd4bf; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
}

.modal-title { font-size: 18px; font-weight: 800; color: #0f172a; }

.modal-close {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.flash-banner {
    padding: 12px 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-weight: 600;
    font-size: 13px;
    opacity: 1;
    transform: translateY(0);
    max-height: 120px;
    overflow: hidden;
    transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                padding 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                margin 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                border-width 0.45s ease;
    animation: flashSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes flashSlideIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flash-banner.fade-out {
    opacity: 0;
    transform: translateY(-8px);
    max-height: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    border-width: 0 !important;
    pointer-events: none;
}
.flash-success { background: #dcfce7; border: 1px solid #bbf7d0; color: #166534; }
.flash-danger { background: #ffe4e6; border: 1px solid #fecdd3; color: #9f1239; }
.flash-info { background: #e0f2fe; border: 1px solid #bae6fd; color: #075985; }

.line-items-wrapper {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    background: #f8fafc;
    margin-top: 8px;
}

.line-item-row {
    display: grid;
    grid-template-columns: 2.6fr 0.8fr 1fr 1fr 42px;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.line-item-header {
    display: grid;
    grid-template-columns: 2.6fr 0.8fr 1fr 1fr 42px;
    gap: 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    font-weight: 700;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.totals-box {
    margin-top: 16px;
    margin-left: auto;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.totals-row { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; }
.totals-row.grand { font-size: 16px; font-weight: 800; color: #0f172a; padding-top: 8px; border-top: 1px solid #e2e8f0; }

.print-sheet { padding: 36px; }
.doc-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 24px; padding-bottom: 22px; border-bottom: 1px solid #e2e8f0; margin-bottom: 24px;
}
.doc-badge-title { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; color: var(--brand-teal); }
.doc-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-bottom: 24px; }

/* ============================================================================
   Login Page
   ============================================================================ */
.login-page-body {
    min-height: 100vh;
    background: radial-gradient(circle at 50% 35%, #ffffff 0%, #f1f5f9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-split-card {
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 22px 60px rgba(6, 33, 46, 0.14), 0 4px 16px rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.login-banner {
    background: linear-gradient(135deg, #0a3144 0%, #06212E 100%);
    border-bottom: 3px solid #EDAA00;
    padding: 28px 30px 24px;
    position: relative;
    overflow: hidden;
    color: #ffffff;
}

.login-banner-watermark {
    position: absolute;
    right: -18px;
    top: -12px;
    width: 145px;
    height: 145px;
    opacity: 0.08;
    pointer-events: none;
    object-fit: contain;
}

.login-brand-row { display: flex; align-items: center; gap: 10px; position: relative; z-index: 2; margin-bottom: 22px; }
.login-brand-logo { height: 34px; width: auto; max-width: 100%; object-fit: contain; display: block; }
.login-brand-icon { width: 30px; height: 30px; object-fit: contain; }
.login-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.login-brand-name { font-size: 18px; font-weight: 800; color: #ffffff; letter-spacing: -0.02em; }
.login-brand-sub { font-size: 11px; font-weight: 600; color: #EDAA00; }
.login-banner-tagline { position: relative; z-index: 2; font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: #ADE5CD; }

.login-form-area { padding: 28px 30px 32px; }
.login-heading { font-size: 22px; font-weight: 800; color: #0f172a; margin-bottom: 4px; }
.login-subheading { font-size: 12.5px; color: #94a3b8; margin-bottom: 22px; }
.login-field { margin-bottom: 16px; }
.login-label { display: block; font-size: 11.5px; font-weight: 700; color: #1e293b; margin-bottom: 6px; }
.login-input-wrap { position: relative; }
.login-input-wrap > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #94a3b8; pointer-events: none; }
.login-input {
    width: 100%; padding: 10px 14px 10px 38px; border-radius: 9px;
    border: 1px solid #e2e8f0; background: #ffffff; color: #0f172a;
    font-family: inherit; font-size: 13px; outline: none; transition: var(--transition);
}
.login-input-has-toggle { padding-right: 38px; }
.login-pwd-toggle {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; border: none; background: transparent;
    color: #94a3b8; border-radius: 6px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.login-pwd-toggle:hover { color: #06212E; background: #f1f5f9; }
.login-pwd-toggle svg { width: 15px; height: 15px; }
.login-input:focus { border-color: #06212E; box-shadow: 0 0 0 3px rgba(6, 33, 46, 0.12); }
.login-submit-btn {
    width: 100%; margin-top: 6px; padding: 11px 16px; border-radius: 9px; border: none;
    background: linear-gradient(135deg, #06212E 0%, #0d3b52 100%);
    color: #ffffff; font-family: inherit; font-size: 13.5px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    cursor: pointer; box-shadow: 0 6px 18px rgba(6, 33, 46, 0.25); transition: var(--transition);
}
.login-submit-btn:hover { background: linear-gradient(135deg, #041720 0%, #06212E 100%); transform: translateY(-1px); }
.login-submit-btn svg { width: 16px; height: 16px; }

/* ============================================================================
   System Settings Module (Matching Uploaded Settings Screenshots 1, 2, 3 & 4)
   ============================================================================ */
.settings-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    background: #ffffff;
    border: 1px solid #e8ecf2;
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    min-height: calc(100vh - 108px);
    overflow: hidden;
}

.settings-nav-pane {
    background: #fafbfc;
    border-right: 1px solid #eef2f6;
    padding: 18px 12px;
}

.settings-nav-header {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #94a3b8;
    padding: 4px 12px 12px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 10px;
}

.settings-nav-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    transition: var(--transition);
}

.settings-nav-item svg {
    width: 15px;
    height: 15px;
    color: #64748b;
    flex-shrink: 0;
}

.settings-nav-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.settings-nav-item.active {
    background: #475569;
    color: #ffffff;
}

.settings-nav-item.active svg {
    color: #ffffff;
}

.settings-content-pane {
    padding: 24px 32px 36px;
    max-width: 680px;
}

.settings-top-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.settings-pane-title {
    font-size: 15.5px;
    font-weight: 800;
    color: #0f172a;
}

.settings-pane-subtitle {
    font-size: 11.5px;
    color: #94a3b8;
    margin-top: 2px;
}

.settings-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: none;
    background: var(--brand-teal);
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.settings-save-btn:hover {
    background: var(--brand-teal-dark);
}

.settings-save-btn svg {
    width: 13px;
    height: 13px;
}

.settings-block-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02);
}

.settings-block-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.settings-icon-badge {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: #f1f5f9;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-icon-badge svg {
    width: 14px;
    height: 14px;
}

.settings-block-title {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.settings-block-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 1px;
}

.settings-small-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 6px;
}

.settings-images-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.settings-upload-box {
    height: 105px;
    border: 1.5px dashed #cbd5e1;
    border-radius: 10px;
    background: #fafbfc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: var(--transition);
}

.settings-upload-box:hover {
    border-color: var(--brand-teal);
    background: #f8fafc;
}

.settings-upload-preview {
    max-width: 100%;
    max-height: 85px;
    object-fit: contain;
}

.settings-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 10px;
    line-height: 1.35;
}

.settings-upload-placeholder svg {
    width: 18px;
    height: 18px;
}

.settings-banner-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.settings-banner-preview img {
    max-height: 62px;
    object-fit: contain;
    margin-top: 4px;
}

.settings-banner-strip {
    width: 100%;
    background: #0f172a;
    color: #ffffff;
    font-size: 9px;
    padding: 3px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-helper-note {
    font-size: 10.5px;
    color: #94a3b8;
    margin-top: 12px;
}

.settings-form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.settings-icon-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
}

.settings-icon-label svg {
    width: 12px;
    height: 12px;
    color: #64748b;
}

/* Branding Color Swatches & Pickers */
.settings-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.settings-color-box {
    width: 34px;
    height: 32px;
    border-radius: 7px;
    border: 1px solid #e2e8f0;
    padding: 4px;
    background: #ffffff;
    cursor: pointer;
    display: inline-flex;
    position: relative;
}

.settings-color-box input[type="color"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.settings-color-box span {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    display: block;
}

.settings-hex-input {
    width: 108px !important;
    font-family: 'Space Grotesk', monospace;
    font-weight: 600;
    text-transform: uppercase;
}

.settings-swatch-list {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.settings-swatch.swatch-lg {
    width: 30px;
    height: 30px;
}

.settings-swatch:hover {
    transform: scale(1.08);
}

.settings-swatch.active {
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #475569;
}

.settings-reset-link {
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 11px;
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
}

.settings-reset-link:hover {
    color: #0f172a;
}

.settings-text-Sample-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.settings-sample-box {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #fafbfc;
    color: #0f172a;
    white-space: nowrap;
}

/* ID Configuration Preview Banner & Rows (Matching Image 4) */
.settings-id-preview-banner {
    background: linear-gradient(135deg, #3b4c63 0%, #475569 100%);
    color: #ffffff;
    border-radius: 11px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.settings-id-preview-tag {
    font-size: 10.5px;
    opacity: 0.8;
    margin-bottom: 3px;
}

.settings-id-preview-code {
    font-size: 23px;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.settings-rows-card {
    padding: 6px 18px;
}

.settings-row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.settings-row-title {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
}

.settings-row-sub {
    font-size: 10.5px;
    color: #94a3b8;
    margin-top: 1px;
}

.settings-row-control {
    width: 110px !important;
}

.settings-amber-notice {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #b45309;
    border-radius: 9px;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

/* iOS-style Toggle Switch */
.settings-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 21px;
    flex-shrink: 0;
}

.settings-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.settings-switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    border-radius: 999px;
    transition: 0.22s;
}

.settings-switch-slider::before {
    position: absolute;
    content: "";
    height: 15px;
    width: 15px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: 0.22s;
}

.settings-switch input:checked + .settings-switch-slider {
    background-color: #475569;
}

.settings-switch input:checked + .settings-switch-slider::before {
    transform: translateX(17px);
}

/* ============================================================================
   Interactive Dashboard Charts: Entrance Animations & Floating Hover Tooltips
   (Matching Uploaded Chart Tooltip Screenshots 1, 2, 3 & 4)
   ============================================================================ */
.chart-top-accent {
    width: 38px;
    height: 3.5px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.chart-line-anim {
    stroke-dasharray: 820;
    stroke-dashoffset: 820;
    animation: chartDrawLine 1.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes chartDrawLine {
    to { stroke-dashoffset: 0; }
}

.chart-area-anim {
    opacity: 0;
    animation: chartFadeArea 0.9s ease 0.25s forwards;
}

@keyframes chartFadeArea {
    to { opacity: 1; }
}

.chart-dot-node {
    transform-box: fill-box;
    transform-origin: center;
    opacity: 0;
    transform: scale(0);
    transition: r 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), stroke-width 0.18s ease;
    animation: chartPopDot 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes chartPopDot {
    to { opacity: 1; transform: scale(1); }
}

.chart-point-group.hovered .chart-dot-node {
    r: 6.5px;
    stroke-width: 2.5px;
}

.donut-seg-anim {
    cursor: pointer;
    transform-origin: 90px 90px;
    transition: stroke-width 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
    animation: chartDonutSweep 0.95s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes chartDonutSweep {
    from { stroke-dasharray: 0 377; opacity: 0.2; }
}

.donut-seg-anim.hovered {
    stroke-width: 30px;
}

.chart-bar-anim {
    transform-box: fill-box;
    transform-origin: bottom;
    transition: opacity 0.2s ease, filter 0.2s ease;
    animation: chartGrowBar 0.75s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes chartGrowBar {
    from { transform: scaleY(0); opacity: 0; }
    to { transform: scaleY(1); opacity: 1; }
}

.bar-hover-band {
    transition: opacity 0.18s ease;
}

.bar-col-group.hovered .bar-hover-band {
    opacity: 0.65;
}

.bar-col-group.hovered .chart-bar-anim {
    filter: brightness(1.12);
}

.progress-fill {
    animation: chartGrowProgress 0.85s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes chartGrowProgress {
    from { width: 0 !important; }
}

/* Floating White Tooltip Box (Matching Uploaded Screenshots) */
.chart-floating-tooltip {
    position: absolute;
    z-index: 35;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.05);
    padding: 10px 14px;
    min-width: 145px;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -100%) translateY(6px) scale(0.96);
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                left 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                top 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-floating-tooltip.visible {
    opacity: 1;
    transform: translate(-50%, -100%) translateY(-10px) scale(1);
}

.chart-tt-title {
    font-size: 12px;
    font-weight: 800;
    color: #1e293b;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid #f1f5f9;
}

.chart-tt-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 0;
    white-space: nowrap;
}

.chart-tt-left {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.chart-tt-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chart-tt-val {
    font-weight: 800;
}

/* ============================================================================
   Dashboard Card Click Popup Sheet Table (Matching Uploaded Screenshot)
   ============================================================================ */
.dash-popup-modal {
    max-width: 920px;
    padding: 20px 26px 22px;
    animation: modalPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dash-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

.dash-sheet-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.dash-sheet-table thead tr {
    background: transparent;
    border-bottom: 2px solid #005248;
}

.dash-sheet-table th {
    padding: 8px 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    background: transparent;
    white-space: nowrap;
}

.dash-sheet-table td {
    padding: 7.5px 10px;
    font-size: 11.8px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.dash-sheet-table tbody tr:hover {
    background: #f8fafc;
}

.sheet-col-num {
    color: #64748b;
    width: 42px;
}

.sheet-col-id {
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
}

.sheet-col-name {
    font-weight: 700;
    color: #0f172a;
}

.sheet-col-meta {
    font-weight: 600;
    color: #1e293b;
}

.sheet-col-shift {
    color: #64748b;
}

.sheet-col-fee {
    font-weight: 700;
    color: #0f172a;
    text-align: right;
    white-space: nowrap;
}

.sheet-col-phone {
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}

.dash-sheet-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    margin-top: 6px;
    font-size: 11px;
    color: #64748b;
}

.dash-sheet-entries-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dash-sheet-page-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
}

/* ============================================================================
   Dark / Light Mode Toggle Icon & Complete Dark Theme Overrides
   ============================================================================ */
.theme-icon-sun {
    display: none;
}

html[data-theme="dark"] .theme-icon-moon {
    display: none;
}

html[data-theme="dark"] .theme-icon-sun {
    display: block;
    color: #fbbf24;
}

html[data-theme="dark"] {
    --bg-canvas: #0b1120;
    --bg-card: #111827;
    --bg-subtle: #1e293b;
    --border-color: #1f2937;
    --border-strong: #334155;
    --text-heading: #f8fafc;
    --text-body: #cbd5e1;
    --text-muted: #94a3b8;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] .app-layout {
    background-color: var(--bg-canvas);
    color: var(--text-body);
}

html[data-theme="dark"] .app-topbar {
    background: #111827;
    border-bottom-color: #1f2937;
}

html[data-theme="dark"] .sidebar-toggle-btn,
html[data-theme="dark"] .header-search-input {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

html[data-theme="dark"] .header-icon-btn {
    color: #cbd5e1;
}

html[data-theme="dark"] .header-icon-btn:hover,
html[data-theme="dark"] .header-user-pill:hover {
    background: #1e293b;
    color: #ffffff;
}

html[data-theme="dark"] .header-user-name {
    color: #f1f5f9;
}

html[data-theme="dark"] .glass-card,
html[data-theme="dark"] .glass-panel,
html[data-theme="dark"] .erp-table-card,
html[data-theme="dark"] .stat-tile,
html[data-theme="dark"] .profile-shell,
html[data-theme="dark"] .profile-mini-card,
html[data-theme="dark"] .settings-shell,
html[data-theme="dark"] .settings-block-card,
html[data-theme="dark"] .glass-modal {
    background: #111827;
    border-color: #1f2937;
    color: #cbd5e1;
}

html[data-theme="dark"] .settings-nav-pane {
    background: #0f172a;
    border-right-color: #1f2937;
}

html[data-theme="dark"] .settings-nav-header {
    border-bottom-color: #1f2937;
}

html[data-theme="dark"] .settings-nav-item {
    color: #cbd5e1;
}

html[data-theme="dark"] .settings-nav-item:hover {
    background: #1e293b;
    color: #ffffff;
}

html[data-theme="dark"] .erp-card-title,
html[data-theme="dark"] .page-title-group h1,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .stat-number,
html[data-theme="dark"] .kpi-value,
html[data-theme="dark"] .modal-title,
html[data-theme="dark"] .profile-name,
html[data-theme="dark"] .mini-card-val,
html[data-theme="dark"] .info-row-value,
html[data-theme="dark"] .settings-pane-title,
html[data-theme="dark"] .settings-block-title,
html[data-theme="dark"] .settings-row-title,
html[data-theme="dark"] .form-section-title,
html[data-theme="dark"] .cell-primary,
html[data-theme="dark"] .amount-col,
html[data-theme="dark"] .sheet-col-id,
html[data-theme="dark"] .sheet-col-name,
html[data-theme="dark"] .sheet-col-meta,
html[data-theme="dark"] .sheet-col-fee,
html[data-theme="dark"] .sheet-col-phone {
    color: #f8fafc !important;
}

html[data-theme="dark"] .glass-table td,
html[data-theme="dark"] .erp-table td,
html[data-theme="dark"] .dash-sheet-table td {
    color: #cbd5e1;
    border-bottom-color: #1f2937;
}

html[data-theme="dark"] .glass-table tbody tr:hover,
html[data-theme="dark"] .erp-table tbody tr:hover,
html[data-theme="dark"] .dash-sheet-table tbody tr:hover {
    background: #1e293b;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .erp-length-select,
html[data-theme="dark"] .settings-sample-box,
html[data-theme="dark"] .settings-color-box {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

html[data-theme="dark"] .settings-upload-box {
    background: #0f172a;
    border-color: #334155;
}

html[data-theme="dark"] .quick-action-pill,
html[data-theme="dark"] .btn-glass,
html[data-theme="dark"] .rv-btn,
html[data-theme="dark"] .erp-page-btn:not(.active),
html[data-theme="dark"] .modal-close {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

html[data-theme="dark"] .quick-action-pill:hover,
html[data-theme="dark"] .btn-glass:hover,
html[data-theme="dark"] .rv-btn:hover,
html[data-theme="dark"] .erp-page-btn:hover:not(:disabled):not(.active) {
    background: #334155;
    color: #ffffff;
}

html[data-theme="dark"] .dots-dropdown {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .dots-item {
    color: #e2e8f0;
}

html[data-theme="dark"] .dots-item:hover {
    background: #334155;
}

html[data-theme="dark"] .dots-divider,
html[data-theme="dark"] .profile-info-row,
html[data-theme="dark"] .settings-row-item,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .dash-popup-header,
html[data-theme="dark"] .form-section-title,
html[data-theme="dark"] .profile-tabs {
    border-color: #1f2937;
}

html[data-theme="dark"] .line-items-wrapper,
html[data-theme="dark"] .totals-box,
html[data-theme="dark"] .sms-preview-box,
html[data-theme="dark"] .sms-var-box {
    background: #0f172a;
    border-color: #1f2937;
}

html[data-theme="dark"] .chart-floating-tooltip {
    background: rgba(17, 24, 39, 0.98);
    border-color: #334155;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .chart-tt-title {
    color: #f8fafc;
    border-bottom-color: #1f2937;
}

@media (max-width: 1200px) {
    .dashboard-kpi-grid, .form-grid-4, .profile-mini-cards, .finance-strip-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .grid-asymmetric, .grid-bottom-dash, .grid-2, .grid-3, .erp-filter-grid, .profile-info-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .app-layout { flex-direction: column; }
    .glass-sidebar { width: 100%; height: auto; position: static; transform: none !important; }
    .main-workspace { margin-left: 0 !important; }
    .workspace-body { padding: 18px; }
}

/* ============================================================================
   Official Print Letterhead & Report Sheet Table Format
   (Matching Uploaded Letterhead Banner + Report Name + Print Date)
   ============================================================================ */
.print-letterhead,
.print-page-number {
    display: none;
}

.print-lh-preview-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 20px;
}

.print-lh-preview-box .print-letterhead {
    display: block !important;
    margin-bottom: 0;
    padding-bottom: 0;
}

.print-letterhead.print-letterhead-inline {
    display: block;
    margin-bottom: 18px;
}

.print-lh-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.print-lh-brand {
    display: flex;
    align-items: center;
}

.print-lh-logo {
    height: 54px;
    width: auto;
    object-fit: contain;
}

.print-lh-custom-wrap {
    width: 100%;
    padding: 0;
    margin: 0;
}

.print-lh-custom-banner {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0;
}

.print-lh-contact-block {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
    font-size: 10.5px;
    color: #005248;
    font-weight: 600;
}

.print-lh-contact-title {
    font-size: 11.5px;
    font-weight: 800;
    color: #f7941d;
    margin-bottom: 2px;
}

.print-lh-contact-row {
    display: flex;
    align-items: center;
    gap: 7px;
    line-height: 1.3;
}

.print-lh-icon-badge {
    width: 15px;
    height: 15px;
    border-radius: 3px;
    background: #f7941d;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.print-lh-icon-badge svg {
    width: 9.5px;
    height: 9.5px;
}

.print-lh-divider {
    height: 1px;
    background: #cbd5e1;
    margin: 12px 0 10px;
}

.print-lh-center-meta {
    text-align: center;
}

.print-lh-report-name {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.print-lh-date {
    font-size: 10.5px;
    color: #334155;
    font-weight: 600;
    margin-top: 2px;
}

@media print {
    @page {
        margin: 14mm 12mm;
    }

    html, body, .app-layout, .main-workspace, .workspace-body {
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
        background: #ffffff !important;
        color: #0f172a !important;
    }

    .glass-sidebar,
    .app-topbar,
    .no-print,
    .quick-actions-bar,
    .dots-menu-wrap,
    .erp-table-footer,
    .erp-filter-grid,
    .rv-btn,
    .row-checkbox {
        display: none !important;
    }

    /* Official Letterhead + Report Title + Print Date */
    .print-letterhead {
        display: block !important;
        margin-bottom: 14px;
    }

    .print-lh-contact-block,
    .print-lh-report-name,
    .print-lh-date {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-lh-icon-badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background: #f7941d !important;
        color: #ffffff !important;
    }

    /* Remove outer card borders/padding so table sits cleanly on the sheet */
    .erp-table-card,
    .glass-card,
    .profile-shell {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    .print-sheet {
        border: 1px solid #cbd5e1 !important;
        padding: 24px !important;
    }

    /* Redesign Printed Tables to Match Uploaded Sheet Screenshot */
    .erp-table,
    .glass-table,
    .report-print-table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .erp-table thead tr,
    .glass-table thead tr,
    .report-print-table thead tr {
        background: #f1f5f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border-top: 2px solid #005248 !important;
        border-bottom: 2px solid #005248 !important;
    }

    .erp-table th,
    .glass-table th,
    .report-print-table th {
        background: #f1f5f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        color: #334155 !important;
        font-size: 9.5px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em !important;
        padding: 7px 8px !important;
        border: none !important;
        border-top: 2px solid #005248 !important;
        border-bottom: 2px solid #005248 !important;
        border-radius: 0 !important;
    }

    /* Show all non-filtered rows when printing */
    .erp-table tbody tr:not([data-filtered-out="1"]),
    .glass-table tbody tr:not([data-filtered-out="1"]),
    .report-print-table tbody tr:not([data-filtered-out="1"]) {
        display: table-row !important;
    }

    .erp-table td,
    .glass-table td,
    .report-print-table td {
        padding: 7px 8px !important;
        font-size: 11px !important;
        color: #0f172a !important;
        border-bottom: 1px solid #e2e8f0 !important;
        background: transparent !important;
    }

    .sheet-col-num {
        color: #64748b !important;
    }

    .sheet-col-id,
    .sheet-col-name,
    .sheet-col-fee,
    .sheet-col-phone,
    .cell-primary,
    .amount-col {
        font-weight: 700 !important;
        color: #0f172a !important;
    }

    .badge {
        background: transparent !important;
        padding: 0 !important;
        color: #334155 !important;
        font-weight: 600 !important;
    }

    .badge::before {
        display: none !important;
    }

    .print-page-number {
        display: block !important;
        text-align: right;
        font-size: 10.5px;
        color: #64748b !important;
        margin-top: 18px;
        font-weight: 500;
    }
}

/* ============================================================================
   Reports Hide / Show Columns Dropdown
   ============================================================================ */
.col-hidden {
    display: none !important;
}

.col-picker-wrap {
    position: relative;
    display: inline-flex;
}

.col-picker-count {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--brand-orange-soft);
    color: var(--brand-orange-hover);
    font-size: 10px;
    font-weight: 700;
}

.col-picker-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 225px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
    padding: 8px;
    z-index: 120;
    display: none;
    flex-direction: column;
    gap: 4px;
}

.col-picker-wrap.open .col-picker-dropdown {
    display: flex;
    animation: fadeMenu 0.15s ease-out;
}

.col-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 8px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
}

.col-picker-reset {
    border: none;
    background: transparent;
    color: var(--brand-teal);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.col-picker-reset:hover {
    text-decoration: underline;
}

.col-picker-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 260px;
    overflow-y: auto;
    padding-top: 2px;
}

.col-picker-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 8px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: background 0.15s ease;
}

.col-picker-item:hover {
    background: #f8fafc;
}

.col-picker-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--brand-teal);
    cursor: pointer;
}

html[data-theme="dark"] .col-picker-dropdown {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .col-picker-head {
    border-bottom-color: #334155;
    color: #cbd5e1;
}

html[data-theme="dark"] .col-picker-item {
    color: #e2e8f0;
}

html[data-theme="dark"] .col-picker-item:hover {
    background: #334155;
}

/* ============================================================================
   AI Assistant Slide-Over Drawer
   ============================================================================ */
.ai-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.36);
    backdrop-filter: blur(2px);
    z-index: 220;
    display: none;
    justify-content: flex-end;
}
.ai-drawer-backdrop.open {
    display: flex;
}
.ai-drawer {
    width: 100%;
    max-width: 420px;
    height: 100%;
    background: #ffffff;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: aiDrawerSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes aiDrawerSlideIn {
    from { transform: translateX(30px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
.ai-drawer-header {
    position: relative;
    padding: 18px 20px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f6 100%);
    border-bottom: 1px solid #e2e8f0;
    overflow: hidden;
}
.ai-header-constellation {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    color: #94a3b8;
    opacity: 0.35;
    pointer-events: none;
}
.ai-header-top {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.ai-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #64748b;
}
.ai-close-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}
.ai-close-btn:hover { background: rgba(15, 23, 42, 0.06); color: #0f172a; }
.ai-brand-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.ai-sparkle-badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #1e293b;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}
.ai-sparkle-badge.sm {
    width: 30px;
    height: 30px;
    border-radius: 9px;
}
.ai-title { font-size: 16px; font-weight: 800; color: #0f172a; line-height: 1.2; }
.ai-subtitle { font-size: 12.5px; color: #64748b; margin-top: 2px; }
.ai-controls-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-history-wrap { position: relative; }
.ai-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.ai-pill-btn:hover { background: #cbd5e1; }
.ai-history-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    max-height: 240px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
    padding: 6px;
    z-index: 20;
    display: none;
}
.ai-history-menu.open { display: block; }
.ai-history-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    color: #334155;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ai-history-item:hover { background: #f1f5f9; color: var(--brand-teal); }

.ai-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.ai-welcome-text {
    font-size: 14px;
    line-height: 1.55;
    color: #475569;
}
.ai-preset-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ai-preset-btn {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #1e293b;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.ai-preset-btn:hover {
    border-color: var(--brand-teal);
    background: #f8fafc;
}
.ai-msg-user-row {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 10px;
}
.ai-msg-user-bubble {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    border-radius: 14px;
    padding: 11px 14px;
    font-size: 13.5px;
    color: #0f172a;
    line-height: 1.45;
    max-width: 82%;
}
.ai-user-avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0f172a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ai-msg-bot-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.ai-msg-bot-content {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: #1e293b;
}
.ai-msg-bot-content ol {
    margin: 10px 0 12px 18px;
    padding: 0;
}
.ai-msg-bot-content li {
    margin-bottom: 6px;
}
.ai-ref-block {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    font-size: 12px;
    color: #64748b;
}
.ai-go-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
}
.ai-go-link:hover { color: var(--brand-teal); text-decoration: underline; }

.ai-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 4px;
}
.ai-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: aiDotPulse 1.1s infinite ease-in-out;
}
.ai-typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes aiDotPulse {
    0%, 80%, 100% { opacity: 0.35; transform: scale(0.85); }
    40% { opacity: 1; transform: scale(1.1); }
}

.ai-drawer-footer {
    padding: 12px 16px 16px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}
.ai-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 6px 6px 6px 16px;
    background: #f8fafc;
}
.ai-input-wrap:focus-within {
    border-color: var(--brand-teal);
    background: #ffffff;
}
.ai-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    color: #0f172a;
}
.ai-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #cbd5e1;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.ai-send-btn.ready,
.ai-input-wrap:focus-within .ai-send-btn {
    background: var(--brand-teal);
}

/* Dark Mode for AI Drawer */
html[data-theme="dark"] .ai-drawer { background: #0f172a; color: #e2e8f0; }
html[data-theme="dark"] .ai-drawer-header { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); border-bottom-color: #334155; }
html[data-theme="dark"] .ai-title { color: #f8fafc; }
html[data-theme="dark"] .ai-subtitle, html[data-theme="dark"] .ai-eyebrow, html[data-theme="dark"] .ai-welcome-text { color: #94a3b8; }
html[data-theme="dark"] .ai-pill-btn { background: #334155; border-color: #475569; color: #f1f5f9; }
html[data-theme="dark"] .ai-history-menu { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .ai-history-item { color: #e2e8f0; }
html[data-theme="dark"] .ai-history-item:hover { background: #334155; }
html[data-theme="dark"] .ai-preset-btn,
html[data-theme="dark"] .ai-msg-user-bubble { background: #1e293b; border-color: #334155; color: #f1f5f9; }
html[data-theme="dark"] .ai-msg-bot-content { color: #e2e8f0; }
html[data-theme="dark"] .ai-ref-block { border-top-color: #334155; color: #94a3b8; }
html[data-theme="dark"] .ai-go-link { color: #f8fafc; }
html[data-theme="dark"] .ai-drawer-footer { background: #0f172a; border-top-color: #1e293b; }
html[data-theme="dark"] .ai-input-wrap { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .ai-input { color: #f8fafc; }
