/* ====================================================
   SMART Docs — Master Stylesheet (Clean Build)
   ==================================================== */

/* ==== CSS VARIABLES ==== */
:root {
    --primary-color: #559c57; /* Professional Green */
    --primary-hover: #458247;
    --secondary-color: #2b78e4; /* Flat Blue */
    --secondary-hover: #1f64c6;
    --danger-color: #d9534f;
    --warning-color: #f0ad4e;
    --info-color: #5bc0de;
    --dark-bg: #2c3e50;
    --light-bg: #f9f9f9;
    --white: #ffffff;
    --text-main: #333333;
    --text-muted: #777777;
    --border-color: #dddddd;
    --sidebar-width: 250px;
    --header-height: 60px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.1);
    --radius-md: 4px;
    --radius-lg: 6px;
    --transition: all 0.2s ease;
}

/* ==== RESET ==== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* ==== HIDE NUMBER SPINNERS ==== */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* ==== GLOBAL FONT ==== */
body {
    background-color: var(--light-bg);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    font-family: 'Inter', 'Roboto', 'Poppins', 'Noto Sans Lao Looped', 'Phetsarath', sans-serif;
}
/* Force font on form elements (they don't inherit from body by default) */
input, select, textarea, button, option, optgroup,
table, th, td, label, a, span, p, div, h1, h2, h3, h4, h5, h6, li, ul, ol {
    font-family: inherit;
}

/* ====================================================
   SIDEBAR
   ==================================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--white);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    border-right: 1px solid var(--border-color);
    z-index: 100;
    display: flex;
    flex-direction: column;
}
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}
.sidebar-header i {
    margin-right: 10px;
    font-size: 1.3rem;
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}
.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    gap: 12px;
}
.nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}
.nav-link:hover, .nav-link.active {
    background-color: #eaf5ea;
    color: var(--primary-color);
}
.nav-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin: 20px 0 10px 16px;
    letter-spacing: 0.05em;
}
.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background: rgba(0,0,0,0.5); z-index: 99; display: none;
}
.sidebar-overlay.active { display: block; }
.sidebar .close-btn { display: none; }

/* ====================================================
   MAIN CONTENT
   ==================================================== */
.main-content {
    min-width: 0;
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

/* ==== TOP HEADER ==== */
.top-header {
    max-width: 100%;
    height: var(--header-height);
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
}
.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--light-bg);
    border-radius: 20px;
    padding: 8px 16px;
    width: 300px;
}
.search-bar i {
    color: var(--text-muted);
    margin-right: 8px;
}
.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}
.notif-wrapper {
    position: relative;
}
.notification-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}
.notification-btn:hover {
    color: var(--primary-color);
    background: #eaf5ea;
}
.notification-btn.active {
    color: var(--primary-color);
    background: #eaf5ea;
}
.notification-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--danger-color);
    color: white;
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 10px;
    font-weight: bold;
    min-width: 16px;
    text-align: center;
}

/* Notification Dropdown */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15), 0 2px 10px rgba(0,0,0,0.08);
    z-index: 999;
    display: none;
    overflow: hidden;
    border: 1px solid var(--border-color);
    animation: notifFadeIn 0.2s ease;
}
.notif-dropdown.show {
    display: block;
}
@keyframes notifFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #f9fafb;
}
.notif-dropdown-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}
.notif-count-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: #eee;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
}
.notif-dropdown-body {
    max-height: 350px;
    overflow-y: auto;
}
.notif-dropdown-body::-webkit-scrollbar {
    width: 4px;
}
.notif-dropdown-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s ease;
    cursor: pointer;
}
.notif-item:hover {
    background: #f9fafb;
}
.notif-item:last-child {
    border-bottom: none;
}
.notif-item-overdue {
    border-left: 3px solid var(--danger-color);
}
.notif-item-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.notif-item-content {
    flex: 1;
    min-width: 0;
}
.notif-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 2px;
}
.notif-item-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-item-time {
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 4px;
}
.notif-item-time i {
    margin-right: 3px;
}
.notif-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.notif-empty i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
    color: #ccc;
}
.notif-empty p {
    font-size: 0.9rem;
    margin: 0;
}
.notif-dropdown-footer {
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: #f9fafb;
}
.notif-dropdown-footer a {
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}
.notif-dropdown-footer a:hover {
    color: var(--primary-hover);
}
.notif-dropdown-footer a i {
    margin-left: 4px;
    font-size: 0.75rem;
}
@media (max-width: 576px) {
    .notif-dropdown {
        width: 300px;
        right: -60px;
    }
}
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ====================================================
   PAGE CONTENT
   ==================================================== */
