/* Al Waseem Accounting — design system
   Hand-authored (no build step required) so Phase 1 runs on any PHP host
   with zero Node/npm dependency. Section 62/63 "clean, minimal, corporate". */

:root {
    --color-bg: #f3f5f8;
    --color-surface: #ffffff;
    --color-border: #e3e7ee;
    --color-text: #1c2430;
    --color-text-muted: #6b7484;
    --color-primary: #0f3d5c;
    --color-primary-dark: #0a2c43;
    --color-accent: #0e8a6d;
    --color-accent-soft: #e5f5f0;
    --color-danger: #c0392b;
    --color-danger-soft: #fbeae8;
    --color-warning: #b7791f;
    --color-warning-soft: #fdf3e0;
    --color-gold: #b8860b;
    --color-gold-dark: #93690a;
    --color-gold-soft: #fdf1d8;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.08);
    --sidebar-width: 250px;
    --topbar-height: 64px;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a { color: inherit; }

/* ---------- App shell ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--color-primary-dark);
    color: #dbe6ee;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar__brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--color-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.sidebar__brand-text strong { color: #fff; font-size: 14px; }
.sidebar__brand-text span { font-size: 11px; color: #9db3c4; }

.sidebar__nav { padding: 10px 0 24px; }

.sidebar__section { padding: 10px 0; }
.sidebar__section-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #6f8ba0;
    padding: 8px 18px 4px;
}

.sidebar__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 18px;
    font-size: 13.5px;
    color: #cbdbe6;
    text-decoration: none;
    border-left: 3px solid transparent;
}
.sidebar__link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar__link--active {
    background: rgba(14, 138, 109, 0.18);
    border-left-color: var(--color-accent);
    color: #fff;
    font-weight: 600;
}
.sidebar__link--soon {
    display: flex;
    justify-content: space-between;
    padding: 9px 18px;
    font-size: 13.5px;
    color: #5f7688;
    cursor: default;
}
.sidebar__link--soon em {
    font-style: normal;
    font-size: 10px;
    background: rgba(255,255,255,0.08);
    padding: 1px 6px;
    border-radius: 100px;
}

.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(10,15,20,0.5); z-index: 20;
}

/* ---------- Main column ---------- */

.app-shell__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar__menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
}

.topbar__title { font-size: 16px; font-weight: 700; margin: 0; }
.topbar__spacer { flex: 1; }

.branch-selector__select {
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary-dark);
}

.topbar__user { position: relative; }
.topbar__user-btn {
    display: flex; align-items: center; gap: 8px;
    background: none; border: none; cursor: pointer; padding: 6px;
    border-radius: var(--radius-sm);
}
.topbar__user-btn:hover { background: var(--color-bg); }
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.topbar__user-name { font-size: 13px; font-weight: 600; }

.topbar__user-menu {
    position: absolute; right: 0; top: 44px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    padding: 10px;
    z-index: 30;
}
.topbar__user-menu-email {
    font-size: 12px; color: var(--color-text-muted);
    padding: 4px 8px 10px; border-bottom: 1px solid var(--color-border); margin-bottom: 6px;
}
.topbar__user-menu a, .topbar__logout {
    display: block; width: 100%; text-align: left;
    padding: 8px; border-radius: var(--radius-sm);
    text-decoration: none; font-size: 13px; color: var(--color-text);
    background: none; border: none; cursor: pointer; font-family: inherit;
}
.topbar__user-menu a:hover, .topbar__logout:hover { background: var(--color-bg); }
.topbar__logout { color: var(--color-danger); }

.app-shell__content { padding: 24px; flex: 1; }

/* ---------- Page header ---------- */

.page-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.page-header__title { margin: 0 0 4px; font-size: 20px; }
.page-header__subtitle { margin: 0; color: var(--color-text-muted); font-size: 13px; }
.page-header__filters { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
    padding: 6px 12px; border-radius: 100px; font-size: 12.5px; font-weight: 600;
    background: var(--color-primary); color: #fff; cursor: pointer;
}
.chip--muted { background: var(--color-surface); color: var(--color-text-muted); border: 1px solid var(--color-border); }

