/* ─── Design tokens ──────────────────────────────────────────────────── */
:root {
    /* Brand — warm brick red (from logo) */
    --primary: #C84A2A;
    --primary-dark: #A83C21;
    --primary-soft: #FDF1EE;
    --primary-glow: rgba(200, 74, 42, .14);

    /* Accent — golden amber */
    --secondary: #E89720;
    --secondary-soft: #FEF5E4;

    /* Semantic */
    --success: #22C493;
    --success-soft: #E6F9F4;
    --warning: #F0A828;
    --warning-soft: #FEF6E3;
    --danger: #E8485A;
    --danger-soft: #FFF0F2;

    /* Surface */
    --bg: #F4EFEC;
    --panel: #FFFFFF;
    --ink: #2E2018;
    --heading: #1C1008;
    --muted: #8C7C72;
    --line: #EDE5DF;

    /* Sidebar — deep warm dark */
    --sidebar: #1C0C08;
    --sidebar-2: #261209;
    --sidebar-line: rgba(255, 255, 255, .08);

    /* Effects */
    --shadow: 0 14px 34px rgba(50, 16, 6, .10);
    --shadow-sm: 0 8px 22px rgba(50, 16, 6, .07);
    --radius: 10px;
}

/* ─── Reset & base ───────────────────────────────────────────────────── */
* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    font-size: 14px;
    background:
        radial-gradient(ellipse at 80% 0%, rgba(200, 74, 42, .07), transparent 42%),
        linear-gradient(180deg, #FAF7F5 0%, var(--bg) 60%, #EDE8E4 100%);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

h1,
h2 {
    margin: 0;
    color: var(--heading);
    letter-spacing: -.01em;
}

h1 {
    font-size: 24px;
    font-weight: 700;
}

h2 {
    font-size: 16px;
    font-weight: 700;
}

p {
    line-height: 1.65;
    margin: 0 0 8px;
}

/* ─── Tables ─────────────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 700px;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 13.5px;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: #FAF7F5;
}

tr:hover td {
    background: #FDF9F7;
}

/* ─── Forms ──────────────────────────────────────────────────────────── */
input,
select,
textarea {
    width: 100%;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    padding: 11px 13px;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    background: #fff;
    transition: border-color .18s, box-shadow .18s;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

input::placeholder,
textarea::placeholder {
    color: #C4B8B2;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .01em;
}

/* ─── Layout shell ───────────────────────────────────────────────────── */
.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
}

/* ─── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px 14px;
    color: #DDD2CA;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(200, 74, 42, .22), transparent 56%),
        linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    border-right: 1px solid rgba(255, 255, 255, .05);
    box-shadow: 8px 0 40px rgba(20, 6, 2, .22);
    overflow-y: auto;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--sidebar-line);
    border-radius: var(--radius);
    padding: 13px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, .05);
}

.sidebar-user span {
    display: inline-flex;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-weight: 800;
    font-size: 15px;
}

.sidebar-user strong {
    display: block;
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
}

.sidebar-user small {
    display: block;
    color: #A8998F;
    font-size: 11.5px;
    font-weight: 500;
    margin-top: 1px;
}

.sidebar nav {
    display: grid;
    gap: 3px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 44px;
    color: #B8A89E;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    transition: color .16s, background .16s;
    position: relative;
}

.sidebar nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.sidebar nav a.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(200, 74, 42, .28), rgba(200, 74, 42, .10));
    font-weight: 600;
}

.sidebar nav a.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
    box-shadow: 0 0 12px rgba(200, 74, 42, .6);
}

/* Brand / logo at bottom of sidebar */
.brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 52px;
    margin-top: auto;
    padding: 14px 10px 4px;
    border-top: 1px solid var(--sidebar-line);
    color: #fff;
}

.brand img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 7px;
    padding: 5px;
    background: rgba(255, 255, 255, .94);
}

.brand span {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
}

/* ─── Nav icons (CSS-drawn) ──────────────────────────────────────────── */
.nav-icon {
    position: relative;
    display: inline-flex;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: currentColor;
    background: rgba(255, 255, 255, .08);
    transition: background .16s;
}

.sidebar nav a.active .nav-icon {
    background: rgba(200, 74, 42, .28);
}

.sidebar nav a:hover .nav-icon {
    background: rgba(255, 255, 255, .12);
}

.nav-icon::before,
.nav-icon::after {
    content: "";
    position: absolute;
    border: 2px solid currentColor;
    border-radius: 4px;
}

.nav-icon.grid::before {
    width: 6px;
    height: 6px;
    left: 7px;
    top: 7px;
    box-shadow: 9px 0 0 -2px currentColor, 0 9px 0 -2px currentColor, 9px 9px 0 -2px currentColor;
}

.nav-icon.building::before {
    width: 14px;
    height: 17px;
    bottom: 6px;
}

.nav-icon.building::after {
    width: 4px;
    height: 3px;
    left: 9px;
    top: 9px;
    box-shadow: 7px 0 0 -1px currentColor, 0 6px 0 -1px currentColor, 7px 6px 0 -1px currentColor;
    border-radius: 1px;
}

.nav-icon.card::before {
    width: 16px;
    height: 12px;
}

.nav-icon.card::after {
    width: 16px;
    height: 0;
    top: 11px;
    border-width: 1px;
}

.nav-icon.wallet::before {
    width: 17px;
    height: 13px;
}

.nav-icon.wallet::after {
    width: 5px;
    height: 5px;
    right: 6px;
    border-radius: 50%;
}

.nav-icon.mail::before {
    width: 17px;
    height: 12px;
}

.nav-icon.mail::after {
    width: 10px;
    height: 10px;
    top: 8px;
    border-width: 0 0 2px 2px;
    border-radius: 0;
    transform: rotate(-45deg);
}

.nav-icon.car::before {
    width: 18px;
    height: 8px;
    top: 10px;
    border-radius: 5px 5px 3px 3px;
}

