:root {
    --bg: #f4f7f6;
    --panel: #ffffff;
    --ink: #18201f;
    --muted: #667370;
    --line: #dfe8e5;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --accent: #f59e0b;
    --danger: #dc2626;
    --ok: #16a34a;
    --shadow: 0 18px 55px rgba(24, 32, 31, .09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.guest-body {
    background: #ecf3f1;
}

.guest-shell {
    display: block;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px;
    background: #101918;
    color: #eff8f5;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand,
.tenant-switcher {
    display: flex;
    gap: 12px;
    align-items: center;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #8ddbd0;
    color: #0b302d;
    font-weight: 800;
}

.brand small,
.brand.dark small,
.tenant-switcher label,
.topbar .eyebrow,
.eyebrow {
    display: block;
    color: #7c8b87;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    margin: 0 0 6px;
    text-transform: uppercase;
}

.brand.dark {
    color: var(--ink);
    margin-bottom: 34px;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav a {
    border-radius: 8px;
    color: #c8d8d4;
    font-weight: 700;
    padding: 12px 14px;
}

.nav a.active,
.nav a:hover {
    background: rgba(141, 219, 208, .14);
    color: #ffffff;
}

.tenant-switcher {
    margin-top: auto;
    align-items: stretch;
    flex-direction: column;
}

.sidebar-card {
    background: #172422;
    border: 1px solid #2d403d;
    border-radius: 8px;
    display: grid;
    gap: 4px;
    padding: 14px;
}

.sidebar-card small {
    color: #a9bbb6;
}

select,
input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    padding: 12px 13px;
}

.tenant-switcher select {
    background: #172422;
    border-color: #2d403d;
    color: #eff8f5;
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 28px;
}

.site-footer {
    background: #101918;
    color: #b9cbc6;
    font-size: 13px;
    margin: 36px -28px -28px;
    padding: 28px;
}

.site-footer__inner {
    align-items: center;
    display: flex;
    gap: 28px;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 1280px;
}

.site-footer__brand {
    display: grid;
    gap: 4px;
}

.site-footer__brand strong {
    color: #ffffff;
    font-size: 17px;
}

.site-footer__brand span,
.site-footer p {
    margin: 0;
}

.site-footer a {
    color: #8ddbd0;
    font-weight: 700;
}

.site-footer a:hover {
    text-decoration: underline;
}

.guest-shell .main {
    min-height: 100vh;
}

.guest-shell .auth-layout {
    min-height: calc(100vh - 120px);
}

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

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(26px, 3vw, 38px);
    margin-bottom: 0;
}

h2 {
    font-size: clamp(24px, 3vw, 42px);
    line-height: 1.05;
}

h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.tenant-pill,
.soft-label {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    padding: 10px 14px;
    font-weight: 800;
}

.tenant-pill small {
    display: block;
    color: var(--muted);
    font-weight: 600;
}

.menu-button {
    display: none;
}

.hero-panel,
.panel,
.table-panel,
.setup-card,
.notification-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero-panel {
    align-items: end;
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr auto;
    margin-bottom: 18px;
    overflow: hidden;
    padding: 34px;
    position: relative;
}

.hero-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto auto;
    width: 36%;
    height: 100%;
    background: linear-gradient(135deg, rgba(15, 118, 110, .12), rgba(245, 158, 11, .16));
    clip-path: polygon(28% 0, 100% 0, 100% 100%, 0 100%);
    pointer-events: none;
}

.hero-panel > * {
    position: relative;
}

.hero-panel p {
    color: var(--muted);
    max-width: 780px;
}

.button,
.icon-button {
    align-items: center;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 42px;
    padding: 11px 16px;
}

.button.primary {
    background: var(--brand);
    color: #fff;
}

.button.primary:hover,
.button.whatsapp:hover {
    background: var(--brand-dark);
}

.button.secondary {
    background: #e8f2ef;
    color: #163d39;
}

.button.whatsapp {
    background: #128c7e;
    color: #fff;
    white-space: nowrap;
}

.icon-button {
    width: 38px;
    min-height: 38px;
    background: #eaf7ee;
    color: var(--ok);
    font-size: 18px;
}

.metric-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 18px;
}

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

.plan-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.plan-card {
    align-content: start;
    display: grid;
    gap: 14px;
}

.plan-price {
    display: block;
    font-size: 30px;
    line-height: 1;
}

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

.metric-card span,
.muted,
td small {
    color: var(--muted);
}

.metric-card strong {
    display: block;
    font-size: 34px;
    margin-top: 8px;
}

.content-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, .7fr);
}

.panel {
    padding: 24px;
}

.button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

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

.section-heading.compact {
    margin-bottom: 8px;
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline-item {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-template-columns: auto 1fr auto;
    padding: 14px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--ok);
}

.status-dot.por-vencer {
    background: var(--accent);
}

