:root {
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --sidebar: #101828;
    --sidebar-soft: #182235;
    --text: #111827;
    --text-invert: #f8fafc;
    --muted: #667085;
    --line: #e4e7ec;
    --green: #05b86b;
    --green-dark: #038c52;
    --blue: #2563eb;
    --red: #e5484d;
    --amber: #f59e0b;
    --shadow: 0 18px 42px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
    font-size: 14px;
}

a { color: inherit; text-decoration: none; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 264px;
    overflow: auto;
    padding: 20px 16px;
    background: var(--sidebar);
    color: var(--text-invert);
}

.brand {
    display: grid;
    gap: 4px;
    margin-bottom: 26px;
    padding: 0 4px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand span {
    font-size: 22px;
    line-height: 1.15;
    font-weight: 800;
}

.brand-logo {
    display: block;
    max-width: 190px;
    max-height: 58px;
    object-fit: contain;
}

.brand small,
.profile span {
    color: #98a2b3;
    font-size: 12px;
}

.profile {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 12px;
    align-items: center;
    margin-bottom: 22px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    background: rgba(255, 255, 255, .04);
}

.profile strong {
    display: block;
    margin-bottom: 3px;
}

.avatar,
.user-chip span {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), var(--blue));
    color: #fff;
    font-weight: 800;
}

nav {
    display: grid;
    gap: 6px;
}

nav a {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    min-height: 42px;
    padding: 6px 10px;
    border-radius: 8px;
    color: #cbd5e1;
    font-weight: 650;
}

nav a:hover,
nav a.active {
    background: var(--sidebar-soft);
    color: #fff;
}

.nav-icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: rgba(255, 255, 255, .08);
    color: #9ae6b4;
}

.nav-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

nav a.active .nav-icon {
    background: var(--green);
    color: #fff;
}

