:root {
    --bg: #f5f6f2;
    --surface: #ffffff;
    --surface-2: #eef4f2;
    --text: #1d2522;
    --muted: #65716c;
    --line: #d9e1dc;
    --primary: #147a6c;
    --primary-dark: #0d5e54;
    --accent: #b7791f;
    --danger: #b42318;
    --success: #157347;
    --shadow: 0 18px 50px rgba(29, 37, 34, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

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

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

.table-link {
    color: var(--primary-dark);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

button,
input,
select,
textarea {
    font: inherit;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background:
        radial-gradient(circle at 12% 12%, rgba(31, 107, 255, 0.10), transparent 26%),
        radial-gradient(circle at 82% 18%, rgba(20, 138, 120, 0.12), transparent 28%),
        var(--bg);
}

.auth-panel {
    width: min(100%, 860px);
}

.auth-experience {
    width: min(1180px, 100%);
    min-height: calc(100vh - 48px);
    display: grid;
    grid-template-columns: minmax(320px, 0.88fr) minmax(360px, 1.12fr);
    gap: 18px;
    align-items: stretch;
}

.auth-visual,
.auth-content-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow);
}

.auth-visual {
    position: relative;
    overflow: hidden;
    min-height: 620px;
    padding: 38px;
    display: grid;
    align-content: space-between;
    color: #f5fbf8;
    background:
        linear-gradient(145deg, rgba(13, 94, 84, 0.94), rgba(20, 31, 51, 0.96)),
        #0d5e54;
}

.auth-visual::after {
    content: "";
    position: absolute;
    inset: auto -18% -26% 18%;
    height: 280px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    transform: rotate(-5deg);
}

.auth-visual-logo {
    position: relative;
    z-index: 1;
    width: min(260px, 72%);
    height: auto;
    padding: 12px;
    border-radius: 8px;
    background: #ffffff;
}

.auth-visual h1 {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 0;
    font-size: clamp(34px, 5vw, 56px);
    line-height: 1.04;
    letter-spacing: 0;
}

.auth-visual p {
    position: relative;
    z-index: 1;
    max-width: 520px;
    color: rgba(245, 251, 248, 0.82);
    line-height: 1.65;
}

.auth-visual .eyebrow {
    color: #9df2d4;
}

.auth-preview {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 10px;
    max-width: 520px;
}

.auth-preview div {
    padding: 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.auth-preview span {
    display: block;
    margin-bottom: 4px;
    color: #9df2d4;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.auth-preview strong {
    color: #ffffff;
    line-height: 1.4;
}

.auth-content-panel {
    display: grid;
    align-content: center;
    padding: clamp(22px, 5vw, 48px);
}

.auth-content-panel .auth-card {
    width: 100%;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: var(--text);
}

.auth-brand {
    margin-bottom: 18px;
}

.brand-image {
    display: block;
    width: 164px;
    height: 46px;
    object-fit: contain;
    object-position: left center;
    border-radius: 6px;
}

.brand-image.large {
    width: min(100%, 260px);
    height: 72px;
}

.auth-card,
.panel,
.metric-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-card {
    padding: 28px;
    max-width: 440px;
}

.auth-card.wide {
    max-width: 860px;
}

.auth-card h1,
.topbar h1,
.panel h2 {
    margin: 0;
}

.auth-card h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.auth-card p {
    color: var(--muted);
    line-height: 1.55;
}

.auth-intro {
    margin: 0 0 20px;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px;
    border-right: 1px solid var(--line);
    background: #fbfcf9;
}

.nav {
    display: grid;
    gap: 6px;
    margin-top: 28px;
}

.nav a {
    padding: 11px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 650;
}

.nav a:hover,
.nav a:focus-visible {
    background: var(--surface-2);
    color: var(--text);
    outline: none;
}

.main {
    padding: 28px;
    min-width: 0;
}

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

.topbar h1 {
    font-size: clamp(24px, 4vw, 34px);
    line-height: 1.1;
}

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

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}

.alert-success {
    background: #eaf6ef;
    border-color: #b7e0c3;
    color: #0f5132;
}

.alert-warning {
    background: #fff7e5;
    border-color: #f1d08a;
    color: #7a4f01;
}

.alert-error {
    background: #fff0ee;
    border-color: #f0bab4;
    color: #8a1c13;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.reminder-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.subscription-reminder {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid #f1d08a;
    border-radius: 8px;
    background: #fff7e5;
    color: #7a4f01;
}

.subscription-reminder.danger {
    border-color: #f0bab4;
    background: #fff0ee;
    color: #8a1c13;
}

.subscription-reminder span {
    line-height: 1.45;
}

.subscription-reminder .button {
    justify-self: start;
    margin-top: 4px;
}

.subscription-summary {
    margin-bottom: 18px;
}

.metric-card {
    padding: 18px;
}

.metric-card span,
.usage-row span,
.compact-list span,
label {
    color: var(--muted);
}

.metric-card strong {
    display: block;
    margin-top: 8px;
    font-size: 32px;
    line-height: 1;
}

.metric-card small,
.usage-row small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.35;
}