.status-dot.vencido {
    background: var(--danger);
}

.badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    padding: 6px 10px;
    text-transform: uppercase;
}

.badge.vigente,
.badge.renovado,
.badge.active {
    background: #dcfce7;
    color: #166534;
}

.badge.por-vencer,
.badge.trial {
    background: #fef3c7;
    color: #92400e;
}

.badge.vencido,
.badge.overdue,
.badge.paused {
    background: #fee2e2;
    color: #991b1b;
}

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    max-width: 520px;
}

.table-panel {
    overflow-x: auto;
}

.plan-table table {
    min-width: 1280px;
}

.table-input {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    margin-bottom: 7px;
    min-height: 36px;
    padding: 7px 9px;
    width: 100%;
}

.table-input:last-child {
    margin-bottom: 0;
}

.muted-input {
    color: var(--muted);
    font-size: 13px;
}

.table-checkbox {
    font-size: 13px;
    min-width: 94px;
}

.phone-code-input {
    min-width: 70px;
}

table {
    border-collapse: collapse;
    min-width: 1120px;
    width: 100%;
}

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td strong,
td small {
    display: block;
}

.operations-heading {
    min-width: 142px;
}

.document-operations {
    display: grid;
    gap: 7px;
    min-width: 142px;
}

.document-operations form {
    margin: 0;
}

.operation-button {
    align-items: center;
    background: #edf5f2;
    border: 1px solid #d8e7e2;
    border-radius: 6px;
    color: #163d39;
    cursor: pointer;
    display: flex;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    justify-content: center;
    min-height: 32px;
    padding: 6px 8px;
    text-align: center;
    width: 100%;
}

.operation-button:hover {
    background: #dceee8;
}

.operation-button.danger {
    background: #fff1f1;
    border-color: #f6d2d2;
    color: #b42318;
}

.operation-button.danger:hover {
    background: #fee2e2;
}

.form-layout {
    max-width: 980px;
}

.form-panel {
    box-shadow: var(--shadow);
}

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

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

.plan-admin-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.client-whatsapp {
    margin: 14px 0 0;
}

label {
    color: #32413f;
    display: grid;
    font-weight: 800;
    gap: 8px;
}

