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

:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-slate: #F8FAFC;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --shadow-soft: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.hide-on-desktop { display: none !important; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-slate);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Glassmorphism utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-soft);
}

/* Card layout */
.card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* Input Fields */
.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-cols-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 700px;
    border-radius: var(--radius-2xl);
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalPop 0.3s ease-out;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Forms & Tables density */
.table-compact td {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
}

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

/* Navbar active state cleanup */
.nav-item i {
    width: 20px;
}

:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-main: #F8FAFC;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --radius-lg: 0.75rem;
    --radius-2xl: 1.5rem;
    --sidebar-width: 260px;
}

/* Sidebar & Navigation Layout */
.sidebar { 
    width: var(--sidebar-width); 
    height: 100vh; 
    position: fixed; 
    left: 0; 
    top: 0; 
    padding: 2rem; 
    border-right: 1px solid var(--border-color); 
    background: white; 
    z-index: 1000;
    transition: transform 0.3s ease;
}

.main-content { 
    margin-left: var(--sidebar-width); 
    padding: 2rem 4rem; 
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    align-items: center;
    justify-content: space-between;
    z-index: 900;
}

.burger-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

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

/* Dashboard Bento Items & Grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto;
    gap: 1.5rem 1rem;
}

.bento-item {
    background: white;
    border-radius: var(--radius-2xl);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 13px rgba(72, 72, 72, 0.1);
    display: flex;
    flex-direction: column;
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.row-2 { grid-row: span 2; }

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #DCFCE7; color: #166534; }
.badge-warning { background: #FEF9C3; color: #854D0E; }
.badge-error { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #EEF2FF; color: #4338CA; }

/* Typography Helpers */
.title-xl { font-size: 1.875rem; font-weight: 700; color: var(--text-main); line-height: 1.2; }
.title-lg { font-size: 1.25rem; font-weight: 600; color: var(--text-main); line-height: 1.2; }
.subtitle { font-size: 0.875rem; color: var(--text-muted); }

.text-amount {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

/* RESPONSIVE BREAKPOINTS */

@media (max-width: 1200px) {
    :root { --sidebar-width: 220px; }
    .main-content { padding: 2rem; }
}

@media (max-width: 992px) {
    :root { --sidebar-width: 260px; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-active { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 5rem 1.5rem 2rem 1.5rem; }
    .mobile-header { display: flex; }
    .bento-grid { grid-template-columns: repeat(2, 1fr); }
    .span-2, .span-3, .span-4 { grid-column: span 2; }
    .hide-on-mobile { display: none !important; }
}

@media (max-width: 640px) {
    .bento-grid { grid-template-columns: 1fr; }
    .span-2, .span-3, .span-4 { grid-column: span 1; }
    .main-content { padding-left: 1rem; padding-right: 1rem; }
    .title-xl { font-size: 1.5rem; }
    .hide-on-mobile { display: none !important; }
}

/* Tables Responsive Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.no-wrap {
    white-space: nowrap;
}


.nav-item { 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
    padding: 0.75rem 1rem; 
    border-radius: 0.75rem; 
    color: var(--text-muted); 
    text-decoration: none; 
    font-weight: 500; 
    margin-bottom: 0.5rem; 
    transition: all 0.2s;
}

.nav-item:hover {
    background: #F8FAFC;
    color: var(--primary);
}

.nav-item.active { 
    background: #EEF2FF; 
    color: var(--primary); 
}
.badge-info { background: #bae6fd; color: #0284c7; }

/* Searchable List */
.search-results-list {
    position: absolute !important;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* Premium shadow */
    z-index: 10000; /* Extremely high */
    max-height: 250px;
    overflow-y: auto;
    display: none;
    padding: 0.5rem;
}

.search-item {
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.search-item:hover {
    background: #F8FAFC;
    transform: translateX(4px);
}

.search-item b {
    display: block;
    color: var(--text-main);
    font-size: 0.95rem;
}

.search-item .subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Mini Toolbar */
.mini-toolbar {
    position: absolute !important;
    background: #1E293B;
    border-radius: 0.5rem;
    padding: 0.4rem;
    display: none;
    gap: 0.4rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    z-index: 20000; /* Higher than results list */
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
}

.mini-toolbar button {
    background: transparent;
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mini-toolbar button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.mini-toolbar::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #1E293B transparent transparent transparent;
}

/* Textarea normalization */
textarea.item-desc {
    resize: vertical;
    min-height: 60px;
    line-height: 1.5;
    padding: 1rem;
    font-family: inherit;
}

/* Preview Table Adjustments */
#prev-items td {
    font-size: 0.8rem;
    line-height: 1.4;
    color: #475569;
}

#prev-items td b {
    color: var(--text-main);
}

