:root {
    --bg: #f4f6fa;
    --panel: #fff;
    --panel-soft: #f8fafc;
    --text: #172033;
    --heading: #101828;
    --muted: #667085;
    --subtle: #98a2b3;
    --line: #e4e7ec;
    --border: #d0d5dd;
    --brand: #4f46e5;
    --brand-dark: #3730a3;
    --brand-soft: #eef2ff;
    --primary: #4f46e5;
    --success: #079455;
    --success-soft: #ecfdf3;
    --danger: #d92d20;
    --danger-soft: #fff1f0;
    --warning: #dc6803;
    --nav: #101828;
    --nav-soft: #1d2939;
    --sidebar-width: 280px;
    --topbar-height: 72px;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
    --shadow: 0 10px 30px rgba(16,24,40,.08);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.menu-locked { overflow: hidden; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
img, svg { max-width: 100%; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { color: var(--heading); line-height: 1.2; }
h2 { margin: 0 0 6px; font-size: 20px; }

:focus-visible { outline: 3px solid rgba(79,70,229,.28); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.12); outline: none; }

/* Application frame */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; display: flex; width: var(--sidebar-width); min-height: 100dvh; flex-direction: column; overflow: hidden; background: var(--nav); color: #fff; box-shadow: 8px 0 30px rgba(16,24,40,.1); }
.sidebar-head { display: flex; min-height: var(--topbar-height); align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand, .auth-brand { display: flex; align-items: center; gap: 12px; }
.brand { min-width: 0; color: #fff; }
.logo { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 13px; background: linear-gradient(135deg, #7c3aed, #4f46e5 52%, #0ea5e9); box-shadow: 0 8px 20px rgba(79,70,229,.35); color: #fff; font-size: 19px; font-weight: 850; }
.brand-copy { display: grid; min-width: 0; }
.brand-copy strong { font-size: 17px; letter-spacing: -.02em; }
.brand-copy small { color: #98a2b3; font-size: 12px; }
.sidebar-nav { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 12px 24px; scrollbar-color: #475467 transparent; scrollbar-width: thin; }
.nav-section + .nav-section { margin-top: 14px; }
.nav-label { display: block; padding: 8px 12px 6px; color: #667085; font-size: 10px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.nav-item { position: relative; display: flex; min-height: 44px; align-items: center; gap: 12px; margin: 2px 0; padding: 10px 12px; border-radius: 10px; color: #cbd5e1; font-size: 14px; font-weight: 560; transition: background .16s, color .16s, transform .16s; }
.nav-item svg { width: 20px; height: 20px; flex: 0 0 auto; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(99,102,241,.28), rgba(99,102,241,.12)); color: #fff; }
.nav-item.active::before { position: absolute; inset: 9px auto 9px 0; width: 3px; border-radius: 3px; background: #818cf8; content: ""; }
.sidebar-footer { display: flex; align-items: center; gap: 11px; margin: 0 12px 14px; padding: 12px; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; background: rgba(255,255,255,.05); }
.company-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: #344054; font-weight: 800; }
.company-summary { display: grid; min-width: 0; }
.company-summary strong, .company-summary small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-summary strong { font-size: 13px; }.company-summary small { color: #98a2b3; font-size: 11px; }
.app-main { min-width: 0; min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; min-height: var(--topbar-height); align-items: center; justify-content: space-between; gap: 18px; padding: 0 clamp(18px,3vw,36px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); box-shadow: var(--shadow-sm); backdrop-filter: blur(12px); }
.topbar-start, .topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-company { display: grid; }.topbar-company strong { color: var(--heading); font-size: 14px; }.topbar-company small { color: var(--muted); font-size: 12px; }
.topbar-actions form { margin: 0; }
.topbar-switch { display: inline-flex; min-height: 40px; align-items: center; padding: 0 12px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 650; }
.topbar-switch:hover { background: var(--panel-soft); color: var(--heading); }
.logout-button { display: inline-flex; min-height: 40px; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #475467; cursor: pointer; font-size: 13px; font-weight: 650; }
.logout-button svg { width: 18px; }.logout-button:hover { background: var(--panel-soft); color: var(--heading); }
.icon-button { display: inline-grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.icon-button svg { width: 22px; height: 22px; }
.menu-toggle, .sidebar-close { display: none; }
.sidebar-close { color: #d0d5dd; }
.sidebar-overlay { display: none; }
.content { width: 100%; max-width: 1600px; margin: 0 auto; padding: clamp(20px,3vw,38px); }

/* Shared components */
.card, .panel, .stats article, .stats-grid article { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-sm); }
.page-head, .heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head h1, .heading h1 { margin: 3px 0 6px; font-size: clamp(26px,3vw,34px); letter-spacing: -.035em; }
.page-head p, .heading p { max-width: 700px; margin: 0; color: var(--muted); }
.eyebrow { display: block; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.button, .primary { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 16px; background: var(--brand); box-shadow: 0 1px 2px rgba(16,24,40,.08); color: #fff; cursor: pointer; font-weight: 700; line-height: 1.2; text-align: center; transition: transform .14s, box-shadow .14s, background .14s; }
.button:hover, .primary:hover { background: var(--brand-dark); box-shadow: 0 6px 16px rgba(79,70,229,.2); transform: translateY(-1px); }
.button.secondary { border-color: var(--line); background: #fff; color: #344054; box-shadow: var(--shadow-sm); }.button.secondary:hover { background: var(--panel-soft); color: var(--heading); }
.button.danger-button, .danger-button { background: var(--danger); color: #fff; }.full { width: 100%; }
.small { width: auto; min-height: 40px; padding: 8px 13px; }
.link { min-height: 36px; border: 0; background: none; color: var(--brand); cursor: pointer; font-weight: 700; }.danger, .danger-text { color: var(--danger) !important; }
.alert, .errors { margin: 0 0 18px; padding: 13px 15px; border: 1px solid #abefc6; border-radius: 11px; background: var(--success-soft); color: #067647; }
.error-alert, .errors, .alert.danger { border-color: #fecdca; background: var(--danger-soft); color: #b42318; }
.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 750; }.badge.success { background: var(--success-soft); color: #027a48; }.badge.muted { background: #f2f4f7; color: #475467; }.badge.danger { background: var(--danger-soft); color: #b42318; }
.muted { color: var(--muted); }.empty { padding: 42px 20px !important; color: var(--muted); text-align: center; }

/* Dashboard */
.dashboard-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.dashboard-hero h1 { margin: 5px 0 8px; font-size: clamp(30px,4vw,42px); letter-spacing: -.045em; }.dashboard-hero p { max-width: 650px; margin: 0; color: var(--muted); font-size: 16px; }.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.metric-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-bottom: 18px; }
.metric-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); }.metric-card.metric-primary { background: linear-gradient(145deg,#4f46e5,#4338ca); border-color: transparent; color: #fff; box-shadow: 0 14px 28px rgba(79,70,229,.22); }.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }.metric-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: rgba(255,255,255,.16); }.metric-card:not(.metric-primary) .metric-icon { background: var(--brand-soft); color: var(--brand); }.metric-icon.green { background: var(--success-soft) !important; color: var(--success) !important; }.metric-icon.violet { background: #f4f3ff !important; color: #7f56d9 !important; }.metric-icon svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }.metric-tag, .metric-trend { padding: 4px 8px; border-radius: 999px; background: #f2f4f7; color: var(--muted); font-size: 11px; font-weight: 750; }.metric-primary .metric-tag { background: rgba(255,255,255,.14); color: #e0e7ff; }.metric-trend.positive { background: var(--success-soft); color: #067647; }.metric-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 13px; font-weight: 650; }.metric-primary .metric-label, .metric-primary small { color: #c7d2fe; }.metric-card > strong { display: block; margin: 2px 0 5px; color: var(--heading); font-size: 32px; line-height: 1.1; letter-spacing: -.04em; }.metric-primary > strong { color: #fff; }.metric-card small { color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(340px,.85fr); gap: 18px; margin-bottom: 18px; }.insight-card, .quick-card, .modules-card { padding: 22px; }.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }.card-heading h2 { margin: 4px 0 0; }.card-heading > a { flex: 0 0 auto; font-size: 13px; font-weight: 700; }
.activity-chart { display: flex; align-items: center; justify-content: center; gap: clamp(28px,5vw,60px); min-height: 220px; }.donut { --value: 0; display: grid; width: 166px; height: 166px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: conic-gradient(var(--brand) calc(var(--value)*1%), #eaecf0 0); }.donut::before { grid-area: 1/1; width: 120px; height: 120px; border-radius: 50%; background: #fff; content: ""; }.donut span { z-index: 1; grid-area: 1/1; display: grid; text-align: center; }.donut strong { font-size: 28px; letter-spacing: -.04em; }.donut small { color: var(--muted); }.chart-legend { width: min(260px,100%); }.chart-legend > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 0; color: var(--muted); }.chart-legend strong { color: var(--heading); }.legend-dot { width: 9px; height: 9px; border-radius: 50%; }.legend-dot.active { background: var(--brand); }.legend-dot.inactive { background: #d0d5dd; }.chart-legend .legend-total { grid-template-columns: 1fr auto; margin-top: 8px; border-top: 1px solid var(--line); }
.quick-grid { display: grid; gap: 7px; }.quick-grid > a { display: grid; min-height: 62px; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 9px; border-radius: 12px; color: var(--text); }.quick-grid > a:hover { background: var(--panel-soft); }.quick-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 11px; background: var(--brand-soft); color: var(--brand); font-size: 20px; font-weight: 600; }.quick-icon.violet { background: #f4f3ff; color: #7f56d9; }.quick-icon.amber { background: #fffaeb; color: #dc6803; }.quick-icon.green { background: var(--success-soft); color: var(--success); }.quick-grid span:nth-child(2) { display: grid; }.quick-grid strong { color: var(--heading); font-size: 13px; }.quick-grid small { color: var(--muted); font-size: 11px; }.quick-grid b { color: var(--subtle); font-size: 22px; }.module-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }.module-grid a { display: grid; min-height: 88px; align-content: center; padding: 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--heading); }.module-grid a:hover { border-color: #c7d2fe; background: #fafaff; }.module-grid span { font-weight: 750; }.module-grid small { margin-top: 3px; color: var(--muted); }

/* Forms */
label { display: grid; gap: 7px; margin: 14px 0; color: #344054; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--heading); padding: 10px 12px; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 96px; resize: vertical; }.check { display: flex !important; min-height: 44px; flex-direction: row !important; align-items: center; gap: 9px; }.check input { width: 18px; min-height: 18px; height: 18px; }.grid2, .form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 16px; }.span-2 { grid-column: span 2; }.form-card { padding: clamp(18px,3vw,26px); }.form-actions, .actions, .head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 22px; }.actions form, .head-actions form { margin: 0; }.filters, .toolbar { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 18px; }.filters label { flex: 1; margin: 0; }.filters input, .filters select, .toolbar input { min-width: 0; }.toolbar input { max-width: 540px; }.split-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(300px,.42fr); gap: 18px; align-items: start; }

/* Tables */
.table-card { overflow-x: auto; padding: 0; -webkit-overflow-scrolling: touch; }.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }.table-wrap::after { pointer-events: none; }.table-card > table, .panel > table { display: table; }
table { width: 100%; min-width: 680px; border-collapse: collapse; }.card table { width: 100%; }th, td { padding: 14px 16px; border-bottom: 1px solid #eaecf0; text-align: left; vertical-align: middle; }th { background: #f9fafb; color: #667085; font-size: 11px; font-weight: 750; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }tbody tr:last-child td { border-bottom: 0; }tbody tr:hover { background: #fcfcfd; }td { color: #344054; }td small { display: block; margin-top: 3px; color: var(--subtle); }.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; white-space: nowrap; }.row-actions form { display: inline-flex; margin: 0; }.row-actions a, .row-actions button { min-height: 36px; padding: 6px; }.pagination { padding: 14px 16px; border-top: 1px solid var(--line); }

/* Existing stats and operational screens */
.stats, .stats-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin-bottom: 18px; }.stats .stat, .stats-grid .stat, .stat { padding: 18px; }.stat span, .stat small { display: block; color: var(--muted); }.stat strong { display: block; margin: 6px 0; color: var(--heading); font-size: 27px; letter-spacing: -.035em; }.welcome, .panel { padding: 22px; }.panel { margin-top: 18px; }.connection-pill { display: inline-flex; min-height: 36px; align-items: center; gap: 8px; padding: 7px 11px; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: 13px; font-weight: 750; }.connection-pill i { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; }.connection-pill.online { background: var(--success-soft); color: #067647; }.connection-pill.online i { background: #12b76a; box-shadow: 0 0 0 4px rgba(18,183,106,.12); }
.whatsapp-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(280px,.4fr); gap: 18px; align-items: start; }.connection-card, .bridge-note { padding: 24px; }.connection-visual { position: relative; display: grid; width: 106px; height: 106px; margin: 10px auto 26px; place-items: center; border-radius: 50%; background: #f2f4f7; }.connection-visual.online { background: var(--success-soft); }.phone-mark { z-index: 2; display: grid; width: 58px; height: 58px; place-items: center; border-radius: 18px; background: #98a2b3; color: #fff; font-size: 26px; font-weight: 850; }.online .phone-mark { background: #12b76a; }.signal-ring { position: absolute; inset: 8px; border: 2px solid #d0d5dd; border-radius: 50%; }.online .signal-ring { border-color: #abefc6; }.connection-details { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }.connection-details div { min-width: 0; padding: 14px; }.connection-details div + div { border-left: 1px solid var(--line); }.connection-details span, .connection-details strong { display: block; }.connection-details span { color: var(--muted); font-size: 11px; }.connection-details strong { margin-top: 3px; font-size: 13px; }.break-text { overflow-wrap: anywhere; }.bridge-note { background: linear-gradient(145deg,#101828,#1d2939); color: #d0d5dd; }.bridge-note h2 { color: #fff; }.note-icon { display: grid; width: 38px; height: 38px; margin-bottom: 18px; place-items: center; border-radius: 11px; background: rgba(129,140,248,.18); color: #a5b4fc; font-weight: 800; }.note-list { display: grid; gap: 10px; margin: 22px 0; }.note-list span { display: flex; gap: 9px; font-size: 13px; }.note-list i { color: #6ee7b7; font-style: normal; }.muted-note { color: #98a2b3; font-size: 12px; }.empty-state { max-width: 440px; margin: 25px auto; padding: 20px; text-align: center; }.empty-state p { color: var(--muted); }.empty-icon { display: grid; width: 64px; height: 64px; margin: 0 auto 16px; place-items: center; border-radius: 18px; background: var(--success-soft); color: var(--success); font-size: 25px; font-weight: 850; }
.connection-pill.waiting { background: #fffaeb; color: #b54708; }.connection-pill.waiting i { background: #f79009; box-shadow: 0 0 0 4px rgba(247,144,9,.12); }.connection-visual.waiting { background: #fffaeb; }.connection-visual.waiting .phone-mark { background: #f79009; }.connection-visual.waiting .signal-ring { border-color: #fedf89; animation: signal-pulse 1.5s ease-in-out infinite; }.refresh-connection { border: 1px solid var(--line); color: var(--muted); }.refresh-connection svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }.refresh-connection:hover { background: var(--panel-soft); color: var(--heading); }.refresh-connection.spinning svg { animation: spin .8s linear infinite; }.bridge-feedback { margin: -6px 0 20px; padding: 11px 13px; border: 1px solid #b2ddff; border-radius: 10px; background: #eff8ff; color: #175cd3; font-size: 13px; }.bridge-feedback.success { border-color: #abefc6; background: var(--success-soft); color: #067647; }.bridge-feedback.error { border-color: #fecdca; background: var(--danger-soft); color: #b42318; }.qr-stage { display: grid; grid-template-columns: minmax(210px,320px) minmax(220px,1fr); align-items: center; gap: clamp(20px,4vw,40px); margin-bottom: 24px; padding: clamp(16px,3vw,24px); border: 1px solid #c7d7fe; border-radius: 16px; background: linear-gradient(145deg,#f8faff,#f0fdf9); }.qr-stage[hidden] { display: none; }.qr-frame { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }.qr-frame img { display: block; width: 100%; height: auto; aspect-ratio: 1; }.qr-stage h3 { margin: 0 0 8px; font-size: 19px; }.qr-stage p { margin: 0 0 10px; color: var(--muted); }.qr-stage small { color: var(--success); font-weight: 650; }.bridge-live-stats { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-top: 12px; }.bridge-live-stats > div { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; border-radius: 10px; background: var(--panel-soft); }.bridge-live-stats span { color: var(--muted); font-size: 12px; }.bridge-live-stats strong { color: var(--heading); }.connection-actions { display: flex; justify-content: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; }.connection-actions button[hidden] { display: none; }.button:disabled, .icon-button:disabled { cursor: not-allowed; opacity: .5; transform: none; box-shadow: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes signal-pulse { 50% { opacity: .35; transform: scale(.94); } }

/* WhatsApp autorespuestas */
.autoreply-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(360px,.45fr); gap: 20px; align-items: start; }.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }.section-heading h2 { margin: 0 0 4px; }.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }.count-badge { display: inline-grid; min-width: 30px; height: 30px; place-items: center; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 800; }.autoreply-list { display: grid; gap: 12px; }.autoreply-rule { padding: 18px; transition: border-color .15s, opacity .15s; }.autoreply-rule:hover { border-color: #c7d2fe; }.autoreply-rule.is-disabled { opacity: .7; }.rule-main, .rule-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }.rule-title { display: flex; min-width: 0; align-items: center; gap: 11px; }.rule-title h3 { margin: 0 0 3px; font-size: 16px; }.rule-title small, .rule-footer small { color: var(--muted); }.rule-priority { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 9px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 800; }.keyword-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 10px; }.keyword-list span { padding: 4px 8px; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: 11px; font-weight: 650; }.reply-preview { margin: 0 0 14px; color: #475467; font-size: 13px; }.rule-footer { align-items: center; padding-top: 12px; border-top: 1px solid var(--line); }.schedule-card { position: sticky; top: calc(var(--topbar-height) + 18px); padding: 20px; }.business-hours { display: grid; gap: 7px; margin: 12px 0 18px; }.business-day { display: grid; grid-template-columns: minmax(92px,1fr) 88px auto 88px; align-items: center; gap: 7px; }.business-day .check { margin: 0; }.business-day input[type="time"] { min-width: 0; padding: 7px; font-size: 12px; }.business-day > span { color: var(--muted); font-size: 11px; }.rate-settings { gap: 10px; }.rate-settings label { margin-top: 0; }.check-stack { align-content: center; padding-top: 6px; }.check-stack .check { margin: 0; }.optional { color: var(--subtle); font-size: 11px; font-weight: 500; }.form-grid label > small { color: var(--muted); font-weight: 450; }.optout-panel { margin-bottom: 18px; }.optout-list { display: grid; gap: 8px; }.optout-list > div { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }.optout-list span { display: grid; min-width: 0; }.optout-list small { color: var(--muted); }.history-filters > input { flex: 1; min-width: 220px; }.history-filters select { width: auto; min-width: 170px; }.message-cell { min-width: 220px; max-width: 360px; white-space: normal; overflow-wrap: anywhere; }

/* POS and detail pages */
.pos-layout, .detail-grid { display: grid; grid-template-columns: minmax(0,1fr) 350px; gap: 18px; align-items: start; }.pos-summary { position: sticky; top: calc(var(--topbar-height) + 18px); padding: 20px; }.product-picker { display: grid; max-height: 330px; grid-template-columns: repeat(auto-fill,minmax(155px,1fr)); gap: 10px; margin: 16px 0 22px; overflow: auto; }.product-option { min-height: 74px; border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 12px; text-align: left; cursor: pointer; }.product-option:hover { border-color: var(--brand); box-shadow: var(--shadow); }.product-option strong, .product-option small { display: block; }.product-option small { color: var(--muted); }.totals { display: grid; gap: 9px; margin: 16px 0; }.totals > div { display: flex; justify-content: space-between; gap: 14px; }.totals .grand { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 19px; }.payment-row { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }.sale-meta { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }.sale-meta > div { padding: 12px; border-radius: 10px; background: var(--panel-soft); }.sale-meta span, .sale-meta strong { display: block; }.sale-meta span { color: var(--muted); font-size: 12px; }.sale-meta strong { margin-top: 3px; }#cart-table input { min-width: 90px; }

/* Authentication */
.auth-page { display: grid; min-height: 100dvh; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 10%,#e0e7ff,transparent 30%), linear-gradient(145deg,#f8faff,#f0fdf9); }.auth-card { width: min(560px,100%); padding: clamp(24px,5vw,36px); border: 1px solid rgba(255,255,255,.8); border-radius: 22px; background: rgba(255,255,255,.96); box-shadow: 0 24px 70px rgba(38,52,91,.14); }.auth-brand { margin-bottom: 26px; }.auth-brand h1 { margin: 0; }.auth-brand p { margin: 2px 0; color: var(--muted); }.primary { width: 100%; }.center { color: var(--muted); text-align: center; }.company-list { display: grid; gap: 10px; }.company-list form { margin: 0; }.company { display: flex; width: 100%; min-height: 64px; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 11px; text-align: left; cursor: pointer; }.company:hover { border-color: #c7d2fe; background: #fafaff; }.company > span { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 850; }.company small { display: block; color: var(--muted); }

@media (max-width: 1199px) {
    .stats, .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .module-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1023px) {
    .sidebar { transform: translateX(-105%); transition: transform .22s ease; }
    .menu-open .sidebar { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .menu-toggle, .sidebar-close { display: inline-grid; }
    .sidebar-overlay { position: fixed; inset: 0; z-index: 40; display: block; border: 0; background: rgba(16,24,40,.56); opacity: 0; pointer-events: none; transition: opacity .2s; }
    .menu-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
    .pos-layout, .detail-grid, .whatsapp-grid, .split-grid { grid-template-columns: 1fr; }
    .autoreply-layout { grid-template-columns: 1fr; }.schedule-card { position: static; }
    .pos-summary { position: static; }
}

@media (max-width: 767px) {
    :root { --topbar-height: 64px; }
    .content { padding: 20px 16px 34px; }
    .topbar { padding: 0 12px; }
    .topbar-switch { display: none; }
    .logout-button { width: 44px; padding: 0; justify-content: center; }.logout-button span { display: none; }
    .dashboard-hero, .page-head, .heading { align-items: stretch; flex-direction: column; gap: 16px; }
    .dashboard-hero { margin-bottom: 20px; }.dashboard-hero p { font-size: 14px; }
    .hero-actions, .head-actions { width: 100%; }.hero-actions .button, .head-actions .button, .head-actions form { flex: 1; }
    .metric-grid { grid-template-columns: 1fr; gap: 12px; }.metric-card { padding: 17px; }.metric-top { margin-bottom: 12px; }
    .activity-chart { flex-direction: column; gap: 18px; }.donut { width: 150px; height: 150px; }.donut::before { width: 108px; height: 108px; }.chart-legend { width: 100%; }
    .module-grid { grid-template-columns: 1fr 1fr; }.modules-card, .quick-card, .insight-card { padding: 18px; }
    .grid2, .form-grid { grid-template-columns: 1fr; }.span-2 { grid-column: auto; }
    .filters, .toolbar { align-items: stretch; flex-direction: column; }.toolbar input { max-width: none; }.filters .button, .toolbar .button { width: 100%; }
    .form-actions, .actions { align-items: stretch; flex-direction: column-reverse; }.form-actions .button, .form-actions > a, .actions .button, .actions > a, .actions form { width: 100%; }.actions form .button { width: 100%; }
    .table-card, .panel, .card { max-width: 100%; }.table-wrap { position: relative; }.table-wrap::before, .table-card:has(> table)::before { display: block; min-width: 100%; padding: 8px 14px; border-bottom: 1px solid var(--line); background: #fffcf5; color: #b54708; content: "Desliza horizontalmente para ver más"; font-size: 11px; font-weight: 650; }
    table { min-width: 620px; }th, td { padding: 12px; }.row-actions { justify-content: flex-start; }
    .connection-details { grid-template-columns: 1fr; }.connection-details div + div { border-top: 1px solid var(--line); border-left: 0; }
    .qr-stage { grid-template-columns: 1fr; text-align: center; }.qr-frame { width: min(320px,100%); margin: 0 auto; }.connection-actions { align-items: stretch; flex-direction: column; }.connection-actions .button { width: 100%; }
    .rule-main, .rule-footer { align-items: stretch; flex-direction: column; }.rule-footer .row-actions { width: 100%; flex-wrap: wrap; }.rule-footer .row-actions > * { flex: 1; }.rule-footer .row-actions form { display: flex; }.rule-footer .row-actions a, .rule-footer .row-actions button { width: 100%; text-align: center; }.optout-list > div { align-items: stretch; flex-direction: column; }.optout-list form, .optout-list button { width: 100%; }.history-filters select { width: 100%; }.business-day { grid-template-columns: minmax(85px,1fr) 1fr auto 1fr; }
    .sale-meta { grid-template-columns: 1fr; }.product-picker { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 520px) {
    .sidebar { width: min(88vw,320px); }
    .topbar-company strong { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .stats, .stats-grid, .module-grid { grid-template-columns: 1fr; }
    .hero-actions { flex-direction: column-reverse; }.hero-actions .button { width: 100%; }
    .page-head h1, .heading h1 { font-size: 27px; }
    .product-picker { grid-template-columns: 1fr; }
    .auth-page { padding: 12px; }.auth-card { border-radius: 17px; }
}

.connect-options { padding: 1rem 0; }
.phone-pairing { margin-top: 1rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 18px; background: var(--panel-soft); }
.phone-pairing #pairing-result { margin-top: 1rem; text-align: center; }
.phone-pairing #pairing-code { display: block; margin: .75rem 0; color: var(--primary); font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: clamp(1.8rem,8vw,3rem); letter-spacing: .18em; overflow-wrap: anywhere; }
.connected-account { display: flex; align-items: center; gap: 1rem; margin: 1.25rem 0; padding: 1.25rem; border: 1px solid #bbf7d0; border-radius: 18px; background: #f0fdf4; }
.connected-account h3, .connected-account p { margin: 0; }.connected-account strong { display: block; margin-top: .35rem; font-size: 1.2rem; }
.connected-check { display: grid; flex: 0 0 3rem; width: 3rem; height: 3rem; place-items: center; border-radius: 50%; background: #16a34a; color: #fff; font-size: 1.5rem; font-weight: 800; }

@media (max-width: 640px) {
    .qr-frame { width: min(100%,360px); }.phone-pairing { padding: 1rem; }
    .phone-pairing .form-actions, .connect-options .connection-actions, #connected-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
    .phone-pairing button, .connect-options button, #connected-actions button { width: 100%; min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* SaaS administration */
.btn { display:inline-flex; min-height:42px; align-items:center; justify-content:center; gap:7px; padding:9px 14px; border:1px solid var(--line); border-radius:10px; background:#fff; color:#344054; cursor:pointer; font-weight:700; line-height:1.2; text-align:center; transition:.15s ease; }
.btn:hover { border-color:#c7d2fe; background:var(--brand-soft); color:var(--brand-dark); }
.btn.primary { border-color:transparent; background:var(--brand); color:#fff; }
.btn.danger { border-color:#fecdca; background:var(--danger-soft); color:var(--danger); }
.page-header,.panel-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.page-header { margin-bottom:22px; }.page-header h1 { margin:4px 0 6px; }.page-header p,.panel-header p { margin:0; }
.stats-grid .stat-card { min-width:0; padding:20px; }.stats-grid .stat-card span { display:block; color:var(--muted); }.stats-grid .stat-card strong { display:block; margin-top:7px; color:var(--heading); font-size:30px; line-height:1; }
.responsive-grid.two,.saas-card-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; align-items:start; }.saas-card-grid { margin-top:18px; }
.saas-form fieldset { margin:16px 0; padding:14px; border:1px solid var(--line); border-radius:12px; }.saas-form legend { padding:0 6px; color:var(--heading); font-weight:750; }.check-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px 14px; }.check-row { display:flex; min-height:40px; flex-direction:row; align-items:center; gap:8px; margin:2px 0; }.check-row input { width:18px; min-height:18px; }
.panel-header .inline-search { display:flex; min-width:min(420px,100%); gap:8px; }.inline-search input { min-width:0; }
.compact-actions { display:flex; flex-wrap:wrap; gap:7px; }.compact-actions form { margin:0; }.compact-actions .btn { min-height:36px; padding:7px 10px; font-size:12px; }
.limit-list { display:flex; flex-wrap:wrap; gap:7px; margin:14px 0; }.limit-list span { padding:5px 9px; border-radius:999px; background:var(--panel-soft); color:var(--muted); font-size:12px; }
.saas-plan-card details { margin-top:12px; }.saas-plan-card summary { cursor:pointer; }

@media(max-width:767px){
 .page-header,.panel-header { align-items:stretch; flex-direction:column; }.panel-header .inline-search { min-width:0; width:100%; }.panel-header .inline-search .btn { flex:0 0 auto; }
 .responsive-grid.two,.saas-card-grid,.check-grid { grid-template-columns:1fr; }.stats-grid.saas-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }.stats-grid .stat-card { padding:16px; }.stats-grid .stat-card strong { font-size:26px; }
 .saas-table::before { display:none!important; }.saas-table table,.saas-table tbody,.saas-table tr,.saas-table td { display:block; min-width:0; width:100%; }.saas-table thead { display:none; }.saas-table tr { margin-bottom:12px; border:1px solid var(--line); border-radius:12px; background:#fff; overflow:hidden; }.saas-table td { display:grid; grid-template-columns:110px minmax(0,1fr); gap:10px; padding:11px 13px; border-bottom:1px solid var(--line); }.saas-table td::before { color:var(--muted); content:attr(data-label); font-size:11px; font-weight:800; text-transform:uppercase; }.saas-table td:last-child { border-bottom:0; }.saas-table td[colspan] { display:block; }
 .compact-actions { justify-content:flex-start; }.compact-actions form,.compact-actions .btn { width:100%; }.saas-form .btn.primary { width:100%; }
}
@media(max-width:420px){.stats-grid.saas-stats{grid-template-columns:1fr}.panel-header .inline-search{flex-direction:column}.panel-header .inline-search .btn{width:100%}}
