/* MISAC eBilling Lite - custom styles on top of misac.css */

/* ── Dashboard ─────────────────────────────────────────────────────────────── */
.ebl-dash { padding: 16px; }
.ebl-dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.ebl-dash-header h2 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--m-accent, #2272b5); }
.ebl-dash-header h2 i { margin-right: 7px; }
.ebl-dash-date { font-size: .8rem; color: var(--m-text-muted, #64748b); }
.ebl-dash-loading { padding: 48px; text-align: center; color: var(--m-text-muted, #94a3b8); font-size: 1.1rem; }
.ebl-panel-loading { padding: 32px; text-align: center; color: var(--m-text-muted, #94a3b8); }

.ebl-kpi-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.ebl-kpi-card { flex: 1; min-width: 180px; background: var(--m-surface, #fff);
    border-radius: var(--m-radius, 6px); border: 1px solid var(--m-border, #dee2e6);
    padding: 20px 20px 16px; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.ebl-kpi-icon { font-size: 1.5rem; margin-bottom: 8px; }
.ebl-kpi-value { font-size: 1.4rem; font-weight: 800; color: var(--m-text, #1e293b); }
.ebl-kpi-label { font-size: .75rem; color: var(--m-text-muted, #64748b); margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }

.ebl-dash-section { background: var(--m-surface, #fff); border-radius: var(--m-radius, 6px);
    border: 1px solid var(--m-border, #dee2e6); margin-bottom: 16px; overflow: hidden; }
.ebl-dash-section-title { padding: 10px 16px; border-bottom: 1px solid var(--m-border, #dee2e6);
    font-size: .8rem; font-weight: 700; color: var(--m-accent, #2272b5); text-transform: uppercase; letter-spacing: .07em; }
.ebl-dash-sync-note { font-size: .8rem; color: var(--m-text-muted, #64748b); margin-top: 8px; }

/* ── Invoice view panel ─────────────────────────────────────────────────────── */
.ebl-view { padding: 0; font-size: .9rem; }
.ebl-view-header { padding: 16px 20px 12px;
    background: linear-gradient(135deg, rgba(34,114,181,.06) 0%, rgba(171,33,127,.04) 100%);
    border-bottom: 1px solid var(--m-border, #dee2e6); }
.ebl-view-badges { margin-bottom: 6px; }
.ebl-inv-number { margin: 4px 0 8px; font-size: 1.15rem; font-weight: 700; color: var(--m-accent, #2272b5); }
.ebl-view-meta { display: flex; gap: 20px; font-size: .78rem; color: var(--m-text-muted, #64748b); flex-wrap: wrap; }
.ebl-view-meta i { margin-right: 4px; }

.ebl-view-section { padding: 14px 20px; border-bottom: 1px solid var(--m-border, #dee2e6); }
.ebl-view-section:last-child { border-bottom: none; }
.ebl-view-section-title { font-size: .72rem; font-weight: 700; color: var(--m-accent, #2272b5);
    text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
.ebl-field-row { display: flex; gap: 12px; margin-bottom: 4px; font-size: .88rem; }
.ebl-field-label { min-width: 90px; color: var(--m-text-muted, #64748b); font-weight: 600; }

.ebl-view-totals { padding: 12px 20px; background: var(--m-bg-muted, #f8fafc); border-top: 1px solid var(--m-border, #dee2e6); }
.ebl-total-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: .88rem; }
.ebl-total-row--grand { font-weight: 800; font-size: 1rem; border-top: 2px solid var(--m-border, #dee2e6); margin-top: 6px; padding-top: 8px; color: var(--m-accent, #2272b5); }

/* Discount (left) + Terms/Charges (right) side by side in the invoice create form */
.ebl-form-row-2col { display: flex; gap: 16px; align-items: flex-start; }
.ebl-form-row-2col > .misac-section { flex: 1 1 50%; min-width: 0; }

/* Invoice view Customer section: detail left, UDF custom fields right (50/50) */
.ebl-cust-2col { display: flex; gap: 16px; align-items: flex-start; }
.ebl-cust-2col > .ebl-cust-left, .ebl-cust-2col > .ebl-cust-right { flex: 1 1 50%; min-width: 0; }
.ebl-cust-2col > .ebl-cust-right { border-left: 1px solid var(--m-border, #dee2e6); padding-left: 16px; }

/* Simple Label + Value rows (keyvalue field, e.g. invoice Custom Fields) */
.mf-kv-rows { display: flex; flex-direction: column; gap: 6px; }
.mf-kv-row { display: flex; gap: 8px; align-items: center; }
.mf-kv-row .mf-kv-label { flex: 0 0 38%; }
.mf-kv-row .mf-kv-value { flex: 1 1 auto; }
.mf-kv-row .mf-kv-del { flex: 0 0 auto; line-height: 1; }
.mf-kv-add { margin-top: 6px; }

/* Live totals panel injected into the invoice create form (after Terms / Charges) */
.ebl-totals-section { border: none; padding: 0; margin: 4px 0 8px; }
.ebl-totals-box { max-width: 360px; margin-left: auto; padding: 12px 18px;
    background: var(--m-bg-muted, #f8fafc); border: 1px solid var(--m-border, #dee2e6); border-radius: 8px; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.ebl-items-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.ebl-items-table th { background: var(--m-bg-muted, #f8fafc); padding: 7px 10px;
    border-bottom: 2px solid var(--m-border, #dee2e6); font-weight: 700; color: var(--m-text-muted, #64748b);
    text-transform: uppercase; letter-spacing: .05em; font-size: .72rem; }
.ebl-items-table td { padding: 6px 10px; border-bottom: 1px solid var(--m-border, #dee2e6); }
.ebl-items-table tr:last-child td { border-bottom: none; }
.ebl-items-editable td { padding: 4px 6px; }
.ebl-items-editable .form-control-sm { font-size: .82rem; }

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.ebl-form { }
.ebl-form-group { margin-bottom: 14px; }
.ebl-form-group label { display: block; font-size: .75rem; font-weight: 700; color: var(--m-text-muted, #64748b);
    text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.ebl-form-static { padding: 6px 0; font-weight: 600; font-size: .95rem; }
.ebl-items-header { display: flex; align-items: center; margin-bottom: 8px; padding: 8px 0; border-bottom: 1px solid var(--m-border, #dee2e6); }
.ebl-items-header strong { font-size: .85rem; }
.ebl-totals-preview { display: flex; gap: 24px; padding: 12px 0 4px; font-size: .85rem; color: var(--m-text-muted, #64748b); }
.ebl-totals-preview strong { color: var(--m-text, #1e293b); }

/* ── Tab bar (shared: admin panels, tenant detail) ───────────────────────────── */
.ebl-tab-bar { display: flex; gap: 2px; border-bottom: 2px solid var(--m-border, #dee2e6); margin-bottom: 0; }
.ebl-tab-btn { border: none; background: none; padding: 7px 16px; font-size: .82rem; font-weight: 600;
    color: var(--m-text-muted, #64748b); cursor: pointer; border-radius: 6px 6px 0 0;
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; }
.ebl-tab-btn:hover { color: var(--m-accent, #2272b5); }
.ebl-tab-btn.active { color: var(--m-accent, #2272b5); border-bottom-color: var(--m-accent, #2272b5); background: rgba(34,114,181,.05); }

/* ── Settings ───────────────────────────────────────────────────────────────── */
.ebl-settings-wrap { padding: 16px; }
.ebl-settings-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid var(--m-border, #dee2e6); }
.ebl-stab { border: none; background: none; padding: 8px 18px; font-size: .85rem; font-weight: 600;
    color: var(--m-text-muted, #64748b); cursor: pointer; border-radius: 6px 6px 0 0;
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; }
.ebl-stab:hover { color: var(--m-accent, #2272b5); }
.ebl-stab.active { color: var(--m-accent, #2272b5); border-bottom-color: var(--m-accent, #2272b5); background: rgba(34,114,181,.05); }
.ebl-settings-section { background: var(--m-surface, #fff); border: 1px solid var(--m-border, #dee2e6);
    border-radius: var(--m-radius, 6px); padding: 20px; max-width: 680px; }
.ebl-settings-content .ebl-items-table { border: 1px solid var(--m-border, #dee2e6); border-radius: var(--m-radius, 6px); overflow: hidden; }

/* ── Table toolbar new button spacing ──────────────────────────────────────── */
#table-container { overflow: hidden; }
.btn-xs { padding: 2px 8px; font-size: .75rem; }