.field-help,
.attachment-note {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.attachment-note {
    color: var(--brand-dark);
    font-weight: 700;
}

.attachment-remove {
    font-size: 13px;
    font-weight: 700;
}

.checkbox-row {
    align-items: center;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.checkbox-row input {
    width: auto;
}

.full {
    grid-column: 1 / -1;
}

.actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 22px;
}

.tenant-grid,
.notification-list {
    display: grid;
    gap: 16px;
}

.tenant-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.tenant-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.tenant-card.selected {
    border-color: var(--brand);
}

.notification-card {
    align-items: center;
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr auto;
    padding: 22px;
}

.empty-state,
.flash,
.setup-card {
    padding: 24px;
}

.empty-state {
    color: var(--muted);
    text-align: center;
}

.flash {
    background: #e7f8f4;
    border: 1px solid #b9e8de;
    border-radius: 8px;
    color: #0f5f57;
    font-weight: 800;
    margin-bottom: 18px;
}

.flash.hidden {
    display: none;
}

.flash.flash-error {
    background: #fff1f1;
    border-color: #f6d2d2;
    color: #991b1b;
}

.whatsapp-account-card {
    color: #eff8f5;
    margin: 16px 0;
}

.template-preview {
    background: #101918;
    border-radius: 8px;
    color: #e7f8f4;
    font: 600 14px/1.6 Consolas, "Liberation Mono", monospace;
    margin: 14px 0;
    overflow-x: auto;
    padding: 16px;
    white-space: pre-wrap;
}

.setup-card {
    display: grid;
    gap: 22px;
    max-width: 840px;
}

.auth-layout {
    align-items: center;
    display: grid;
    gap: 40px;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
    min-height: 100vh;
    padding: 48px;
}

.auth-layout.wide-auth {
    grid-template-columns: minmax(320px, .75fr) minmax(520px, 1fr);
}

.auth-layout.legal-page {
    align-items: start;
    grid-template-columns: minmax(280px, .65fr) minmax(520px, 1fr);
    min-height: auto;
}

.public-hero,
.public-section {
    margin: 0 auto;
    max-width: 1180px;
    width: 100%;
}

.public-hero {
    min-height: calc(100vh - 120px);
    padding: 28px 0 54px;
}

.public-nav {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 64px;
}

.public-nav .brand.dark {
    margin-bottom: 0;
}

.public-nav__links,
.public-actions {
    align-items: center;
    display: flex;
    gap: 12px;
}

.public-nav__links a:not(.button) {
    color: var(--brand-dark);
    font-weight: 800;
}

.public-hero__grid {
    align-items: center;
    display: grid;
    gap: 46px;
    grid-template-columns: minmax(0, 1.18fr) minmax(340px, .82fr);
}

.public-hero__copy h1 {
    font-size: clamp(42px, 6vw, 76px);
    line-height: .95;
    margin-bottom: 24px;
    max-width: 820px;
}

.public-hero__copy p {
    color: var(--muted);
    font-size: 20px;
    line-height: 1.65;
    max-width: 760px;
}

.public-actions {
    margin-top: 28px;
}

.public-preview {
    display: grid;
    gap: 18px;
}

.message-bubble {
    background: #e7f8f4;
    border: 1px solid #b9e8de;
    border-radius: 8px;
    display: grid;
    gap: 8px;
    line-height: 1.55;
    padding: 18px;
}

.message-bubble strong {
    color: var(--brand-dark);
}

.message-bubble span,
.public-checks,
.public-mini-card span,
.public-split p,
.public-steps span {
    color: var(--muted);
}

.public-checks,
.public-steps {
    display: grid;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.public-checks li {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.public-section {
    padding: 34px 0;
}

.public-card-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.public-mini-card {
    box-shadow: none;
    display: grid;
    gap: 8px;
}

.public-split {
    align-items: center;
    display: grid;
    gap: 34px;
    grid-template-columns: minmax(0, .9fr) minmax(360px, 1fr);
}

.public-steps li {
    align-items: center;
    display: grid;
    gap: 14px;
    grid-template-columns: 42px 1fr;
}

.public-steps strong {
    background: #e8f2ef;
    border-radius: 8px;
    color: var(--brand-dark);
    display: grid;
    height: 42px;
    place-items: center;
    width: 42px;
}

.auth-copy {
    max-width: 640px;
}

.auth-copy h1 {
    font-size: clamp(42px, 6vw, 74px);
    line-height: .96;
    margin-bottom: 20px;
}

.auth-copy p {
    color: var(--muted);
    font-size: 19px;
    line-height: 1.6;
}

.auth-copy__content {
    max-width: 650px;
}

.auth-copy__lead {
    max-width: 620px;
}

.auth-benefits {
    display: grid;
    gap: 12px;
    list-style: none;
    margin: 26px 0 20px;
    padding: 0;
}

.auth-benefits li {
    line-height: 1.55;
    padding-left: 28px;
    position: relative;
}

.auth-benefits li::before {
    color: var(--brand);
    content: "\2713";
    font-weight: 800;
    left: 0;
    position: absolute;
    top: 0;
}

.auth-copy .auth-copy__note {
    font-size: 14px;
    margin-top: 22px;
}

.auth-card__header h2 {
    margin-bottom: 6px;
}

.auth-card__header p,
.auth-links p {
    margin-bottom: 0;
}

.auth-links {
    display: grid;
    gap: 10px;
    margin-top: 6px;
}

.auth-card {
    display: grid;
    gap: 16px;
}

.auth-card .button {
    width: 100%;
}

.auth-card a {
    color: var(--brand);
    font-weight: 800;
}

.legal-card {
    max-width: 860px;
}

.legal-card h3 {
    margin: 12px 0 0;
}

.legal-card p {
    color: var(--muted);
    line-height: 1.65;
}

.setup-code {
    display: grid;
    gap: 10px;
}

code {
    background: #101918;
    border-radius: 8px;
    color: #dff8f2;
    display: block;
    padding: 13px 14px;
}

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

    .sidebar {
        display: none;
        height: auto;
        position: fixed;
        inset: 0 auto 0 0;
        width: min(310px, 88vw);
        z-index: 20;
    }

    body.menu-open .sidebar {
        display: flex;
    }

    .menu-button {
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 8px;
        display: inline-grid;
        font-size: 22px;
        height: 42px;
        place-items: center;
        width: 42px;
    }

    .metric-grid,
    .metric-grid.four,
    .plan-grid,
    .content-grid,
    .hero-panel,
    .notification-card,
    .auth-layout,
    .auth-layout.wide-auth,
    .public-hero__grid,
    .public-split {
        grid-template-columns: 1fr;
    }

    .auth-layout,
    .auth-layout.wide-auth {
        padding: 24px;
    }

    .public-nav {
        margin-bottom: 34px;
    }

    .public-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tenant-pill {
        display: none;
    }
}

@media (max-width: 640px) {
    .main {
        padding: 18px;
    }

    .topbar,
    .section-heading,
    .filter-bar,
    .actions {
        align-items: stretch;
        flex-direction: column;
    }

    .metric-grid,
    .metric-grid.four,
    .plan-grid,
    .public-card-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .public-nav,
    .public-nav__links,
    .public-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .public-nav {
        gap: 20px;
    }

    .hero-panel,
    .panel {
        padding: 20px;
    }

    .site-footer {
        margin: 28px -18px -18px;
        padding: 24px 18px;
    }

    .site-footer__inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }
}