/* ---------- Cards ---------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}
.stat-card--emphasis { border-color: var(--color-accent); background: var(--color-accent-soft); }
.stat-card__label { font-size: 12px; color: var(--color-text-muted); margin-bottom: 8px; font-weight: 600; }
.stat-card__value { font-size: 20px; font-weight: 700; color: var(--color-primary-dark); }

/* ---------- Panels & tables ---------- */

.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}
.panel__header {
    padding: 16px 18px; border-bottom: 1px solid var(--color-border);
}
.panel__header h3 { margin: 0; font-size: 14.5px; }

.empty-state {
    padding: 28px 18px; text-align: center; color: var(--color-text-muted); font-size: 13px;
}

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left; padding: 12px 18px; background: var(--color-bg);
    color: var(--color-text-muted); font-weight: 600; font-size: 12px;
    border-bottom: 1px solid var(--color-border);
}
.data-table td { padding: 12px 18px; border-bottom: 1px solid var(--color-border); }
.data-table tbody tr:hover { background: var(--color-bg); }
.table-link { color: var(--color-primary); font-weight: 600; text-decoration: none; }
.table-link:hover { text-decoration: underline; }

/* ---------- Badges ---------- */

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 100px;
    font-size: 11.5px; font-weight: 700;
}
.badge--muted { background: #eef1f5; color: var(--color-text-muted); }
.badge--success { background: var(--color-accent-soft); color: var(--color-accent); }
.badge--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge--warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge--info { background: #e7eef4; color: var(--color-primary); }

/* ---------- Forms & buttons ---------- */

.form-label { display: block; font-size: 12.5px; font-weight: 600; margin: 14px 0 6px; }
.form-input {
    width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--color-border); font-size: 14px; font-family: inherit;
}
.form-input:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.form-hint { font-size: 12px; color: var(--color-text-muted); margin: 4px 0 0; }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 18px; border-radius: var(--radius-sm); border: none;
    font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-dark); }
.btn--block { width: 100%; margin-top: 18px; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 10px; }
.alert--error { background: var(--color-danger-soft); color: var(--color-danger); }
.alert--warning { background: var(--color-warning-soft); color: var(--color-warning); }
.alert--info { background: var(--color-accent-soft); color: var(--color-accent); }

/* ---------- Auth pages ---------- */

.auth-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--color-primary-dark);
}
.auth-card {
    width: 380px; background: var(--color-surface); border-radius: var(--radius-lg);
    padding: 32px; box-shadow: var(--shadow-md);
}
.auth-card__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-card__subtitle { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.auth-form { display: flex; flex-direction: column; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .sidebar {
        position: fixed; left: -100%; top: 0; z-index: 25; transition: left .2s ease;
    }
    .sidebar--open { left: 0; }
    .topbar__menu-toggle { display: block; }
}

/* ---------- Phase 2: additional form controls ---------- */

.form-select, .form-textarea {
    width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--color-border); font-size: 14px; font-family: inherit;
    background: var(--color-surface); color: var(--color-text);
}
.form-select:focus, .form-textarea:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select[disabled], .form-input[disabled] { background: var(--color-bg); color: var(--color-text-muted); cursor: not-allowed; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 20px; }
.form-grid .form-label { margin-top: 14px; }
.form-checkbox-row { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; }
.form-checkbox-row input[type="checkbox"] { width: 16px; height: 16px; }
.form-checkbox-row label { font-size: 13px; font-weight: 600; }
.form-error { color: var(--color-danger); font-size: 12px; margin: 4px 0 0; }
.form-section-title { font-size: 13px; font-weight: 700; margin: 22px 0 4px; color: var(--color-primary-dark); }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.checkbox-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 16px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 12px; background: var(--color-bg); }
.checkbox-list label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkbox-list input[type="checkbox"] { width: 15px; height: 15px; }

/* ---------- Phase 2: buttons ---------- */

