/* ============================================================================
   JiL Rev - Revenue Management System
   Application stylesheet
   ============================================================================ */

:root {
    --ink: #10241f;
    --ink-soft: #33463f;
    --muted: #6c7c75;
    --brand: #0f6b52;
    --brand-dark: #0a4f3d;
    --brand-soft: #e7f2ed;
    --gold: #c8a24a;
    --gold-soft: #f6efdd;
    --paper: #f5f2ea;
    --card: #ffffff;
    --line: #e4dfd2;
    --line-soft: #efece2;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --warn: #b54708;
    --warn-soft: #fef4e6;
    --ok: #067647;
    --ok-soft: #e7f6ef;
    --shadow-sm: 0 1px 2px rgba(16, 36, 31, 0.05);
    --shadow-md: 0 2px 6px rgba(16, 36, 31, 0.06), 0 18px 40px -28px rgba(16, 36, 31, 0.45);
    --radius: 16px;
    --radius-sm: 10px;
    --serif: Arial, Helvetica, sans-serif;
    --sans: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 14px;
    color: var(--ink);
    background: var(--paper);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }

.ico { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }

.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; }

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

.app { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 266px;
    padding: 22px 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #dcebe4;
    background:
        radial-gradient(140% 90% at 0% 0%, rgba(200, 162, 74, 0.16), transparent 55%),
        linear-gradient(180deg, #0c3028 0%, #08221c 100%);
    z-index: 40;
    overflow-y: auto;
}

.sidebar::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 18px 18px;
    opacity: 0.5;
}

.sidebar > * { position: relative; z-index: 1; }

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 6px 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 12px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--gold);
    flex: none;
}

.brand-mark img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.brand-mark .ico { width: 24px; height: 24px; }

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b {
    font-family: var(--serif);
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.brand-text i { font-style: normal; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(220, 235, 228, 0.55); margin-top: 4px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-group { margin-top: 12px; }
.nav-group:first-child { margin-top: 0; }
.nav-label {
    display: block;
    padding: 0 12px 6px;
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(220, 235, 228, 0.45);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 10px;
    color: rgba(232, 243, 238, 0.82);
    font-size: 13.2px;
    font-weight: 500;
    text-decoration: none;
    position: relative;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav-item.active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--gold);
}
.nav-item.active .nav-ico { color: var(--gold); }
.nav-ico { display: inline-grid; place-items: center; color: rgba(220, 235, 228, 0.6); }
.nav-ico .ico { width: 17px; height: 17px; }

.sidebar-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 12px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11px;
    color: rgba(220, 235, 228, 0.5);
    margin-top: 16px;
}
.foot-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18); }

.app-main {
    margin-left: 266px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 30px;
    background: rgba(245, 242, 234, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.heading { min-width: 0; flex: 1; }
.heading h1 { font-size: 21px; line-height: 1.15; }
.heading p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.menu-btn { display: none !important; }

.topbar-user { display: flex; align-items: center; gap: 10px; }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-dark);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex: none;
}

.who { display: flex; flex-direction: column; line-height: 1.2; max-width: 200px; }
.who b { font-size: 12.8px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who i { font-style: normal; font-size: 11px; color: var(--muted); }

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-soft);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: #fff; border-color: var(--line); }

.content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 26px 30px 48px;
    flex: 1;
}

.app-foot {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 30px 26px;
    font-size: 11.5px;
    color: var(--muted);
    border-top: 1px solid var(--line-soft);
}

.nav-scrim { display: none; }

/* ---------------------------------------------------------------------------
   Typography helpers and page heads
   --------------------------------------------------------------------------- */

.eyebrow {
    font-size: 10.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--brand);
    font-weight: 700;
}

.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.page-intro h2 { font-size: 24px; }
.page-intro p { color: var(--muted); font-size: 13px; margin-top: 4px; max-width: 70ch; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

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

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 0;
}

.card-head h2 { font-size: 16.5px; }
.card-head .sub { font-size: 12.3px; color: var(--muted); margin-top: 3px; }
.card-body { padding: 18px 22px 22px; }
.card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    border-top: 1px solid var(--line-soft);
    background: #fdfcf8;
    border-radius: 0 0 var(--radius) var(--radius);
}

.card + .card { margin-top: 20px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn:hover { text-decoration: none; }
.btn .ico { width: 16px; height: 16px; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-busy { opacity: 0.6; cursor: default; }

.btn-primary {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(0, 0, 0, 0.12) 100%), var(--brand);
    border-color: #0c5a46;
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 10px 18px -14px rgba(10, 79, 61, 0.95);
}
.btn-primary:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(0, 0, 0, 0.14) 100%), var(--brand-dark);
    border-color: var(--brand-dark);
}

.btn-ghost {
    background: #fff;
    color: var(--ink-soft);
    border-color: #e0dacb;
    box-shadow: 0 1px 2px rgba(16, 36, 31, 0.05);
}
.btn-ghost:hover {
    border-color: var(--brand);
    color: var(--brand-dark);
    background: #fff;
    box-shadow: 0 4px 10px -6px rgba(15, 107, 82, 0.35);
}

.btn-quiet { background: transparent; color: var(--brand); border-color: transparent; padding: 0 8px; }
.btn-quiet:hover { background: var(--brand-soft); }

.btn-danger {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(0, 0, 0, 0.12) 100%), var(--danger);
    border-color: #8f1c12;
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 8px 16px -12px rgba(149, 29, 19, 0.9);
}
.btn-danger:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(0, 0, 0, 0.14) 100%), #951d13;
    border-color: #951d13;
}

.btn-sm { height: 33px; padding: 0 12px; font-size: 12.3px; border-radius: 9px; }
.btn-sm .ico { width: 14px; height: 14px; }

.btn-lg { height: 46px; padding: 0 22px; font-size: 14px; border-radius: 12px; }
.btn-block { width: 100%; }

.btn.is-busy .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
.btn-ghost.is-busy .spinner { border-color: rgba(16, 36, 31, 0.2); border-top-color: var(--brand); }

@keyframes spin { to { transform: rotate(360deg); } }

.row-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
}
.row-btn:hover { background: var(--brand-soft); color: var(--brand-dark); }
.row-btn .ico { width: 15px; height: 15px; }
.row-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: span 2; }
.head-details-card .card-head { padding-left: 31px; padding-right: 31px; }
.head-details-card .card-body { padding-left: 31px; padding-right: 31px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 600; color: #43524c; letter-spacing: 0.01em; }
.req { color: var(--danger); font-weight: 700; }

.input, .select, textarea.input {
    width: 100%;
    height: 41px;
    padding: 0 13px;
    border-radius: var(--radius-sm);
    border: 1px solid #d9d3c4;
    background: #fff;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea.input { height: auto; min-height: 88px; padding: 10px 13px; resize: vertical; }
.input::placeholder { color: #9aa69f; }
.input:focus, .select:focus, textarea.input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 107, 82, 0.12);
}
.input:disabled, .input[readonly] { background: #f6f4ee; color: #58655f; }
.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1); }

.select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236c7c75' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

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; appearance: textfield; }

.search-box { position: relative; display: flex; align-items: center; }
.search-box .ico { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search-box .input { padding-left: 34px; }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }
.form-actions.left { justify-content: flex-start; }

