:root {
    --bg: #f4f7f6;
    --panel: #ffffff;
    --line: #d6e0df;
    --text: #1f2a2e;
    --muted: #66777f;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --highlight: #f59e0b;
    --sidebar: #172326;
    --danger: #b45309;
    --shadow: 0 18px 60px rgba(20, 32, 38, .12);
    --font-family: Inter, Arial, Helvetica, sans-serif;
    --font-scale: 1;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
    margin: 0;
    font-family: var(--font-family);
    font-size: calc(16px * var(--font-scale));
    background: var(--bg);
    color: var(--text);
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font: inherit; }
label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}
input, select, textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid color-mix(in srgb, var(--line) 78%, var(--accent));
    border-radius: 10px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--bg) 22%, #fff));
    color: var(--text);
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 1px 2px rgba(15, 23, 42, .04);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%),
        linear-gradient(180deg, #fff, color-mix(in srgb, var(--bg) 22%, #fff));
    background-position:
        calc(100% - 18px) 19px,
        calc(100% - 13px) 19px,
        0 0;
    background-size: 5px 5px, 5px 5px, 100% 100%;
    background-repeat: no-repeat;
    padding-right: 40px;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    background-color: #fff;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent), 0 10px 24px rgba(15, 23, 42, .07);
}
input.price-warning {
    border-color: var(--highlight);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--highlight) 18%, transparent);
}
textarea { min-height: 92px; resize: vertical; }
button, .primary, .secondary, .icon-button {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}
.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    padding: 12px 16px;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 24%, transparent);
}
.secondary {
    background: color-mix(in srgb, var(--accent) 9%, #fff);
    color: var(--text);
    padding: 12px 16px;
    border: 1px solid var(--line);
}
.icon-button {
    width: 42px;
    height: 42px;
    background: color-mix(in srgb, var(--accent) 10%, #fff);
    color: var(--text);
    border: 1px solid var(--line);
    font-size: 22px;
}
.full { width: 100%; }
.small { padding: 10px 13px; white-space: nowrap; }
.icon-only {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
}

.primary.icon-only, .secondary.icon-only, .table-action.icon-only {
    padding: 0;
}

.table-action.icon-only {
    min-height: 34px;
    min-width: 34px;
    width: 34px;
    height: 34px;
    font-size: 15px;
}
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
    background:
        radial-gradient(circle at 15% 12%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 30%),
        linear-gradient(135deg, var(--bg), color-mix(in srgb, var(--accent) 8%, #fff));
}
.login-card {
    width: min(430px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 8px; font-size: 30px; }
.login-card p { margin: 0 0 22px; color: var(--muted); line-height: 1.5; }
.login-card form, .form-grid { display: grid; gap: 14px; }
.alert {
    padding: 12px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: var(--danger);
    border-radius: 8px;
    margin-bottom: 16px;
}
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    background: var(--sidebar);
    color: #e6eef0;
    padding: 20px;
    display: grid;
    align-content: start;
    gap: 7px;
    z-index: 30;
    box-shadow: 12px 0 34px rgba(0,0,0,.16);
}
.brand {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 18px;
    letter-spacing: 0;
}
.sidebar a, .link-button {
    color: #e6eef0;
    background: transparent;
    width: 100%;
    justify-content: flex-start;
    border-radius: 8px;
    padding: 12px 13px;
    border: 0;
    text-align: left;
}
.sidebar a:hover, .link-button:hover {
    background: rgba(255,255,255,.10);
}
.sidebar a:first-of-type {
    background: color-mix(in srgb, var(--accent) 55%, transparent);
}
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(8, 13, 18, .44);
}
.main { margin-left: 250px; min-height: 100vh; }
.topbar {
    min-height: 72px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 15;
}
.menu-toggle { display: none; }
.topbar-user { min-width: 0; }
.topbar-user strong { display: block; }
.topbar-user span { color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.theme-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}
.theme-switcher span { font-weight: 800; }
.theme-switcher select {
    min-width: 118px;
    padding: 9px 10px;
    min-height: 40px;
    font-size: 13px;
}
.page-head {
    padding: 30px 28px 18px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}
.page-head h1 { margin: 0 0 6px; font-size: 32px; line-height: 1.1; }
.page-head p { margin: 0; color: var(--muted); }
.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    padding: 0 28px 20px;
}
.stats article, .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(22, 35, 38, .05);
}
.stats article { padding: 18px; border-top: 4px solid var(--accent); }
.stats span { display: block; color: var(--muted); margin-bottom: 8px; }
.stats strong { font-size: 24px; line-height: 1.15; }
.panel {
    margin: 0 28px 28px;
    padding: 18px;
    overflow-x: auto;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}