.page-content {
    max-width: 100%;
    overflow-x: hidden;
    min-width: 0;
    padding: 24px 32px;
    flex: 1;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 15px;
}
.header-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
}
.page-subtitle {
    color: var(--text-muted);
    margin-top: 5px;
    font-size: 0.95rem;
}

/* ====================================================
   BUTTONS (Flat Professional UI)
   ==================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    letter-spacing: 0.01em;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn i {
    font-size: 1rem;
}
.btn:active {
    transform: translateY(1px);
}

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

.btn-secondary {
    background-color: #f8f9fa;
    color: var(--text-main);
    border-color: #ccc;
}
.btn-secondary:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--white);
    border-color: var(--danger-color);
}
.btn-danger:hover {
    background-color: #c9302c;
    border-color: #ac2925;
}

.btn-warning {
    background-color: var(--warning-color);
    color: var(--white);
    border-color: var(--warning-color);
}
.btn-warning:hover {
    background-color: #ec971f;
    border-color: #d58512;
}

.btn-success {
    background-color: #5cb85c;
    color: var(--white);
    border-color: #5cb85c;
}
.btn-success:hover {
    background-color: #449d44;
    border-color: #398439;
}

.btn-info {
    background-color: var(--secondary-color);
    color: var(--white);
    border-color: var(--secondary-color);
}
.btn-info:hover {
    background-color: var(--secondary-hover);
    border-color: var(--secondary-hover);
}

.btn-submit {
    font-size: 1rem;
    padding: 10px 24px;
}
.btn-block {
    width: 100%;
    padding: 12px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}
.btn-icon:hover {
    color: var(--primary-color);
    background-color: #f0f0f0;
}
.btn-icon.danger { color: var(--danger-color); }
.btn-icon.danger:hover { 
    background-color: #fef2f2; 
}

/* ====================================================
   DASHBOARD CARDS
   ==================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}
.stat-icon.quo { background-color: #eaf5ea; color: var(--primary-color); }
.stat-icon.inv { background-color: #dbeafe; color: var(--secondary-color); }
.stat-icon.due { background-color: #fee2e2; color: var(--danger-color); }
.stat-icon.rev { background-color: #fef3c7; color: var(--warning-color); }
.stat-details h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}
.stat-details p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* ====================================================
   CARDS & TABLES
   ==================================================== */
.card {
    min-width: 0;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.card + .card, .card.mb { margin-bottom: 20px; }
.card-narrow { max-width: 800px; }
.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-title {
    font-weight: 600;
    font-size: 1.1rem;
}
.card-body {
    padding: 24px;
}
.card-search {
    width: 250px;
    background: var(--white);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    border-radius: 20px;
    padding: 8px 16px;
}
.card-search i {
    color: var(--text-muted);
    margin-right: 8px;
}
.card-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
}
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-responsive table {
    min-width: 800px;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
th {
    background-color: #f9fafb;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}
td { font-size: 0.95rem; }
tbody tr:hover { background-color: #f9fafb; }

/* Status Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-draft { background-color: #f3f4f6; color: #4b5563; }
.badge-sent { background-color: #dbeafe; color: #2563eb; }
.badge-paid { background-color: #dcfce7; color: #166534; }
.badge-overdue { background-color: #fee2e2; color: #991b1b; }

/* ====================================================
   TABLE FILTER ROW (Bansila Style)
   ==================================================== */
.filter-row th {
    background-color: var(--white) !important;
    padding: 8px 6px !important;
    border-bottom: 2px solid var(--border-color) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}
.filter-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.filter-input {
    width: 100%;
    padding: 6px 28px 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    outline: none;
    background: var(--white);
    color: var(--text-main);
    font-family: inherit;
    transition: var(--transition);
}
.filter-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(85, 156, 87, 0.12);
}
.filter-input::placeholder {
    color: #bbb;
    font-size: 0.8rem;
}
.filter-clear {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #bbb;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 4px;
    line-height: 1;
    display: none;
}
.filter-clear:hover {
    color: var(--danger-color);
}
.filter-input:not(:placeholder-shown) + .filter-clear {
    display: block;
}
.filter-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    outline: none;
    background: var(--white);
    color: var(--text-main);
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    -webkit-appearance: auto;
}
.filter-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(85, 156, 87, 0.12);
}