.nav-icon.car::after {
    width: 4px;
    height: 4px;
    left: 7px;
    bottom: 6px;
    border-radius: 50%;
    box-shadow: 11px 0 0 -2px currentColor;
}

.nav-icon.ticket::before {
    width: 17px;
    height: 12px;
    transform: rotate(-8deg);
}

.nav-icon.chart::before {
    width: 3px;
    height: 12px;
    left: 8px;
    bottom: 7px;
    border-radius: 2px;
    box-shadow: 6px -4px 0 -1px currentColor, 12px -8px 0 -1px currentColor;
}

.nav-icon.calendar::before {
    width: 16px;
    height: 15px;
    bottom: 6px;
}

.nav-icon.calendar::after {
    width: 16px;
    height: 0;
    top: 11px;
    border-width: 1px;
    box-shadow: 0 -4px 0 -1px currentColor;
}

.nav-icon.users::before {
    width: 7px;
    height: 7px;
    top: 7px;
    border-radius: 50%;
}

.nav-icon.users::after {
    width: 16px;
    height: 8px;
    bottom: 6px;
    border-radius: 8px 8px 3px 3px;
}

.nav-icon.settings::before {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.nav-icon.settings::after {
    width: 2px;
    height: 18px;
    border-width: 1px;
    transform: rotate(45deg);
}

.nav-icon.search::before {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    left: 6px;
    top: 5px;
}

.nav-icon.search::after {
    width: 7px;
    height: 0;
    right: 5px;
    bottom: 7px;
    transform: rotate(45deg);
    border-radius: 0;
}

.nav-icon.bell::before {
    width: 13px;
    height: 14px;
    top: 6px;
    border-radius: 8px 8px 4px 4px;
}

.nav-icon.bell::after {
    width: 5px;
    height: 2px;
    bottom: 5px;
    border-radius: 2px;
}

/* Content area nav-icons (light bg context) */
.action-grid .nav-icon {
    color: var(--primary);
    background: var(--primary-soft);
}

.action-grid a:hover .nav-icon {
    color: #fff;
    background: var(--primary);
}

/* ─── Main content ───────────────────────────────────────────────────── */
.main {
    padding: 28px;
    min-width: 0;
}

/* ─── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 74px;
    margin: -28px -28px 28px;
    padding: 16px 28px;
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 20px rgba(50, 16, 6, .05);
    backdrop-filter: blur(18px);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 172px;
    min-height: 40px;
    padding: 7px 12px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: #FAF7F5;
    font-weight: 600;
    font-size: 13px;
}

.search-pill .nav-icon,
.icon-btn .nav-icon {
    background: transparent;
    color: var(--muted);
}

.icon-btn {
    position: relative;
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--line);
    border-radius: 50%;
    background: #fff;
}

.icon-btn i {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(232, 72, 90, .14);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(34, 196, 147, .16);
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* ─── Buttons ────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 0;
    border-radius: 8px;
    min-height: 42px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(200, 74, 42, .26);
    transition: opacity .16s, box-shadow .16s, transform .12s;
    text-decoration: none;
}

.btn:hover {
    opacity: .9;
    box-shadow: 0 10px 24px rgba(200, 74, 42, .34);
    color: #fff;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn.secondary {
    background: linear-gradient(135deg, var(--secondary), #d4831a);
    box-shadow: 0 8px 20px rgba(232, 151, 32, .26);
}

.btn.secondary:hover {
    box-shadow: 0 10px 24px rgba(232, 151, 32, .34);
}

.btn.ghost {
    background: rgba(46, 32, 24, .07);
    color: var(--ink);
    box-shadow: none;
}

.btn.ghost:hover {
    background: rgba(46, 32, 24, .12);
    color: var(--ink);
    transform: none;
}

.btn.small {
    min-height: 34px;
    padding: 7px 14px;
    font-size: 13px;
}

/* ─── Notices & errors ───────────────────────────────────────────────── */
.notice {
    background: var(--success-soft);
    border-left: 3px solid var(--success);
    color: #137d5e;
    padding: 13px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 13.5px;
    font-weight: 500;
}

.error-notice {
    background: var(--danger-soft);
    border-left-color: var(--danger);
    color: #9c2432;
}

.error {
    color: var(--danger);
    font-weight: 600;
    margin: 0;
    font-size: 13px;
}

/* ─── Metric cards ───────────────────────────────────────────────────── */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.metrics article {
    position: relative;
    overflow: hidden;
    padding: 22px 22px 18px;
    display: grid;
    gap: 6px;
    min-height: 120px;
    background: var(--panel);
    border: 1px solid rgba(232, 215, 206, .6);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.metrics article::before {
    content: "";
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary-soft);
    box-shadow: 0 0 0 6px rgba(200, 74, 42, .06);
}

.metrics article::after {
    content: "";
    position: absolute;
    right: -26px;
    bottom: -30px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(200, 74, 42, .07);
}

.metrics article:nth-child(2)::before {
    background: var(--success-soft);
    box-shadow: 0 0 0 6px rgba(34, 196, 147, .06);
}

.metrics article:nth-child(2)::after {
    background: rgba(34, 196, 147, .09);
}

.metrics article:nth-child(3)::before {
    background: var(--warning-soft);
    box-shadow: 0 0 0 6px rgba(240, 168, 40, .06);
}

.metrics article:nth-child(3)::after {
    background: rgba(240, 168, 40, .12);
}

.metrics article:nth-child(4)::before {
    background: var(--secondary-soft);
    box-shadow: 0 0 0 6px rgba(232, 151, 32, .06);
}

.metrics article:nth-child(4)::after {
    background: rgba(232, 151, 32, .08);
}

.metrics strong {
    font-size: 28px;
    font-weight: 700;
    color: var(--heading);
    position: relative;
    z-index: 1;
    overflow-wrap: anywhere;
    letter-spacing: -.02em;
}

.metrics span {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* ─── Panels ─────────────────────────────────────────────────────────── */
.panel {
    padding: 22px;
    margin-bottom: 22px;
    overflow-x: auto;
    background: var(--panel);
    border: 1px solid rgba(232, 215, 206, .6);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 18px;
}

/* ─── Create drawer ──────────────────────────────────────────────────── */
.create-drawer {
    margin: -4px 0 18px;
}

.create-drawer summary {
    width: fit-content;
    list-style: none;
}

.create-drawer summary::-webkit-details-marker {
    display: none;
}

.create-drawer[open] summary {
    margin-bottom: 16px;
}

.create-drawer .form-grid {
    padding: 18px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: #FAF7F5;
}

/* ─── Badges ─────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 11px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .01em;
}

/* ─── Forms: layout helpers ──────────────────────────────────────────── */
.form {
    display: grid;
    gap: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid .btn,
.form-grid .error {
    grid-column: 1 / -1;
}

.plan-line {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.plan-line strong {
    display: inline-flex;
    padding: 10px 13px;
    border-radius: 8px;
    background: #FAF7F5;
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 600;
    border: 1px solid var(--line);
}

/* ─── Action menu ────────────────────────────────────────────────────── */
.action-menu {
    position: relative;
    display: inline-grid;
    justify-items: start;
}

.action-menu summary {
    list-style: none;
}

.action-menu summary::-webkit-details-marker {
    display: none;
}

.action-menu[open] summary {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.action-menu-list {
    display: grid;
    min-width: 170px;
    margin-top: 6px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.action-menu-list button {
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    color: var(--ink);
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.action-menu-list button:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

/* ─── Action grid ────────────────────────────────────────────────────── */
.action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.action-grid a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 82px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    color: var(--heading);
    font-weight: 600;
    font-size: 13.5px;
    background: #FAF7F5;
    transition: border-color .16s, color .16s, background .16s, box-shadow .16s;
}

.action-grid a:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 6px 18px rgba(200, 74, 42, .12);
}

.dashboard-grid .action-grid {
    grid-template-columns: 1fr;
}

/* ─── Inline form (payments row) ─────────────────────────────────────── */
.inline-form {
    display: grid;
    grid-template-columns: minmax(110px, .7fr) minmax(160px, .9fr) minmax(100px, .7fr) auto;
    gap: 7px;
    align-items: center;
}

.invoice-receive-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.invoice-receive-form select {
    min-width: 170px;
}

.billing-payment-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
    padding: 18px;
}

.billing-payment-options article {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
}

.billing-payment-options h3 {
    margin: 10px 0 6px;
    font-size: 15px;
    color: var(--heading);
}

.billing-payment-options p {
    color: var(--muted);
    font-size: 13px;
}

.payment-method-instructions {
    margin-top: 10px;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.55;
}

.payment-method-instructions p,
.payment-method-instructions ul,
.payment-method-instructions ol {
    margin: 0 0 8px;
}

.payment-method-instructions strong {
    color: var(--heading);
}

.billing-payment-options form {
    margin-top: 12px;
}

.ftp-help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.ftp-help-grid article {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FAF7F5;
}

.ftp-help-grid h3 {
    margin: 0;
    color: var(--heading);
    font-size: 14px;
}

.ftp-help-grid p,
.ftp-help-grid li {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.ftp-help-grid ol {
    margin: 0;
    padding-left: 18px;
}

.ftp-help-grid code {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    background: #fff;
    color: var(--heading);
    font-size: 12px;
    overflow-wrap: anywhere;
}

/* ─── Dashboard grid ─────────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
    gap: 22px;
}

/* ─── Chart ──────────────────────────────────────────────────────────── */
.chart-card {
    min-height: 320px;
}

.chart-bars {
    display: grid;
    grid-template-columns: repeat(12, minmax(10px, 1fr));
    align-items: end;
    gap: 10px;
    height: 218px;
    padding: 16px 6px 0;
    border-bottom: 1px solid var(--line);
    background: repeating-linear-gradient(180deg,
            transparent 0 24.5%,
            rgba(232, 215, 206, .4) 24.5% 25%,
            transparent 25% 49.5%,
            rgba(232, 215, 206, .4) 49.5% 50%,
            transparent 50% 74.5%,
            rgba(232, 215, 206, .4) 74.5% 75%,
            transparent 75%);
}

.chart-bars span {
    display: block;
    min-height: 20px;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, var(--primary), #e07458);
    box-shadow: 0 8px 14px rgba(200, 74, 42, .22);
}

.chart-bars span:nth-child(2n) {
    background: linear-gradient(180deg, var(--secondary), #f4b654);
    box-shadow: 0 8px 14px rgba(232, 151, 32, .2);
}

.chart-bars span:nth-child(3n) {
    background: linear-gradient(180deg, var(--success), #5dddb8);
    box-shadow: 0 8px 14px rgba(34, 196, 147, .2);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
}

.chart-legend span::before {
    content: "";
    display: inline-flex;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--primary);
    vertical-align: middle;
}

.chart-legend span:nth-child(2)::before {
    background: var(--secondary);
}

.chart-legend span:nth-child(3)::before {
    background: var(--success);
}

.monthly-chart {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    min-height: 238px;
    padding: 16px 6px 0;
    border-bottom: 1px solid var(--line);
    background: repeating-linear-gradient(180deg,
            transparent 0 24.5%,
            rgba(232, 215, 206, .4) 24.5% 25%,
            transparent 25% 49.5%,
            rgba(232, 215, 206, .4) 49.5% 50%,
            transparent 50% 74.5%,
            rgba(232, 215, 206, .4) 74.5% 75%,
            transparent 75%);
}

.monthly-chart-group {
    display: grid;
    grid-template-rows: minmax(180px, 1fr) auto;
    gap: 9px;
    min-width: 0;
}

.monthly-chart-bars {
    display: grid;
    grid-template-columns: repeat(3, minmax(10px, 1fr));
    align-items: end;
    gap: 5px;
}

.monthly-chart-bars span {
    position: relative;
    display: flex;
    min-height: 26px;
    align-items: flex-start;
    justify-content: center;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 8px 14px rgba(50, 16, 6, .12);
}

.monthly-chart-bars .clients {
    background: linear-gradient(180deg, var(--primary), #e07458);
}

.monthly-chart-bars .trials {
    background: linear-gradient(180deg, var(--secondary), #f4b654);
}

.monthly-chart-bars .blocks {
    background: linear-gradient(180deg, var(--success), #5dddb8);
}

.monthly-chart-bars strong {
    margin-top: -20px;
    color: var(--heading);
    font-size: 11px;
    line-height: 1;
}

.monthly-chart-label {
    min-height: 30px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    text-transform: capitalize;
}

.weekly-chart {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    min-height: 238px;
    padding: 16px 6px 0;
    border-bottom: 1px solid var(--line);
    background: repeating-linear-gradient(180deg,
            transparent 0 24.5%,
            rgba(232, 215, 206, .4) 24.5% 25%,
            transparent 25% 49.5%,
            rgba(232, 215, 206, .4) 49.5% 50%,
            transparent 50% 74.5%,
            rgba(232, 215, 206, .4) 74.5% 75%,
            transparent 75%);
}

.weekly-chart-group {
    display: grid;
    grid-template-rows: minmax(180px, 1fr) auto;
    gap: 9px;
    min-width: 0;
}

.weekly-chart-bars {
    display: grid;
    grid-template-columns: repeat(2, minmax(12px, 1fr));
    align-items: end;
    gap: 6px;
}

.weekly-chart-bars span {
    position: relative;
    display: flex;
    min-height: 26px;
    align-items: flex-start;
    justify-content: center;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 8px 14px rgba(50, 16, 6, .12);
}

.weekly-chart-bars .entries {
    background: linear-gradient(180deg, var(--primary), #e07458);
}

.weekly-chart-bars .payments {
    background: linear-gradient(180deg, var(--secondary), #f4b654);
}

.weekly-chart-bars strong {
    margin-top: -20px;
    color: var(--heading);
    font-size: 11px;
    line-height: 1;
}

.weekly-chart-label {
    min-height: 42px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
}

.weekly-chart-label small {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    font-weight: 600;
}

/* ─── Activity list ──────────────────────────────────────────────────── */
.activity-list {
    display: grid;
    gap: 0;
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
}

.activity-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.activity-list li:last-child {
    border-bottom: 0;
}

.activity-list strong {
    display: block;
    color: var(--heading);
    font-size: 13.5px;
    font-weight: 600;
}

.activity-list small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    margin-top: 1px;
}

/* ─── Pagination ─────────────────────────────────────────────────────── */
nav[role="navigation"] {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 16px;
}

nav[role="navigation"] span,
nav[role="navigation"] a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 4px 10px;
    border: 1.5px solid var(--line);
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    background: #fff;
}

nav[role="navigation"] a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

nav[role="navigation"] span[aria-current] {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ─── Auth pages ─────────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% 20%, rgba(200, 74, 42, .14), transparent 30%),
        linear-gradient(135deg, #FAF6F3 0%, #EDE8E4 100%);
}

.auth-grid {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(340px, 40vw) minmax(480px, 1fr);
}

.auth-panel {
    position: relative;
    color: #fff;
    padding: 56px;
    display: flex;
    align-items: center;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 30% 10%, rgba(232, 151, 32, .28), transparent 44%),
        linear-gradient(145deg, rgba(200, 74, 42, .36), transparent 40%),
        linear-gradient(160deg, #1C0C08 0%, #2C1612 100%);
}

.auth-panel::after {
    content: "";
    position: absolute;
    inset: auto -90px -90px auto;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
}

.auth-panel::before {
    content: "";
    position: absolute;
    top: -60px;
    left: -60px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(200, 74, 42, .18);
}

.auth-panel-inner {
    position: relative;
    z-index: 1;
    max-width: 520px;
}

.auth-logo {
    width: 130px;
    margin-bottom: 42px;
    filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .2));
}

.auth-brand-hero {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 40px;
    padding: 10px 16px 10px 10px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
    box-shadow: 0 18px 36px rgba(0, 0, 0, .16);
    backdrop-filter: blur(10px);
}

.auth-brand-hero span:not(.logo-tile) {
    display: block;
    color: #F5C4A8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .10em;
    text-transform: uppercase;
}

.auth-brand-hero strong {
    display: block;
    color: #fff;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
    margin-top: 2px;
}

.logo-tile {
    display: inline-flex;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(200, 74, 42, .1), rgba(232, 151, 32, .12)), #fff;
    box-shadow: var(--shadow);
}

.logo-tile img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    filter: hue-rotate(0deg) saturate(1.1) brightness(.9);
}

.logo-tile-dark {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .24), rgba(232, 151, 32, .16)), rgba(255, 255, 255, .12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 16px 30px rgba(0, 0, 0, .2);
}

.logo-tile-dark img {
    width: 34px;
    height: 34px;
    filter: brightness(0) invert(1) drop-shadow(0 6px 10px rgba(0, 0, 0, .2));
}

.auth-kicker {
    color: #F5C4A8;
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .10em;
    margin: 0 0 10px;
}

.auth-panel h1 {
    color: #fff;
    font-size: 36px;
    line-height: 1.18;
    max-width: 560px;
    font-weight: 700;
}

.auth-panel p {
    color: #EDD8CE;
    font-size: 16px;
    line-height: 1.7;
    max-width: 560px;
}

.auth-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.auth-highlights span {
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    padding: 7px 13px;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    background: rgba(255, 255, 255, .09);
    backdrop-filter: blur(8px);
}

.auth-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 46px;
    overflow-y: auto;
    background: #FDFAF8;
}

.auth-card-head {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 520px;
    margin-bottom: 22px;
    color: var(--muted);
}

.auth-card-head span {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 600;
}

.auth-card-head .logo-tile {
    display: inline-flex;
}

.auth-card-head strong {
    display: block;
    color: var(--heading);
    font-size: 21px;
    font-weight: 700;
    margin-top: 2px;
}

.auth-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
    max-width: 520px;
    padding: 5px;
    margin-bottom: 22px;
    border-radius: 9px;
    background: #EDE8E4;
}

.auth-switch a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 6px;
    color: #7A6A62;
    font-weight: 600;
    font-size: 13.5px;
    transition: color .15s;
}

.auth-switch a.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 4px 14px rgba(50, 16, 6, .09);
}