.panel-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.panel h2, .panel-head h2 { margin: 0; font-size: 20px; }
.filter-bar {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 680px; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--bg) 60%, #fff);
    position: sticky;
    top: 0;
    z-index: 1;
}
th:first-child { border-top-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, #fff); }
.empty { text-align: center; color: var(--muted); }
.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}
.status.active {
    background: color-mix(in srgb, #16a34a 14%, #fff);
    color: #166534;
}
.status.cancelled {
    background: color-mix(in srgb, #dc2626 12%, #fff);
    color: #991b1b;
}
.row-actions {
    display: flex;
    gap: 7px;
    align-items: center;
}
.table-action {
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-weight: 900;
    font-size: 13px;
}
.table-action.danger {
    color: #991b1b;
    background: #fff5f5;
}
.muted { color: var(--muted); }
.pagination {
    margin: -10px 28px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: var(--muted);
}
.pagination-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.pagination a {
    min-width: 38px;
    min-height: 38px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}
.pagination a.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.pagination a.disabled {
    pointer-events: none;
    opacity: .45;
}
.modal {
    width: min(560px, calc(100vw - 28px));
    border: 0;
    border-radius: 12px;
    padding: 0;
    background: transparent;
}
.modal-wide { width: min(980px, calc(100vw - 28px)); }
.modal::backdrop { background: rgba(8, 13, 18, .50); }
.modal-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    box-shadow: var(--shadow);
}
.modal-head, .modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.modal-head h2 { margin: 0; }
.modal-actions { justify-content: flex-end; margin-top: 4px; }
.tablet-shell { background: var(--bg); }
.tablet-header {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    background: var(--sidebar);
    color: #fff;
}
.tablet-header > a { font-size: 22px; font-weight: 900; }
.tablet-header nav { display: flex; gap: 10px; align-items: center; }
.tablet-header nav a {
    background: rgba(255,255,255,.12);
    padding: 12px 16px;
    border-radius: 8px;
}
.tablet-header .theme-switcher { color: #dce7ea; }
.tablet-main { max-width: 1120px; margin: 0 auto; padding: 22px; }
.tablet-actions {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}
.tablet-action {
    min-height: 116px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 25px;
    font-weight: 900;
    box-shadow: 0 10px 26px rgba(22, 35, 38, .06);
}
.tablet-action.primary { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; }
.tablet-stats { padding: 0 0 18px; grid-template-columns: repeat(3, 1fr); }
.tablet-purchase {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
    display: grid;
    gap: 16px;
    box-shadow: 0 10px 26px rgba(22, 35, 38, .06);
}
.modal-card.tablet-purchase {
    gap: 18px;
}
.purchase-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}
.purchase-modal-grid label:only-child {
    grid-column: 1 / -1;
}
.payment-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.payment-row label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
}
.payment-row input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--accent);
}
.payment-row-card {
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: color-mix(in srgb, var(--bg) 45%, #fff);
}
.payment-row-card label {
    justify-content: center;
    min-height: 54px;
    font-weight: 800;
}
.purchase-items { display: grid; gap: 10px; }
.purchase-item {
    display: grid;
    grid-template-columns: minmax(170px, 2fr) minmax(96px, .9fr) minmax(92px, .8fr) minmax(118px, 1fr) minmax(130px, auto) 38px;
    gap: 10px;
    align-items: end;
}
.modal-card .purchase-items {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: linear-gradient(180deg, #fbfbff, #fff);
}
.purchase-item-head {
    align-items: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}
.field-compact { gap: 5px; }
.field-compact > span { display: none; }
.line-total-wrap {
    min-height: 42px;
    justify-content: end;
}
.line-total {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    background: #f9fafb;
    text-align: right;
    font-size: 18px;
    white-space: nowrap;
}
.add-line-button {
    justify-self: start;
}
.remove-purchase-item:disabled {
    opacity: .4;
    cursor: not-allowed;
}
.tablet-total {
    position: sticky;
    bottom: 0;
    background: color-mix(in srgb, var(--panel) 94%, var(--accent));
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    align-items: center;
    box-shadow: 0 -8px 24px rgba(22, 35, 38, .08);
}
.tablet-total strong { font-size: 30px; }
.receipt-page {
    background: #fff;
    color: #111827;
    padding: 24px;
}
.receipt {
    width: min(780px, 100%);
    margin: 0 auto;
}
.receipt header, .receipt footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 2px solid #111827;
    padding-bottom: 14px;
    margin-bottom: 18px;
}
.receipt h1 { margin: 0; font-size: 28px; }
.receipt p { margin: 6px 0 0; color: #4b5563; }
.receipt button { padding: 10px 14px; background: #111827; color: #fff; border-radius: 8px; }
.receipt-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}
.receipt-grid div {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px;
}
.receipt-grid span { display: block; color: #6b7280; font-size: 12px; margin-bottom: 5px; }
.receipt footer {
    border-top: 2px solid #111827;
    border-bottom: 0;
    padding-top: 14px;
    margin-top: 18px;
    font-size: 22px;
}

@media print {
    .receipt button { display: none; }
    .receipt-page { padding: 0; }
}

@media (max-width: 980px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tablet-actions { grid-template-columns: 1fr 1fr; }
    .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .sidebar {
        transform: translateX(-105%);
        transition: transform .22s ease;
        width: min(290px, 86vw);
    }
    .sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-open .sidebar-backdrop { display: block; }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; flex: 0 0 auto; }
    .topbar {
        padding: 10px 14px;
        min-height: 66px;
        gap: 10px;
    }
    .topbar-actions { gap: 8px; }
    .topbar-actions .small { display: none; }
    .theme-switcher span { display: none; }
    .theme-switcher select { min-width: 104px; }
    .page-head {
        padding: 22px 14px 14px;
        align-items: stretch;
        flex-direction: column;
    }
    .page-head h1 { font-size: 28px; }
    .stats, .tablet-stats, .payment-row, .purchase-modal-grid, .purchase-item, .tablet-total {
        grid-template-columns: 1fr;
    }
    .filter-bar { grid-template-columns: 1fr; }
    .stats { padding: 0 14px 18px; }
    .panel { margin: 0 14px 18px; padding: 14px; }
    .pagination {
        margin: -4px 14px 18px;
        align-items: stretch;
        flex-direction: column;
    }
    .pagination-links {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .pagination a { width: 100%; }
    .purchase-item-head { display: none; }
    .field-compact > span { display: block; }
    .line-total {
        text-align: left;
        width: 100%;
    }
    .remove-purchase-item {
        width: 100%;
    }
    .tablet-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px;
    }
    .tablet-header nav {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .tablet-header .theme-switcher {
        grid-column: 1 / -1;
        width: 100%;
    }
    .tablet-header .theme-switcher select { width: 100%; }
    .tablet-main { padding: 14px; }
    .tablet-actions { grid-template-columns: 1fr; }
    .tablet-action { min-height: 92px; font-size: 22px; }
    .modal { width: calc(100vw - 20px); }
    .modal-wide { width: calc(100vw - 20px); }
    .modal-card { padding: 14px; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions button { width: 100%; }
    .receipt-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .panel {
        overflow-x: visible;
    }

    table.responsive-table,
    .panel table {
        min-width: 0;
        border-collapse: collapse;
    }

    .panel table thead {
        display: none;
    }

    .panel table tbody {
        display: grid;
        gap: 12px;
    }

    .panel table tr {
        display: grid;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        padding: 8px 10px;
        box-shadow: 0 8px 20px rgba(17, 24, 39, .05);
    }

    .panel table td {
        display: grid;
        grid-template-columns: minmax(92px, 38%) 1fr;
        gap: 10px;
        align-items: center;
        border-bottom: 1px solid var(--line);
        padding: 9px 0;
        text-align: right;
        word-break: break-word;
    }

    .panel table tr:not(.details-open) td:nth-child(n+4) {
        display: none;
    }

    .panel table tr.details-open td:nth-child(n+4) {
        display: grid;
    }

    .panel table td:first-child {
        grid-template-columns: minmax(92px, 38%) 1fr auto;
        text-align: left;
    }

    .mobile-detail-toggle {
        display: inline-flex;
        margin-left: auto;
    }

    .panel table td:last-child {
        border-bottom: 0;
    }

    .panel table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 11px;
        font-weight: 900;
        text-align: left;
        text-transform: uppercase;
    }

    .panel table td.empty {
        display: block;
        text-align: center;
    }

    .panel table td.empty::before {
        content: "";
    }

    .row-actions {
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}

@media (min-width: 761px) {
    .mobile-detail-toggle {
        display: none;
    }
}

/* Dash UI inspired refresh */
:root {
    --bg: #f7f8fb;
    --panel: #ffffff;
    --line: #e5e7eb;
    --text: #161c2d;
    --muted: #6b7280;
    --accent: #624bff;
    --accent-dark: #4f39f6;
    --highlight: #19cb98;
    --sidebar: #ffffff;
    --danger: #dc2626;
    --shadow: 0 12px 34px rgba(17, 24, 39, .08);
    --font-family: Inter, Arial, Helvetica, sans-serif;
    --font-scale: 1;
}

body {
    background: var(--bg);
    color: var(--text);
}

input, select, textarea {
    min-height: 42px;
    border-color: var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.primary {
    background: var(--accent);
    border-radius: 6px;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 22%, transparent);
}

.primary:hover {
    background: var(--accent-dark);
}

.secondary, .table-action, .icon-button {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
}

.danger-primary {
    background: var(--danger);
}

.sidebar {
    width: 260px;
    background: var(--sidebar);
    color: var(--text);
    border-right: 1px solid var(--line);
    box-shadow: none;
    padding: 18px 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    padding: 4px 10px 18px;
    margin-bottom: 8px;
    font-size: 18px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 900;
}

.side-nav {
    display: grid;
    gap: 4px;
}

.sidebar a, .link-button {
    color: var(--muted);
    border-radius: 6px;
    padding: 10px 12px;
    font-weight: 700;
}

.sidebar a:hover, .link-button:hover {
    background: color-mix(in srgb, var(--accent) 8%, #fff);
    color: var(--accent);
}

.sidebar a:first-of-type {
    background: color-mix(in srgb, var(--accent) 10%, #fff);
    color: var(--accent);
}

.sidebar-footer {
    margin-top: 18px;
}

.main {
    margin-left: 260px;
}

.topbar {
    min-height: 68px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 0 30px;
}

.topbar-title {
    margin-right: auto;
}

.topbar-title span, .topbar-user span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.topbar-title strong {
    display: block;
    font-size: 15px;
}

.notification-button {
    position: relative;
    font-size: 16px;
    font-weight: 900;
}

.notification-button i {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-style: normal;
    line-height: 18px;
}

.notification-popover {
    display: none;
    position: absolute;
    top: 60px;
    right: 28px;
    width: min(360px, calc(100vw - 28px));
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 14px;
    z-index: 25;
}

.notification-popover.open {
    display: block;
}

.notification-list, .note-list, .reminder-list {
    display: grid;
    gap: 10px;
}

.notification-item, .note-item, .reminder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
    background: #fff;
}

.notification-item, .reminder-item {
    align-items: flex-start;
}

.notification-item span, .reminder-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}

.reminder-item.done {
    opacity: .62;
}

.page-head {
    padding: 28px 30px 16px;
}

.page-head h1 {
    font-size: 28px;
    font-weight: 800;
}

.stats {
    padding: 0 30px 22px;
}

.stats article, .panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stats article {
    padding: 20px;
    border-top: 0;
}

.stats article::before {
    content: "";
    width: 38px;
    height: 5px;
    display: block;
    border-radius: 999px;
    margin-bottom: 14px;
    background: var(--accent);
}

.stats article:nth-child(2)::before { background: var(--highlight); }
.stats article:nth-child(3)::before { background: #f59e0b; }
.stats article:nth-child(4)::before { background: #3b82f6; }

.stats span {
    font-size: 13px;
}

.stats strong {
    font-size: 22px;
}

.panel {
    margin: 0 30px 24px;
    padding: 18px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr .9fr 1fr;
    gap: 18px;
    padding: 0 30px 24px;
}

.report-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.report-grid .panel {
    margin: 0;
}

.dashboard-card.panel {
    margin: 0;
}

.mini-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 12px;
}

.calendar-mini {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.calendar-mini strong, .calendar-mini button, .calendar-mini span {
    min-height: 34px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    font-size: 12px;
}

.calendar-mini strong {
    color: var(--muted);
}

.calendar-mini button {
    background: #fff;
    border: 1px solid var(--line);
}

.calendar-mini button.today {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.calendar-mini button.has-event {
    position: relative;
    border-color: var(--highlight);
}

.calendar-mini button.has-event::after {
    content: "";
    position: absolute;
    bottom: 4px;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: var(--highlight);
}

.calendar-event-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.calendar-event-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
    background: #fff;
}

.calendar-event-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}

th {
    background: #f9fafb;
    color: #6b7280;
    font-size: 11px;
}

td {
    color: #374151;
}

tbody tr:hover {
    background: #fbfbff;
}

.status {
    border-radius: 999px;
    min-width: 62px;
}

.status.active {
    background: #dcfce7;
    color: #15803d;
}

.status.cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

.table-action.danger {
    color: var(--danger);
    background: #fff;
}

.pagination {
    margin: -8px 30px 24px;
}

.pagination a {
    border-radius: 6px;
}

.pagination a.active {
    background: var(--accent);
    border-color: var(--accent);
}

.modal-card, .modal {
    border-radius: 8px;
}

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

.checkline input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--accent);
}

.matrix-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 900;
}

.matrix-check input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--accent);
}