/* Action Buttons (Bansila Style) */
.action-btns {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: nowrap;
}
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--white);
    text-decoration: none;
    transition: var(--transition);
}
.action-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}
.action-btn.edit { background-color: var(--secondary-color); }
.action-btn.delete { background-color: var(--danger-color); }
.action-btn.print { background-color: var(--text-muted); }
.action-btn.convert { background-color: var(--primary-color); }

/* Table Footer */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 10px;
}
.table-footer-info {
    flex-shrink: 0;
}
.table-footer-pager {
    display: flex;
    gap: 4px;
}
.table-footer-pager button,
.table-footer-pager span {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-main);
    transition: var(--transition);
}
.table-footer-pager button:hover {
    background: var(--light-bg);
}
.table-footer-pager .active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* ====================================================
   FORMS
   ==================================================== */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.95rem;
}
.form-control, .form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
    background-color: var(--white);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(85, 156, 87, 0.15);
}
textarea.form-control {
    resize: vertical;
    min-height: 100px;
}
.form-row {
    display: flex;
    gap: 20px;
}
.form-col { flex: 1; }
.form-col-wide { flex: 2; }
.form-col-narrow { flex: 0.4; }
.form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
}
.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}
.form-check label { margin-bottom: 0; cursor: pointer; }

/* ==== REQUIRED ASTERISK ==== */
.text-required { color: var(--danger-color); font-weight: bold; }

/* ====================================================
   TABLE INPUTS (items table)
   ==================================================== */
.table-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    background-color: var(--white);
    color: var(--text-main);
    font-family: inherit;
}
.table-input:focus {
    border-color: var(--primary-color);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(85, 156, 87, 0.15);
}
.table-input[readonly] {
    background-color: #fafafa;
    font-weight: 600;
    border-color: transparent;
}
.table-input:hover:not([readonly]) {
    border-color: #bbb;
}

/* Items Table Grid Lines */
.items-table {
    border: 1px solid var(--border-color);
}
.items-table th {
    background-color: #f5f5f5;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.items-table td {
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    vertical-align: top;
}
.items-table tbody tr:hover {
    background-color: #fafffe;
}
.items-toolbar {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.items-toolbar .form-select {
    width: 300px;
    max-width: 100%;
}
.items-table th:nth-child(1) { width: 40%; min-width: 200px; }
.items-table th:nth-child(2) { width: 12%; min-width: 80px; }
.items-table th:nth-child(3) { width: 18%; min-width: 100px; }
.items-table th:nth-child(4) { width: 18%; min-width: 100px; }
.items-table th:nth-child(5) { width: 50px; min-width: 50px; }

/* ====================================================
   SUMMARY BOX (Subtotal, Discount, VAT, Grand Total)
   ==================================================== */
.summary-container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 30px;
}
.notes-container {
    flex: 1;
    min-width: 250px;
    max-width: 50%;
}
.summary-box {
    width: 420px;
    max-width: 100%;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-color);
    gap: 15px;
}
.summary-row:last-child { border-bottom: none; }
.summary-row.total {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    padding-top: 15px;
    border-top: 2px solid var(--primary-color);
    border-bottom: none;
}
.summary-row span {
    white-space: nowrap;
    color: var(--text-main);
    font-weight: 500;
    flex-shrink: 0;
}
.summary-input {
    width: 140px;
    min-width: 140px;
    text-align: right;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
    background-color: var(--white);
    font-family: inherit;
}
.summary-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(85, 156, 87, 0.15);
}
.summary-vat-input {
    width: 70px;
    min-width: 70px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
    background-color: var(--white);
    font-family: inherit;
}
.summary-vat-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(85, 156, 87, 0.15);
}
.summary-value {
    width: 140px;
    min-width: 140px;
    text-align: right;
    font-size: 1.05rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-family: inherit;
}
.summary-row.total .summary-value {
    color: var(--primary-color);
    font-size: 1.25rem;
}
.vat-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ====================================================
   ALERTS
   ==================================================== */