.auth-form-wrap {
    width: 100%;
    max-width: 520px;
}

.auth-box {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 8px 32px rgba(50, 16, 6, .09);
    border: 1px solid var(--line);
}

.auth-box h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-secondary-action {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.auth-secondary-action a {
    color: var(--primary);
    font-weight: 700;
}

.auth-secondary-action a:hover {
    text-decoration: underline;
}

.register-box {
    border-top: 3px solid var(--secondary);
}

/* ─── Dialogs ────────────────────────────────────────────────────────── */
dialog {
    border: none;
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(50, 16, 6, .18);
    padding: 0;
    max-width: 680px;
    width: 95vw;
    max-height: 82vh;
    overflow: hidden;
}

dialog[open] {
    display: flex;
    flex-direction: column;
}

dialog::backdrop {
    background: rgba(28, 12, 8, .48);
}

dialog.dialog-sm { max-width: 560px; }
dialog.dialog-lg { max-width: 1080px; }
dialog.dialog-xl { max-width: 1300px; }

.dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--line);
    gap: 12px;
}

.dialog-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.dialog-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 13px 24px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}

.dialog-meta strong {
    color: var(--heading);
}

.dialog-stats {
    display: flex;
    border-bottom: 1px solid var(--line);
}

.dialog-stats article {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
    border-right: 1px solid var(--line);
}