.segmented { display: inline-flex; background: #f0ede4; border-radius: 11px; padding: 4px; gap: 4px; }
.segmented button {
    border: 0;
    background: transparent;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: var(--sans);
    font-size: 12.6px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}
.segmented button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

.type-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.type-choice button {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    padding: 12px 14px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: #fff;
    font-family: var(--sans);
    cursor: pointer;
    color: var(--ink);
}
.type-choice button:hover { border-color: #cfc8b6; background: #fbf9f3; }
.type-choice button.active { border-color: var(--brand); background: var(--brand-soft); }
.type-choice button:disabled { opacity: 0.75; cursor: default; }
.type-choice-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid #c9c2b2;
    display: grid;
    place-items: center;
    flex: none;
}
.type-choice-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.type-choice button.active .type-choice-dot { border-color: var(--brand); }
.type-choice button.active .type-choice-dot::after { background: var(--brand); }
.type-choice-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.type-choice-text b { font-size: 12.8px; font-weight: 700; }
.type-choice-text i { font-style: normal; font-size: 11.5px; color: var(--muted); line-height: 1.35; }

@media (max-width: 560px) {
    .type-choice { grid-template-columns: minmax(0, 1fr); }
}

.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13px; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid #c9c2b2;
    background: #fff;
    display: grid;
    place-items: center;
    flex: none;
    margin-top: 1px;
    color: #fff;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.check .box .ico { width: 12px; height: 12px; opacity: 0; }
.check input:checked + .box { background: var(--brand); border-color: var(--brand); }
.check input:checked + .box .ico { opacity: 1; }
.check input:focus-visible + .box { box-shadow: 0 0 0 3px rgba(15, 107, 82, 0.16); }

/* Picker */

.picker { position: relative; }
.picker-trigger {
    width: 100%;
    height: 41px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid #d9d3c4;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-family: var(--sans);
    font-size: 13.5px;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
}
.picker-trigger:hover { border-color: #cfc8b6; }
.picker-trigger .ico { width: 15px; height: 15px; color: var(--muted); flex: none; }
.picker.open .picker-trigger { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 107, 82, 0.12); }
.picker-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-text.placeholder { color: #9aa69f; }

.picker-pop {
    position: fixed;
    z-index: 300;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 50px -18px rgba(16, 36, 31, 0.4);
    overflow: hidden;
}
.picker-search { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); }
.picker-search .ico { width: 15px; height: 15px; color: var(--muted); flex: none; }
.picker-search input {
    flex: 1;
    border: 0;
    outline: 0;
    font-family: var(--sans);
    font-size: 13.5px;
    background: transparent;
    padding: 4px 0;
    min-width: 0;
}
.picker-list { max-height: 268px; overflow-y: auto; padding: 6px; }
.picker-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 0;
    background: transparent;
    border-radius: 8px;
    font-family: var(--sans);
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
}
.picker-item:hover, .picker-item.active { background: #f4f1e8; }
.picker-item.selected { color: var(--brand-dark); font-weight: 600; }
.picker-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.picker-tick { width: 14px; height: 14px; color: var(--brand); opacity: 0; }
.picker-item.selected .picker-tick { opacity: 1; }
.picker-clear { color: var(--danger); font-weight: 600; }
.picker-none { padding: 14px 12px; font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------------------
   Badges, chips, toolbar
   --------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.off { background: #f1efe8; color: #6b7a74; }
.badge.neutral { background: #f4f1e8; color: #55645e; }
.badge.gold { background: var(--gold-soft); color: #8a6a1c; }
.badge.brand { background: var(--brand-soft); color: var(--brand-dark); }

.switch {
    position: relative;
    width: 34px;
    height: 20px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid #d8d2c3;
    background: #ece8dc;
    cursor: pointer;
    flex: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 36, 31, 0.25);
    transition: transform 0.15s ease;
}
.switch.on { background: var(--brand); border-color: var(--brand); }
.switch.on::after { transform: translateX(14px); }
.switch.off { background: var(--danger-soft); border-color: #e7b4ad; }
.switch.off::after { background: var(--danger); }
.head-status { display: inline-flex; align-items: center; gap: 7px; flex: none; white-space: nowrap; }
.switch-label { font-size: 11.5px; color: var(--muted); }
.switch-label.off { color: var(--danger); font-weight: 600; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    height: 32px;
    padding: 0 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-family: var(--sans);
    font-size: 12.3px;
    font-weight: 600;
    cursor: pointer;
}
.chip:hover { border-color: #cfc8b6; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 22px 0;
}
.toolbar .search-box { min-width: 250px; }
.toolbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.community-filter { width: 240px; }

@media (max-width: 560px) {
    .toolbar-actions { width: 100%; }
    .toolbar-actions .btn-primary { flex: 1 1 100%; }
    .community-filter { width: 100%; }
    .category-filter { width: 100%; }
}

/* ---------------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
.table-wrap.is-scroll {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d3ccbc transparent;
}
.table-wrap.is-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: inset 0 -1px 0 var(--line);
}
.table-wrap.is-scroll::-webkit-scrollbar { width: 10px; }
.table-wrap.is-scroll::-webkit-scrollbar-track { background: transparent; }
.table-wrap.is-scroll::-webkit-scrollbar-thumb {
    background: #d9d2c2;
    border-radius: 999px;
    border: 3px solid var(--card);
}
.table-wrap.is-scroll::-webkit-scrollbar-thumb:hover { background: #c6bda9; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: #fdfcf8;
    white-space: nowrap;
}
.table th:first-child { padding-left: 22px; }
.table th:last-child { padding-right: 22px; }
.table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
    vertical-align: middle;
}
.table td:first-child { padding-left: 22px; }
.table td:last-child { padding-right: 22px; }
.table tbody tr:hover { background: #fbf9f3; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .strong { font-weight: 600; }
.table th.center, .table td.center { text-align: center; }
.table .sub-line { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; }

.code-pill {
    display: inline-flex;
    align-items: center;
    height: 25px;
    padding: 0 9px;
    border-radius: 7px;
    background: #f4f1e8;
    color: #43524c;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

.avatar-cell { display: flex; align-items: center; gap: 11px; }
.avatar-cell .avatar { width: 34px; height: 34px; font-size: 11px; background: #eef3f0; }

/* ---------------------------------------------------------------------------
   Empty, loading, skeletons
   --------------------------------------------------------------------------- */

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 44px 24px;
    gap: 6px;
}
.empty-ico {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #f5f2e9;
    color: #9aa69f;
    display: grid;
    place-items: center;
    margin-bottom: 6px;
}
.empty-ico .ico { width: 21px; height: 21px; }
.empty b { font-size: 14px; }
.empty p { font-size: 12.5px; color: var(--muted); max-width: 42ch; }

.loading-block { padding: 24px; position: relative; }
.loading-label { display: block; margin-top: 14px; font-size: 12px; color: var(--muted); }
.skeleton {
    background: linear-gradient(90deg, #f1eee5 25%, #f8f6ef 37%, #f1eee5 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease infinite;
    border-radius: 8px;
}
.sk-line { height: 12px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------------------------------------------------------------------
   KPI cards
   --------------------------------------------------------------------------- */

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}
.kpi::after {
    content: "";
    position: absolute;
    right: -28px;
    top: -28px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--brand-soft);
    opacity: 0.55;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }
.kpi-label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kpi-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; }
.kpi-ico .ico { width: 16px; height: 16px; }
.kpi-value { font-family: var(--serif); font-size: 31px; line-height: 1; position: relative; z-index: 1; }
.kpi-hint { font-size: 11.8px; color: var(--muted); position: relative; z-index: 1; }

/* ---------------------------------------------------------------------------
   Toasts
   --------------------------------------------------------------------------- */

.toasts {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(360px, calc(100vw - 40px));
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: 12px;
    padding: 13px 14px;
    box-shadow: 0 18px 40px -18px rgba(16, 36, 31, 0.45);
    animation: toast-in 0.24s ease;
}
.toast.out { animation: toast-out 0.2s ease forwards; }
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--danger); }
.toast-ico { color: var(--brand); flex: none; margin-top: 1px; }
.toast.ok .toast-ico { color: var(--ok); }
.toast.warn .toast-ico { color: var(--warn); }
.toast.error .toast-ico { color: var(--danger); }
.toast-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.toast-body b { font-size: 12.5px; }
.toast-body span { font-size: 12.6px; color: var(--ink-soft); }
.toast-x { border: 0; background: transparent; color: #9aa69f; cursor: pointer; padding: 2px; }
.toast-x .ico { width: 14px; height: 14px; }

@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------------------------------------------------------------------------
   Modal
   --------------------------------------------------------------------------- */

.modal-wrap {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-back {
    position: absolute;
    inset: 0;
    background: rgba(11, 30, 25, 0.5);
    backdrop-filter: blur(3px);
    animation: fade-in 0.16s ease;
}
.modal {
    position: relative;
    width: min(560px, 100%);
    max-height: calc(100vh - 48px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 30px 80px -24px rgba(6, 24, 19, 0.6);
    display: flex;
    flex-direction: column;
    animation: modal-in 0.2s ease;
}
.modal.lg { width: min(760px, 100%); }
.modal.sm { width: min(440px, 100%); }
.modal-wrap.out .modal { animation: modal-out 0.16s ease forwards; }
.modal-wrap.out .modal-back { animation: fade-out 0.16s ease forwards; }

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 0;
}
.modal-head h3 { font-size: 19px; }
.modal-head p { font-size: 12.7px; color: var(--muted); margin-top: 4px; }
.modal-x {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: #f5f2e9;
    color: var(--muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex: none;
}
.modal-x:hover { background: #ece8dc; color: var(--ink); }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 22px;
    border-top: 1px solid var(--line-soft);
    background: #fdfcf8;
    border-radius: 0 0 18px 18px;
}
.confirm .modal-body { padding-top: 4px; color: var(--ink-soft); font-size: 13.5px; }
.confirm .modal-head { padding-bottom: 8px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px); } }

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

.auth-body {
    background: #0b2a23;
    min-height: 100vh;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.auth-brand {
    position: relative;
    overflow: hidden;
    color: #eef6f2;
    padding: 64px 64px 34px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        radial-gradient(100% 80% at 10% 0%, rgba(200, 162, 74, 0.22), transparent 60%),
        radial-gradient(80% 70% at 100% 100%, rgba(63, 176, 138, 0.22), transparent 60%),
        linear-gradient(155deg, #0d352b 0%, #08221c 100%);
}
.auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: 0.6;
}
.auth-brand::after {
    content: "";
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    right: -220px;
    bottom: -220px;
    box-shadow: 0 0 0 60px rgba(255, 255, 255, 0.02), 0 0 0 120px rgba(255, 255, 255, 0.016);
}
.auth-brand-inner { position: relative; z-index: 1; max-width: 520px; }

.auth-mark {
    width: 62px;
    height: 62px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    display: grid;
    place-items: center;
    color: var(--gold);
    margin-bottom: 40px;
    overflow: hidden;
}
.auth-mark img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.auth-mark .ico { width: 30px; height: 30px; }

.auth-kicker {
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(238, 246, 242, 0.6);
    margin-bottom: 14px;
}
.auth-brand h1 {
    font-size: clamp(44px, 5vw, 66px);
    line-height: 0.98;
    color: #fff;
    letter-spacing: -0.02em;
}
.auth-lead {
    margin-top: 22px;
    font-size: 14.5px;
    line-height: 1.6;
    color: rgba(238, 246, 242, 0.72);
    max-width: 46ch;
}
.auth-points { list-style: none; margin: 30px 0 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.auth-points li { display: flex; align-items: center; gap: 11px; font-size: 13px; color: rgba(238, 246, 242, 0.8); }
.auth-points span { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); flex: none; }
.auth-brand-foot {
    position: relative;
    z-index: 1;
    font-size: 11.5px;
    color: rgba(238, 246, 242, 0.42);
}

.auth-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background: var(--paper);
}
.auth-card {
    width: min(430px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 30px 60px -30px rgba(16, 36, 31, 0.4);
    padding: 34px 34px 30px;
}
.auth-card h2 { font-size: 25px; }
.auth-card .auth-sub { font-size: 13px; color: var(--muted); margin-top: 6px; margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .btn { margin-top: 4px; }
.auth-foot { margin-top: 22px; font-size: 11.5px; color: var(--muted); }

.auth-switch { margin-top: 18px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------------------------------------------------------------------------
   Heads tree
   --------------------------------------------------------------------------- */

.head-card-head { align-items: center; }
.head-count { font-size: 12px; }
.head-toolbar { padding: 16px 22px 0; }
.head-tree-head {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin: 14px 12px 0;
    padding: 0 12px 9px 48px;
    border-bottom: 1px solid var(--line);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}
.head-tree-head[hidden] { display: none; }
.head-tree-head .head-col { flex: 1; }
.head-tree-head .head-status-head { width: 106px; }
.head-tree-head .head-num { width: 78px; text-align: right; }
.head-tree-head .head-act { width: 30px; }
.head-tree { padding: 4px 12px 16px; }

.head-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    box-shadow: inset 0 -1px 0 var(--line-soft);
    position: relative;
}
.head-row:hover { background: #faf8f2; }
.head-row.selected { background: var(--brand-soft); border-color: #cde4da; }
.head-row.head-sub { margin-left: 26px; }
.head-tree > .head-row:last-child,
.head-tree > .head-subs:last-child > .head-row:last-child { box-shadow: none; }

.head-toggle {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 0;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex: none;
}
.head-toggle:hover { background: #ece8dc; color: var(--ink); }
.head-toggle.blank { visibility: hidden; }
.head-toggle .ico { width: 14px; height: 14px; }

.tree-elbow { width: 24px; flex: none; position: relative; }
.tree-elbow::before {
    content: "";
    position: absolute;
    left: 11px;
    top: -12px;
    bottom: 50%;
    width: 1px;
    background: #ddd7c8;
}
.tree-elbow::after {
    content: "";
    position: absolute;
    left: 11px;
    top: 50%;
    width: 10px;
    height: 1px;
    background: #ddd7c8;
}

.head-line { flex: 1; min-width: 0; }
.head-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.head-name { font-size: 13.4px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-status-cell { width: 106px; flex: none; display: flex; align-items: center; }
.head-stats { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); flex: none; }
.head-stats span { width: 78px; text-align: right; font-variant-numeric: tabular-nums; }
.head-stats b { color: var(--ink-soft); font-weight: 700; }
.head-actions { display: flex; gap: 4px; flex: none; }
.head-subs { padding-top: 4px; }

/* Categories grouped under revenue heads */
.cat-tree-head { padding-left: 48px; }
.cat-tree-head .cat-num { width: 60px; text-align: right; }
.cat-tree-head .cat-date { width: 132px; }
.cat-group-count { font-size: 11.5px; font-weight: 600; color: var(--muted); flex: none; }
.cat-tree .head-sub .head-name { color: var(--ink-soft); font-weight: 500; }
.cat-rates { width: 60px; flex: none; text-align: right; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-rates b { color: var(--ink-soft); font-weight: 700; }

/* Fee fixing grouped by fee item */
.fee-tree-head { padding-left: 48px; }
.fee-tree-head .fee-col-desc { flex: 1; }
.fee-tree-head .fee-col-rate { width: 130px; text-align: right; }
.fee-tree .head-title { overflow: hidden; }
.fee-tree .head-title .head-name { flex: 0 0 auto; }
.fee-tree .head-sub .head-name { flex: 0 1 auto; }
.fee-tree .head-row.head-sub { margin-left: 0; }
.fee-tree .head-sub .head-title { padding-left: 26px; }
.fee-tree .head-actions { width: 30px; flex: none; }
.fee-tree .fee-desc {
    flex: 1;
    min-width: 0;
    font-size: 12.4px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fee-tree .fee-rate {
    width: 130px;
    flex: none;
    text-align: right;
    font-size: 12.4px;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
}
.fee-tree .fee-rate b { font-weight: 700; }
.fee-tree .fee-rate span { font-size: 10.5px; color: var(--muted); margin-left: 5px; }
.fee-tree .head-sub .head-name { color: var(--ink-soft); font-weight: 500; }

/* Fee fixing schedule table */
.fee-list-toolbar {
    padding: 16px 22px;
    background: #faf9f4;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
}
.fee-schedule-host { padding: 10px 14px 16px; overflow-x: auto; }
.fee-schedule-host.is-scroll {
    padding-top: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d3ccbc transparent;
}
.fee-schedule-host.is-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}
.fee-schedule-host.is-scroll::-webkit-scrollbar { width: 10px; }
.fee-schedule-host.is-scroll::-webkit-scrollbar-track { background: transparent; }
.fee-schedule-host.is-scroll::-webkit-scrollbar-thumb {
    background: #d9d2c2;
    border-radius: 999px;
    border: 3px solid var(--card);
}
.fee-schedule-host.is-scroll::-webkit-scrollbar-thumb:hover { background: #c6bda9; }
.fee-schedule { width: 100%; border-collapse: separate; border-spacing: 0; }
.fee-schedule th {
    text-align: left;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
    font-weight: 700;
    background: #f7f5ee;
    border: 0;
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    padding: 10px 14px;
}
.fee-schedule thead th { border-top: 1px solid var(--line-soft); }
.fee-schedule th:first-child { border-left: 1px solid var(--line-soft); }
.fee-schedule td {
    border: 0;
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    padding: 9px 14px;
    font-size: 13px;
    vertical-align: middle;
}
.fee-schedule td:first-child { border-left: 1px solid var(--line-soft); }
.fee-schedule th.sn, .fee-schedule td.sn { width: 68px; color: var(--muted); }
.fee-schedule th.amt, .fee-schedule td.amt { width: 150px; text-align: right; font-variant-numeric: tabular-nums; }
.fee-schedule tr.schedule-part td {
    background: #faf8f1;
    font-weight: 700;
    font-size: 11.5px;
    letter-spacing: 0.04em;
    color: var(--brand-dark);
}
.fee-schedule tr.schedule-item td { font-weight: 600; }
.fee-schedule tr.schedule-cat td { padding-top: 5px; padding-bottom: 5px; }
.fee-schedule tr.schedule-cat td.item-name { padding-left: 34px; font-weight: 400; color: var(--ink-soft); }
.fee-schedule tr.schedule-cat .muted { color: var(--muted); }
.fee-schedule .row-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid #f0cfae;
    border-radius: 8px;
    background: var(--warn-soft);
    color: var(--warn);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.fee-schedule .row-edit:hover {
    background: #fde8d0;
    border-color: #e6bb8c;
    color: #92400e;
}
.fee-schedule .row-edit .ico { width: 13px; height: 13px; }
@media (max-width: 760px) {
    .fee-tree-head .fee-col-desc,
    .fee-tree .fee-desc { display: none; }
    .fee-tree-head .fee-col-rate { width: 88px; }
    .fee-tree .fee-rate { width: 88px; }
}
@media (max-width: 560px) {
    .fee-tree .head-row { gap: 8px; }
    .fee-tree .fee-rate { width: 72px; }
    .fee-tree-head .fee-col-rate { width: 72px; }
    .fee-tree .head-status-cell { width: auto; }
    .fee-tree-head .head-status-head { width: 34px; }
    .fee-tree .head-actions { width: 26px; }
    .fee-tree .switch-label { display: none; }
}
.cat-date { width: 132px; flex: none; font-size: 11.5px; }
.category-filter { width: 240px; }

.cat-list { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.cat-row { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; }
.cat-row:hover { background: #faf8f2; }
.cat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cat-main b { font-size: 12.8px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-main span { font-size: 11px; color: var(--muted); }

.existing-list { display: flex; flex-direction: column; gap: 2px; }
.existing-list .cat-row { display: grid; grid-template-columns: minmax(0, 320px) 96px; align-items: center; gap: 11px; justify-content: start; }
.existing-list .cat-main { display: block; min-width: 0; }
.existing-list .cat-main b { display: block; }

.attach-block { padding: 4px 0 0; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: #43524c; margin-bottom: 8px; }
.field-note { font-size: 11.5px; color: var(--muted); line-height: 1.4; margin: -2px 0 9px; }
.attach-list { display: flex; flex-direction: column; gap: 6px; max-height: 190px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.attach-item { padding: 6px 8px; border-radius: 8px; align-items: center; }
.attach-item:hover { background: #faf8f2; }
.attach-text { font-size: 12.5px; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sub-list-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px;
    gap: 8px;
    padding: 0 2px 7px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.sub-list { display: flex; flex-direction: column; gap: 8px; }
.sub-line { display: grid; grid-template-columns: minmax(0, 1fr) 30px; gap: 8px; align-items: center; }
.sub-line .row-btn { margin-top: 0; }

/* ---------------------------------------------------------------------------
   Fee fixing
   --------------------------------------------------------------------------- */

.fee-head { display: flex; flex-direction: column; gap: 3px; }
.fee-head b { font-size: 13px; }
.fee-head span { font-size: 11.5px; color: var(--muted); }
.rate-lines { display: flex; flex-direction: column; gap: 9px; }
.rate-line {
    display: grid;
    grid-template-columns: minmax(150px, 0.9fr) minmax(180px, 1.3fr) 120px 34px;
    gap: 9px;
    align-items: start;
    padding: 10px;
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    background: #fdfcf8;
}
.rate-line .picker-trigger, .rate-line .input, .rate-line .select { height: 38px; }
.rate-line-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; padding: 0 2px; }
.rate-line-labels {
    display: grid;
    grid-template-columns: minmax(150px, 0.9fr) minmax(180px, 1.3fr) 120px 34px;
    gap: 9px;
    padding: 0 11px 6px;
}
.rate-line-labels span { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.line-remove { margin-top: 4px; }

.fee-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.fee-tools .file-name { margin-top: 0; }
.fee-tools-actions { display: inline-flex; gap: 8px; }
.fee-tools-result { margin-bottom: 14px; }
.fee-summary { font-size: 12px; color: var(--muted); }
.fee-summary b { color: var(--ink); }

.file-name { font-size: 12px; color: var(--brand-dark); font-weight: 600; margin-top: 8px; }

.error-list { margin: 0; padding: 10px 10px 10px 28px; background: var(--danger-soft); border-radius: 10px; color: #7a1c12; font-size: 12.3px; max-height: 220px; overflow-y: auto; }
.error-list li { margin: 3px 0; }

/* ---------------------------------------------------------------------------
   Audit
   --------------------------------------------------------------------------- */

.audit-row { display: flex; gap: 14px; padding: 13px 22px; border-bottom: 1px solid var(--line-soft); }
.audit-row:last-child { border-bottom: 0; }
.audit-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); margin-top: 6px; flex: none; box-shadow: 0 0 0 4px var(--brand-soft); }
.audit-main { flex: 1; min-width: 0; }
.audit-main b { font-size: 12.8px; }
.audit-main p { font-size: 12px; color: var(--muted); margin-top: 1px; }
.audit-when { font-size: 11px; color: var(--muted); white-space: nowrap; }
.audit-who { font-size: 11.5px; color: var(--ink-soft); font-weight: 600; }

/* ---------------------------------------------------------------------------
   Scope builder (cashiers)
   --------------------------------------------------------------------------- */

.scope-list { display: flex; flex-direction: column; gap: 10px; }
.scope-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fdfcf8; }
.scope-head { display: flex; align-items: center; gap: 10px; }
.scope-head .grow { flex: 1; min-width: 0; }
.scope-head b { font-size: 12.8px; display: block; }
.scope-head span { font-size: 11.5px; color: var(--muted); }
.scope-mode { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.scope-communities { margin-top: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; max-height: 180px; overflow-y: auto; padding: 8px; border: 1px solid var(--line-soft); border-radius: 9px; background: #fff; }
.scope-communities .check { font-size: 12.3px; }

/* ---------------------------------------------------------------------------
   Misc
   --------------------------------------------------------------------------- */

.notice {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: #fdfcf8;
    font-size: 12.5px;
    color: var(--ink-soft);
}
.notice .ico { color: var(--brand); margin-top: 1px; }
.notice.warn { background: var(--warn-soft); border-color: #f4dcb8; }
.notice.warn .ico { color: var(--warn); }
.notice.bad { background: var(--danger-soft); border-color: #f6cfca; }
.notice.bad .ico { color: var(--danger); }

.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.detail-list .wide { grid-column: span 2; }
.detail-item span { display: block; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.detail-item b { font-size: 13.5px; font-weight: 600; display: block; margin-top: 3px; }

/* ---------------------------------------------------------------------------
   Assembly profile
   --------------------------------------------------------------------------- */

.profile-split { align-items: stretch; }
.profile-split > .card { display: flex; flex-direction: column; }
.profile-split > .card > .card-body { flex: 1; display: flex; flex-direction: column; }

.asset-list { display: flex; flex-direction: column; flex: 1; }
.asset-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    padding: 18px 0;
}
.asset-row:first-child { padding-top: 0; }
.asset-row + .asset-row { border-top: 1px solid var(--line-soft); }

.asset-preview {
    width: 96px;
    height: 96px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: inset 0 0 0 1px #fff, 0 10px 20px -22px rgba(16, 36, 31, 0.6);
    display: grid;
    place-items: center;
    overflow: hidden;
}
.asset-preview img { width: 100%; height: 100%; object-fit: contain; padding: 9px; }
.asset-preview .ico { width: 26px; height: 26px; color: #b7b0a0; }

.asset-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.asset-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.asset-note { font-size: 11.5px; color: var(--muted); }
.asset-copy .upload-duo { align-self: flex-start; margin-top: 3px; }
.asset-copy .upload-status { font-size: 11.5px; }
.asset-copy .upload-status:empty { display: none; }
.asset-copy .btn-quiet { align-self: flex-start; height: 30px; padding: 0 6px; font-size: 12px; color: var(--muted); }
.asset-copy .btn-quiet:hover { color: var(--danger); background: var(--danger-soft); }
.asset-designation {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
}

.profile-savebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    padding: 12px 14px 12px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}
.profile-savebar-meta { display: flex; align-items: center; gap: 9px; font-size: 11.8px; color: var(--muted); min-width: 0; }
.profile-savebar-meta .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(6, 118, 71, 0.12);
    flex: none;
}
.profile-savebar-meta span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.alert-success .modal { width: min(420px, 100%); overflow: hidden; }
.alert-success .modal-head {
    justify-content: center;
    text-align: center;
    padding: 30px 56px 0;
}
.alert-success .modal-head h3 { font-size: 21px; letter-spacing: -0.01em; }
.alert-success .modal-head .modal-x { position: absolute; top: 14px; right: 14px; }
.alert-success .modal-body { padding: 8px 28px 0; }
.alert-success .modal-foot { justify-content: center; }
.alert-success .modal-foot .btn { min-width: 148px; }

.alert-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 14px 0 22px;
    text-align: center;
}
.alert-mark .alert-ico {
    position: relative;
    width: 82px;
    height: 82px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--brand-dark);
    background: radial-gradient(circle at 32% 26%, #ffffff 0%, #eaf5ef 46%, #d9ecdf 100%);
    border: 1px solid rgba(200, 162, 74, 0.5);
    box-shadow: 0 0 0 8px rgba(15, 107, 82, 0.06), 0 18px 34px -22px rgba(10, 79, 61, 0.75);
    animation: alert-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.alert-mark .alert-ico::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 1px dashed rgba(200, 162, 74, 0.55);
}
.alert-mark .alert-ico svg { width: 36px; height: 36px; }
.alert-tick {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: alert-tick 0.55s 0.18s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.alert-mark p { font-size: 13.2px; line-height: 1.55; color: var(--muted); max-width: 34ch; }

.alert-timer {
    height: 4px;
    border-radius: 999px;
    background: var(--line-soft);
    overflow: hidden;
    margin-bottom: 18px;
}
.alert-timer i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand) 0%, #3f9c7f 100%);
    animation: alert-countdown 3s linear forwards;
}
.alert-2s .alert-timer i { animation-duration: 2s; }

@keyframes alert-pop {
    from { opacity: 0; transform: scale(0.72); }
    to { opacity: 1; transform: none; }
}
@keyframes alert-tick {
    to { stroke-dashoffset: 0; }
}
@keyframes alert-countdown {
    from { width: 100%; }
    to { width: 0; }
}

.alert-10s .alert-timer i { animation-duration: 10s; }

.fee-upload {
    position: fixed;
    inset: 0;
    z-index: 550;
    display: grid;
    place-items: center;
    background: rgba(8, 24, 20, 0.38);
    animation: fee-upload-in 0.16s ease-out;
}
.fee-upload-card {
    width: min(380px, calc(100% - 40px));
    padding: 26px 28px 24px;
    text-align: center;
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: 0 30px 60px -30px rgba(8, 30, 24, 0.55);
}
.fee-upload-title { display: block; font-size: 15px; color: var(--ink); }
.fee-upload-pct {
    display: block;
    margin: 10px 0 14px;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--brand-dark);
}
.fee-upload-bar {
    display: block;
    height: 8px;
    border-radius: 999px;
    background: var(--line-soft);
    overflow: hidden;
}
.fee-upload-bar i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand) 0%, #3f9c7f 100%);
    transition: width 0.18s ease;
}
.fee-upload.is-working .fee-upload-pct { display: none; }
.fee-upload.is-working .fee-upload-bar { margin-top: 16px; }
.fee-upload.is-working .fee-upload-bar i {
    width: 40% !important;
    animation: fee-upload-sweep 1.05s ease-in-out infinite;
}
@keyframes fee-upload-sweep {
    from { margin-left: -40%; }
    to { margin-left: 100%; }
}
@keyframes fee-upload-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 760px) {
    .asset-row { grid-template-columns: 96px minmax(0, 1fr); }
    .profile-savebar { flex-direction: column; align-items: stretch; }
    .profile-savebar .btn { width: 100%; }
}

/* ---------------------------------------------------------------------------
   Electoral area form
   --------------------------------------------------------------------------- */

.area-form { width: 100%; max-width: 900px; margin: 0 auto; }
.area-form-top { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.area-back { height: 36px; padding: 0 14px; font-size: 12.5px; }

.area-card {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #fdfbf6 100%);
    box-shadow: 0 1px 2px rgba(16, 36, 31, 0.04), 0 30px 60px -48px rgba(9, 38, 31, 0.5);
    overflow: hidden;
}

.area-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line-soft);
    background:
        radial-gradient(120% 180% at 0% 0%, rgba(15, 107, 82, 0.055) 0%, rgba(15, 107, 82, 0) 60%),
        linear-gradient(180deg, #fcfbf6 0%, #faf8f1 100%);
}

.area-card-mark {
    width: 40px;
    height: 40px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--brand-dark);
    background: #fff;
    border: 1px solid rgba(15, 107, 82, 0.16);
    box-shadow: inset 0 1px 0 #fff, 0 6px 14px -12px rgba(15, 107, 82, 0.7);
}
.area-card-mark .ico { width: 18px; height: 18px; }

.area-card-title { min-width: 0; }
.area-card-title h2 { font-size: 15.5px; font-weight: 700; letter-spacing: -0.005em; }

.area-status {
    margin-left: auto;
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f2efe6;
}
.area-status-opt { position: relative; display: inline-flex; }
.area-status-opt input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.area-status-face {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.area-status-opt input:hover + .area-status-face { color: var(--ink-soft); }
.area-status-opt input:checked + .area-status-face {
    background: #fff;
    border-color: var(--line);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(16, 36, 31, 0.08);
}
.area-status-opt input:focus-visible + .area-status-face { border-color: var(--brand); }
.area-status-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; }
.area-status-dot.is-on { background: #1a8a63; }
.area-status-dot.is-off { background: #b8ae97; }

.area-card-body { padding: 22px; }

.area-fields {
    display: grid;
    grid-template-columns: minmax(0, 0.68fr) minmax(0, 1.32fr);
    gap: 18px;
}
.area-fields.is-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.area-form .picker-trigger { height: 46px; border-radius: 12px; font-size: 14px; }
.area-form .picker.open .picker-trigger { box-shadow: none; }
.area-fields .field > label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}
.area-fields .input {
    height: 46px;
    border-radius: 12px;
    font-size: 14px;
    background: #fff;
}
.area-form .input:focus,
.area-form .select:focus { box-shadow: none; }
.area-code-input {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.area-code-input::placeholder { font-weight: 400; letter-spacing: 0.06em; }

.area-form-error { margin-top: 16px; }

.category-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.category-existing {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
}
.category-existing-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}
.category-existing-head .field-label { margin-bottom: 0; }
.category-existing-count { font-size: 11.5px; }
.category-existing .existing-list { max-height: 266px; overflow-y: auto; }
.category-existing .existing-list .cat-row { display: flex; align-items: center; gap: 11px; }
.category-existing .existing-list .cat-main { flex: 0 1 auto; max-width: 320px; margin-right: 13px; }
.category-existing .existing-list .head-status,
.category-existing .existing-list .row-btn { flex: none; }
.existing-empty { font-size: 12px; padding: 8px 10px; }

.area-savebar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 14px 16px;
    border-top: 1px solid var(--line-soft);
    background: linear-gradient(180deg, #fbf9f3 0%, #f5f1e6 100%);
}
.area-savebar-actions { display: flex; align-items: center; gap: 8px; }
.area-savebar .btn-primary {
    min-width: 122px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 12px 24px -14px rgba(10, 79, 61, 0.9);
}

@media (max-width: 700px) {
    .area-card-head { flex-wrap: wrap; row-gap: 12px; padding: 16px 18px; }
    .area-status { width: 100%; margin-left: 0; }
    .area-status-opt { flex: 1; }
    .area-status-face { width: 100%; height: 34px; justify-content: center; }
    .area-card-body { padding: 18px; }
    .area-fields { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .area-fields.is-even { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
    .area-savebar { padding: 12px; }
    .area-savebar-actions { flex: 1; justify-content: flex-end; }
    .area-savebar-actions .btn { height: 38px; padding: 0 13px; font-size: 12.5px; }
    .area-savebar .btn-primary { min-width: 0; }
}

.divider { height: 1px; background: var(--line-soft); margin: 20px 0; }

.letterhead { display: flex; align-items: center; gap: 16px; }

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

@media (max-width: 1180px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 980px) {
    .sidebar { transform: translateX(-104%); transition: transform 0.24s ease; box-shadow: 0 0 60px rgba(0, 0, 0, 0.3); }
    body.nav-open .sidebar { transform: none; }
    .app-main { margin-left: 0; }
    .menu-btn { display: inline-grid !important; }
    .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(11, 30, 25, 0.45); z-index: 35; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
    body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
    .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .auth-brand { padding: 40px 32px 28px; min-height: 340px; }
    .auth-brand h1 { font-size: 42px; }
    .auth-points { display: none; }
    .auth-panel { padding: 32px 20px 48px; }
    .cat-date { display: none; }
}

@media (max-width: 760px) {
    .topbar { padding: 12px 16px; }
    .content { padding: 18px 16px 36px; }
    .app-foot { padding: 14px 16px 22px; flex-direction: column; gap: 4px; }
    .heading h1 { font-size: 18px; }
    .heading p { display: none; }
    .who { display: none; }
    .kpi-grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .form-grid .span-2 { grid-column: span 1; }
    .rate-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .rate-line .line-remove { justify-self: end; }
    .rate-line-labels { display: none; }
    .detail-list { grid-template-columns: minmax(0, 1fr); }
    .head-stats { display: none; }
    .head-tree-head .head-num,
    .head-tree-head .head-act { display: none; }
    .cat-tree-head .cat-num,
    .head-row .cat-rates { display: none; }
    .cat-tree-head .head-act { display: block; }
    .toolbar .search-box { min-width: 0; width: 100%; }
    .auth-card { padding: 26px 22px; }
    .auth-brand { min-height: 280px; padding: 32px 24px 24px; }
    .auth-brand h1 { font-size: 34px; }
    .auth-lead { font-size: 13px; }
    .scope-communities { grid-template-columns: minmax(0, 1fr); }
    .modal { max-height: calc(100vh - 24px); }
    .modal-wrap { padding: 12px; }
}

/* ---------------------------------------------------------------------------
   Rate payers, accounts and billing
   --------------------------------------------------------------------------- */

.table-link { color: inherit; text-decoration: none; display: inline-block; }
.table-link:hover { text-decoration: none; }
.table-link:hover .strong, .table-link:hover { color: var(--brand-dark); }
.table .amount, .table th.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .amount.neg { color: var(--danger); }
.table .code-pill, .table td .code-pill { margin-left: 8px; vertical-align: middle; }
.table tfoot td { background: #fdfcf8; font-weight: 700; border-top: 1px solid var(--line); }

.payer-hero { display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 28px; align-items: start; }
.payer-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.payer-title h3 { font-size: 28px; line-height: 1.1; }
.payer-details { margin-top: 18px; }
.payer-access { margin-top: 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.payer-access > span { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.access-code {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    letter-spacing: 0.16em;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--gold-soft);
    border: 1px solid #e9d9ad;
    color: #6d5417;
}
.payer-photo { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.payer-photo .photo-frame {
    width: 96px;
    max-width: 100%;
    aspect-ratio: 4 / 5;
    border-radius: 12px;
    overflow: hidden;
    background: var(--brand-soft);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
}
.payer-photo .photo-frame img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.payer-photo .photo-empty { font-family: var(--serif); font-size: 20px; color: var(--brand-dark); opacity: 0.55; letter-spacing: 0.06em; }
.payer-photo .upload-duo {
    flex-direction: row;
    flex-wrap: nowrap;
    width: 96px;
}
.payer-photo .upload-duo .btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 34px;
    padding: 0;
    justify-content: center;
}
.payer-photo .upload-duo .btn .ico { width: 16px; height: 16px; }
.payer-signature {
    width: 100%;
    border-top: 1px solid #b9b3a4;
    padding-top: 5px;
    font-size: 9.5px;
    text-align: center;
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.payer-map-wrap { padding: 0 22px 22px; }
.map-preview { height: 250px; }
.split > .card + .card, .payer-split > .card + .card { margin-top: 0; }
.payer-split { margin-bottom: 20px; }
.payer-split .card { height: 100%; display: flex; flex-direction: column; }
.payer-split .payer-map-wrap { flex: 1; display: flex; }
.payer-split .payer-map-wrap .map { flex: 1; }

.payer-loc-split { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; padding: 0 22px 22px; }
.payer-loc-split .payer-map-wrap { padding: 0; }
@media (max-width: 760px) {
    .payer-loc-split { grid-template-columns: 1fr; }
    .payer-loc-split .photo-frame-side { max-width: 260px; min-height: 160px; }
    .payer-loc-split .payer-map-wrap .map { min-height: 220px; }
}

.photo-block { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.photo-frame {
    width: 220px;
    max-width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #f6f8f7;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 22px -14px rgba(15, 23, 42, 0.22);
}
.photo-frame img { width: 100%; height: 100%; object-fit: contain; object-position: center; background: #eef1ee; display: block; }
.photo-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    width: 100%;
    height: 100%;
    border: 1.5px dashed var(--line);
    border-radius: 12px;
    margin: 10px;
}
.photo-empty svg { width: 34px; height: 34px; opacity: 0.55; }
.photo-frame-side { width: 100%; height: 100%; min-height: 180px; aspect-ratio: auto; }
.photo-frame-side img { object-fit: cover; object-position: center; background: transparent; }
.photo-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.upload-duo {
    display: inline-flex;
    align-items: stretch;
    gap: 4px;
    padding: 4px;
    background: linear-gradient(180deg, #fbfaf6 0%, #f1eee5 100%);
    border: 1px solid var(--line);
    border-radius: 13px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 20px -18px rgba(16, 36, 31, 0.6);
}
.upload-duo .btn {
    height: 36px;
    padding: 0 18px;
    border-radius: 9px;
    font-weight: 600;
    font-size: 13px;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease,
        box-shadow 0.18s ease, transform 0.18s ease;
}
.upload-duo .up-choose {
    background: #ffffff;
    color: var(--brand-dark);
    border: 1px solid #e0dacb;
    box-shadow: 0 1px 2px rgba(16, 36, 31, 0.07);
}
.upload-duo .up-choose:hover {
    border-color: var(--brand);
    color: var(--brand);
    box-shadow: 0 4px 10px -6px rgba(15, 107, 82, 0.45);
}
.upload-duo .up-take {
    background: linear-gradient(180deg, #14715a 0%, #0a4f3d 100%);
    color: #ffffff;
    border: 1px solid #0a4f3d;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 6px 14px -9px rgba(10, 79, 61, 0.95);
}
.upload-duo .up-take:hover {
    background: linear-gradient(180deg, #178264 0%, #0b5a46 100%);
    border-color: #0b5a46;
}
.upload-duo .btn:active { transform: translateY(1px); }
.upload-duo .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.upload-status { font-size: 12.5px; color: var(--muted); }
.upload-status.has-file { color: var(--ink-soft); font-weight: 600; }
.upload-hint { font-size: 11.5px; color: var(--muted); margin-top: -2px; }

.id-photo-block { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-top: 2px; }
.id-photo-frame {
    width: 96px;
    aspect-ratio: 4 / 5;
    flex: none;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--brand-soft);
    overflow: hidden;
    display: grid;
    place-items: center;
}
.id-photo-frame img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.id-photo-frame .photo-empty { border: 0; margin: 0; gap: 0; color: var(--brand-dark); opacity: 0.5; }
.id-photo-frame .photo-empty svg { width: 30px; height: 30px; }
.id-photo-actions { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; padding-top: 2px; }
.id-photo-actions .upload-duo .btn { height: 34px; padding: 0 14px; font-size: 12.5px; }
.id-photo-actions .upload-duo .btn .ico { width: 15px; height: 15px; }

.camera-box { position: relative; background: #10141a; border-radius: 12px; overflow: hidden; }
.camera-video { display: block; width: 100%; max-height: 58vh; object-fit: contain; background: #000; }

.input-embed { position: relative; }
.input-embed .input { padding-right: 190px; }
.embed-check {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: #f2f1ea;
    border: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.embed-check:hover { border-color: var(--brand); color: var(--brand-dark); }
.embed-check input[type="checkbox"] {
    width: 13px;
    height: 13px;
    margin: 0;
    accent-color: var(--brand);
    cursor: pointer;
}
.embed-check.is-on {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #ffffff;
}
.embed-check.is-on input[type="checkbox"] { accent-color: #ffffff; }
@media (max-width: 560px) {
    .input-embed .input { padding-right: 14px; }
    .embed-check { position: static; transform: none; margin-top: 8px; height: 30px; }
    .existing-list .cat-row { grid-template-columns: minmax(0, 1fr) 96px; }
    .head-details-card .card-head,
    .head-details-card .card-body { padding-left: 18px; padding-right: 18px; }
}

.payer-mini { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.payer-mini-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.04em;
    flex: none;
}
.payer-mini-main { display: flex; flex-direction: column; margin-right: auto; min-width: 0; }
.payer-mini-main b { font-size: 15px; }
.payer-mini-main span { font-size: 12px; color: var(--muted); }
.access-mini { display: flex; flex-direction: column; align-items: flex-end; }
.access-mini span { font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; }
.access-mini b { font-family: Arial, Helvetica, sans-serif; letter-spacing: 0.1em; font-size: 13px; }

.fee-total { text-align: right; }
.fee-total span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; }
.fee-total b { font-family: var(--serif); font-size: 25px; line-height: 1.1; }

.btn-gold {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.32) 0%, rgba(0, 0, 0, 0.06) 100%), var(--gold);
    border-color: #b8903b;
    color: #2e2410;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 16px -12px rgba(200, 162, 74, 0.9);
}
.btn-gold:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(0, 0, 0, 0.08) 100%), #b8903b;
    border-color: #a57f31;
}
.btn-gold.is-busy .spinner { border-color: rgba(46, 36, 16, 0.25); border-top-color: #2e2410; }

.gps-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gps-row .input { flex: 1 1 220px; min-width: 0; }
.gps-row .btn { flex: none; }

.choice-row { display: flex; gap: 10px; }
.choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.choice input { accent-color: var(--brand); margin: 0; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }

.fee-section { border-bottom: 1px solid var(--line-soft); transition: background 0.15s ease; }
.fee-section:last-child { border-bottom: 0; }
.fee-section:hover { background: #fbfaf4; }
.fee-section-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 120px;
    gap: 22px;
    align-items: end;
    padding: 16px 22px;
}
.fee-section-row .picker-trigger { height: 40px; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.fee-section-row .picker-trigger:hover { border-color: var(--brand); }
.fee-section-row .picker-trigger:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.fee-col-label { display: block; font-size: 11px; font-weight: 600; color: #0e7490; margin-bottom: 7px; }
.fee-item { min-width: 0; }
.fee-rate { min-width: 0; position: relative; }
.fee-rate .input { height: 40px; text-align: right; font-variant-numeric: tabular-nums; background: #f6f8f7; }
.fee-tick { position: absolute; right: 12px; bottom: 12px; display: flex; color: var(--brand); pointer-events: none; }
.fee-section.is-picked .fee-rate .input { color: var(--brand-dark); border-color: rgba(20, 94, 79, 0.45); padding-right: 36px; }
.fee-section.is-missing { background: var(--danger-soft); box-shadow: inset 3px 0 0 var(--danger); }
.fee-section.is-missing .fee-col-label { color: var(--danger); }

.fee-subtotal {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    padding: 16px 22px;
    border-top: 1px solid var(--line-soft);
}
.fee-subtotal span { font-size: 13px; color: var(--ink); }
.fee-subtotal b {
    min-width: 130px;
    text-align: right;
    font-family: var(--serif);
    font-size: 20px;
    font-variant-numeric: tabular-nums;
    background: #f6f8f7;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 14px;
}


.account-checks { display: flex; flex-direction: column; }
.check-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 22px;
    border-bottom: 1px solid var(--line-soft);
    cursor: pointer;
}
.check-row:last-child { border-bottom: 0; }
.check-row:hover { background: #fbf9f3; }
.check-row.is-on { background: #fbfaf4; }
.check-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.check-main b { font-size: 13px; }
.check-main span { font-size: 11.5px; color: var(--muted); }
.check-rate { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.combine-total { display: flex; flex-direction: column; }
.combine-total span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 700; }
.combine-total b { font-family: var(--serif); font-size: 23px; line-height: 1.1; }

.confirm-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.confirm-summary .wide { grid-column: span 2; }
.confirm-summary span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 700; }
.confirm-summary b { font-size: 13px; }
.confirm-summary b.big { font-size: 21px; font-family: var(--serif); }

.bill-summary-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.bill-summary-head b { font-size: 16px; display: block; }
.bill-summary-head span { font-size: 12px; color: var(--muted); }
.bill-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.bill-summary-grid span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.bill-summary-grid b { display: block; font-size: 15px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.bill-summary-grid i { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.bill-summary-grid .due b { color: var(--danger); }

.page-intro + .notice { margin-bottom: 20px; }

/* Map */

.map {
    position: relative;
    overflow: hidden;
    background: #e8eef0;
    border-radius: 12px;
    border: 1px solid var(--line);
    min-height: 160px;
}
.map-facility { height: 380px; }
.facility-loc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; margin-top: 14px; }
.facility-loc span { display: block; font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.facility-loc b { display: block; margin-top: 3px; font-size: 13px; font-weight: 600; }
@media (max-width: 640px) {
    .map-facility { height: 300px; }
    .facility-loc { grid-template-columns: 1fr; }
}
.map-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    background: #e7ece9;
    outline: none;
}
.map-viewport:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.map-viewport.is-dragging { cursor: grabbing; }
.map-tiles { position: absolute; inset: 0; }
.map-tile { position: absolute; left: 0; top: 0; width: 256px; height: 256px; user-select: none; pointer-events: none; }
.map-offline {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(244, 246, 244, 0.94);
    padding: 18px;
}
.map-offline.hidden { display: none; }
.map-offline-box {
    max-width: 320px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #3c443f;
}
.map-offline-box b { font-size: 14.5px; }
.map-offline-box span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.map-markers { position: absolute; inset: 0; pointer-events: none; }
.map-pin { position: absolute; left: 0; top: 0; width: 0; height: 0; border: 0; background: none; padding: 0; pointer-events: auto; cursor: pointer; }
.map-pin-dot {
    position: absolute;
    left: -7px;
    top: -7px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--brand);
    border: 2px solid #fff;
    box-shadow: 0 1px 5px rgba(16, 36, 31, 0.45);
}
.map-pin-label {
    position: absolute;
    left: 50%;
    top: 9px;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 10px;
    font-weight: 700;
    color: #26332f;
    background: rgba(255, 255, 255, 0.86);
    padding: 1px 5px;
    border-radius: 5px;
    letter-spacing: 0.02em;
}
.map-pin.is-selected .map-pin-dot { background: var(--gold); box-shadow: 0 0 0 4px rgba(200, 162, 74, 0.3); }
.map-pin.is-pick .map-pin-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.18); }
.map-popup {
    position: absolute;
    z-index: 4;
    transform: translate(-50%, -108%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    padding: 10px 30px 10px 12px;
    min-width: 170px;
    max-width: 250px;
    font-size: 12px;
}
.map-popup b { display: block; font-size: 12.5px; }
.map-popup span { display: block; color: var(--muted); margin-top: 2px; font-size: 11px; }
.map-popup-link { display: inline-block; margin-top: 6px; font-weight: 600; font-size: 11.5px; }
.map-popup-close { position: absolute; top: 1px; right: 5px; border: 0; background: none; font-size: 16px; line-height: 1; color: var(--muted); cursor: pointer; padding: 3px; }
.map-controls { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.map-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 17px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(16, 36, 31, 0.18);
}
.map-btn:hover { background: #f6f4ee; }
.map-attrib { position: absolute; right: 8px; bottom: 6px; z-index: 3; background: rgba(255, 255, 255, 0.82); padding: 2px 6px; border-radius: 5px; font-size: 9px; }
.map-attrib a { color: #4a5852; text-decoration: none; }
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; background: #fbfaf5; }
.map-pick .map-viewport { cursor: crosshair; }
.map-full { height: calc(100vh - 250px); min-height: 520px; }
.map-compact { height: 280px; margin-top: 12px; }

.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: stretch; }
.map-card { overflow: hidden; }
.map-card .map { height: calc(100vh - 250px); min-height: 520px; border: 0; border-radius: var(--radius); }
.map-side { display: flex; flex-direction: column; max-height: calc(100vh - 250px); }
.map-side .toolbar { padding-bottom: 12px; }
.map-side .toolbar .search-box { min-width: 0; flex: 1; }
.map-list { flex: 1; overflow-y: auto; padding: 0 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.map-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    border: 1px solid var(--line-soft);
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    font-family: var(--sans);
    color: var(--ink);
}
.map-list-item:hover { border-color: var(--brand); background: #fbfdfc; }
.map-list-code {
    font-size: 10px;
    font-weight: 700;
    color: var(--brand-dark);
    background: var(--brand-soft);
    padding: 3px 7px;
    border-radius: 6px;
    white-space: nowrap;
    letter-spacing: 0.03em;
}
.map-list-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.map-list-main b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-list-main span { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-list-amount { text-align: right; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.map-list-amount i { display: block; font-style: normal; font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }

@media (max-width: 1180px) {
    .map-layout { grid-template-columns: minmax(0, 1fr); }
    .map-side { max-height: none; }
    .map-card .map { height: 520px; }
    .map-full { height: 520px; }
}

@media (max-width: 980px) {
    .payer-hero { grid-template-columns: minmax(0, 1fr); }
    .payer-photo { max-width: 220px; }
    .bill-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .fee-section-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .fee-rate .input { text-align: left; }
    .confirm-summary { grid-template-columns: minmax(0, 1fr); }
    .confirm-summary .wide { grid-column: span 1; }
    .map-full, .map-card .map { height: 420px; min-height: 380px; }
    .payer-access { align-items: flex-start; flex-direction: column; gap: 6px; }
}