.content-grid {
    display: grid;
    gap: 18px;
}

.content-grid.two {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.panel {
    padding: 18px;
    min-width: 0;
}

.panel.narrow {
    max-width: 760px;
}

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

.panel-header h2 {
    font-size: 18px;
}

.form {
    display: grid;
    gap: 14px;
}

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

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

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

.form-actions {
    display: grid;
    gap: 10px;
}

label {
    display: grid;
    gap: 7px;
    font-size: 13px;
    font-weight: 750;
}

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

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

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(20, 122, 108, 0.18);
    border-color: var(--primary);
}

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

.button,
.icon-button {
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
}

.button {
    min-height: 42px;
    padding: 0 16px;
    background: var(--primary);
    color: #fff;
}

.button:hover,
.button:focus-visible {
    background: var(--primary-dark);
    outline: none;
}

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

.button.ghost {
    background: var(--surface-2);
    color: var(--primary-dark);
}

.button.ghost-danger {
    background: #fff0ee;
    color: var(--danger);
}

.button.full {
    width: 100%;
}

.button.compact {
    min-height: 34px;
    padding: 0 12px;
    white-space: nowrap;
}

.icon-button {
    width: 38px;
    height: 38px;
    background: var(--surface-2);
    color: var(--text);
}

.icon-button.small {
    width: 42px;
    height: 42px;
}

.icon-button.danger {
    color: var(--danger);
}

.notification-bell {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #fff7e5;
    color: #7a4f01;
    text-decoration: none;
    font-weight: 900;
}

.topbar .notification-bell {
    margin-left: auto;
    flex: 0 0 auto;
}

.topbar form {
    flex: 0 0 auto;
}

.notification-bell strong {
    position: absolute;
    top: -7px;
    right: -7px;
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--danger);
    color: #ffffff;
    font-size: 12px;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(190, 43, 25, 0.22);
}

.delete-connection-button {
    width: 46px;
    height: 46px;
    font-size: 22px;
    line-height: 1;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    color: var(--primary-dark);
    font-weight: 750;
}

.otp-resend-form {
    margin-top: 12px;
}

.otp-trust-option {
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
    margin-top: 2px;
}

.otp-trust-option small {
    grid-column: 2;
    max-width: 100%;
    line-height: 1.45;
}

.toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.toggle-row label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.toggle-row input {
    width: 18px;
    height: 18px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.pagination div {
    display: flex;
    gap: 8px;
}

.disabled-link {
    pointer-events: none;
    cursor: not-allowed;
    opacity: 0.55;
}

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

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

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

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 260px;
}

.inline-form select {
    min-width: 150px;
    padding-block: 8px;
}

.payment-actions {
    min-width: 260px;
}

.payment-actions .inline-form {
    min-width: 240px;
}

.payment-actions input {
    min-width: 120px;
    padding-block: 8px;
}

.checkbox-cell {
    width: 42px;
    text-align: center;
}

.checkbox-cell input {
    width: 18px;
    height: 18px;
}