.dialog-stats article:last-child {
    border-right: none;
}

.dialog-stats article strong {
    display: block;
    font-size: 22px;
    color: var(--primary);
    font-weight: 700;
}

.dialog-stats article span {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.dialog-body {
    overflow-y: auto;
    flex: 1;
}

.create-dialog-trigger {
    margin: 0 0 18px;
}

.panel-head .create-dialog-trigger {
    margin: 0;
}

.create-dialog-body {
    padding: 20px 24px 24px;
}

.create-dialog-footer {
    display: flex;
    justify-content: flex-end;
    padding: 12px 24px 18px;
    border-top: 1px solid var(--line);
}

.user-create-form label {
    align-content: start;
    min-width: 0;
}

.user-create-form input:not([type="hidden"]),
.user-create-form select {
    min-height: 44px;
}

.user-create-form .user-create-full {
    grid-column: 1 / -1;
}

.dialog-body table {
    margin: 0;
}

.dialog-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--muted);
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: color .14s, background .14s;
}

.dialog-close:hover {
    color: var(--heading);
    background: var(--line);
}

.coupon-create-content {
    display: grid;
    grid-template-columns: minmax(220px, .8fr) minmax(0, 1.4fr);
    gap: 0;
    overflow-y: auto;
}

.coupon-help {
    padding: 20px 22px;
    background: #FAF7F5;
    border-right: 1px solid var(--line);
    color: var(--muted);
}