.nav-icon.green { color: #00d26a; }
.nav-icon.blue { color: #1687f2; }
.nav-icon.red { color: #ff3f4f; }
.nav-icon.yellow { color: #ffb000; }
.nav-icon.violet { color: #7d5cff; }
.nav-icon.purple { color: #a855f7; }

nav a:hover .nav-icon,
nav a.active .nav-icon {
    color: #fff;
}

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

.submenu {
    display: grid;
    gap: 2px;
    margin: -2px 0 4px 48px;
}

.submenu a {
    min-height: 30px;
    display: flex;
    padding: 4px 8px;
    border-radius: 6px;
    color: #8790bd;
    font-size: 14px;
    font-weight: 500;
}

.submenu a:before {
    display: none;
}

.tenant-panel .submenu {
    margin: 0 0 6px 54px;
}

.tenant-panel .submenu a {
    min-height: 28px;
    padding: 4px 0;
    background: transparent;
    border-radius: 0;
    color: #8790bd;
    font-size: 14px;
}

.tenant-panel .submenu a.active,
.tenant-panel .submenu a:hover {
    background: transparent;
    color: #fff;
}

.main {
    min-height: 100vh;
    margin-left: 264px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    min-height: 78px;
    padding: 18px 32px;
    background: rgba(255, 255, 255, .9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.topbar h1 {
    margin: 2px 0 0;
    font-size: 22px;
    line-height: 1.2;
    letter-spacing: 0;
}

.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

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

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 4px 12px 4px 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 750;
}

.user-chip span {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.top-dropdown {
    position: relative;
}

.top-dropdown > summary {
    list-style: none;
    cursor: pointer;
}

.top-dropdown > summary::-webkit-details-marker {
    display: none;
}

.top-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 80;
    display: grid;
    min-width: 232px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 3px;
    background: #191d25;
    color: #fff;
    box-shadow: 0 18px 34px rgba(0, 0, 0, .28);
}

.quick-dropdown .top-dropdown-menu {
    right: auto;
    left: 0;
}

.dropdown-title {
    display: block;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    font-size: 15px;
    font-weight: 850;
}

.dropdown-item {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    gap: 10px;
    min-height: 60px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    color: #e7ecff;
    font-weight: 750;
}

.dropdown-item:last-child {
    border-bottom: 0;
}

.dropdown-item:hover {
    background: #11151d;
    color: #fff;
}

.dropdown-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #050607;
    color: #fff;
}

.dropdown-icon svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dropdown-icon.blue { color: #1687f2; }
.dropdown-icon.green { color: #00d26a; }
.dropdown-icon.red { color: #fc424a; }
.dropdown-icon.light { color: #fff; }

.caret {
    color: #cbd5e1;
    font-size: 15px;
    line-height: 1;
}

.content {
    max-width: 1440px;
    padding: 24px 32px 42px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 7px;
    background: var(--green);
    color: #fff;
    font-weight: 800;
    padding: 10px 16px;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(5, 184, 107, .22);
}

.btn:hover { background: var(--green-dark); }
.btn.small { min-height: 32px; padding: 7px 11px; font-size: 12px; }
.btn.full { width: 100%; }

.flash {
    margin: 0 0 18px;
    padding: 13px 16px;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
}

.flash.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.flash.success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.panel {
    margin: 0 0 22px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel h2,
.panel h3 {
    margin: 0 0 18px;
    color: #101828;
    line-height: 1.2;
}

.narrow { max-width: 650px; }

.split {
    display: grid;
    grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
    gap: 22px;
}

.grid.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.stats div {
    position: relative;
    overflow: hidden;
    min-height: 116px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.stats div:before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(var(--green), var(--blue));
}

.stats span {
    display: block;
    margin-bottom: 18px;
    color: var(--muted);
    font-weight: 750;
}

.stats strong {
    color: #101828;
    font-size: 26px;
    line-height: 1;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

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

th {
    color: #475467;
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

tbody tr:hover td { background: #f9fafb; }

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    background: #ecfdf3;
    color: #027a48;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 800;
}

label {
    display: block;
    margin: 0 0 14px;
    color: #344054;
    font-weight: 780;
}

input,
select,
textarea {
    width: 100%;
    margin-top: 7px;
    border: 1px solid #d0d5dd;
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    padding: 11px 12px;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

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

.inline { display: inline; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 14px;
    align-items: end;
}

.form-grid .btn { margin-bottom: 14px; }

.center-panel {
    min-height: 430px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.center-panel h1 {
    color: var(--amber);
    margin: 14px 0 8px;
}

.center-panel h2 {
    color: var(--red);
    margin: 0 0 30px;
}

.receipt-icon {
    display: grid;
    place-items: center;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: #fff1f2;
    color: var(--red);
    font-size: 52px;
    font-weight: 900;
}

.subscription-status {
    min-height: 390px;
    gap: 6px;
}

.subscription-status h1 {
    margin: 18px 0 6px;
    color: #00d26a;
}

.subscription-status h2 {
    margin: 0 0 20px;
    color: #ffb000;
}

.subscription-status p {
    max-width: 660px;
    margin: 0 0 18px;
    color: #9aa6d8;
    font-weight: 650;
}

.subscription-status.is-overdue h1,
.subscription-status.is-overdue h2 {
    color: #fc424a;
}

.subscription-icon {
    display: grid;
    place-items: center;
    width: 122px;
    height: 122px;
    border: 7px solid #101218;
    border-radius: 50%;
    background: #5db77b;
    color: #101218;
    font-size: 64px;
    line-height: 1;
    font-weight: 950;
}

.subscription-status.is-overdue .subscription-icon {
    background: #fc424a;
    color: #fff;
}

.pay {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 42px;
}

.pay pre {
    max-width: 100%;
    overflow: auto;
    white-space: pre-wrap;
    border-radius: 8px;
    background: #ecfdf3;
    color: #065f46;
    padding: 18px;
    font-size: 12px;
}

.qr {
    width: 240px;
    height: 240px;
    display: grid;
    place-items: center;
    border: 14px solid #fff;
    background: repeating-linear-gradient(45deg, #111827 0 8px, #fff 8px 16px);
    color: #fff;
    font-weight: 900;
    box-shadow: var(--shadow);
}

.manual-pay-panel {
    max-width: 820px;
}

.manual-pay-panel pre {
    max-width: 100%;
    overflow: auto;
    white-space: pre-wrap;
    border-radius: 6px;
    background: #11151d;
    color: #00d26a;
    padding: 18px;
    font-size: 16px;
    font-weight: 800;
}

.manual-pay-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.guest {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background: #000;
}

.login-card {
    width: min(430px, calc(100vw - 32px));
    padding: 28px 32px 30px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    background: #050607;
    color: #fff;
    box-shadow: 0 0 34px rgba(5, 184, 107, .12);
    text-align: center;
}

.register-card {
    width: min(390px, calc(100vw - 32px));
}

.login-card h1 {
    margin: 0 0 24px;
    font-size: 21px;
}

.login-card p,
.login-card small {
    color: #d6d9e1;
}

.auth-logo {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    margin: 0 auto 18px;
    border: 2px solid #1fc867;
    border-radius: 50%;
    background: #101828;
    color: #fff;
    font-size: 48px;
    font-weight: 900;
    box-shadow: 0 0 22px rgba(31, 200, 103, .22);
}

.auth-logo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
}

.field {
    display: grid;
    grid-template-columns: 1fr 40px;
    align-items: stretch;
    margin: 14px 0;
    color: #fff;
}

.field input,
.field select {
    height: 38px;
    margin: 0;
    border-radius: 8px 0 0 8px;
    border: 1px solid #d0d5dd;
    background: #fff;
    color: #111827;
}

.field span {
    display: grid;
    place-items: center;
    height: 38px;
    border: 1px solid #d0d5dd;
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: #eef2f7;
    color: #475467;
    font-weight: 900;
}

.auth-links {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 16px 0;
    color: #cbd5e1;
    font-weight: 700;
}

.auth-links a {
    color: #4ade80;
}

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

@media (max-width: 760px) {
    .sidebar {
        position: static;
        width: auto;
        border-radius: 0;
    }

    .main {
        margin-left: 0;
    }

    .topbar {
        position: static;
        align-items: flex-start;
        flex-direction: column;
        padding: 18px;
    }

    .top-actions {
        width: 100%;
        justify-content: space-between;
    }

    .content {
        padding: 18px;
    }

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

    .panel {
        padding: 18px;
        overflow-x: auto;
    }

    table {
        min-width: 680px;
    }
}

/* Functional collapsible tenant sidebar */
.tenant-panel {
    --tenant-sidebar-expanded: 254px;
    --tenant-sidebar-collapsed: 68px;
    --tenant-sidebar-current: var(--tenant-sidebar-expanded);
}

.tenant-panel.sidebar-collapsed {
    --tenant-sidebar-current: var(--tenant-sidebar-collapsed);
}

.tenant-panel .sidebar {
    width: var(--tenant-sidebar-current) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin;
    scrollbar-color: #00d26a #050607;
    transition: width .22s ease;
}

.tenant-panel .sidebar::-webkit-scrollbar {
    width: 8px;
}

.tenant-panel .sidebar::-webkit-scrollbar-track {
    background: #050607;
}

.tenant-panel .sidebar::-webkit-scrollbar-thumb {
    background: #00d26a;
    border-radius: 999px;
}

.tenant-panel .main {
    margin-left: var(--tenant-sidebar-current) !important;
    transition: margin-left .22s ease;
}

.tenant-panel .topbar {
    left: var(--tenant-sidebar-current) !important;
    transition: left .22s ease;
}

.tenant-panel.sidebar-collapsed .sidebar {
    padding-left: 10px;
    padding-right: 10px;
}

.tenant-panel.sidebar-collapsed .brand {
    display: grid;
    place-items: center;
    padding: 0 0 18px;
    margin-bottom: 18px;
}

.tenant-panel.sidebar-collapsed .brand span {
    width: 40px;
    max-width: 40px;
    overflow: hidden;
    white-space: nowrap;
    font-size: 22px;
    line-height: 1;
}

.tenant-panel.sidebar-collapsed .brand small,
.tenant-panel.sidebar-collapsed .profile strong,
.tenant-panel.sidebar-collapsed .profile span,
.tenant-panel.sidebar-collapsed nav:before,
.tenant-panel.sidebar-collapsed nav a:not(.submenu a) {
    font-size: 0;
}

.tenant-panel.sidebar-collapsed .profile {
    grid-template-columns: 1fr;
    justify-items: center;
    margin-bottom: 18px;
}

.tenant-panel.sidebar-collapsed .profile > div:last-child {
    display: none;
}

.tenant-panel.sidebar-collapsed nav {
    justify-items: center;
    gap: 10px;
}

.tenant-panel.sidebar-collapsed nav a {
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    width: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 50%;
}

.tenant-panel.sidebar-collapsed nav a.active:before {
    display: none;
}

.tenant-panel.sidebar-collapsed .nav-icon {
    width: 34px;
    height: 34px;
}

.tenant-panel.sidebar-collapsed .submenu {
    display: none;
}

.tenant-panel.sidebar-collapsed .topbar {
    padding-left: 24px;
}

@media (max-width: 760px) {
    .tenant-panel,
    .tenant-panel.sidebar-collapsed {
        --tenant-sidebar-current: 100%;
    }

    .tenant-panel .sidebar,
    .tenant-panel.sidebar-collapsed .sidebar {
        width: 100% !important;
        max-height: none;
        overflow: visible !important;
    }

    .tenant-panel .main,
    .tenant-panel.sidebar-collapsed .main {
        margin-left: 0 !important;
    }

    .tenant-panel .topbar,
    .tenant-panel.sidebar-collapsed .topbar {
        left: 0 !important;
    }

    .tenant-panel.sidebar-collapsed .brand small,
    .tenant-panel.sidebar-collapsed .profile strong,
    .tenant-panel.sidebar-collapsed .profile span,
    .tenant-panel.sidebar-collapsed nav:before,
    .tenant-panel.sidebar-collapsed nav a:not(.submenu a) {
        font-size: inherit;
    }

    .tenant-panel.sidebar-collapsed .brand span {
        width: auto;
        max-width: none;
        font-size: 22px;
    }

    .tenant-panel.sidebar-collapsed .profile {
        grid-template-columns: 40px minmax(0, 1fr);
        justify-items: stretch;
    }

    .tenant-panel.sidebar-collapsed .profile > div:last-child,
    .tenant-panel.sidebar-collapsed .submenu {
        display: grid;
    }

    .tenant-panel.sidebar-collapsed nav {
        justify-items: stretch;
        gap: 4px;
    }

    .tenant-panel.sidebar-collapsed nav a {
        grid-template-columns: 34px minmax(0, 1fr);
        place-items: center start;
        width: auto;
        min-height: 42px;
        padding: 6px 12px;
        border-radius: 999px;
    }
}

/* Tenant shell - final polished layout */
.tenant-panel {
    --tenant-sidebar: 248px;
    --tenant-topbar: 72px;
    --tenant-bg: #050607;
    --tenant-side: #171b23;
    --tenant-panel: #191d25;
    --tenant-panel-2: #202630;
    --tenant-muted: #8790bd;
    --tenant-line: #2a3040;
    --tenant-green: #00d26a;
    background: var(--tenant-bg);
}

.tenant-panel .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--tenant-sidebar);
    padding: 20px 14px 18px;
    overflow-y: auto;
    scrollbar-width: none;
    background: var(--tenant-side);
    border-right: 1px solid rgba(255,255,255,.03);
}

.tenant-panel .sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.tenant-panel .brand {
    min-height: auto;
    margin: 0 0 26px;
    padding: 0 6px 18px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.tenant-panel .brand span {
    display: block;
    max-width: 190px;
    color: #fff;
    font-size: 22px;
    line-height: 1.16;
    font-weight: 900;
}

.tenant-panel .brand small {
    display: block;
    margin-top: 8px;
    color: #9aa6d8;
    font-size: 12px;
}

.tenant-panel .profile {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin: 0 4px 24px;
    padding: 0;
    border: 0;
    background: transparent;
}

.tenant-panel .profile .avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #00d26a, #1687f2);
}

.tenant-panel .profile strong,
.tenant-panel .profile span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.tenant-panel nav:before {
    content: "Menu";
    margin: 0 0 10px 4px;
    color: #9aa6d8;
    font-size: 13px;
    font-weight: 700;
}

.tenant-panel nav a {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    min-height: 42px;
    margin: 0;
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--tenant-muted);
    font-size: 14px;
    font-weight: 650;
}

.tenant-panel nav a:hover {
    background: rgba(255,255,255,.035);
    color: #fff;
}

.tenant-panel nav a.active {
    background: #101218;
    color: #fff;
}

.tenant-panel nav a.active:before {
    left: -14px;
    width: 3px;
    background: #1687f2;
}

.tenant-panel .nav-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #252b3a;
}

.tenant-panel .nav-icon svg {
    width: 15px;
    height: 15px;
}

.tenant-panel nav a.active .nav-icon {
    background: var(--tenant-green);
    color: #fff;
}

.tenant-panel .submenu {
    display: grid;
    gap: 2px;
    margin: 1px 0 5px 58px;
}

.tenant-panel .submenu a {
    display: block;
    min-height: 26px;
    padding: 4px 0;
    border-radius: 0;
    background: transparent;
    color: var(--tenant-muted);
    font-size: 13px;
    font-weight: 600;
}

.tenant-panel .submenu a.active,
.tenant-panel .submenu a:hover {
    background: transparent;
    color: #fff;
}

.tenant-panel .main {
    min-height: 100vh;
    margin-left: var(--tenant-sidebar);
    padding-top: var(--tenant-topbar);
    background: var(--tenant-bg);
}

.tenant-panel .topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--tenant-sidebar);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--tenant-topbar);
    min-height: var(--tenant-topbar);
    padding: 0 28px;
    background: var(--tenant-panel);
    border-bottom: 1px solid rgba(255,255,255,.03);
}

.tenant-panel .icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: transparent;
    color: #9aa6d8;
}

.tenant-panel .top-actions {
    display: flex;
    align-items: center;
    gap: 22px;
    height: auto;
    padding: 0;
    background: transparent;
}

.tenant-panel .top-actions .btn {
    min-height: 38px;
    border-radius: 4px;
    box-shadow: none;
}

.tenant-panel .user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
}

.tenant-panel .user-chip span {
    width: 34px;
    height: 34px;
    font-size: 13px;
}

.tenant-panel .top-dropdown-menu {
    top: calc(100% + 11px);
    background: #191d25;
}

.tenant-panel .quick-dropdown .top-dropdown-menu {
    left: auto;
    right: 0;
}

.tenant-panel .dropdown-item {
    color: #e7ecff;
}

.tenant-panel .content {
    width: 100%;
    max-width: none;
    padding: 28px;
}

.tenant-panel .panel,
.tenant-panel .dash-card {
    border: 1px solid rgba(255,255,255,.025);
    border-radius: 5px;
    background: var(--tenant-panel);
    box-shadow: none;
}

.tenant-panel .panel {
    margin-bottom: 16px;
}

.tenant-panel input,
.tenant-panel select,
.tenant-panel textarea {
    border: 1px solid transparent;
    border-radius: 4px;
    background: #2a3038;
    color: #fff;
}

.tenant-panel input:focus,
.tenant-panel select:focus,
.tenant-panel textarea:focus {
    border-color: rgba(0,210,106,.75);
    box-shadow: 0 0 0 3px rgba(0,210,106,.12);
}

.tenant-panel .dashboard-filter form {
    grid-template-columns: minmax(160px, 190px) minmax(160px, 190px) minmax(220px, 1fr) minmax(220px, 1fr) minmax(150px, 190px);
}

.tenant-panel .dashboard-cards,
.tenant-panel .report-cards {
    gap: 22px;
}

.tenant-panel .chart-panel {
    min-height: 335px;
}

@media (max-width: 1180px) {
    .tenant-panel {
        --tenant-sidebar: 232px;
    }

    .tenant-panel .dashboard-filter form,
    .tenant-panel .contracts-filter form,
    .tenant-panel .daily-filter form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tenant-panel .dashboard-cards,
    .tenant-panel .report-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .tenant-panel .sidebar {
        position: static;
        width: 100%;
        max-height: none;
        overflow: visible;
        padding: 18px;
    }

    .tenant-panel .brand span {
        max-width: none;
        font-size: 22px;
    }

    .tenant-panel .main {
        margin-left: 0;
        padding-top: 0;
    }

    .tenant-panel .topbar {
        position: sticky;
        left: 0;
        height: auto;
        min-height: 64px;
        padding: 12px 16px;
    }

    .tenant-panel .top-actions {
        gap: 10px;
    }

    .tenant-panel .top-actions .btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    .tenant-panel .content {
        padding: 16px;
    }

    .tenant-panel .dashboard-filter form,
    .tenant-panel .contracts-filter form,
    .tenant-panel .daily-filter form,
    .tenant-panel .dashboard-cards,
    .tenant-panel .report-cards {
        grid-template-columns: 1fr;
    }

    .tenant-panel .form-row.two,
    .tenant-panel .form-row.three,
    .tenant-panel .form-row.four {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .tenant-panel .topbar {
        position: static;
        display: flex;
        height: auto;
        min-height: 70px;
        padding: 14px;
        flex-direction: column;
        align-items: stretch;
    }

    .tenant-panel .header-brand,
    .tenant-panel .tenant-top-main,
    .tenant-panel .top-actions {
        height: auto;
        padding: 0;
    }

    .tenant-panel .sidebar {
        position: static;
        width: auto;
        overflow: visible;
    }

    .tenant-panel .main {
        margin-left: 0;
        padding-top: 0;
    }
}

.tenant-panel {
    background: #000;
    color: #fff;
    --tenant-sidebar: 244px;
    --tenant-topbar: 70px;
}

.tenant-panel .sidebar {
    width: var(--tenant-sidebar);
    inset: 0 auto 0 0;
    padding: 18px 14px;
    overflow: hidden;
    background: #191d25;
}

.tenant-panel .brand {
    display: grid;
    gap: 8px;
    min-height: 54px;
    margin: 0 0 24px;
    padding: 0 0 14px;
    border-bottom: 0;
}

.tenant-panel .brand span {
    max-width: 205px;
    color: #fff;
    font-size: 24px;
    line-height: 1.25;
    font-weight: 900;
}

.tenant-panel .brand small {
    color: #b7c0e4;
}

.tenant-panel .profile {
    grid-template-columns: 34px 1fr;
    gap: 10px;
    margin-bottom: 28px;
    padding: 0;
    border-color: transparent;
    background: transparent;
}

.tenant-panel .profile .avatar {
    width: 34px;
    height: 34px;
    font-size: 13px;
}

.tenant-panel .profile strong {
    font-size: 15px;
}

.tenant-panel .profile span {
    color: #8790bd;
}

.tenant-panel nav:before {
    content: "Menu";
    display: block;
    margin: 2px 0 16px 4px;
    color: #8790bd;
    font-size: 13px;
    font-weight: 700;
}

.tenant-panel nav a {
    grid-template-columns: 34px 1fr;
    min-height: 42px;
    margin: 2px 0;
    padding: 6px 14px;
    border-radius: 999px;
    color: #8790bd;
    font-size: 15px;
    font-weight: 500;
}

.tenant-panel nav a:hover,
.tenant-panel nav a.active {
    background: #101218;
    color: #fff;
}

.tenant-panel nav a.active {
    position: relative;
}

.tenant-panel nav a.active:before {
    content: "";
    position: absolute;
    left: -14px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #1687f2;
}

.tenant-panel .nav-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #252b3a;
}

.tenant-panel nav a.active .nav-icon,
.tenant-panel .btn {
    background: #00d26a;
}

.tenant-panel .main {
    margin-left: var(--tenant-sidebar);
    padding-top: var(--tenant-topbar);
    background: #000;
}

.tenant-panel .topbar {
    position: fixed;
    top: 0;
    left: var(--tenant-sidebar);
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    min-height: var(--tenant-topbar);
    height: var(--tenant-topbar);
    padding: 0 28px;
    background: #191d25;
    border-bottom: 0;
    color: #fff;
    backdrop-filter: none;
}

.tenant-panel .icon-btn {
    width: 34px;
    height: 34px;
    color: #8790bd;
    font-size: 18px;
}

.tenant-panel .topbar h1 {
    color: #fff;
}

.tenant-panel .eyebrow {
    color: #8790bd;
}

.tenant-panel .user-chip {
    border-color: transparent;
    background: #191d25;
    color: #fff;
    padding-right: 0;
}

.tenant-panel .top-actions {
    height: var(--tenant-topbar);
    padding-right: 28px;
    background: #191d25;
}

.tenant-panel .content {
    max-width: none;
    padding: 28px 28px 42px;
}

.tenant-panel .panel {
    border: 0;
    background: #191d25;
    color: #fff;
    box-shadow: none;
}

.tenant-panel .panel h2,
.tenant-panel .panel h3 {
    color: #fff;
}

.tenant-panel label {
    color: #fff;
}

.tenant-panel input,
.tenant-panel select,
.tenant-panel textarea {
    border-color: #2d333d;
    background: #2a3038;
    color: #fff;
}

.tenant-panel input:focus,
.tenant-panel select:focus,
.tenant-panel textarea:focus {
    border-color: #00d26a;
    box-shadow: 0 0 0 3px rgba(0, 210, 106, .12);
}

.tenant-panel th {
    background: #202630;
    color: #9aa6d8;
}

.tenant-panel td,
.tenant-panel th {
    border-bottom-color: #2a3040;
}

.tenant-panel tbody tr:hover td {
    background: #151922;
}

.tenant-panel .badge {
    background: rgba(0, 210, 106, .12);
    color: #00d26a;
}

.dashboard-filter {
    margin-bottom: 16px;
    padding: 26px;
}

.dashboard-filter form {
    display: grid;
    grid-template-columns: 190px 190px minmax(220px, 1fr) minmax(220px, 1fr) 190px;
    gap: 22px;
    align-items: end;
}

.dashboard-filter label {
    margin: 0;
}

.dashboard-filter input,
.dashboard-filter select {
    height: 36px;
    margin-top: 10px;
    border-radius: 2px;
    font-weight: 750;
}

.dashboard-filter .btn {
    height: 36px;
    min-height: 36px;
    border-radius: 3px;
    box-shadow: none;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(190px, 1fr));
    gap: 24px;
    margin-bottom: 22px;
}

.dash-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 116px;
    padding: 24px;
    border-radius: 4px;
    background: #191d25;
}

.dash-card strong {
    display: block;
    color: #fff;
    font-size: 25px;
    line-height: 1;
    margin-bottom: 10px;
}

.dash-card span {
    color: #8790bd;
}

.dash-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    font-weight: 900;
}

.dash-icon.green {
    background: rgba(0, 210, 106, .12);
    color: #00d26a;
}

.dash-icon.red {
    background: rgba(255, 63, 79, .12);
    color: #ff3f4f;
}

.chart-panel {
    min-height: 340px;
    margin-bottom: 22px;
}

.chart-panel h2 {
    color: #00d26a;
    font-size: 15px;
}

.fake-chart {
    display: flex;
    align-items: end;
    gap: 18px;
    height: 245px;
    padding: 28px 0 0;
}

.fake-chart div {
    width: 48px;
    border-radius: 5px 5px 0 0;
    background: linear-gradient(180deg, #00d26a, #1687f2);
    opacity: .78;
}

.tenant-panel .recent-panel {
    display: none;
}

.contract-form {
    max-width: none;
}

.contract-section {
    margin-bottom: 16px;
}

.contract-section h2 {
    margin-bottom: 24px;
}

.section-title {
    font-size: 16px;
    margin-bottom: 18px;
}

.section-title.blue {
    color: #1687f2 !important;
}

.section-title.red {
    color: #ff3f4f !important;
}

.section-title.amber {
    color: #ffb000 !important;
}

.form-row {
    display: grid;
    gap: 24px;
}

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

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

.form-row.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.contract-result {
    min-height: 20px;
    margin-bottom: 18px;
    color: #9aa6d8;
}

.hidden-field {
    display: none;
}

.days-picker {
    display: none;
    grid-template-columns: repeat(7, minmax(95px, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.days-picker > span {
    grid-column: 1 / -1;
    color: #fff;
    font-weight: 800;
}

.days-picker label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    border-radius: 4px;
    background: #11151d;
    color: #fff;
    cursor: pointer;
}

.days-picker input {
    width: auto;
    margin: 0;
}

.installment-preview {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
}

.preview-title {
    text-align: center;
    color: #fff;
    font-size: 30px;
    font-weight: 900;
}

.preview-title span {
    color: #35b957;
}

.preview-list {
    display: grid;
    gap: 14px;
    max-height: 420px;
    overflow: auto;
    padding-right: 4px;
}

.preview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 22px;
    border-radius: 4px;
    background: #11151d;
    color: #fff;
}

.preview-row small {
    display: block;
    margin-top: 6px;
    color: #fff;
    font-weight: 800;
}

.preview-row > strong {
    color: #00d26a;
    white-space: nowrap;
}

.empty-preview {
    padding: 16px;
    border-radius: 4px;
    background: #11151d;
    color: #9aa6d8;
    text-align: center;
}

.green-title {
    color: #00d26a !important;
}

.client-form-panel {
    padding: 28px 26px;
}

.photo-row {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.photo-row label {
    width: min(360px, 100%);
    text-align: center;
}

.photo-row input {
    margin-top: 8px;
}

.file-input {
    cursor: pointer;
}

.admin-settings-form {
    display: grid;
    gap: 18px;
}

.admin-settings-form small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-weight: 600;
    word-break: break-all;
}

.plans-admin table input,
.plans-admin table select,
.plans-admin table textarea {
    min-width: 110px;
    margin-top: 0;
}

.plans-admin .table-textarea {
    min-width: 190px;
    min-height: 44px;
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.client-thumb {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.client-thumb.empty {
    display: grid;
    place-items: center;
    background: #252b3a;
    color: #00d26a;
    font-weight: 900;
}

.profile-panel {
    max-width: 920px;
}

.profile-form {
    display: grid;
    gap: 4px;
}

.profile-actions {
    display: flex;
    align-items: end;
    justify-content: flex-start;
    min-height: 76px;
}

.loading-field {
    background-image: linear-gradient(90deg, rgba(255,255,255,0), rgba(0,210,106,.16), rgba(255,255,255,0));
    background-size: 220% 100%;
    animation: loading-field 1s linear infinite;
}

@keyframes loading-field {
    from { background-position: 220% 0; }
    to { background-position: -220% 0; }
}

.form-row.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.contracts-filter form {
    grid-template-columns: repeat(3, minmax(220px, 1fr)) 300px;
}

.filter-actions {
    display: grid;
    gap: 14px;
}

.btn.blue {
    background: #1687f2;
    box-shadow: none;
}

.report-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 22px;
}

.report-cards .dash-card:nth-child(4),
.report-cards .dash-card:nth-child(5) {
    grid-column: span 1;
}

.daily-filter form {
    display: grid;
    grid-template-columns: 300px 300px 300px;
    gap: 20px;
    align-items: end;
}

.referral-hero {
    border: 1px solid #00d26a !important;
    text-align: center;
    padding: 28px;
}

.referral-hero h2 {
    color: #00d26a !important;
    font-size: 24px;
}

.referral-hero p {
    font-size: 20px;
    margin-bottom: 6px;
}

.referral-hero > span {
    color: #8790bd;
}

.referral-benefits {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 30px;
    max-width: 880px;
    margin: 26px auto 22px;
}

.referral-benefits div {
    min-height: 170px;
    padding: 34px 24px;
    border-radius: 12px;
    background: #dff5e7;
    color: #166534;
    box-shadow: 0 10px 22px rgba(0, 210, 106, .14);
}

.referral-benefits strong {
    display: block;
    margin-bottom: 10px;
    font-size: 21px;
}

.referral-benefits p {
    margin: 0;
    font-size: 16px;
}

.copy-input {
    max-width: 520px;
    text-align: center;
    margin: 0 auto 14px !important;
}

.empty-message {
    border-radius: 4px;
    background: #eadfff;
    color: #4c1d95;
    padding: 14px;
    text-align: center;
}

.app-install-page {
    min-height: calc(100vh - 140px);
    display: grid;
    place-items: center;
}

.app-install-card {
    width: min(490px, 100%);
    padding: 28px 24px 22px;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
}

.app-install-card h1 {
    color: #000;
    font-size: 25px;
}

.app-install-card h2 {
    color: #000;
    font-size: 18px;
    margin-top: 22px;
}

.app-illustration {
    display: grid;
    place-items: center;
    width: 180px;
    height: 180px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dff7ef, #bdebdc);
    color: #0f9f6e;
    font-size: 42px;
    font-weight: 900;
}

.green-alt {
    margin-top: 22px;
    background: #0f9f6e !important;
}

.backup-panel {
    min-height: 205px;
}

.backup-actions {
    display: grid;
    gap: 14px;
    width: min(290px, 100%);
    margin: 16px auto 0;
}

.btn.light {
    background: #e8eef2;
    color: #111827;
    box-shadow: none;
}

.btn.danger {
    background: #fc424a;
    box-shadow: none;
}

.contract-header-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 26px;
}

.contract-client {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
}

.contract-avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 3px;
    background: #00d26a;
    color: #fff;
    font-weight: 900;
}

.contract-client strong,
.contract-client span,
.contract-meta span {
    display: block;
}

.contract-client span,
.contract-meta span {
    color: #8790bd;
}

.contract-meta {
    display: grid;
    justify-items: end;
    gap: 10px;
    text-align: right;
}

.contract-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 22px;
}

.installments-list {
    display: grid;
    gap: 14px;
}

.installment-card {
    display: grid;
    grid-template-columns: 1.15fr 1fr 1fr auto;
    gap: 22px;
    align-items: center;
    padding: 18px 22px;
    border-radius: 4px;
    background: #11151d;
    color: #fff;
}

.installment-card span,
.installment-card strong {
    display: block;
    margin: 4px 0;
}

.status-pill {
    display: inline-block;
    padding: 7px 10px;
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
}

.status-pill.open {
    background: #fc424a;
}

.status-pill.paid {
    background: #00d26a;
}

.money-green { color: #00d26a; }
.money-red { color: #fc424a; }
.money-yellow { color: #ffb000; }

.due-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.due-form input {
    max-width: 150px;
    padding: 6px 8px;
}

.public-contract-body {
    background: #000;
}

.public-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px;
}

.public-contract-brand {
    color: #fff;
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 20px;
}

.public-contract-logo {
    display: block;
    max-width: 220px;
    max-height: 70px;
    object-fit: contain;
}

@media (max-width: 1050px) {
    .contract-stats,
    .installment-card {
        grid-template-columns: 1fr;
    }

    .contract-header-card {
        flex-direction: column;
    }

    .contract-meta {
        justify-items: start;
        text-align: left;
    }
}

@media (max-width: 1150px) {
    .dashboard-filter form,
    .dashboard-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-row.two,
    .form-row.three,
    .form-row.four,
    .days-picker,
    .contracts-filter form,
    .daily-filter form,
    .referral-benefits,
    .report-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .tenant-panel .content {
        padding: 18px;
    }

    .dashboard-filter form,
    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .dash-card {
        min-height: 96px;
    }

    .tenant-panel .topbar {
        position: static;
        left: auto;
        right: auto;
        height: auto;
        min-height: 70px;
        padding: 14px;
        flex-direction: column;
        align-items: stretch;
    }

    .tenant-panel .sidebar {
        position: static;
        width: auto;
        overflow: visible;
    }

    .tenant-panel .main {
        margin-left: 0;
        padding-top: 0;
    }

    .tenant-panel .top-actions {
        height: auto;
        padding-right: 0;
    }
}