.model-assignment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.model-group {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.model-group legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.check-option {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
    gap: 9px;
    font-size: 14px;
    font-weight: 650;
}

.check-option input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.check-option small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.feature-selector {
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.6fr) auto;
    align-items: end;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.feature-option {
    min-height: 72px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.feature-option.is-disabled {
    background: var(--surface-2);
    color: var(--muted);
}

.feature-config-section {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.feature-config-section h3 {
    margin: 0;
    font-size: 17px;
}

.feature-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.feature-config-card {
    display: grid;
    gap: 14px;
    align-content: space-between;
    min-height: 190px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.feature-config-card h4 {
    margin: 10px 0 6px;
    font-size: 18px;
}

.feature-config-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.feature-config-card small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-weight: 750;
}

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

.feature-config-form {
    margin-top: 18px;
}

.feature-checkbox-group {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.feature-checkbox-group legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
}

.feature-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
}

.badge.active,
.badge.info,
.badge.verified {
    background: #e8f7ef;
    color: var(--success);
}

.badge.pending,
.badge.warning,
.badge.trial {
    background: #fff4d9;
    color: var(--accent);
}

.badge.connected {
    background: #e8f7ef;
    color: var(--success);
}

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

.badge.suspended,
.badge.inactive,
.badge.past_due,
.badge.cancelled,
.badge.rejected,
.badge.error,
.badge.qr_expirado {
    background: #ffe9e6;
    color: var(--danger);
}

.badge.pending_qr {
    background: #e8f3ff;
    color: #155a9c;
}

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

.usage-row,
.compact-list {
    display: grid;
    gap: 12px;
}

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

.usage-row div,
.compact-list div,
.node-item {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf9;
}

.usage-row strong,
.compact-list strong {
    display: block;
    margin-top: 4px;
}

.muted,
.empty-cell {
    color: var(--muted);
}

.empty-cell {
    text-align: center;
    padding: 28px;
}

.empty-state {
    display: grid;
    gap: 12px;
    place-items: start;
    padding: 24px;
}

#planes-disponibles,
#solicitudes-plan,
.admin-payment-alert {
    margin-top: 18px;
}

.business-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.business-plan-card {
    display: grid;
    gap: 16px;
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.business-plan-card.featured {
    border-color: #1f6bff;
    box-shadow: 0 20px 44px rgba(31, 107, 255, 0.10);
}

.business-plan-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.business-plan-card h3 {
    margin: 0 0 8px;
    font-size: 22px;
}

.business-plan-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.business-plan-price {
    display: grid;
    gap: 3px;
    padding: 14px;
    border: 1px solid #dfe8e5;
    border-radius: 8px;
    background: #f5faf8;
}

.business-plan-price span,
.business-plan-price small,
.plan-limit-list span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.business-plan-price strong {
    font-size: 28px;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.plan-limit-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
    gap: 10px;
}

.plan-limit-list div {
    display: grid;
    gap: 4px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf9;
}

.plan-limit-list strong {
    font-size: 18px;
}

.flow-builder {
    display: grid;
    gap: 12px;
}

.node-list {
    display: grid;
    gap: 8px;
}

.node-item {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) 38px;
    gap: 10px;
    align-items: center;
}

.node-item span {
    overflow-wrap: anywhere;
}

.flow-board-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 14px;
}

.flow-board-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.45fr);
    gap: 14px;
}

.flow-board-canvas {
    position: relative;
    min-height: 620px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(#eef4f2 1px, transparent 1px),
        linear-gradient(90deg, #eef4f2 1px, transparent 1px),
        #fbfcf9;
    background-size: 28px 28px;
}

.flow-board-canvas.is-linking {
    cursor: crosshair;
}

.flow-lines {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: visible;
    pointer-events: none;
}

.flow-line-path {
    fill: none;
    stroke: var(--primary-dark);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.12));
}

.flow-line-path.is-draft {
    stroke: #64716c;
    stroke-dasharray: 9 7;
}

.flow-line-arrow-head {
    fill: var(--primary-dark);
}

.flow-line-label {
    fill: var(--primary-dark);
    paint-order: stroke;
    stroke: #fbfcf9;
    stroke-width: 5;
    stroke-linejoin: round;
    font-size: 12px;
    font-weight: 800;
    text-anchor: middle;
}

.flow-node-card {
    position: absolute;
    left: var(--node-x);
    top: var(--node-y);
    display: grid;
    gap: 10px;
    width: 260px;
    min-height: 180px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(29, 37, 34, 0.08);
    cursor: grab;
    z-index: 2;
}

.flow-node-card.is-dragging {
    cursor: grabbing;
    z-index: 5;
}

.flow-node-port {
    position: absolute;
    top: 50%;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--primary-dark);
    box-shadow: 0 0 0 2px var(--primary-dark), 0 8px 18px rgba(0, 0, 0, 0.16);
    cursor: crosshair;
    transform: translateY(-50%);
}

.flow-node-port.input {
    left: -12px;
}

.flow-node-port.output {
    right: -12px;
}

