/* ==========================================================================
   FORMS, INPUTS & BUTTONS
   ========================================================================== */
.form-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }
.form-group.inline { flex-direction: row; align-items: center; gap: 1rem; margin-bottom: 0; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--text-main); }
input[type="text"], input[type="date"], input[type="number"], select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background-color: white;
    transition: var(--transition);
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02) inset;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}
.readonly-input {
    background-color: #f8fafc;
    color: var(--text-muted);
    cursor: not-allowed;
}
.form-row { display: flex; gap: 1.5rem; margin-bottom: 1.5rem; }
.form-row.two-col > * { flex: 1; }
.form-row.three-col > * { flex: 1; }
.form-row.four-col > * { flex: 1; }
.form-row .flex-2 { flex: 2; }
.align-end { align-items: flex-end; }
/* Buttons */
button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(79, 70, 229, 0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-success {
    background: var(--success);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 6px -1px rgba(5, 150, 105, 0.3);
}
.btn-success:hover {
    background: #047857;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(5, 150, 105, 0.4);
}
.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-strong);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}
.btn-text {
    background: transparent;
    color: var(--danger);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
}
.btn-text:hover { background: var(--danger-bg); }
.btn-text.blue { color: var(--primary); }
.btn-text.blue:hover { background: var(--primary-light); }
.btn-text:disabled { color: var(--text-light); cursor: not-allowed; background: transparent; }
/* ==========================================================================
   UPLOAD BOX
   ========================================================================== */
