/* =====================================================================
   MeSeva — panel styles (admin / agent / worker / customer) + shared bits
   Brand: orange #f35525, gold #f3bd00, ink #1e1e1e
   ===================================================================== */
:root {
    --ms-brand: #f35525;
    --ms-brand-dark: #d8431a;
    --ms-gold: #f3bd00;
    --ms-ink: #1e1e1e;
    --ms-bg: #f4f6f9;
    --bs-primary: #f35525;
    --bs-primary-rgb: 243, 85, 37;
    --bs-link-color: #d8431a;
    --bs-link-color-rgb: 216, 67, 26;
    --bs-link-hover-color: #a8330f;
}

body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
.tiny { font-size: .75rem; }
.text-brand { color: var(--ms-brand) !important; }
.bg-brand { background: var(--ms-brand) !important; color: #fff; }

.btn-primary, .btn-brand {
    --bs-btn-bg: var(--ms-brand); --bs-btn-border-color: var(--ms-brand);
    --bs-btn-hover-bg: var(--ms-brand-dark); --bs-btn-hover-border-color: var(--ms-brand-dark);
    --bs-btn-active-bg: var(--ms-brand-dark); --bs-btn-active-border-color: var(--ms-brand-dark);
    --bs-btn-disabled-bg: #f6927a; --bs-btn-disabled-border-color: #f6927a;
    --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff;
}
.btn-outline-primary {
    --bs-btn-color: var(--ms-brand); --bs-btn-border-color: var(--ms-brand);
    --bs-btn-hover-bg: var(--ms-brand); --bs-btn-hover-border-color: var(--ms-brand); --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--ms-brand-dark); --bs-btn-active-border-color: var(--ms-brand-dark);
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #f9a68d; box-shadow: 0 0 0 .2rem rgba(243, 85, 37, .18);
}
.form-check-input:checked { background-color: var(--ms-brand); border-color: var(--ms-brand); }
.page-link { color: var(--ms-brand-dark); }
.active > .page-link, .page-link.active { background-color: var(--ms-brand); border-color: var(--ms-brand); }
.nav-pills .nav-link.active { background-color: var(--ms-brand); }
.nav-tabs .nav-link { color: #555; }
.nav-tabs .nav-link.active { color: var(--ms-brand-dark); font-weight: 600; }
.required::after { content: " *"; color: #dc3545; }

/* ---------------------------------------------------------------- layout: corporate sidebar
   Expanded (default) · icon rail (body.sidebar-collapsed, desktop) · off-canvas (mobile, body.sidebar-open)
   Accordion: Bootstrap .collapse with data-bs-parent → only one section open at a time.            */
:root {
    --sb-w: 264px;
    --sb-rail: 72px;
    --sb-bg: #0f172a;
    --sb-bg-2: #111c33;
    --sb-border: rgba(255, 255, 255, .06);
    --sb-text: #aab4c5;
    --sb-text-strong: #e8edf5;
    --sb-muted: #6b7a93;
    --sb-hover: rgba(255, 255, 255, .05);
    --sb-active-bg: rgba(243, 85, 37, .14);
    --sb-section-open: rgba(255, 255, 255, .03);
}
.panel { background: var(--ms-bg); }
.panel-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sb-w); position: fixed; inset: 0 auto 0 0; z-index: 1040;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--sb-bg) 0%, var(--sb-bg-2) 100%);
    color: var(--sb-text); border-right: 1px solid var(--sb-border);
    transition: width .2s ease, transform .2s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .5rem; height: 64px; padding: 0 1rem;
    border-bottom: 1px solid var(--sb-border); flex-shrink: 0;
}
.sidebar-brand-link { display: flex; align-items: center; gap: .7rem; min-width: 0; text-decoration: none; color: var(--sb-text-strong); }
.sidebar-logo {
    width: 40px; height: 40px; border-radius: 10px; background: #fff; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-logo img { object-fit: contain; }
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; overflow: hidden; }
.sidebar-brand-text strong { font-size: 1rem; letter-spacing: .02em; }
.sidebar-brand-text small { font-size: .7rem; color: var(--sb-muted); text-transform: uppercase; letter-spacing: .08em; }
.sidebar-close { margin-left: auto; color: var(--sb-text); }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: .75rem .6rem 1rem; scrollbar-width: thin; scrollbar-color: #2a3650 transparent; }
.sidebar-icon { width: 1.25rem; text-align: center; font-size: .95rem; color: var(--sb-muted); flex-shrink: 0; transition: color .15s; }
.sidebar-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-badge {
    min-width: 1.35rem; height: 1.25rem; padding: 0 .4rem; border-radius: 999px; background: #ef4444; color: #fff;
    font-size: .7rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* top-level link + section header share one look */
.sidebar-link, .sidebar-section-toggle {
    display: flex; align-items: center; gap: .75rem; width: 100%; padding: .6rem .75rem; margin-bottom: 2px;
    border: 0; border-radius: .55rem; background: transparent; color: var(--sb-text);
    font-size: .9rem; font-weight: 500; text-align: left; text-decoration: none; position: relative;
}
.sidebar-link:hover, .sidebar-section-toggle:hover { background: var(--sb-hover); color: var(--sb-text-strong); }
.sidebar-link:hover .sidebar-icon, .sidebar-section-toggle:hover .sidebar-icon { color: var(--sb-text-strong); }
.sidebar-link.active { background: var(--ms-brand); color: #fff; box-shadow: 0 6px 16px rgba(243, 85, 37, .25); }
.sidebar-link.active .sidebar-icon { color: #fff; }
.sidebar-section-toggle:focus-visible, .sidebar-link:focus-visible, .sidebar-sublink:focus-visible {
    outline: 2px solid var(--ms-gold); outline-offset: 1px;
}
.sidebar-chevron { font-size: .65rem; color: var(--sb-muted); transition: transform .2s ease; }
.sidebar-section-toggle:not(.collapsed) { color: var(--sb-text-strong); background: var(--sb-section-open); }
.sidebar-section-toggle:not(.collapsed) .sidebar-chevron { transform: rotate(180deg); }
.sidebar-section-toggle:not(.collapsed) .sidebar-icon,
.sidebar-section.is-current > .sidebar-section-toggle .sidebar-icon { color: var(--ms-brand); }

.sidebar-sub { list-style: none; margin: .15rem 0 .5rem; padding: 0 0 0 1.6rem; position: relative; }
.sidebar-sub::before { content: ""; position: absolute; left: 1.35rem; top: .25rem; bottom: .25rem; width: 1px; background: #26324a; }
.sidebar-sublink {
    display: flex; align-items: center; gap: .5rem; padding: .42rem .75rem .42rem 1rem; border-radius: .45rem;
    color: var(--sb-text); font-size: .85rem; text-decoration: none; position: relative;
}
.sidebar-sublink::before {
    content: ""; position: absolute; left: -.28rem; top: 50%; width: 7px; height: 7px; margin-top: -3.5px;
    border-radius: 50%; background: #26324a; border: 2px solid var(--sb-bg);
}
.sidebar-sublink:hover { color: var(--sb-text-strong); background: var(--sb-hover); }
.sidebar-sublink.active { color: #fff; background: var(--sb-active-bg); font-weight: 600; }
.sidebar-sublink.active::before { background: var(--ms-brand); }

.sidebar-flyout { display: none; }

.sidebar-footer {
    display: flex; align-items: center; gap: .5rem; padding: .75rem .9rem; border-top: 1px solid var(--sb-border); flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1; }
.sidebar-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sidebar-user-text strong { color: var(--sb-text-strong); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-text small { color: var(--sb-muted); font-size: .72rem; }
.sidebar-logout { color: var(--sb-text); padding: .35rem .55rem; border-radius: .45rem; }
.sidebar-logout:hover { color: #fff; background: rgba(239, 68, 68, .25); }

/* main column */
.panel-main { flex: 1; margin-left: var(--sb-w); min-width: 0; display: flex; flex-direction: column; transition: margin-left .2s ease; }
.panel-topbar {
    position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; min-height: 64px;
    background: #fff; border-bottom: 1px solid #e6e8ec; padding: .5rem 1.25rem; box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.panel-toggle {
    width: 38px; height: 38px; border-radius: .55rem; border: 1px solid #e6e8ec; color: var(--ms-ink);
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.panel-toggle:hover { background: #f4f6f9; }
.panel-heading { min-width: 0; }
.panel-title { font-size: 1.1rem; margin: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-breadcrumb { margin: 0; font-size: .78rem; --bs-breadcrumb-divider-color: #9aa3af; }
.panel-breadcrumb a { color: #6b7280; text-decoration: none; }
.panel-breadcrumb a:hover { color: var(--ms-brand-dark); }
.panel-content { padding: 1.5rem 1.25rem; flex: 1; }
.panel-footer { padding: 1rem 1.25rem; font-size: .8rem; color: #8a8f98; border-top: 1px solid #e6e8ec; background: #fff; }
.panel-backdrop { display: none; }

.avatar-circle {
    width: 32px; height: 32px; border-radius: 50%; background: var(--ms-brand); color: #fff; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem;
}
.notif-menu { width: 340px; max-height: 70vh; overflow-y: auto; }
.notif-item { white-space: normal; border-bottom: 1px solid #f0f1f3; padding: .6rem 1rem; }
.notif-item.unread { background: #fff6f2; }

/* ---------- icon rail (desktop) */
@media (min-width: 992px) {
    .sidebar-collapsed .sidebar { width: var(--sb-rail); }
    .sidebar-collapsed .panel-main { margin-left: var(--sb-rail); }
    .sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
    .sidebar-collapsed .sidebar-brand-text,
    .sidebar-collapsed .sidebar-label,
    .sidebar-collapsed .sidebar-chevron,
    .sidebar-collapsed .sidebar-user-text,
    .sidebar-collapsed .sidebar-nav .collapse,
    .sidebar-collapsed .sidebar-nav .collapsing { display: none !important; }
    .sidebar-collapsed .sidebar-nav { overflow: visible; padding: .75rem .55rem; }
    .sidebar-collapsed .sidebar-link,
    .sidebar-collapsed .sidebar-section-toggle { justify-content: center; padding: .7rem 0; }
    .sidebar-collapsed .sidebar-icon { font-size: 1.05rem; }
    /* in rail mode a section opens as a flyout (hover, keyboard focus, or click/tap via app.js) */
    .sidebar-collapsed .sidebar-section-toggle .sidebar-badge,
    .sidebar-collapsed .sidebar-link .sidebar-badge {
        position: absolute; top: 4px; right: 6px; min-width: .55rem; height: .55rem; padding: 0; font-size: 0;
    }
    .sidebar-collapsed .sidebar-footer { flex-direction: column; padding: .6rem 0; }
    .sidebar-collapsed .sidebar-user { flex: 0; }

    /* flyouts */
    .sidebar-collapsed .sidebar-section { position: relative; }
    .sidebar-collapsed .sidebar-section:hover > .sidebar-flyout,
    .sidebar-collapsed .sidebar-section:focus-within > .sidebar-flyout,
    .sidebar-collapsed .sidebar-section.flyout-open > .sidebar-flyout {
        display: block; position: absolute; left: calc(100% + 8px); top: 0; min-width: 230px; z-index: 1060;
        background: #fff; color: var(--ms-ink); border-radius: .65rem; padding: .4rem;
        box-shadow: 0 12px 32px rgba(15, 23, 42, .22); border: 1px solid #e6e8ec;
    }
    .sidebar-collapsed .sidebar-section:hover > .sidebar-flyout::before { /* hover bridge across the gap */
        content: ""; position: absolute; left: -10px; top: 0; bottom: 0; width: 10px;
    }
    .sidebar-flyout-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: #6b7280; padding: .45rem .7rem .3rem; font-weight: 600; }
    .sidebar-flyout-link {
        display: flex; align-items: center; gap: .6rem; padding: .48rem .7rem; border-radius: .45rem;
        color: #374151; font-size: .87rem; text-decoration: none;
    }
    .sidebar-flyout-link .fa { color: #9aa3af; width: 1.1rem; text-align: center; }
    .sidebar-flyout-link span:not(.sidebar-badge) { flex: 1; }
    .sidebar-flyout-link:hover { background: #fff3ee; color: var(--ms-brand-dark); }
    .sidebar-flyout-link:hover .fa, .sidebar-flyout-link.active .fa { color: var(--ms-brand); }
    .sidebar-flyout-link.active { background: #fff3ee; color: var(--ms-brand-dark); font-weight: 600; }

    /* tooltip for top-level links in rail mode */
    .sidebar-collapsed .sidebar-link:hover::after {
        content: attr(data-label); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
        background: #0f172a; color: #fff; font-size: .8rem; padding: .35rem .6rem; border-radius: .4rem; white-space: nowrap;
        box-shadow: 0 6px 16px rgba(15, 23, 42, .25); z-index: 1060;
    }
}

/* ---------- off-canvas (mobile / tablet) */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); width: min(86vw, var(--sb-w)); }
    .panel-main { margin-left: 0; }
    .sidebar-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
    .sidebar-open .panel-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1030; }
    .panel-content { padding: 1rem .85rem; }
    .panel-topbar { padding: .5rem .85rem; }
}

/* ---------------------------------------------------------------- components */
.card { border: 1px solid #e6e8ec; border-radius: .6rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid #eef0f3; font-weight: 600; }
.card-header:first-child { border-radius: .6rem .6rem 0 0; }

.stat-card { display: flex; flex-direction: row; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; height: 100%; text-decoration: none; color: inherit; }
a.stat-card:hover { box-shadow: 0 4px 14px rgba(16,24,40,.08); color: inherit; }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0; background: #fff1ec; color: var(--ms-brand);
}
.stat-icon.blue { background: #e8f1ff; color: #2563eb; }
.stat-icon.green { background: #e7f8ef; color: #16a34a; }
.stat-icon.amber { background: #fff7e0; color: #c58a00; }
.stat-icon.red { background: #fde8e8; color: #dc2626; }
.stat-icon.purple { background: #f1ebff; color: #7c3aed; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .82rem; color: #6b7280; }

.table > :not(caption) > * > * { padding: .65rem .75rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; background: #fafbfc; white-space: nowrap; }
.table-hover tbody tr:hover { background: #fffaf7; }
.table-actions { white-space: nowrap; text-align: right; }
.filter-bar { background: #fff; border: 1px solid #e6e8ec; border-radius: .6rem; padding: .85rem; margin-bottom: 1rem; }

.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
.detail-list dt { color: #6b7280; font-weight: 500; font-size: .88rem; }
.detail-list dd { margin: 0; word-break: break-word; }

.empty-state .fa { opacity: .5; }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: #e6e8ec; }
.timeline-item { position: relative; padding: 0 0 1.1rem 46px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: #fff;
    border: 2px solid #d1d5db; display: flex; align-items: center; justify-content: center; font-size: .8rem; color: #6b7280;
}
.timeline-item.is-status .timeline-dot { border-color: var(--ms-brand); color: var(--ms-brand); }
.timeline-dot.status-completed, .timeline-dot.status-closed { border-color: #16a34a !important; color: #16a34a !important; }
.timeline-dot.status-rejected, .timeline-dot.status-cancelled { border-color: #dc2626 !important; color: #dc2626 !important; }
.timeline-item.is-internal .timeline-body { background: #fafafa; border: 1px dashed #e0e0e0; border-radius: .4rem; padding: .35rem .6rem; }

/* stepper */
.stepper { display: flex; list-style: none; padding: 0; margin: 0; counter-reset: s; overflow-x: auto; }
.stepper-item { flex: 1; text-align: center; position: relative; min-width: 80px; }
.stepper-item::before {
    content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 3px; background: #e6e8ec; z-index: 0;
}
.stepper-item:first-child::before { display: none; }
.stepper-item.done::before, .stepper-item.current::before { background: var(--ms-brand); }
.stepper-dot {
    position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 2px solid #d1d5db;
    display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 600; color: #6b7280;
}
.stepper-item.done .stepper-dot { background: var(--ms-brand); border-color: var(--ms-brand); color: #fff; }
.stepper-item.current .stepper-dot { border-color: var(--ms-brand); color: var(--ms-brand); box-shadow: 0 0 0 4px rgba(243,85,37,.15); }
.stepper-label { display: block; font-size: .78rem; margin-top: .35rem; color: #6b7280; }
.stepper-item.current .stepper-label { color: var(--ms-ink); font-weight: 600; }

/* rating stars */
.stars { color: var(--ms-gold); white-space: nowrap; }
.rating-input { display: inline-flex; flex-direction: row-reverse; gap: .2rem; }
.rating-input input { display: none; }
.rating-input label { font-size: 1.6rem; color: #d1d5db; cursor: pointer; }
.rating-input input:checked ~ label, .rating-input label:hover, .rating-input label:hover ~ label { color: var(--ms-gold); }

/* skill checklist */
.skill-group { border: 1px solid #eef0f3; border-radius: .5rem; padding: .75rem 1rem; margin-bottom: .75rem; background: #fff; }
.skill-group legend { font-size: .9rem; font-weight: 600; float: none; width: auto; margin-bottom: .25rem; }

/* auth / error pages */
.error-page { background: var(--ms-bg); min-height: 100vh; display: flex; align-items: center; }
.auth-card { max-width: 480px; margin: 0 auto; }

/* invoice print */
@media print {
    .sidebar, .panel-topbar, .panel-footer, .panel-backdrop, .no-print, .breadcrumb, .alert { display: none !important; }
    .panel-main { margin: 0 !important; }
    .panel-content { padding: 0 !important; }
    .card { border: none !important; box-shadow: none !important; }
    body { background: #fff !important; }
}

/* =====================================================================
   UI KIT — shared by every panel module (use these, never module-specific variants)
   ===================================================================== */

/* ---------- drawer (all add / edit forms) */
.app-drawer { --bs-offcanvas-width: 640px; border-left: 0; box-shadow: -12px 0 40px rgba(15, 23, 42, .18); }
.app-drawer.app-drawer-md { --bs-offcanvas-width: 520px; }
.app-drawer.app-drawer-lg { --bs-offcanvas-width: 720px; }
.app-drawer.app-drawer-xl { --bs-offcanvas-width: 960px; }
@media (max-width: 767.98px) { .app-drawer, .app-drawer.app-drawer-md, .app-drawer.app-drawer-lg, .app-drawer.app-drawer-xl { --bs-offcanvas-width: 100vw; } }
.app-drawer-header { border-bottom: 1px solid #e6e8ec; padding: 1rem 1.5rem; background: #fff; }
.app-drawer-body { padding: 0; background: #f8fafc; display: flex; flex-direction: column; }
.app-drawer-body > .alert { margin: 1rem 1.5rem 0; }
.drawer-loading { display: flex; align-items: center; justify-content: center; min-height: 40vh; }

/* standard form markup (works full-page AND in the drawer):
   <form class="drawer-form" method="post"> <div class="drawer-form-body"> <section class="form-section"> <h3 class="form-section-title">…</h3> fields… </section> </div>
   <div class="drawer-form-footer"> <a href="…" class="btn btn-light" data-cancel>Cancel</a> <button class="btn btn-primary">Save</button> </div> </form> */
.drawer-form { display: flex; flex-direction: column; min-height: 100%; }
.drawer-form-body { flex: 1; padding: 1.25rem 1.5rem; }
.app-drawer .drawer-form { flex: 1; }
.form-section { background: #fff; border: 1px solid #e6e8ec; border-radius: .65rem; padding: 1rem 1.15rem; margin-bottom: 1rem; }
.form-section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #475569; margin: 0 0 .85rem; display: flex; align-items: center; gap: .5rem; }
.form-section-title .fa { color: var(--ms-brand); }
.form-section .form-label { font-size: .85rem; font-weight: 500; color: #334155; margin-bottom: .3rem; }
.form-section .form-text { font-size: .76rem; }
.drawer-form-footer {
    position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: .5rem;
    padding: .85rem 1.5rem; background: #fff; border-top: 1px solid #e6e8ec; box-shadow: 0 -6px 16px rgba(15, 23, 42, .05);
}
.drawer-form-footer .footer-note { margin-right: auto; font-size: .78rem; color: #64748b; }
.panel-content .drawer-form { max-width: 980px; }
.panel-content .drawer-form-body { padding: 0; }
.panel-content .drawer-form-footer { border-radius: .65rem; border: 1px solid #e6e8ec; margin-top: .5rem; }

/* ---------- page header: title + subtitle + primary actions */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.1rem; }
.page-header-title { font-size: 1.35rem; font-weight: 700; margin: 0; color: #0f172a; }
.page-header-sub { color: #64748b; font-size: .88rem; margin: .15rem 0 0; }
.page-header-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- status tabs with counts (clean URLs: /list/<status>) */
.status-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.status-tab {
    display: inline-flex; align-items: center; gap: .45rem; padding: .42rem .85rem; border-radius: 999px;
    border: 1px solid #e2e8f0; background: #fff; color: #475569; font-size: .85rem; font-weight: 500; text-decoration: none;
}
.status-tab:hover { border-color: #cbd5e1; color: #0f172a; }
.status-tab .count { background: #f1f5f9; color: #475569; border-radius: 999px; padding: 0 .5rem; font-size: .74rem; font-weight: 600; }
.status-tab.active { background: var(--ms-brand); border-color: var(--ms-brand); color: #fff; }
.status-tab.active .count { background: rgba(255, 255, 255, .25); color: #fff; }

/* ---------- list card: toolbar + table */
.list-card { background: #fff; border: 1px solid #e6e8ec; border-radius: .65rem; overflow: hidden; }
.list-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .85rem 1rem; border-bottom: 1px solid #eef0f3; }
.list-toolbar .search-box { position: relative; flex: 1 1 260px; max-width: 420px; }
.list-toolbar .search-box .fa { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.list-toolbar .search-box .form-control { padding-left: 2.2rem; }
.list-card .table { margin: 0; }
.list-card .table thead th { border-top: 0; }
.list-card .table thead th a { color: inherit; text-decoration: none; }
.list-card .table thead th a:hover { color: var(--ms-brand-dark); }
.list-card .list-footer { padding: .6rem 1rem; border-top: 1px solid #eef0f3; }
.list-card .list-footer > .d-flex { margin-top: 0 !important; }

/* ---------- row actions */
.row-actions { display: inline-flex; gap: .3rem; justify-content: flex-end; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: .45rem; }

/* ---------- detail header card */
.detail-header { background: #fff; border: 1px solid #e6e8ec; border-radius: .65rem; padding: 1.1rem 1.25rem; margin-bottom: 1rem;
    display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.detail-header-main { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.detail-header-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.detail-header-meta { color: #64748b; font-size: .85rem; display: flex; flex-wrap: wrap; gap: .25rem .9rem; }

/* tables: keep visually-hidden header text from causing horizontal page scroll on phones */
.table-responsive { position: relative; }
.progress-thin { height: 6px; border-radius: 999px; }
/* filter form inside a dropdown menu */
.dropdown-form { width: min(20rem, 90vw); padding: .85rem; }
/* status tabs scroll sideways on phones instead of wrapping into many rows */
@media (max-width: 575.98px) {
    .status-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: .25rem; margin-right: -.85rem; }
    .status-tabs::-webkit-scrollbar { display: none; }
    .status-tab { flex-shrink: 0; }
}
/* drawer footer on phones: wrap, hide the note so buttons keep their labels */
.drawer-form-footer { flex-wrap: wrap; }
@media (max-width: 575.98px) { .drawer-form-footer .footer-note { display: none; } }
/* misc kit helpers requested by modules */
.avatar-lg { width: 56px; height: 56px; font-size: 1.3rem; }
.option-list { max-height: 340px; overflow: auto; }
.progress-cell .progress { min-width: 110px; }
.option-item.is-selected { background: #fff3ee; border-color: #f9a68d; }

/* ---------- printable invoice document (shared by admin + customer invoice pages) */
.invoice-doc { position: relative; background: #fff; color: #1e1e1e; font-size: .92rem; }
    .invoice-doc .inv-brand img { background: #fff; object-fit: contain; }
    .invoice-doc .inv-title { font-size: 1.5rem; font-weight: 700; letter-spacing: .04em; color: #f35525; margin: 0; }
    .invoice-doc .inv-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; font-weight: 600; margin-bottom: .25rem; }
    .invoice-doc .inv-meta td { padding: .1rem 0 .1rem .9rem; }
    .invoice-doc .inv-meta td:first-child { color: #6b7280; padding-left: 0; }
    .invoice-doc table.inv-items thead th { background: #f7f7f8; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: #4b5563; }
    .invoice-doc table.inv-items td, .invoice-doc table.inv-items th { padding: .5rem .6rem; }
    .invoice-doc .inv-totals td { padding: .25rem .6rem; }
    .invoice-doc .inv-totals .inv-grand td { font-size: 1.05rem; font-weight: 700; border-top: 2px solid #1e1e1e; }
    .invoice-doc .inv-totals .inv-balance td { font-weight: 700; color: #b42318; }
    .invoice-doc .inv-box { border: 1px solid #e6e8ec; border-radius: .5rem; padding: .75rem 1rem; height: 100%; }
    .invoice-doc .inv-stamp { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg);
        font-size: 5rem; font-weight: 800; letter-spacing: .2em; opacity: .12; pointer-events: none; user-select: none; }
    .invoice-doc .inv-stamp.void { color: #b42318; }
    .invoice-doc .inv-stamp.draft { color: #6b7280; }
    .invoice-doc .inv-stamp.paid { color: #16a34a; }
    @media print {
        @page { margin: 12mm; }
        .invoice-doc { font-size: 10pt; }
        .invoice-doc table.inv-items td, .invoice-doc table.inv-items th { padding: .3rem .5rem; }
        .invoice-doc .inv-totals td { padding: .12rem .5rem; }
        .invoice-doc tr, .invoice-doc .inv-box { page-break-inside: avoid; }
        .invoice-doc .inv-stamp { opacity: .18; }
        .invoice-doc .badge { border: 1px solid #999; color: #000 !important; background: transparent !important; }
        .invoice-doc a { color: inherit; text-decoration: none; }
    }
.icon-tile { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: #fff1ec; color: var(--ms-brand); flex-shrink: 0; }

/* ---------- e-mail templates (gmeva → E-mail templates): sandboxed HTML preview, plain-text version, template switcher */
.email-preview-frame { display: block; width: 100%; height: 720px; border: 0; background: #f4f6f9; }
.email-text { margin: 0; max-height: 720px; overflow: auto; background: #f8fafc; font-size: .82rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.email-template-nav { --bs-list-group-active-bg: var(--ms-brand); --bs-list-group-active-border-color: var(--ms-brand); }
@media (min-width: 992px) { .email-template-nav { max-height: 860px; overflow-y: auto; } }
@media (max-width: 575.98px) { .email-preview-frame { height: 600px; } }