.btn--secondary { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
.btn--secondary:hover { background: var(--color-bg); }
.btn--danger { background: var(--color-danger); color: #fff; }
.btn--danger:hover { background: #a13324; }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }
.btn--ghost { background: none; color: var(--color-primary); padding: 6px 10px; }
.btn--ghost:hover { background: var(--color-bg); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Phase 2: toolbar & filters ---------- */

.toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 16px;
}
.toolbar__search { flex: 1; min-width: 200px; }
.toolbar__search input { width: 100%; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); font-size: 13.5px; }
.toolbar__filter select { padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); font-size: 13px; }
.toolbar__note { font-size: 12px; color: var(--color-text-muted); width: 100%; }

/* ---------- Phase 2: pagination ---------- */

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px; font-size: 12.5px; color: var(--color-text-muted); }
.pagination__links { display: flex; gap: 6px; }
.pagination__links a, .pagination__links span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 30px; border-radius: var(--radius-sm);
    border: 1px solid var(--color-border); text-decoration: none; color: var(--color-text); font-size: 12.5px;
}
.pagination__links a:hover { background: var(--color-bg); }
.pagination__links span.is-current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); font-weight: 700; }
.pagination__links span.is-disabled { color: var(--color-text-muted); opacity: .5; }

/* ---------- Phase 2: row actions dropdown ---------- */

.row-actions { position: relative; text-align: right; }
.row-actions__toggle { background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: var(--radius-sm); color: var(--color-text-muted); }
.row-actions__toggle:hover { background: var(--color-bg); }
.row-actions__menu {
    position: absolute; right: 0; top: 32px; z-index: 20; min-width: 170px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 6px; text-align: left;
}
.row-actions__menu a, .row-actions__menu button {
    display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm);
    text-decoration: none; font-size: 13px; color: var(--color-text); background: none; border: none; cursor: pointer; font-family: inherit;
}
.row-actions__menu a:hover, .row-actions__menu button:hover { background: var(--color-bg); }
.row-actions__menu button.is-danger { color: var(--color-danger); }

/* ---------- Phase 2: confirm dialog modal ---------- */

.modal-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-card { background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); width: 100%; max-width: 400px; padding: 22px; }
.modal-card h3 { margin: 0 0 10px; font-size: 16px; }
.modal-card p { margin: 0 0 18px; font-size: 13.5px; color: var(--color-text-muted); }
.modal-card__actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Phase 2: toast ---------- */

.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.toast { padding: 12px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-md); font-size: 13.5px; }
.toast--success { background: var(--color-accent-soft); color: var(--color-accent); border: 1px solid var(--color-accent); }
.toast--error { background: var(--color-danger-soft); color: var(--color-danger); border: 1px solid var(--color-danger); }
.toast--warning { background: var(--color-warning-soft); color: var(--color-warning); border: 1px solid var(--color-warning); }

/* ---------- Phase 2: tabs ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 18px; }
.tabs a { padding: 10px 16px; text-decoration: none; font-size: 13.5px; font-weight: 600; color: var(--color-text-muted); border-bottom: 2px solid transparent; }
.tabs a.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.info-note { font-size: 12px; color: var(--color-text-muted); background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; }
.text-muted { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- UI/UX overhaul: gold accent button ---------- */

.btn--gold { background: var(--color-gold); color: #fff; }
.btn--gold:hover { background: var(--color-gold-dark); }
.btn--gold .btn__icon { margin-right: 6px; }

/* ---------- UI/UX overhaul: drawer (right-side slide-in) ---------- */

.drawer-backdrop {
    position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
    z-index: 55; display: flex; justify-content: flex-end;
}
.drawer-panel {
    background: var(--color-surface); width: 100%; max-width: 560px;
    height: 100vh; overflow-y: auto; box-shadow: var(--shadow-md);
    display: flex; flex-direction: column;
}
.drawer-panel--wide { max-width: 760px; }
.drawer-panel__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; background: var(--color-surface); z-index: 2;
}
.drawer-panel__header h3 { margin: 0; font-size: 16px; }
.drawer-panel__close {
    background: none; border: none; font-size: 18px; cursor: pointer;
    color: var(--color-text-muted); line-height: 1; padding: 4px;
}
.drawer-panel__close:hover { color: var(--color-text); }
.drawer-panel__body { padding: 20px 22px; flex: 1; }
.drawer-panel__footer {
    padding: 16px 22px; border-top: 1px solid var(--color-border);
    display: flex; justify-content: flex-end; gap: 10px;
    position: sticky; bottom: 0; background: var(--color-surface);
}