.upload-box {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    background: #f8fafc;
    transition: var(--transition);
}
.upload-box:hover, .upload-box.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.01);
}
.upload-icon { color: var(--primary); margin-bottom: 1rem; opacity: 0.8; }
.upload-box h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-main); margin-bottom: 0.5rem; }
.upload-box p { font-size: 0.9rem; color: var(--text-muted); }
/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-float);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-body { padding: 2rem; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: #f8fafc;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
/* ==========================================================================
   E-INVOICE & SPECIFIC COMPONENTS
   ========================================================================== */
.e-invoice-preview {
    font-family: 'Inter', sans-serif;
    color: #0f172a;
    padding: 3rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: var(--shadow-md);
}
.ei-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}
.ei-title { font-size: 2.5rem; color: var(--primary); font-weight: 800; letter-spacing: -0.02em; }
.ei-table th { background: #f8fafc; color: #475569; }
.ei-summary-row.tot { color: var(--primary); border-top: 2px solid #e2e8f0; }
.action-list { list-style: none; }
.action-list li {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}
.action-list li:hover { background: #f8fafc; }
/* Filter Bars */
.dashboard-filter-bar, .date-filter-bar {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 1.5rem;
    align-items: center;
}
.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
/* Print Media */
@media print {
    .sidebar, .topbar, .app-view:not(.active) { display: none !important; }
    .main-content { overflow: visible !important; }
    .modal-overlay { background: transparent !important; position: absolute; }
    .modal-content { box-shadow: none !important; }
}
/* Statement of Account specific overrides */
.table-container .data-table { table-layout: fixed !important; width: 100% !important; }
.table-container .data-table th, .table-container .data-table td { word-break: break-word !important; }
.table-container .data-table th.num-col, .table-container .data-table td.num-col { width: 120px !important; text-align: right !important; }
.table-container .data-table th:nth-child(1), .table-container .data-table td:nth-child(1) { width: 120px !important; }
.table-container .data-table th:nth-child(2), .table-container .data-table td:nth-child(2) { width: 140px !important; }
.table-container .data-table th:nth-child(3), .table-container .data-table td:nth-child(3) { width: auto !important; min-width: 150px !important; }
/* ==========================================================================
   TAX SUMMARY STYLING (VAT & Corporate Tax)
   ========================================================================== */
.vat-card {
    border: none;
    background: linear-gradient(145deg, var(--bg-surface), #f8fafc);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.vat-box {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.vat-box h3 {
    padding: 0.75rem 1rem;
    background: #f1f5f9;
    margin: 1.5rem -1.5rem 0.5rem -1.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}
.vat-box h3:first-child {
    margin-top: -1.5rem;
    border-top: none;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}
.vat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px dashed var(--border-color);
    transition: background-color 0.2s ease;
}
.vat-row:last-child {
    border-bottom: none;
}
.vat-row:hover {
    background-color: rgba(241, 245, 249, 0.6);
    border-radius: var(--radius-sm);
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    margin-left: -0.75rem;
    margin-right: -0.75rem;
}
.vat-row.divider {
    border-top: 2px solid var(--border-strong);
    border-bottom: none;
    margin-top: 0.5rem;
}
.vat-row.total-vat-row {
    background: linear-gradient(to right, #e0e7ff, #ede9fe);
    border-radius: var(--radius-md);
    padding: 1.25rem 1rem;
    margin: 1rem -0.5rem -0.5rem -0.5rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.5);
}
.vat-row.total-vat-row:hover {
    background: linear-gradient(to right, #dbeafe, #e0e7ff);
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    padding-left: 1rem;
    padding-right: 1rem;
}
.vat-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 75%;
}
.vat-label strong {
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 600;
}
.vat-label span {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}
.vat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
    min-width: 120px;
}
.vat-row.total-vat-row .vat-value {
    font-size: 1.4rem;
    color: var(--primary);
    font-weight: 700;
}
/* Premium Filter Bar */
.filter-bar {
    background: var(--bg-surface);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: inline-flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.filter-group input {
    height: 42px;
    padding: 0 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    background: #f8fafc;
    transition: var(--transition);
}
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: #fff;
}
.filter-bar .btn-primary {
    height: 42px;
    padding: 0 1.5rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    white-space: nowrap;
}
/* Art. 59 / Art. 60 Line-Item Grid & Tax Document Preview Modal */
.line-item-row > .form-group,
.crn-line-item-row > .form-group {
    min-width: 0;
    margin-bottom: 0;
}
.line-item-row input,
.line-item-row select,
.crn-line-item-row input,
.crn-line-item-row select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
#invoiceModal .modal-content {
    max-width: 960px;
}
#salesDocumentsCard .data-table {
    table-layout: auto !important;
    width: 100% !important;
}
#salesDocumentsCard .data-table th,
#salesDocumentsCard .data-table td {
    width: auto !important;
    min-width: 0 !important;
    padding: 0.65rem 0.6rem !important;
    word-break: normal !important;
    white-space: nowrap;
}
/* Collapsible Sidebar, Topbar Controls & Quick-Jump Command Palette */
.topbar-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.topbar-right-controls { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.sidebar-toggle-btn { width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-main); font-size: 1rem; padding: 0; }
.sidebar-toggle-btn:hover { background: var(--bg-surface-hover); border-color: var(--border-strong); }
.quick-jump-trigger { display: inline-flex; align-items: center; gap: 0.45rem; height: 34px; padding: 0 0.75rem; border-radius: var(--radius-sm); border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-muted); font-size: 0.8125rem; font-weight: 500; }
.quick-jump-trigger:hover { background: var(--bg-surface-hover); color: var(--text-main); border-color: var(--border-strong); }
.kbd-hint { padding: 0.1rem 0.38rem; border-radius: 4px; background: #f1f5f9; border: 1px solid var(--border-color); font-size: 0.7rem; font-family: "JetBrains Mono", monospace; color: var(--text-muted); }
body.sidebar-collapsed .sidebar { width: 68px; }
body.sidebar-collapsed .sidebar .logo span, body.sidebar-collapsed .sidebar .nav-dropdown > .nav-item:first-child { display: none; }
body.sidebar-collapsed .sidebar .nav-item { justify-content: center; font-size: 0; padding: 0.6rem; }
body.sidebar-collapsed .sidebar .nav-item svg { width: 20px; height: 20px; }
.nav-dropdown.is-collapsed .nav-dropdown-content { display: none !important; }
.command-palette-card { max-width: 560px; overflow: hidden; }
.command-palette-header { display: flex; align-items: center; gap: 0.65rem; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border-color); background: var(--bg-surface); }
.command-palette-input { flex: 1; border: none !important; box-shadow: none !important; font-size: 0.95rem; padding: 0.25rem 0 !important; background: transparent !important; }
.command-palette-list { max-height: 360px; overflow-y: auto; padding: 0.5rem; display: flex; flex-direction: column; gap: 2px; }
.command-palette-item { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); background: transparent; color: var(--text-main); font-size: 0.875rem; font-weight: 500; text-align: left; }
.command-palette-item:hover, .command-palette-item.is-active { background: var(--primary-light); color: var(--primary); }
.command-palette-group { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