.coupon-help strong {
    display: block;
    margin: 0 0 8px;
    color: var(--heading);
    font-size: 13px;
}

.coupon-help strong:not(:first-child) {
    margin-top: 18px;
}

.coupon-help p {
    font-size: 12.5px;
    line-height: 1.55;
    margin-bottom: 10px;
}

.coupon-help b {
    color: var(--ink);
}

.coupon-create-form {
    padding: 20px 22px 22px;
    align-content: start;
}

.coupon-form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 4px;
}

/* ─── Payment modal ──────────────────────────────────────────────────── */
.payment-dialog {
    max-width: 760px;
}

.payment-form {
    display: grid;
    gap: 16px;
    padding: 20px 24px 24px;
    overflow-y: auto;
}

.payment-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.coupon-validator {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FAF7F5;
}

.coupon-validation-message {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.45;
}

.coupon-validation-message[data-state="valid"] {
    color: #137d5e;
    font-weight: 600;
}

.coupon-validation-message[data-state="invalid"] {
    color: var(--danger);
    font-weight: 600;
}

.payment-total-box {
    display: grid;
    gap: 5px;
    padding: 16px;
    border: 1px solid rgba(200, 74, 42, .22);
    border-radius: 8px;
    background: var(--primary-soft);
}

.payment-total-box span {
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.payment-total-box strong {
    color: var(--heading);
    font-size: 30px;
    line-height: 1;
}

.payment-total-box small {
    color: var(--muted);
    font-size: 12.5px;
}

.payment-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.password-dialog-body {
    padding: 20px 24px 24px;
}

.password-dialog-body .section-help {
    margin-bottom: 18px;
    max-width: 100%;
}

.password-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.password-dialog-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

.password-dialog-actions .btn {
    min-width: 150px;
}

.btn:disabled {
    opacity: .48;
    cursor: not-allowed;
    transform: none;
}

.register-box .btn.is-loading::before {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: .5em;
    vertical-align: -.15em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: register-spin .8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .register-box .btn.is-loading::before {
        animation: none;
    }
}

.link-button {
    display: inline;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.link-button:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.paid-detail-dialog {
    max-width: 85%;
}

.paid-detail-body {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding: 20px 24px 24px;
    overflow-y: auto;
}

.paid-detail-body section {
    min-width: 0;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FAF7F5;
}

.paid-detail-body h4 {
    margin: 0 0 12px;
    color: var(--heading);
    font-size: 13px;
}

.detail-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.detail-list div {
    display: grid;
    gap: 2px;
}

.detail-list dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.detail-list dd {
    margin: 0;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.records-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
}

.records-actions {
    align-items: end;
}

.records-filter label {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.records-filter input {
    min-height: 40px;
}

.records-detail-body {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.record-json {
    max-height: 220px;
    margin: 0;
    overflow: auto;
    white-space: pre-wrap;
    color: var(--ink);
    font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ─── Billing ────────────────────────────────────────────────────────── */
.billing-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    align-items: stretch;
    margin-bottom: 22px;
}

.billing-plan-card,
.billing-change-card {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 22px;
    border: 1px solid rgba(232, 215, 206, .72);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.billing-plan-card h2,
.billing-change-card h2 {
    margin: 0;
    font-size: 24px;
}

.billing-plan-card p,
.billing-change-card p {
    color: var(--muted);
}

.billing-plan-card .btn {
    justify-self: start;
}

.billing-change-card>span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.billing-change-card .billing-pay-form {
    margin-top: 0;
}

.billing-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, .42fr);
    gap: 22px;
    margin-bottom: 22px;
}

.billing-hero>div:first-child,
.billing-status-card,
.billing-info {
    padding: 22px;
    border: 1px solid rgba(232, 215, 206, .72);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.billing-hero h2 {
    margin-top: 12px;
    font-size: 24px;
}

.billing-hero p,
.billing-info li {
    color: var(--muted);
    line-height: 1.6;
}

.billing-status-card {
    display: grid;
    align-content: start;
    gap: 6px;
    background: var(--primary-soft);
    border-color: rgba(200, 74, 42, .22);
}

.billing-status-card span {
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.billing-status-card strong {
    color: var(--heading);
    font-size: 28px;
}

.billing-status-card small {
    color: var(--muted);
    font-size: 12.5px;
}

.billing-status-card .btn {
    justify-self: start;
    margin-top: 8px;
}

.billing-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
    gap: 22px;
}

.trial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin: -8px 0 22px;
}

.trial-grid article {
    display: grid;
    gap: 5px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.trial-grid span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.trial-grid strong {
    color: var(--heading);
    font-size: 22px;
}

.trial-grid small {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.5;
}

.billing-pay-form {
    margin-top: 16px;
}

.billing-info ul {
    display: grid;
    gap: 10px;
    margin: 14px 0 0;
    padding-left: 18px;
}

.billing-info strong {
    color: var(--heading);
}

.plan-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    align-items: start;
    gap: 14px;
    padding: 18px;
}

.plan-cards article {
    display: grid;
    gap: 9px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FAF7F5;
}

.plan-cards article.current {
    background: var(--primary-soft);
    border-color: rgba(200, 74, 42, .25);
}

.plan-cards h3 {
    margin: 0;
    color: var(--heading);
    font-size: 16px;
}

.plan-cards strong {
    color: var(--heading);
    font-size: 20px;
}

.plan-cards small,
.plan-cards p {
    color: var(--muted);
    font-size: 12.5px;
}

/* ─── Tariffs ────────────────────────────────────────────────────────── */
.tariff-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
    gap: 22px;
    align-items: stretch;
    margin-bottom: 22px;
}

.tariff-hero>div:first-child {
    display: grid;
    align-content: center;
    gap: 12px;
    padding: 26px;
    border-radius: var(--radius);
    border: 1px solid rgba(232, 215, 206, .72);
    background: linear-gradient(135deg, #fff 0%, #FEF8F4 100%);
    box-shadow: var(--shadow-sm);
}

.tariff-hero h2 {
    max-width: 780px;
    font-size: 24px;
    line-height: 1.28;
}

.tariff-hero p {
    max-width: 760px;
    color: var(--muted);
    font-size: 14px;
}

.tariff-quick-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.tariff-quick-stats article {
    display: grid;
    align-content: center;
    gap: 4px;
    min-height: 112px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.tariff-quick-stats strong {
    color: var(--heading);
    font-size: 28px;
    line-height: 1;
}

.tariff-quick-stats span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.tariff-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
    gap: 22px;
    align-items: stretch;
}

.tariff-simulator {
    overflow-x: visible;
}

.tariff-simulator-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    align-items: end;
}

.tariff-simulator-form .btn {
    grid-column: auto;
    white-space: nowrap;
}

.simulation-result {
    display: grid;
    gap: 5px;
    margin-top: 18px;
    padding: 18px;
    border: 1px solid rgba(200, 74, 42, .22);
    border-radius: 8px;
    background: var(--primary-soft);
}

.simulation-result span {
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.simulation-result strong {
    color: var(--heading);
    font-size: 34px;
    line-height: 1;
}

.simulation-result small {
    color: var(--muted);
    font-size: 12.5px;
}

.monthly-payment-total {
    grid-column: 1 / -1;
    margin-top: 0;
}

.tariff-guide {
    padding: 22px;
    border: 1px solid rgba(232, 215, 206, .72);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.tariff-guide h2 {
    margin-bottom: 14px;
}

.tariff-guide ol {
    display: grid;
    gap: 11px;
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
}

.tariff-guide li {
    line-height: 1.55;
}

.tariff-guide strong {
    color: var(--heading);
}

.compact-drawer {
    margin: 0;
    flex: 0 0 auto;
}

.compact-drawer[open] {
    flex-basis: 100%;
    margin-top: 14px;
}

.tariff-examples {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.tariff-examples article {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FAF7F5;
}

.tariff-examples strong {
    display: block;
    margin-bottom: 5px;
    color: var(--heading);
    font-size: 13px;
}

.tariff-examples span {
    display: block;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.5;
}

.tariff-rule-list {
    display: grid;
    gap: 12px;
}

.tariff-rule-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.tariff-rule-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, auto);
    gap: 16px;
    align-items: center;
    padding: 16px;
}

.rule-title-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}

.rule-title-line h3 {
    margin: 0;
    color: var(--heading);
    font-size: 16px;
}

.tariff-rule-summary p {
    color: var(--muted);
    font-size: 12.5px;
    margin: 0;
}

.rule-meta {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.rule-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: #FAF7F5;
    font-size: 12px;
    font-weight: 600;
}

.rule-meta strong {
    color: var(--heading);
    margin-left: 4px;
}

.muted-badge {
    background: #F0ECE9;
    color: var(--muted);
}

.rule-edit-drawer {
    border-top: 1px solid var(--line);
    padding: 12px 16px 16px;
}

.rule-edit-drawer summary {
    width: fit-content;
    list-style: none;
}

.rule-edit-drawer summary::-webkit-details-marker {
    display: none;
}

.rule-edit-drawer[open] summary {
    margin-bottom: 14px;
}

.tariff-rule-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 14px;
    align-items: start;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FAF7F5;
}

.tariff-create-form {
    display: grid;
    gap: 18px;
}

.tariff-create-intro,
.tariff-create-hint,
.tariff-advanced p,
.tariff-price-panel p,
.tariff-step-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.tariff-create-step,
.tariff-advanced {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #FAF7F5;
}

.tariff-step-heading {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.tariff-step-heading > span {
    display: grid;
    place-items: center;
    flex: 0 0 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 700;
}

.tariff-step-heading h3 {
    margin: 0 0 3px;
    font-size: 15px;
    color: var(--heading);
}

.tariff-create-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.tariff-price-panel {
    display: grid;
    gap: 12px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.tariff-price-panel[hidden] { display: none; }

.tariff-advanced summary {
    color: var(--heading);
    font-weight: 600;
    cursor: pointer;
}

.tariff-advanced[open] > :not(summary) { margin-top: 14px; }

@media (max-width: 600px) {
    .tariff-create-grid { grid-template-columns: 1fr; }
}

.tariff-rule-form>.btn {
    grid-column: 1 / -1;
    justify-self: start;
}

.tariff-form-section {
    display: grid;
    gap: 12px;
    align-content: start;
}

.tariff-form-section h3 {
    margin: 0;
    color: var(--heading);
    font-size: 13px;
}

label small {
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.45;
}

.section-help {
    max-width: 640px;
    color: var(--muted);
    font-size: 13px;
}

.tariff-holidays-panel {
    margin-top: 22px;
}

.holiday-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    max-width: min(360px, calc(100vw - 40px));
    padding: 12px 16px;
    border-radius: 8px;
    background: #245c43;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

.holiday-toast.is-error { background: #a6322d; }
.holiday-toast[hidden] { display: none; }

.empty-state {
    display: grid;
    gap: 4px;
    padding: 22px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: #FAF7F5;
}

.empty-state strong {
    color: var(--heading);
}

.cash-methods {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 24px 0;
}

.cash-methods div {
    display: grid;
    min-width: 180px;
    gap: 3px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #FAF7F5;
}

.cash-methods span,
.cash-methods small,
.empty-cell {
    color: var(--muted);
}

.cash-close-form {
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.receipt-page {
    min-height: 100vh;
    padding: 32px 16px;
    background: #F4F1EF;
}

.receipt-card {
    width: min(100%, 620px);
    margin: 0 auto;
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: white;
    box-shadow: var(--shadow);
}

.receipt-card header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.receipt-card header img {
    width: 58px;
}

.receipt-card header p,
.receipt-card header h1 {
    margin: 0;
}

.receipt-card header p {
    color: var(--muted);
}

.receipt-card header h1 {
    font-size: 22px;
}

.receipt-number {
    display: flex;
    justify-content: space-between;
    margin: 22px 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: #FAF7F5;
}

.receipt-details {
    margin: 0;
}

.receipt-details div,
.receipt-totals div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.receipt-details dt {
    color: var(--muted);
}

.receipt-details dd {
    margin: 0;
    text-align: right;
    font-weight: 600;
}

.receipt-totals {
    margin-top: 20px;
}

.receipt-totals .receipt-total {
    padding: 16px 0;
    font-size: 20px;
    border-bottom: 0;
}

.receipt-disclaimer {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.receipt-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

@media print {
    .receipt-page {
        padding: 0;
        background: white;
    }

    .receipt-card {
        border: 0;
        box-shadow: none;
    }

    .receipt-actions {
        display: none;
    }
}

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .billing-hero,
    .billing-grid,
    .trial-grid {
        grid-template-columns: 1fr;
    }

    .tariff-hero,
    .tariff-workspace {
        grid-template-columns: 1fr;
    }

    .tariff-rule-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    .auth-panel {
        min-height: 340px;
    }

    .auth-card-head,
    .auth-switch,
    .auth-form-wrap {
        max-width: 560px;
    }
}

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

    .sidebar {
        position: static;
        height: auto;
    }

    .brand {
        margin-top: 16px;
    }

    .main {
        padding: 18px;
    }

    .topbar {
        margin: -18px -18px 20px;
        padding: 16px 18px;
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .search-pill {
        min-width: 0;
        flex: 1 1 140px;
    }

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

    .auth-panel {
        padding: 34px;
    }

    .auth-card {
        padding: 24px;
    }

    .auth-panel h1 {
        font-size: 28px;
    }

    .coupon-create-content {
        grid-template-columns: 1fr;
    }

    .coupon-help {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .payment-form-grid,
    .coupon-validator {
        grid-template-columns: 1fr;
    }

    .paid-detail-body {
        grid-template-columns: 1fr;
    }

    .tariff-simulator-form,
    .tariff-examples,
    .tariff-rule-summary {
        grid-template-columns: 1fr;
    }

    .tariff-simulator-form .btn {
        grid-column: 1 / -1;
    }

    .rule-meta {
        justify-content: flex-start;
    }
}

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

    .panel {
        padding: 16px;
    }

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

    .chart-bars {
        gap: 5px;
        height: 170px;
    }

    .monthly-chart,
    .weekly-chart {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tariff-quick-stats,
    .tariff-rule-form,
    .password-form {
        grid-template-columns: 1fr;
    }

    .password-dialog-actions {
        justify-content: stretch;
    }

    .password-dialog-actions .btn {
        width: 100%;
    }

    .tariff-hero h2 {
        font-size: 20px;
    }

    .simulation-result strong {
        font-size: 28px;
    }
}

/* Centro de ayuda */
.help-page { max-width: 1400px; margin: 0 auto; }
.help-hero { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:38px 42px; border-radius:22px; color:#fff; background:linear-gradient(115deg,#113e39,#236b57); overflow:hidden; }
.help-hero h2 { color:#fff; font-size:clamp(26px,3vw,38px); line-height:1.2; max-width:620px; margin:10px 0; letter-spacing:-.03em; }
.help-hero p { max-width:650px; margin:0; line-height:1.7; color:#d9ede3; }
.help-kicker { font-size:11px; font-weight:700; letter-spacing:.13em; color:#a9e9c5; }
.help-hero-mark { flex:none; width:112px; height:112px; display:grid; place-items:center; border:1px solid #ffffff40; border-radius:35px; background:#ffffff12; font-size:72px; font-weight:700; color:#a9e9c5; }
.help-layout { display:grid; grid-template-columns:245px minmax(0,1fr); gap:28px; align-items:start; margin-top:28px; }
.help-index { position:sticky; top:24px; max-height:calc(100vh - 48px); overflow:auto; padding:22px; border:1px solid #e4ebe7; border-radius:18px; background:#fff; }
.help-index > summary { font-size:15px; color:#193d32; font-weight:700; cursor:pointer; }
.help-index > p { margin:8px 0 20px; color:#72847d; font-size:12px; line-height:1.6; }
.help-index-group { display:grid; gap:9px; margin-top:20px; }
.help-index-group span { color:#899a92; text-transform:uppercase; letter-spacing:.08em; font-size:10px; font-weight:700; }
.help-index-group a { color:#45645a; text-decoration:none; font-size:12px; line-height:1.4; }
.help-index-group a:hover { color:#16805b; text-decoration:underline; }
.help-start { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:24px 26px; background:#edf7f0; border:1px solid #d9ede0; border-radius:18px; }
.help-section-label { display:block; color:#438265; font-size:10px; text-transform:uppercase; letter-spacing:.1em; font-weight:700; }
.help-start h2 { margin:6px 0; font-size:20px; color:#163e31; }
.help-start p { margin:0; font-size:13px; line-height:1.6; color:#577668; }
.help-start-link,.help-action { flex:none; display:inline-flex; align-items:center; gap:10px; color:#166148; font-weight:700; text-decoration:none; font-size:13px; }
.help-start-link:hover,.help-action:hover { text-decoration:underline; }
.help-search-label { display:block; margin:30px 0 8px; color:#24463a; font-size:13px; font-weight:700; }
.help-search-wrap { display:flex; align-items:center; gap:10px; background:#fff; border:1px solid #dbe7df; border-radius:12px; padding:0 15px; }
.help-search-wrap span { color:#588071; font-size:25px; }
.help-search-wrap input { width:100%; padding:14px 0; border:0; outline:0; background:transparent; font:inherit; font-size:14px; color:#203b30; }
.help-search-count { margin:8px 0 24px; font-size:12px; color:#788e83; }
.help-category { margin:30px 0; }
.help-category-heading { display:flex; align-items:center; gap:10px; margin:0 0 13px; }
.help-category-heading span { width:5px; height:21px; border-radius:4px; background:#45ae79; }
.help-category-heading h2 { margin:0; color:#204337; font-size:18px; }
.help-guide { scroll-margin-top:24px; margin:0 0 16px; border:1px solid #e1ebe4; border-radius:17px; background:#fff; overflow:hidden; }
.help-guide-top { padding:23px 26px 17px; border-bottom:1px solid #eef3ef; }
.help-guide-top h3 { margin:7px 0; color:#173d31; font-size:19px; }
.help-guide-top p { margin:0; color:#667d71; font-size:13px; line-height:1.7; }
.help-guide-body { padding:18px 26px 24px; }
.help-guide-body h4 { margin:0 0 12px; color:#264f3e; font-size:13px; }
.help-guide-body ol { display:grid; gap:10px; margin:0; padding-left:22px; color:#425b50; font-size:13px; line-height:1.75; }
.help-guide-body li { padding-left:4px; }
.help-guide-body li::marker { color:#23825d; font-weight:700; }
.help-note { margin-top:18px; border-left:3px solid #64bb8e; border-radius:0 9px 9px 0; background:#f1f8f3; padding:12px 15px; color:#466c57; font-size:12px; line-height:1.65; }
.help-note p { margin:4px 0 0; }
.help-action { margin-top:20px; }
.help-empty { padding:30px; border:1px solid #e1ebe4; border-radius:16px; text-align:center; color:#71867c; background:#fff; }
.help-guide[hidden],.help-category[hidden],.help-empty[hidden] { display:none; }
@media (max-width:900px) { .help-layout { grid-template-columns:1fr; } .help-index { position:static; max-height:none; } }
@media (max-width:600px) { .help-hero { padding:28px 24px; } .help-hero-mark { display:none; } .help-start { align-items:flex-start; flex-direction:column; } .help-guide-top,.help-guide-body { padding-left:20px; padding-right:20px; } }