.is-loading {
    opacity: .55;
    pointer-events: none;
}

.bar-list, .mini-list {
    display: grid;
    gap: 10px;
}

.bar-list div {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
}

.bar-list i {
    grid-column: 1 / -1;
    display: block;
    height: 7px;
    border-radius: 999px;
    background: var(--accent);
}

.mini-list div {
    display: grid;
    gap: 3px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 9px;
}

.mini-list span {
    color: var(--muted);
    font-size: 12px;
}

.cash-summary {
    display: grid;
    gap: 8px;
}

.cash-summary span, .cash-summary small {
    color: var(--muted);
}

.cash-summary strong {
    font-size: 28px;
    line-height: 1.1;
}

.chat-panel {
    display: grid;
    gap: 16px;
}

.chat-list {
    max-height: 520px;
    overflow: auto;
    display: grid;
    gap: 10px;
}

.chat-message {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.chat-message header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}

.chat-message p {
    margin: 8px 0 0;
}

.chat-form {
    display: grid;
    grid-template-columns: 180px 1fr 220px auto;
    gap: 12px;
    align-items: end;
}

.chat-widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 45;
}

.chat-fab {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 14px 34px color-mix(in srgb, var(--accent) 30%, transparent);
    position: relative;
    font-size: 21px;
}