.flow-node-port:hover,
.flow-node-port:focus-visible {
    background: #0f7f6e;
    box-shadow: 0 0 0 3px rgba(24, 137, 117, 0.25), 0 0 0 2px #0f7f6e, 0 8px 18px rgba(0, 0, 0, 0.16);
    outline: none;
}

.flow-node-card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 8px;
    align-items: center;
}

.flow-node-card-header strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flow-node-meta {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.flow-board-side {
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf9;
}

.flow-board-side h3 {
    margin: 0;
}

.flow-edge-list {
    display: grid;
    gap: 10px;
}

.flow-edge-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.flow-edge-row select,
.flow-edge-row input {
    min-width: 0;
    padding: 8px 9px;
}

.flow-edge-row [data-flow-edge-match],
.flow-edge-row [data-flow-edge-value],
.flow-edge-row [data-flow-edge-label] {
    grid-column: 1 / -1;
}

.flow-edge-row .icon-button {
    grid-column: 3;
    justify-self: end;
}

.flow-edge-arrow {
    color: var(--primary-dark);
    font-weight: 900;
    text-align: center;
}

.conversation-thread {
    display: grid;
    gap: 12px;
    max-height: calc(100vh - 240px);
    min-height: 420px;
    overflow-y: auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf9;
}

.chat-message {
    display: flex;
}

.chat-message.outbound {
    justify-content: flex-end;
}

.chat-bubble {
    display: grid;
    gap: 7px;
    max-width: min(720px, 82%);
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.chat-message.outbound .chat-bubble {
    border-color: #b7d9d2;
    background: #e9f6f2;
}

.chat-meta,
.chat-status {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.chat-bubble p {
    margin: 0;
    line-height: 1.48;
    overflow-wrap: anywhere;
    white-space: normal;
}

.inline-error {
    border: 1px solid #f0bab4;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff0ee;
    color: #8a1c13;
}

.inline-note {
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eef4f2;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.meta-config-fields {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf9;
}

.meta-config-fields[hidden] {
    display: none;
}

.qr-panel {
    margin-top: 18px;
}

.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.qr-card {
    display: grid;
    gap: 12px;
    justify-items: center;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf9;
    text-align: center;
}

.qr-card h3 {
    margin: 0 0 4px;
    font-size: 18px;
}

.qr-card p {
    margin: 0;
}

.qr-image {
    width: min(100%, 260px);
    aspect-ratio: 1;
    object-fit: contain;
    border: 10px solid #fff;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(29, 37, 34, 0.12);
}

.qr-missing {
    display: grid;
    gap: 6px;
    place-items: center;
    min-height: 180px;
    padding: 16px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
}

.qr-help {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 13px;
}

.qr-help strong {
    color: var(--primary-dark);
    font-variant-numeric: tabular-nums;
}

.settings-status {
    display: grid;
    gap: 14px;
}

.settings-status div {
    display: grid;
    gap: 5px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf9;
}

.settings-status span,
.settings-guide p {
    overflow-wrap: anywhere;
}

.settings-guide {
    margin-top: 18px;
}

.settings-guide h3 {
    margin: 0 0 8px;
}

.calendar-toolbar-panel {
    margin-bottom: 18px;
}

.calendar-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 0.7fr) minmax(220px, 1fr) auto;
    align-items: end;
    gap: 12px;
}

.calendar-grid {
    align-items: start;
}

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

.calendar-action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

.calendar-action-row form {
    display: inline-grid;
}

.calendar-selection-panel,
.calendar-advanced-panel {
    margin-top: 18px;
}

.calendar-selection-form {
    grid-template-columns: minmax(260px, 1fr) auto;
    align-items: end;
}

.calendar-advanced-panel details {
    display: grid;
    gap: 14px;
}

.calendar-advanced-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    padding: 2px 0;
    font-weight: 850;
}

.calendar-advanced-panel summary small {
    color: var(--muted);
    font-weight: 700;
}

.calendar-error-box {
    border-color: #f0bab4 !important;
    background: #fff0ee !important;
    color: #8a1c13;
}

pre {
    overflow-x: auto;
    margin: 12px 0;
    padding: 12px;
    border-radius: 8px;
    background: #1d2522;
    color: #f5f6f2;
}

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

    .auth-visual {
        min-height: auto;
        gap: 26px;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

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

    .metrics-grid,
    .content-grid.two,
    .flow-board-shell,
    .usage-row,
    .calendar-toolbar,
    .calendar-selection-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .auth-shell {
        padding: 10px;
    }

    .auth-visual,
    .auth-content-panel {
        padding: 20px;
    }

    .auth-visual h1 {
        font-size: 32px;
    }

    .main {
        padding: 18px;
    }

    .auth-card {
        padding: 20px;
    }

    .topbar,
    .panel-header,
    .business-plan-card-head,
    .auth-links {
        align-items: stretch;
        flex-direction: column;
    }

    .metrics-grid,
    .content-grid.two,
    .grid-form,
    .feature-selector,
    .form-row,
    .flow-board-toolbar,
    .flow-board-shell,
    .usage-row,
    .calendar-toolbar,
    .calendar-selection-form,
    .nav {
        grid-template-columns: 1fr;
    }

    .payment-actions,
    .payment-actions .inline-form,
    .payment-actions input {
        min-width: 0;
        width: 100%;
    }

    .calendar-action-row,
    .calendar-advanced-panel summary {
        align-items: stretch;
        flex-direction: column;
    }

    .calendar-action-row .button,
    .calendar-action-row form {
        width: 100%;
    }

    .node-item {
        grid-template-columns: 1fr 38px;
    }

    .node-item strong {
        grid-column: 1 / -1;
    }

    .chat-bubble {
        max-width: 100%;
    }
}

.public-page {
    background: #fbfcff;
    color: #101817;
}

.public-header {
    position: sticky;
    top: 0;
    z-index: 20;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 18px 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    background: rgba(251, 252, 255, 0.92);
    backdrop-filter: blur(18px);
}

.public-brand img {
    display: block;
    width: 178px;
    height: 56px;
    object-fit: contain;
    object-position: left center;
}

.public-nav {
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border: 1px solid #dfe8e5;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(16, 24, 23, 0.06);
}

.public-nav a,
.public-login {
    padding: 9px 12px;
    color: #43524e;
    font-weight: 700;
    font-size: 14px;
}

.public-nav a:hover,
.public-login:hover {
    color: #0d5e54;
}

.public-actions,
.public-hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.public-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid #148a78;
    border-radius: 8px;
    background: #148a78;
    color: #ffffff;
    font-weight: 850;
    box-shadow: 0 16px 32px rgba(20, 138, 120, 0.18);
}

