/*! tailwindcss v3.4.0 | MIT License | https://tailwindcss.com */
*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}::after,::before{--tw-content:''}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}[dir="rtl"] body{font-family:'Cairo','Tajawal',Arial,sans-serif}[dir="ltr"] body{font-family:'Inter',system-ui,sans-serif}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}::-webkit-search-decoration{-webkit-appearance:none}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*,::after,::before{--tw-border-spacing:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.mt-1{margin-top:.25rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.w-full{width:100%}.max-w-2xl{max-width:42rem}.flex-wrap{flex-wrap:wrap}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}@media (min-width:768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:1024px){.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-t-2{border-top-width:2px}.border-gray-300{border-color:#d1d5db}.border-red-400{border-color:#f87171}.border-red-500{border-color:#ef4444}.border-yellow-400{border-color:#fbbf24}.bg-blue-600{background-color:#2563eb}.bg-gray-50{background-color:#f9fafb}.bg-gray-100{background-color:#f3f4f6}.bg-gray-200{background-color:#e5e7eb}.bg-green-50{background-color:#f0fdf4}.bg-red-100{background-color:#fee2e2}.bg-white{background-color:#fff}.bg-yellow-100{background-color:#fef3c7}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-12{padding-top:3rem;padding-bottom:3rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.pb-4{padding-bottom:1rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-sm{font-size:.875rem;line-height:1.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.font-medium{font-weight:500}.font-semibold{font-weight:600}.font-bold{font-weight:700}.leading-none{line-height:1}.text-blue-600{color:#2563eb}.text-gray-500{color:#6b7280}.text-gray-600{color:#4b5563}.text-gray-700{color:#374151}.text-gray-800{color:#1f2937}.text-green-600{color:#16a34a}.text-red-500{color:#ef4444}.text-red-600{color:#dc2626}.text-red-700{color:#b91c1c}.text-white{color:#fff}.text-yellow-700{color:#a16207}.underline{text-decoration:underline}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(0.4,0,0.2,1);transition-duration:150ms}.rounded-lg{border-radius:.5rem}.shadow-md{box-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1),0 2px 4px -2px rgb(0 0 0 / 0.1)}.shadow-sm{box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.outline-none{outline:2px solid transparent;outline-offset:2px}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-color:#3b82f6}.hover\:bg-blue-700:hover{background-color:#1d4ed8}.hover\:bg-gray-300:hover{background-color:#d1d5db}.hover\:text-blue-600:hover{color:#2563eb}.hover\:text-gray-800:hover{color:#1f2937}.hover\:underline:hover{text-decoration:underline}.hover\:shadow-lg:hover{box-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1),0 4px 6px -4px rgb(0 0 0 / 0.1)}.rtl\:space-x-reverse:where([dir="rtl"])>*+*{margin-left:0;margin-right:calc(var(--tw-space-x-reverse) * 1rem);margin-right:0;margin-left:calc(calc(1 - var(--tw-space-x-reverse)) * 1rem)}.overflow-x-auto{overflow-x:auto}@media (min-width:640px){.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width:1024px){.lg\:px-8{padding-left:2rem;padding-right:2rem}}.btn{display:inline-flex;align-items:center;justify-content:center;padding:.5rem 1rem;border-radius:.5rem;font-weight:500;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(0.4,0,0.2,1);transition-duration:150ms}.btn-primary{background-color:#2563eb;color:#fff}.btn-primary:hover{background-color:#1d4ed8}.btn-secondary{background-color:#e5e7eb;color:#1f2937}.btn-secondary:hover{background-color:#d1d5db}.btn-danger{background-color:#dc2626;color:#fff}.btn-danger:hover{background-color:#b91c1c}.form-input{width:100%;padding:.5rem .75rem;border-width:1px;border-color:#d1d5db;border-radius:.5rem;outline:2px solid transparent;outline-offset:2px}.form-input:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-color:#3b82f6}.form-label{display:block;margin-bottom:.25rem;font-size:.875rem;line-height:1.25rem;font-weight:500}.card{background-color:#fff;border-radius:.5rem;box-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1),0 2px 4px -2px rgb(0 0 0 / 0.1);padding:1.5rem}.table{width:100%;border-collapse:collapse}.table th{padding:.75rem 1rem;text-align:left;background-color:#f9fafb;font-weight:600;border-bottom-width:1px}.table td{padding:.75rem 1rem;border-bottom-width:1px}

/* Custom Zoho Books Style Enhancements */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --bg-gray: #f9fafb;
    
    /* Z-Index Hierarchy System */
    --z-base: 1;
    --z-dropdown: 50;
    --z-sticky: 100;
    --z-dropdown-menu: 9999;
    --z-modal: 10000;
}

/* Fix SVG sizing */
svg {
    display: inline-block;
    vertical-align: middle;
    max-width: 100%;
    height: auto;
}

svg.w-4, svg[class*="w-4"] {
    width: 1rem;
    height: 1rem;
}

svg.w-5, svg[class*="w-5"] {
    width: 1.25rem;
    height: 1.25rem;
}

svg.w-6, svg[class*="w-6"] {
    width: 1.5rem;
    height: 1.5rem;
}

svg.w-8, svg[class*="w-8"] {
    width: 2rem;
    height: 2rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

[dir="rtl"] body {
    font-family: 'Cairo', 'Tajawal', Arial, sans-serif;
}

/* Enhanced Cards */
.card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.card:last-child {
    margin-bottom: 0;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Modern Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    color: #374151;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* Enhanced Header */
header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Dashboard Cards */
.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
}

.stat-card.positive {
    border-left-color: var(--success-color);
}

.stat-card.negative {
    border-left-color: var(--danger-color);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-top: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Tables */
.table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.table th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    text-align: left;
    vertical-align: middle;
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
}

/* RTL table alignment */
[dir="rtl"] .table th,
[dir="rtl"] .table td {
    text-align: right;
}

/* Numeric columns should always be right-aligned */
.table th.text-right,
.table td.text-right {
    text-align: right !important;
}

/* Ensure consistent padding and alignment */
.table th,
.table td {
    white-space: nowrap;
}

.table th:first-child,
.table td:first-child {
    padding-left: 1rem;
}

.table th:last-child,
.table td:last-child {
    padding-right: 1rem;
}

[dir="rtl"] .table th:first-child,
[dir="rtl"] .table td:first-child {
    padding-right: 1rem;
    padding-left: 0.75rem;
}

[dir="rtl"] .table th:last-child,
[dir="rtl"] .table td:last-child {
    padding-left: 1rem;
    padding-right: 0.75rem;
}

/* Responsive layout fixes */
.header-row {
    gap: 1rem;
}

.header-left {
    flex: 1 1 auto;
    min-width: 0;
}

.main-nav {
    flex-wrap: nowrap;
    white-space: nowrap;
}

.header-actions {
    flex: 0 0 auto;
}

.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-primary);
}

.mobile-menu {
    display: none;
    padding: 12px 0 16px 0;
    border-top: 1px solid var(--border-color);
    background: #ffffff;
}

.mobile-menu-section {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.mobile-menu-section:last-child {
    border-bottom: none;
}

.mobile-menu-link {
    display: block;
    padding: 10px 4px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
}

.mobile-menu-link:hover {
    color: var(--primary-color);
}

.mobile-menu-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.mobile-user {
    margin-bottom: 10px;
}

.mobile-user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-user-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.mobile-logout {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 10px 4px;
    color: var(--danger-color);
    cursor: pointer;
}

[dir="rtl"] .mobile-logout,
[dir="rtl"] .mobile-menu-link {
    text-align: right;
}

body.mobile-menu-open .mobile-menu {
    display: block;
}

@media (max-width: 1024px) {
    .main-nav {
        display: none;
    }
    .header-actions {
        display: none;
    }
    .mobile-menu-toggle {
        display: inline-flex;
    }
    .header-row {
        height: auto;
        padding: 10px 0;
    }
}

/* Table usability improvements on small screens */
.table {
    width: 100%;
}

@media (max-width: 768px) {
    .table th,
    .table td {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* Chart of Accounts */
.coa-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.coa-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.coa-search {
    flex: 1 1 320px;
    min-width: 240px;
}

.coa-search-input {
    position: relative;
}

.coa-search-input svg {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    inset-inline-start: 12px;
}

.coa-search-input .form-input {
    padding-inline-start: 40px;
}

.coa-legend {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.coa-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 4px 10px;
}

.coa-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
}

.coa-dot-parent {
    background: #2563eb;
}

.coa-dot-child {
    background: #9ca3af;
}

.coa-card {
    padding: 0;
    overflow: hidden;
}

.coa-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #f9fafb;
}

.coa-count {
    background: #e5e7eb;
    color: #111827;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 2px 10px;
}

.coa-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
    padding-inline-start: calc(20px + (var(--level) * 18px));
}

.coa-row:hover {
    background: #f9fafb;
}

.coa-row-parent {
    background: #f8fafc;
    border-inline-start: 4px solid #2563eb;
}

.coa-row-child {
    background: #ffffff;
    border-inline-start: 2px solid #e5e7eb;
}

.coa-row-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.coa-indicator {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.coa-indicator-parent {
    background: #2563eb;
}

.coa-indicator-child {
    background: #9ca3af;
}

.coa-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    color: #6b7280;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 2px 8px;
    flex: 0 0 auto;
}

.coa-name {
    font-size: 0.95rem;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coa-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.coa-badge {
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 2px 8px;
    margin-inline-start: 8px;
    white-space: nowrap;
}

.coa-badge-parent {
    background: #dbeafe;
    color: #1d4ed8;
}

.coa-badge-child {
    background: #f3f4f6;
    color: #6b7280;
}

@media (max-width: 768px) {
    .coa-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .coa-name {
        white-space: normal;
    }
    .coa-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

.table tr:hover {
    background: #f9fafb;
}

/* Forms */
.form-input {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

/* Ensure custom select buttons don't clip dropdowns */
.custom-select-wrapper button.form-input {
    overflow: visible !important;
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* Fix select dropdown overflow for RTL languages - AGGRESSIVE CONSTRAINTS */
select.form-input,
select {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
    width: 100% !important;
    position: relative !important;
}

/* Exception: custom select buttons should allow overflow for dropdown */
.custom-select-wrapper button.form-input {
    overflow: visible !important;
}

/* Constrain select dropdown to viewport - use size attribute to limit visible options */
select.form-input[size],
select[size] {
    max-height: 200px;
    overflow-y: auto;
}

/* Ensure select elements and their containers don't cause horizontal overflow */
select.form-input,
select {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.form-group {
    max-width: 100% !important;
    overflow: visible !important;
    position: relative !important;
}

/* Ensure form containers don't overflow */
form,
.card,
.card.max-w-2xl {
    max-width: 100% !important;
    overflow-x: visible !important;
    position: relative !important;
}

/* Ensure parent containers constrain properly */
.card,
form,
.grid,
div[class*="grid"] {
    overflow-x: hidden !important;
    max-width: 100% !important;
    position: relative !important;
}

/* Prevent select dropdowns from overflowing viewport */
body,
html {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

/* Constrain all select elements globally */
select {
    max-width: 100% !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

/* Wrap selects in constrained containers */
select.form-input,
select {
    position: relative !important;
}

/* For RTL layouts, ensure proper text direction */
[dir="rtl"] select.form-input,
[dir="rtl"] select {
    direction: rtl;
    text-align: right;
}

/* Custom select dropdown - NEW DESIGN */
.custom-select-wrapper {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
}

.custom-select-button {
    width: 100% !important;
    max-width: 100% !important;
    text-align: left;
}

.custom-select-dropdown-portal {
    max-width: 100vw !important;
    box-sizing: border-box !important;
}

.custom-select-option {
    transition: background-color 0.15s ease;
}

[dir="rtl"] .custom-select-dropdown {
    left: 0 !important;
    right: 0 !important;
}

/* Ensure custom select options don't overflow */
.custom-select-option {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

/* Form Spacing Utilities */
.form-group {
    margin-bottom: 1rem;
    overflow: visible !important;
}

.form-group:last-child {
    margin-bottom: 0;
}

/* Remove bottom margin when in grid - grid gap handles spacing */
.grid .form-group,
.grid > .form-group,
.grid .mb-4:not(:last-child) {
    margin-bottom: 0;
}

/* Ensure grid gaps are consistent */
.grid {
    gap: 1rem;
}

/* Form sections spacing */
.form-section {
    margin-bottom: 1.5rem;
}

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

/* Global container constraints - prevent ANY overflow */
.card,
form,
.grid,
div[class*="grid"],
div[class*="col-span"] {
    overflow-x: hidden !important;
    max-width: 100% !important;
    position: relative !important;
}

/* Ensure form inputs stay within bounds */
.form-input,
select,
input[type="text"],
input[type="number"],
input[type="date"],
textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

/* Prevent body/html horizontal overflow but allow vertical scrolling */
html,
body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    max-width: 100vw !important;
    position: relative !important;
    height: auto !important;
    min-height: 100vh !important;
}

/* Main content wrapper */
main {
    overflow-x: hidden !important;
    max-width: 100% !important;
    position: relative !important;
}

/* Container spacing */
.container {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .stat-value {
        font-size: 1.5rem;
    }
}

/* Utility classes */
.hidden {
    display: none;
}

.space-y-6 > * + * {
    margin-top: 1.5rem;
}

/* Hide scrollbars on elements that shouldn't have them - GLOBAL FIX */
*:not(.overflow-x-auto):not(.overflow-y-auto) {
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE and Edge */
}

*:not(.overflow-x-auto):not(.overflow-y-auto)::-webkit-scrollbar {
    display: none !important; /* Chrome, Safari, Opera */
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

/* Specifically target divs, spans, and other inline/block elements */
div:not(.overflow-x-auto):not(.overflow-y-auto),
span:not(.overflow-x-auto):not(.overflow-y-auto),
p:not(.overflow-x-auto):not(.overflow-y-auto),
a:not(.overflow-x-auto):not(.overflow-y-auto),
li:not(.overflow-x-auto):not(.overflow-y-auto),
td:not(.overflow-x-auto):not(.overflow-y-auto),
th:not(.overflow-x-auto):not(.overflow-y-auto) {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    overflow: visible !important;
}

div:not(.overflow-x-auto):not(.overflow-y-auto)::-webkit-scrollbar,
span:not(.overflow-x-auto):not(.overflow-y-auto)::-webkit-scrollbar,
p:not(.overflow-x-auto):not(.overflow-y-auto)::-webkit-scrollbar,
a:not(.overflow-x-auto):not(.overflow-y-auto)::-webkit-scrollbar,
li:not(.overflow-x-auto):not(.overflow-y-auto)::-webkit-scrollbar,
td:not(.overflow-x-auto):not(.overflow-y-auto)::-webkit-scrollbar,
th:not(.overflow-x-auto):not(.overflow-y-auto)::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Only show scrollbars when explicitly needed with .overflow-x-auto or .overflow-y-auto */
.overflow-x-auto {
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin; /* Firefox - show thin scrollbar */
    -ms-overflow-style: auto; /* IE and Edge - show scrollbar */
}

.overflow-x-auto::-webkit-scrollbar {
    display: block !important; /* Chrome, Safari, Opera - show scrollbar */
    height: 8px;
}

.overflow-y-auto {
    overflow-y: auto;
    overflow-x: visible;
    scrollbar-width: thin; /* Firefox - show thin scrollbar */
    -ms-overflow-style: auto; /* IE and Edge - show scrollbar */
}

.overflow-y-auto::-webkit-scrollbar {
    display: block !important; /* Chrome, Safari, Opera - show scrollbar */
    width: 8px;
}

/* Ensure common elements never show scrollbars */
div:not(.overflow-x-auto):not(.overflow-y-auto):not(body):not(html):not(main),
p, span, a, li, td, th,
div.py-2,
div[class*="py-"],
div[class*="border-"],
.card > div,
.card,
.table td,
.table th,
.table,
form {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

div:not(.overflow-x-auto):not(.overflow-y-auto):not(body):not(html):not(main)::-webkit-scrollbar,
div.py-2::-webkit-scrollbar,
div[class*="py-"]::-webkit-scrollbar,
div[class*="border-"]::-webkit-scrollbar,
.card > div::-webkit-scrollbar,
.card::-webkit-scrollbar,
.table td::-webkit-scrollbar,
.table th::-webkit-scrollbar,
.table::-webkit-scrollbar,
form::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}