.alert-error {
    background: var(--danger-color);
    color: white;
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}
.alert-error-inline {
    background: var(--danger-color);
    color: white;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: var(--radius-md);
}
.alert-success {
    background: #dcfce7;
    color: #166534;
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

/* ====================================================
   ACTION LINKS (table row actions)
   ==================================================== */
.action-link {
    text-decoration: none;
    margin-right: 10px;
    font-size: 1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.action-link:hover { opacity: 0.7; }
.action-link.edit { color: var(--info-color); }
.action-link.convert { color: var(--secondary-color); }
.action-link.print { color: var(--text-muted); }
.action-link.delete { color: var(--danger-color); }

/* ====================================================
   INVOICE SELECT TABLE (Billing/Collection)
   ==================================================== */
.invoice-select-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border-color);
}
.invoice-select-table thead { background: #f9fafb; }
.invoice-select-table.danger thead { background: #fee2e2; }
.invoice-select-table th,
.invoice-select-table td {
    padding: 10px;
    border: 1px solid var(--border-color);
}
.invoice-select-table th.check-col { width: 5%; }
.invoice-select-total { text-align: right; font-weight: bold; padding: 15px; }
.invoice-select-value { text-align: right; font-weight: bold; padding: 15px; font-size: 1.2rem; }
.invoice-select-value.primary { color: var(--primary-color); }
.invoice-select-value.danger { color: var(--danger-color); }

/* ====================================================
   MISC UTILITIES
   ==================================================== */
.table-empty { text-align: center; color: var(--text-muted); padding: 40px; }
.text-muted-col { color: var(--text-muted); }
.text-danger { color: var(--danger-color); }
.text-primary { color: var(--primary-color); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-bold { font-weight: bold; }
.text-primary-bold { color: var(--primary-color); font-weight: bold; }
.text-danger-bold { color: var(--danger-color); font-weight: bold; }
.text-overdue { color: var(--danger-color); font-weight: bold; }
.text-help { color: var(--text-muted); font-size: 0.85rem; }
.icon-receipt { color: var(--secondary-color); }
.link-invoice { color: var(--info-color); text-decoration: none; }
.link-invoice:hover { text-decoration: underline; }
.js-hidden { display: none; }
.mt-20 { margin-top: 20px; }
.mb-50 { margin-bottom: 50px; }
.input-amount { font-weight: bold; color: var(--primary-color); font-size: 1.1rem; }
.section-title { margin-bottom: 10px; color: var(--text-main); }
.section-title.danger { color: var(--danger-color); }
.empty-state { display: none; text-align: center; padding: 30px; color: var(--text-muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 10px; }
.empty-state-icon.success { color: var(--secondary-color); }

/* ====================================================
   PROFILE PAGE
   ==================================================== */
.profile-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
}
.profile-avatar-card {
    position: sticky;
    top: 84px;
}
.profile-avatar-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 0 auto 20px;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 4px solid var(--primary-color);
    transition: var(--transition);
}
.profile-avatar-wrapper:hover {
    box-shadow: 0 6px 20px rgba(85, 156, 87, 0.25);
    transform: scale(1.03);
}
.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), #3a7d3c);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3.5rem;
    font-weight: 700;
}
.avatar-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}
.avatar-overlay i { font-size: 1.1rem; margin-bottom: 2px; }
.avatar-overlay span { font-size: 0.7rem; }
.profile-avatar-wrapper:hover .avatar-overlay {
    transform: translateY(0);
}
.profile-avatar-wrapper.uploading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    animation: pulse 1s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
.profile-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}
.profile-role {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.profile-role i { margin-right: 5px; }
.profile-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 8px;
}
.profile-meta i { margin-right: 5px; }
.profile-forms { min-width: 0; }