.public-button.small {
    min-height: 40px;
}

.public-button.ghost {
    background: #ffffff;
    color: #126d61;
    box-shadow: none;
}

.public-button.full {
    width: 100%;
}

.public-hero {
    width: min(1180px, calc(100% - 32px));
    margin: 52px auto 28px;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.55fr);
    align-items: center;
    gap: 46px;
    min-height: 430px;
}

.public-hero-copy h1,
.public-section-head h2,
.public-split h2,
.public-cta h2 {
    margin: 0;
    line-height: 1.03;
    letter-spacing: 0;
    color: #101817;
}

.public-hero-copy h1 {
    max-width: 820px;
    font-size: clamp(42px, 7vw, 78px);
}

.public-hero-copy h1 span {
    color: #1f6bff;
    font-style: italic;
}

.public-hero-copy p {
    max-width: 660px;
    color: #53625e;
    font-size: 18px;
    line-height: 1.65;
}

.public-eyebrow {
    margin: 0 0 12px;
    color: #147a6c;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.public-hero-panel {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid #dfe8e5;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(31, 107, 255, 0.08), rgba(20, 138, 120, 0.12)), #ffffff;
    box-shadow: 0 24px 52px rgba(16, 24, 23, 0.09);
}

.public-hero-panel div,
.public-feature-list article {
    padding: 16px;
    border: 1px solid #dfe8e5;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
}

.public-hero-panel strong,
.public-feature-list strong {
    display: block;
    color: #101817;
    font-size: 18px;
}

.public-hero-panel span,
.public-feature-list span {
    display: block;
    margin-top: 6px;
    color: #53625e;
    line-height: 1.45;
}

.public-section,
.public-cta {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 76px 0;
}

.public-section-head {
    max-width: 760px;
    margin: 0 auto 24px;
    text-align: center;
}

.public-section-head h2,
.public-split h2,
.public-cta h2 {
    font-size: clamp(30px, 4vw, 48px);
}

.public-section-head p,
.public-cta p {
    color: #53625e;
    line-height: 1.6;
    font-size: 17px;
}