/* ---------- UI/UX overhaul: searchable selector (customer/item) ---------- */

.selector { position: relative; }
.selector__input-row { display: flex; gap: 6px; }
.selector__input {
    width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--color-border); font-size: 14px; font-family: inherit;
}
.selector__input:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.selector-dropdown {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-md);
    max-height: 320px; overflow-y: auto; padding: 6px;
}
.selector-result {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    border-radius: var(--radius-sm); cursor: pointer;
}
.selector-result:hover, .selector-result.is-active { background: var(--color-bg); }
.selector-result__avatar {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.selector-result__body { min-width: 0; flex: 1; }
.selector-result__title { font-size: 13.5px; font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selector-result__subtitle { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selector-dropdown__empty { padding: 14px 10px; text-align: center; font-size: 13px; color: var(--color-text-muted); }
.selector-dropdown__action {
    display: flex; align-items: center; gap: 8px; padding: 10px;
    border-top: 1px solid var(--color-border); margin-top: 4px;
    font-size: 13px; font-weight: 600; color: var(--color-primary);
    cursor: pointer; background: none; border-left: none; border-right: none; border-bottom: none;
    width: 100%; text-align: left; font-family: inherit;
}
.selector-dropdown__action:hover { background: var(--color-bg); }
.selector__selected {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    background: var(--color-bg);
}
.selector__selected-clear { background: none; border: none; cursor: pointer; color: var(--color-text-muted); font-size: 15px; padding: 2px 6px; }
.selector__selected-clear:hover { color: var(--color-danger); }

/* ---------- UI/UX overhaul: stat card row groupings ---------- */

.stat-card-row__label {
    font-size: 13px; font-weight: 700; color: var(--color-primary-dark);
    margin: 4px 0 10px; padding-top: 6px; border-top: 1px dashed var(--color-border);
}
.stat-card-row__label:first-child { border-top: none; padding-top: 0; }

/* ---------- UI/UX overhaul: pill tabs (Quick Entry) ---------- */

.tabs--pill { border-bottom: none; gap: 0; background: var(--color-bg); border-radius: var(--radius-sm); padding: 3px; display: inline-flex; margin-bottom: 20px; }
.tabs--pill button { border: none; background: none; font-family: inherit; padding: 9px 18px; font-size: 13.5px; font-weight: 600; color: var(--color-text-muted); cursor: pointer; border-radius: var(--radius-sm); }
.tabs--pill button.is-active { background: var(--color-primary-dark); color: #fff; }

/* ---------- UI/UX overhaul: repeatable payment rows (split payments) ---------- */

.payment-rows { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 12px; background: var(--color-bg); }
.payment-rows__row { display: grid; grid-template-columns: 1fr 1fr 140px auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.payment-rows__row:last-child { margin-bottom: 0; }
.payment-rows__remove { background: none; border: none; color: var(--color-danger); cursor: pointer; font-size: 16px; padding: 4px 8px; }
.payment-rows__add { margin-top: 6px; }
.payment-rows__totals { display: flex; gap: 18px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border); font-size: 13px; }
.payment-rows__totals strong { color: var(--color-primary-dark); }

@media (max-width: 640px) {
    .drawer-panel { max-width: 100%; }
    .payment-rows__row { grid-template-columns: 1fr; }
}

/* ==========================================================
   Al Waseem UI 2026 — reference-site visual system
   Applied as a non-destructive presentation layer over Phase 4.
   ========================================================== */
:root{
  --color-bg:#F1F1EA;
  --color-surface:#FCFCF9;
  --color-border:#D5D6CB;
  --color-text:#1E2521;
  --color-text-muted:#5C655F;
  --color-primary:#0E6E58;
  --color-primary-dark:#185044;
  --color-accent:#0E6E58;
  --color-accent-soft:#E3EEE9;
  --color-danger:#B3432E;
  --color-danger-soft:#F5E7E2;
  --color-warning:#B4842A;
  --color-warning-soft:#F5EDDD;
  --color-gold:#B4842A;
  --color-gold-dark:#93691E;
  --color-gold-soft:#F5EDDD;
  --radius-sm:6px;
  --radius-md:9px;
  --radius-lg:10px;
  --shadow-sm:0 1px 2px rgba(30,37,33,.035);
  --shadow-md:0 8px 28px rgba(30,37,33,.10);
  --sidebar-width:220px;
  --topbar-height:58px;
}
html,body{font-family:'IBM Plex Sans',-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:var(--color-bg);font-size:14px}
h1,h2,.page-header__title{font-family:'Fraunces',Georgia,serif;letter-spacing:-.015em;color:var(--color-text)}
.mono,.stat-card__value,.amount,.amt,td[data-money]{font-family:'IBM Plex Mono',ui-monospace,monospace;font-variant-numeric:tabular-nums}
.sidebar{background:#1E2521;color:#C7CDC5}
.sidebar__brand{padding:21px 20px 18px;border-bottom:1px solid rgba(241,241,234,.14);gap:9px}
.sidebar__brand-mark{width:34px;height:34px;border-radius:7px;background:#0E6E58;font-family:'Fraunces',serif;font-size:12px}
.sidebar__brand-text strong{font-family:'Fraunces',serif;font-size:17px;color:#FCFCF9}
.sidebar__brand-text span{font-size:9.5px;letter-spacing:1.3px;text-transform:uppercase;color:#9CA79E}
.sidebar__section{padding:7px 0}
.sidebar__section-label{color:#78827B;font-size:9.5px;letter-spacing:.11em;padding:8px 20px 4px}
.sidebar__link,.sidebar__link--soon{padding:8px 20px;font-size:13px;border-left-width:3px}
.sidebar__link:hover{background:rgba(241,241,234,.06);color:#FCFCF9}
.sidebar__link--active{background:rgba(241,241,234,.09);border-left-color:#B4842A;color:#FCFCF9;font-weight:500}
.sidebar__link--soon{color:#606A63}.sidebar__link--soon em{background:rgba(241,241,234,.07);color:#89928C}
.topbar{background:#FCFCF9;border-bottom-color:var(--color-border);padding:0 28px}
.topbar__title{font-family:'Fraunces',serif;font-size:16px;font-weight:600}
.avatar{background:#0E6E58}
.branch-selector__select{background:#F7F7F1;border-color:var(--color-border);color:var(--color-text);font-weight:500}
.app-shell__content{padding:28px 34px 54px}
.page-header{align-items:center;margin-bottom:20px}.page-header__title{font-size:24px;font-weight:600}.page-header__subtitle{font-size:12.5px;margin-top:3px}
.card-grid{gap:12px;margin-bottom:22px;grid-template-columns:repeat(auto-fit,minmax(175px,1fr))}
.stat-card{border-radius:9px;padding:15px 17px;box-shadow:none;background:#FCFCF9}
.stat-card--emphasis{border-color:#B9D1C8;background:#F8FBF9}
.stat-card__label{font-size:10.5px;text-transform:uppercase;letter-spacing:.075em;margin-bottom:5px;color:#69716C}
.stat-card__value{font-size:22px;font-weight:600;color:#1E2521}.stat-card--emphasis .stat-card__value{color:#0E6E58}
.panel{background:#FCFCF9;border-color:var(--color-border);border-radius:9px;box-shadow:none}
.panel__header{padding:13px 16px;background:#FAFAF6;border-bottom-color:var(--color-border)}
.panel__header h3{font-family:'Fraunces',serif;font-size:15px;font-weight:600}
.table-wrap{border:1px solid var(--color-border);border-radius:9px;background:#FCFCF9}
table{font-size:12.75px}th{background:#E8E8DF!important;color:#343B37;font-size:11.5px;letter-spacing:.015em;font-weight:600}th,td{padding:8px 12px!important;border-color:#DDDED4!important}tbody tr:hover{background:#F8F8F3}
td.amount,th.amount,td.amt,th.amt{text-align:right;font-family:'IBM Plex Mono',monospace;font-variant-numeric:tabular-nums}
.btn{border-radius:6px;min-height:34px;padding:7px 13px;font-weight:600;font-size:12.75px;box-shadow:none;transition:background-color .12s,border-color .12s,color .12s}
.btn--primary{background:#0E6E58}.btn--primary:hover{background:#0A5A48}.btn--gold{background:#B4842A}.btn--gold:hover{background:#966F23}
.btn--secondary{background:#FCFCF9;border-color:#CFCFC5}.btn--secondary:hover{background:#F1F1EA}
.btn--danger{background:#B3432E}.btn--ghost{color:#0E6E58}
.toolbar{background:transparent!important;border:0!important;padding:0!important;margin-bottom:14px;gap:8px}.toolbar__filter{gap:5px}.toolbar__filter select,.toolbar input,.toolbar select{background:#FCFCF9!important;border-color:#CFCFC5!important;min-height:34px;padding:7px 10px!important}
.form-label{font-size:10.5px!important;letter-spacing:.055em;text-transform:uppercase;color:#5C655F;font-weight:600!important;margin-bottom:5px!important}
.form-control,input[type=text],input[type=email],input[type=number],input[type=date],input[type=password],input[type=tel],select,textarea{border-color:#CFCFC5!important;border-radius:6px!important;background:#FCFCF9;color:#1E2521;min-height:36px;box-shadow:none!important}
.form-control:focus,input:focus,select:focus,textarea:focus{outline:none!important;border-color:#0E6E58!important;box-shadow:0 0 0 2px rgba(14,110,88,.10)!important}
.form-grid{gap:0 18px}.form-grid .form-label{margin-top:12px}
.alert{border-radius:7px;box-shadow:none}.badge,.status-badge{border-radius:999px;font-size:10.5px;font-weight:600;letter-spacing:.01em}
.tabs{gap:0}.tabs a{padding:9px 13px}.tabs a.is-active{color:#0E6E58;border-bottom-color:#0E6E58}
.tabs--pill{background:#E8E8DF;border-radius:7px}.tabs--pill button{border-radius:5px;padding:8px 15px}.tabs--pill button.is-active{background:#1E2521}
.selector__input,.selector__selected{border-color:#CFCFC5;background:#FCFCF9;border-radius:6px;min-height:38px}.selector__input:focus{outline:none;border-color:#0E6E58;box-shadow:0 0 0 2px rgba(14,110,88,.10)}
.selector-dropdown{border-color:#CFCFC5;border-radius:8px;box-shadow:var(--shadow-md)}.selector-result:hover,.selector-result.is-active{background:#F1F1EA}.selector-result__avatar{background:#0E6E58}.selector-dropdown__action{color:#0E6E58}
.drawer-backdrop,.modal-backdrop{background:rgba(30,37,33,.42)}.drawer-panel,.modal-card{background:#FCFCF9}.drawer-panel__header,.drawer-panel__footer{background:#FCFCF9;border-color:#D5D6CB}.drawer-panel__header h3,.modal-card h3{font-family:'Fraunces',serif;font-weight:600}
.payment-rows{background:#F7F7F1;border-color:#D5D6CB}.payment-rows__totals strong{color:#1E2521}
.info-note{background:#F7F7F1;border-color:#D5D6CB}
@media(max-width:1000px){:root{--sidebar-width:220px}.app-shell__content{padding:22px}.sidebar{position:fixed;left:-230px;z-index:60;transition:left .18s}.sidebar.sidebar--open{left:0}.topbar__menu-toggle{display:block}}
@media(max-width:640px){.app-shell__content{padding:16px 12px 80px}.page-header__title{font-size:21px}.page-header{align-items:flex-start}.card-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.stat-card{padding:12px}.stat-card__value{font-size:18px}.form-grid{grid-template-columns:1fr}.topbar{padding:0 12px}.topbar__user-name{display:none}}