.chat-fab i {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-style: normal;
    line-height: 20px;
}

.chat-drawer {
    display: none;
    position: absolute;
    right: 0;
    bottom: 66px;
    width: min(420px, calc(100vw - 28px));
    height: min(680px, calc(100vh - 110px));
    max-height: min(680px, calc(100vh - 110px));
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat-widget.open .chat-drawer { display: grid; }
.chat-widget.open .user-chat-drawer {
    grid-template-rows: auto 1fr;
}

.chat-drawer > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
}

.chat-drawer > header span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.chat-user-layout {
    display: grid;
    grid-template-columns: 150px 1fr;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.chat-user-list {
    border-right: 1px solid var(--line);
    overflow: auto;
    background: #f9fafb;
    padding: 8px;
}

.chat-user {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 8px;
    align-items: center;
    text-align: left;
    border: 0;
    border-radius: 8px;
    background: transparent;
    padding: 9px;
    color: var(--text);
    position: relative;
}

.chat-user:hover, .chat-user.active {
    background: color-mix(in srgb, var(--accent) 10%, #fff);
}

.chat-user span {
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-user small {
    grid-column: 1 / -1;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-user i {
    min-width: 19px;
    height: 19px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-style: normal;
    display: inline-grid;
    place-items: center;
}

.chat-conversation {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.chat-current-user {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    font-weight: 900;
}

.chat-widget-list {
    min-height: 0;
    overflow: auto;
    padding: 16px;
    display: grid;
    align-content: start;
    gap: 12px;
    background: linear-gradient(180deg, #fbfbff, #fff);
}

.chat-bubble {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
    max-width: 82%;
    box-shadow: 0 6px 18px rgba(17, 24, 39, .05);
}

.chat-bubble.mine {
    justify-self: end;
    background: color-mix(in srgb, var(--accent) 9%, #fff);
    border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
}

.chat-bubble header {
    display: grid;
    gap: 2px;
    margin-bottom: 6px;
}

.chat-bubble header span {
    color: var(--muted);
    font-size: 11px;
}

.chat-bubble p {
    margin: 0;
    line-height: 1.45;
}

.chat-image {
    display: block;
    width: min(260px, 100%);
    max-height: 220px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    margin-top: 8px;
}

.chat-audio {
    width: min(280px, 100%);
    margin-top: 8px;
}

.chat-widget-form {
    border-top: 1px solid var(--line);
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 38px 38px 38px;
    gap: 8px;
    align-items: end;
    background: var(--panel);
    position: sticky;
    bottom: 0;
}

.chat-widget-form textarea {
    min-height: 44px;
    max-height: 110px;
}

.chat-file {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.chat-record {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--danger);
    font-size: 17px;
}

.chat-record.recording {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent);
}

.chat-file input {
    display: none;
}

@media (max-width: 980px) {
    .chat-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .chat-user-layout {
        grid-template-columns: 1fr;
    }

    .chat-user-list {
        display: flex;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .chat-user {
        min-width: 128px;
    }
}

.icon-only {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
}

.primary.icon-only, .secondary.icon-only, .table-action.icon-only {
    padding: 0;
}

.table-action.icon-only {
    min-height: 34px;
    min-width: 34px;
    width: 34px;
    height: 34px;
    font-size: 15px;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .main {
        margin-left: 0;
    }

    .topbar {
        padding: 10px 14px;
    }

    .page-head, .stats, .dashboard-grid {
        padding-left: 14px;
        padding-right: 14px;
    }

    .panel {
        margin-left: 14px;
        margin-right: 14px;
    }

    .mini-form {
        grid-template-columns: 1fr;
    }
}