.pricing-controls {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 18px;
    margin: 28px 0 34px;
    flex-wrap: wrap;
}

.billing-segmented {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid #d9e1dc;
    border-radius: 8px;
    background: #f7faf8;
    color: #43524e;
    font-weight: 800;
    flex-wrap: wrap;
}

.billing-segmented button {
    height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
}

.billing-segmented button[aria-pressed="true"] {
    background: #101817;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(16, 24, 23, 0.14);
}

.billing-segmented small {
    margin-left: 6px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #e7f8ef;
    color: #107244;
    font-size: 12px;
    white-space: nowrap;
}

.currency-select {
    display: grid;
    gap: 6px;
    color: #43524e;
    font-size: 13px;
    font-weight: 800;
}

.currency-select select {
    min-width: 190px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d9e1dc;
    border-radius: 8px;
    background: #ffffff;
    color: #101817;
    font-weight: 750;
}

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

.public-plan-card {
    position: relative;
    display: grid;
    align-content: start;
    gap: 22px;
    min-height: 520px;
    padding: 30px;
    border: 1px solid #dfe8e5;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 22px 48px rgba(16, 24, 23, 0.07);
}

.public-plan-card.featured {
    border-color: #1f6bff;
    box-shadow: 0 26px 58px rgba(31, 107, 255, 0.14);
}

.popular-pill {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    padding: 7px 16px;
    border-radius: 999px;
    background: #1f6bff;
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.public-plan-card h3 {
    margin: 0 0 10px;
    font-size: 24px;
}

.public-plan-card p {
    margin: 0;
    color: #53625e;
    line-height: 1.5;
}

.plan-price {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    min-width: 0;
}

.plan-price strong {
    min-width: 0;
    font-size: 34px;
    line-height: 1.08;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.plan-price span,
.plan-note {
    color: #53625e;
    font-weight: 700;
}

.plan-price span {
    padding-bottom: 3px;
    white-space: nowrap;
}

.public-plan-card ul {
    display: grid;
    gap: 13px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.public-plan-card li {
    position: relative;
    padding-left: 28px;
    color: #192421;
    line-height: 1.45;
}

.public-plan-card li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.58em;
    width: 14px;
    height: 8px;
    border-left: 2px solid #1f6bff;
    border-bottom: 2px solid #1f6bff;
    transform: rotate(-45deg);
}

.public-empty {
    grid-column: 1 / -1;
    padding: 24px;
    border: 1px solid #dfe8e5;
    border-radius: 8px;
    background: #ffffff;
    color: #53625e;
    text-align: center;
}

.public-split {
    display: grid;
    grid-template-columns: minmax(0, 0.75fr) minmax(0, 1fr);
    gap: 36px;
    align-items: start;
}

.public-feature-list {
    display: grid;
    gap: 12px;
}

.public-cta {
    margin-bottom: 40px;
    padding: 44px;
    border: 1px solid #dfe8e5;
    border-radius: 8px;
    background: #101817;
    color: #ffffff;
    box-shadow: 0 28px 60px rgba(16, 24, 23, 0.16);
}

.public-cta h2 {
    color: #ffffff;
}

.public-cta p {
    color: #d7e3df;
}

.legal-page {
    width: min(100% - 32px, 960px);
    margin: 34px auto 72px;
}

.legal-hero {
    padding: 30px 0 22px;
    border-bottom: 1px solid #dfe8e5;
}

.legal-hero p {
    max-width: 760px;
    margin: 12px 0 0;
    color: #40514c;
    font-size: 16px;
    line-height: 1.65;
}

.legal-hero span {
    display: inline-block;
    margin-top: 12px;
    color: #64736f;
    font-size: 13px;
    font-weight: 800;
}

.legal-content {
    display: grid;
    gap: 22px;
    padding-top: 28px;
}

.legal-content section {
    padding-bottom: 20px;
    border-bottom: 1px solid #eef3f1;
}

.legal-content h2 {
    margin-bottom: 10px;
    font-size: 20px;
}

.legal-content p,
.legal-content li {
    color: #40514c;
    line-height: 1.65;
}

.legal-content ul {
    display: grid;
    gap: 8px;
    padding-left: 20px;
}

.legal-content a,
.legal-consent a {
    color: #096f62;
    font-weight: 900;
    text-decoration: none;
}

.legal-content a:hover,
.legal-content a:focus-visible,
.legal-consent a:hover,
.legal-consent a:focus-visible {
    text-decoration: underline;
}

.legal-consent {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid #dfe8e5;
    border-radius: 8px;
    background: #f7fbfa;
}

.legal-consent-check {
    display: grid;
    grid-template-columns: 22px 1fr;
    align-items: start;
    gap: 10px;
    font-weight: 900;
    line-height: 1.45;
}

.legal-consent-check input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
}

.legal-consent p {
    margin: 0;
    color: #40514c;
    line-height: 1.55;
}

/* Widget publico de WhatsApp: boton flotante + formulario previo antes de abrir wa.me. */
.public-whatsapp-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 40;
    display: grid;
    justify-items: end;
    gap: 14px;
}