/* Password Input Wrap */
.password-input-wrap {
    position: relative;
}
.password-input-wrap .form-control {
    padding-right: 45px;
}
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    transition: var(--transition);
}
.password-toggle:hover {
    color: var(--primary-color);
}

/* Profile Toast Notification */
.profile-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.profile-toast.success {
    background: #dcfce7;
    color: #166534;
    border-left: 4px solid #22c55e;
}
.profile-toast.error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}
@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* ====================================================
   RESPONSIVE (Profile additions)
   ==================================================== */
@media (max-width: 992px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }
    .profile-avatar-card {
        position: static;
    }
}
@media (max-width: 576px) {
    .profile-avatar-wrapper {
        width: 110px;
        height: 110px;
    }
    .profile-avatar-placeholder span {
        font-size: 2.5rem;
    }
}

/* ====================================================
   RESPONSIVE
   ==================================================== */

/* Large Desktop (≤ 1400px) */
@media (max-width: 1400px) {
    .page-content { padding: 20px 24px; }
    .summary-box { width: 380px; }
}

/* Medium screens (≤ 1200px) */
@media (max-width: 1200px) {
    .form-row { flex-wrap: wrap; }
    .form-col { min-width: 200px; }
    .summary-container { gap: 20px; }
    .notes-container { max-width: 100%; min-width: auto; }
    .summary-box { width: 100%; }
}

/* Tablet & Mobile (≤ 992px) */
@media (max-width: 992px) {
    .page-content {
        max-width: 100%;
        overflow-x: hidden;
        padding: 15px;
    }
    .card-header {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .card-search { width: 100%; margin-top: 10px; }
    .stat-card { padding: 15px; gap: 10px; }
    .stat-icon { width: 45px; height: 45px; font-size: 1.2rem; }
    #mobileMenuBtn { display: inline-block !important; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        position: fixed;
        height: 100vh;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        background: white;
    }
    .sidebar.active { transform: translateX(0); }
    .sidebar .close-btn {
        display: block;
        position: absolute;
        right: 15px;
        top: 20px;
        font-size: 1.5rem;
        background: none;
        border: none;
        color: var(--text-muted);
        cursor: pointer;
    }
    .main-content { min-width: 0; margin-left: 0; }
    .form-row { flex-direction: column; }
    .form-col { width: 100%; flex: none !important; }
    .top-header { max-width: 100%; padding: 10px 15px; gap: 10px; }
    .search-bar { display: flex; flex: 1; min-width: 0; margin: 0 10px; padding: 6px 12px; }
    .user-info { display: none; }
    .search-bar input { width: 100%; min-width: 0; font-size: 0.85rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .header-actions { width: 100%; }
    .items-toolbar { flex-direction: column; align-items: stretch; }
    .items-toolbar .form-select { width: 100%; }
    .items-toolbar .btn { width: 100%; justify-content: center; }
    .form-actions { flex-direction: row; justify-content: stretch; }
    .form-actions .btn { flex: 1; justify-content: center; min-width: 0; }
    .page-title { font-size: 1.3rem; }
    .summary-container { flex-direction: column; }
}

/* Small Mobile (≤ 576px) */
@media (max-width: 576px) {
    .page-content { padding: 10px; }
    .stats-grid { grid-template-columns: 1fr; gap: 12px; }
    .stat-card { padding: 12px; }
    .btn { font-size: 0.85rem; padding: 7px 12px; }
    .btn-submit { font-size: 0.9rem; padding: 9px 18px; }
    .page-title { font-size: 1.1rem; }
    .page-subtitle { font-size: 0.85rem; }
    .card-body { padding: 15px; }
    th, td { padding: 10px 12px; font-size: 0.85rem; }
    .summary-row span { font-size: 0.9rem; }
    .summary-input, .summary-value { width: 120px; min-width: 120px; font-size: 0.9rem; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; }
    .top-header { padding: 8px 10px; }
    .search-bar { padding: 5px 10px; }
}