.public-whatsapp {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 50%;
    background: #25d366;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 20px 36px rgba(37, 211, 102, 0.34);
}

.public-whatsapp:hover,
.public-whatsapp:focus-visible {
    background: #1ebe5d;
    outline: none;
}

.public-whatsapp svg {
    display: block;
    width: 34px;
    height: 34px;
}

.public-whatsapp .whatsapp-bubble {
    fill: #ffffff;
}

.public-whatsapp .whatsapp-phone {
    fill: #25d366;
}

.public-whatsapp:hover .whatsapp-phone,
.public-whatsapp:focus-visible .whatsapp-phone {
    fill: #1ebe5d;
}

.public-whatsapp span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.public-whatsapp-form {
    width: min(360px, calc(100vw - 32px));
    padding: 18px;
    border: 1px solid #dfe8e5;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 28px 72px rgba(16, 24, 23, 0.18);
}

.public-whatsapp-form[hidden] {
    display: none;
}

.public-whatsapp-form,
.public-whatsapp-form label {
    display: grid;
    gap: 12px;
}

.public-whatsapp-form label {
    gap: 7px;
    color: #40514c;
    font-size: 13px;
    font-weight: 800;
}

.public-whatsapp-form input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #d0ddd9;
    border-radius: 8px;
    color: #0d1513;
}

.public-whatsapp-form input:focus {
    border-color: #148a78;
    outline: 3px solid rgba(20, 138, 120, 0.13);
}

.public-whatsapp-form-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.public-whatsapp-form-head strong,
.public-whatsapp-form-head span {
    display: block;
}

.public-whatsapp-form-head strong {
    margin-bottom: 4px;
    font-size: 17px;
}

.public-whatsapp-form-head span {
    color: #53625e;
    line-height: 1.4;
}

.public-whatsapp-close {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: #eef4f2;
    color: #40514c;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

/* Ajustes responsive de la experiencia publica. */
@media (max-width: 980px) {
    .public-header {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .public-actions,
    .public-hero-actions {
        justify-content: center;
    }

    .public-hero,
    .public-split {
        grid-template-columns: 1fr;
    }

    .public-hero {
        margin-top: 28px;
        text-align: center;
    }

    .public-hero-copy p,
    .public-hero-copy h1 {
        margin-left: auto;
        margin-right: auto;
    }

    .public-plan-grid {
        grid-template-columns: 1fr;
    }

    .public-plan-card {
        min-height: auto;
    }
}

@media (max-width: 640px) {
    .public-header {
        width: min(100% - 20px, 1180px);
        padding-top: 12px;
    }

    .public-nav {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
    }

    .public-hero,
    .public-section,
    .public-cta {
        width: min(100% - 20px, 1180px);
    }

    .public-hero {
        gap: 24px;
    }

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

    .billing-segmented {
        flex-wrap: wrap;
    }

    .pricing-controls {
        align-items: stretch;
    }

    .billing-segmented,
    .currency-select,
    .currency-select select {
        width: 100%;
    }

    .billing-segmented button {
        flex: 1 1 96px;
    }

    .public-plan-card,
    .public-cta {
        padding: 22px;
    }

    .public-whatsapp-widget {
        right: 16px;
        bottom: 16px;
    }

    .public-whatsapp {
        width: 58px;
        height: 58px;
    }

    .public-whatsapp svg {
        width: 31px;
        height: 31px;
    }

    .legal-page {
        width: min(100% - 20px, 960px);
        margin-top: 20px;
    }

    .legal-hero {
        padding-top: 18px;
    }

    .legal-content h2 {
        font-size: 18px;
    }
}
