/* Softtalia Monitor · 1.0 */
:root {
    --pro-bg: #f5f5f6;
    --pro-surface: #ffffff;
    --pro-text: #29292d;
    --pro-muted: #747477;
    --pro-line: #dedee1;
    --pro-line-soft: #ececef;
    --pro-dark: #2d2d31;
    --pro-green: #43a34f;
    --pro-green-soft: #edf7ee;
    --pro-red: #e54848;
    --pro-red-soft: #fff0f0;
    --pro-amber: #c77a0a;
    --pro-amber-soft: #fff7e8;
    --bg: var(--pro-bg);
    --surface: var(--pro-surface);
    --surface-soft: #fafafa;
    --text: var(--pro-text);
    --muted: var(--pro-muted);
    --line: var(--pro-line);
    --primary: var(--pro-dark);
    --primary-dark: #171719;
    --ok: var(--pro-green);
    --warning: var(--pro-amber);
    --critical: var(--pro-red);
    --radius: 8px;
}

body { background: var(--pro-bg); color: var(--pro-text); font-size: 13px; }
.app-shell { grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { height: calc(100vh - 12px); margin: 6px; padding: 18px 10px 14px; color: var(--pro-text); background: var(--pro-surface); border: 1px solid var(--pro-line); border-radius: 8px; box-shadow: none; }
.brand { min-height: 52px; gap: 10px; padding: 0 12px; color: var(--pro-text); }
.brand:hover { color: var(--pro-text); }
.brand-logo { width: 27px; height: 35px; flex: 0 0 auto; object-fit: contain; }
.brand strong { color: var(--pro-text); font-size: 14px; font-weight: 700; }
.brand small { color: #929295; font-size: 8px; letter-spacing: .05em; }
.nav-list { margin-top: 18px; gap: 2px; }
.nav-heading { margin: 15px 14px 7px; color: #929295; font-size: 9px; letter-spacing: .06em; }
.nav-list a { min-height: 38px; padding: 0 13px; border-radius: 6px; color: #55555a; font-size: 11px; font-weight: 580; }
.nav-list a:hover { color: var(--pro-text); background: #f2f2f3; }
.nav-list a.active { color: #fff; background: var(--pro-dark); box-shadow: 0 3px 8px rgba(30, 30, 34, .16); font-weight: 680; }
.sidebar-footer { border-color: var(--pro-line); }
.user-chip { padding: 0 12px; }
.user-chip strong { color: var(--pro-text); font-size: 10px; }
.user-chip small { color: var(--pro-muted); font-size: 8px; }
.link-button { color: var(--pro-text); font-size: 10px; }

.content-area { width: min(1780px, 100%); padding: 24px clamp(18px, 2.2vw, 34px) 60px; }
.dashboard-heading { min-height: 112px; margin: 0; align-items: center; }
.dashboard-path { margin: 0 0 16px; color: var(--pro-text); font-size: 11px; }
.dashboard-path span { color: #939397; }
.dashboard-heading h1 { margin: 0 0 3px; font-size: 25px; font-weight: 720; letter-spacing: -.035em; }
.dashboard-updated { color: var(--pro-muted); font-size: 11px; }
.dashboard-updated i { width: 7px; height: 7px; margin-right: 6px; display: inline-block; border-radius: 50%; background: var(--pro-green); box-shadow: 0 0 0 3px var(--pro-green-soft); }
.dashboard-guide { margin: 8px 0 0; color: #89898d; font-size: 9px; }
.heading-actions { align-self: flex-start; gap: 8px; }
.button { min-height: 38px; padding: 0 16px; border-radius: 7px; font-size: 11px; font-weight: 650; }
.button-primary { color: #fff; border-color: var(--pro-dark); background: var(--pro-dark); box-shadow: 0 3px 8px rgba(30, 30, 34, .13); }
.button-primary:hover { background: #171719; box-shadow: 0 4px 10px rgba(30, 30, 34, .16); }
.button-secondary { color: var(--pro-text); border-color: #cfd0d3; background: #fff; }
.button-secondary:hover { border-color: #9b9ba0; background: #fafafa; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { position: relative; min-height: 108px; padding: 15px 16px 13px; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--pro-line); border-radius: 8px; color: var(--pro-text); background: var(--pro-surface); box-shadow: 0 1px 2px rgba(24, 24, 28, .04); text-align: left; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.metric-card:hover { border-color: #b8b8bc; box-shadow: 0 4px 12px rgba(24, 24, 28, .07); transform: translateY(-1px); }
.metric-card.is-selected { border-color: var(--pro-dark); box-shadow: inset 0 0 0 1px var(--pro-dark); }
.metric-card > span { color: var(--pro-muted); font-size: 11px; }
.metric-card > strong { margin: 7px 0 10px; font-size: 25px; line-height: 1; letter-spacing: -.035em; }
.metric-card > small { width: calc(100% + 32px); margin: auto -16px -13px; padding: 9px 16px 0; border-top: 1px solid var(--pro-line-soft); color: var(--pro-muted); font-size: 9px; }
.metric-card small b { color: var(--pro-green); }
.metric-card.metric-warning small b { color: var(--pro-amber); }
.metric-card.metric-critical small b { color: var(--pro-red); }
.metric-card:focus-visible { outline: 2px solid #1f6feb; outline-offset: 2px; }

.analytics-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.analytics-card { min-width: 0; overflow: hidden; border: 1px solid var(--pro-line); border-radius: 8px; background: var(--pro-surface); box-shadow: 0 1px 2px rgba(24, 24, 28, .04); }
.analytics-card > header { min-height: 72px; padding: 16px 16px 6px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.analytics-card h2 { margin: 0; font-size: 13px; font-weight: 720; }
.analytics-card header p { margin: 4px 0 0; color: var(--pro-muted); font-size: 10px; }
.analytics-card header > strong { color: var(--pro-text); font-size: 16px; }
.trend-chart { width: 100%; height: 156px; display: block; padding: 4px 8px 0; overflow: visible; }
.trend-chart line { stroke: #e3e3e6; stroke-width: 1; }
.trend-chart text { fill: #7d7d81; font-size: 9px; }
.trend-chart rect { fill: var(--pro-green); }
.trend-chart polyline { fill: none; stroke: var(--pro-green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.trend-chart circle { fill: var(--pro-green); }
.incident-chart polyline { stroke: var(--pro-red); }
.incident-chart circle { fill: var(--pro-red); }
.analytics-card > footer { min-height: 42px; padding: 12px 16px; display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--pro-line-soft); color: var(--pro-muted); font-size: 9px; }
.analytics-card footer strong { color: var(--pro-text); font-weight: 620; }

.operation-note { min-height: 44px; margin-top: 18px; padding: 0 14px; border: 1px solid var(--pro-line); border-radius: 7px; background: #fafafa; }
.operation-state { padding: 0 12px 0 0; border: 0; border-right: 1px solid var(--pro-line); border-radius: 0; color: var(--pro-muted); background: transparent; font-size: 8px; }
.operation-note p { color: var(--pro-muted); font-size: 10px; }
.operation-note a { padding: 0; color: var(--pro-text); font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.operation-note a:hover { background: transparent; }

.attention-section,
.monitoring-section { margin-top: 18px; overflow: hidden; border: 1px solid var(--pro-line); border-radius: 8px; background: var(--pro-surface); box-shadow: 0 1px 2px rgba(24, 24, 28, .04); }
.section-heading { min-height: 72px; padding: 15px 16px; border-bottom: 1px solid var(--pro-line); }
.section-heading h2 { margin: 0 0 4px; font-size: 14px; font-weight: 720; }
.section-heading > div > span { color: var(--pro-muted); font-size: 10px; }
.plain-count { padding: 6px 10px; border-radius: 5px; color: var(--pro-red); background: var(--pro-red-soft); font-size: 9px; }
.incident-list { padding: 0; gap: 0; }
.incident-row { min-height: 60px; padding: 10px 16px; grid-template-columns: 55px minmax(0, 1fr) auto; border: 0 !important; border-bottom: 1px solid var(--pro-line-soft) !important; border-radius: 0; }
.incident-row:last-child { border-bottom: 0 !important; }
.incident-row:hover { background: #fafafa; }
.incident-level { padding: 4px 7px; border-radius: 4px; color: #7a4700; background: var(--pro-amber-soft); font-size: 8px; }
.incident-row.severity-critical .incident-level { color: #aa2525; background: var(--pro-red-soft); }
.incident-row strong { color: var(--pro-text); font-size: 11px; }
.incident-row small { color: var(--pro-muted); font-size: 9px; }
.incident-row time { color: var(--pro-muted); font-size: 9px; }

.table-heading { min-height: 78px; }
.filters { gap: 8px; align-items: flex-end; }
.filter-control { display: grid; gap: 5px; }
.filter-control > span { color: var(--pro-muted); font-size: 8px; font-weight: 650; letter-spacing: .02em; }
.filters select,
.search-field input { height: 36px; border: 1px solid #d5d5d8; border-radius: 6px; color: var(--pro-text); background: #fff; font-size: 10px; }
.filters select { padding-left: 10px; }
.search-field input { width: 220px; padding: 0 11px; }
.filters input:focus,
.filters select:focus,
input:focus,
select:focus { border-color: #8f8f94; box-shadow: 0 0 0 2px rgba(50, 50, 55, .08); }
.data-table th { padding: 10px 12px; color: #88888d; background: #fafafa; font-size: 8px; }
.data-table td { padding: 11px 12px; border-color: var(--pro-line-soft); color: #56565a; font-size: 9px; }
.data-table tbody tr:hover { background: #fafafa; }
.site-row-warning,
.site-row-error,
.site-row-down { background: transparent; }
.site-row-warning { box-shadow: inset 3px 0 var(--pro-amber); }
.site-row-error,
.site-row-down { box-shadow: inset 3px 0 var(--pro-red); }
.domain-cell strong { color: var(--pro-text); font-size: 10px; }
.domain-cell small { color: var(--pro-muted); font-size: 8px; }
.status-pill { min-height: 22px; padding: 0 7px; border-radius: 4px; font-size: 8px; }
.status-pill.status-ok { color: #287d32; background: var(--pro-green-soft) !important; }
.status-pill.status-warning { color: #8a5200; background: var(--pro-amber-soft) !important; }
.status-pill.status-error,
.status-pill.status-down { color: #b02a2a; background: var(--pro-red-soft) !important; }
.diagnostic-text { font-size: 9px; }
.row-link { min-height: 26px; padding: 0 8px; border-radius: 5px; color: var(--pro-text); font-size: 9px; }
.row-link:hover { background: #eeeeef; }
.clear-filters { height: 36px; padding: 0 12px; border: 1px solid #d5d5d8; border-radius: 6px; color: var(--pro-text); background: #fff; font-size: 9px; font-weight: 650; cursor: pointer; }
.clear-filters:hover { border-color: #9b9ba0; background: #f7f7f8; }
.filter-empty { padding: 44px 20px; border-top: 1px solid var(--pro-line-soft); text-align: center; }
.filter-empty strong { display: block; color: var(--pro-text); font-size: 13px; }
.filter-empty p { margin: 6px 0 14px; color: var(--pro-muted); font-size: 10px; }
.filter-empty button { padding: 8px 12px; border: 1px solid #d5d5d8; border-radius: 6px; color: var(--pro-text); background: #fff; font-size: 9px; cursor: pointer; }

.auth-brand { margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.auth-brand img { width: 38px; height: 49px; object-fit: contain; }
.auth-brand strong { color: var(--pro-text); font-size: 15px; font-weight: 720; letter-spacing: -.02em; }
.login-card { border: 1px solid var(--pro-line); border-radius: 10px; box-shadow: 0 8px 26px rgba(24, 24, 28, .07); }
.mobile-header .brand-logo { width: 18px; height: 24px; }

.panel,
.setup-banner,
.sync-strip,
.connection-card,
.config-card,
.history-card,
.upload-card,
.mapping-card,
.alert-status-card,
.alert-rule-card { border: 1px solid var(--pro-line); border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgba(24, 24, 28, .04); }
.mobile-header { color: var(--pro-text); background: #fff; border-bottom: 1px solid var(--pro-line); box-shadow: none; }
.mobile-header .brand { color: var(--pro-text); }
.menu-button { border-radius: 6px; color: var(--pro-text); border-color: #cfcfd2; }

@media (max-width: 1200px) {
    .analytics-grid { grid-template-columns: 1fr 1fr; }
    .analytics-card:last-child { grid-column: 1 / -1; }
}

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

@media (max-width: 820px) {
    .sidebar { width: 250px; height: 100vh; margin: 0; border-width: 0 1px 0 0; border-radius: 0; }
    .content-area { padding: 22px 14px 48px; }
    .dashboard-heading { align-items: flex-start; }
    .dashboard-path { margin-bottom: 16px; }
}

@media (max-width: 620px) {
    .metric-grid,
    .analytics-grid { grid-template-columns: 1fr; }
    .analytics-card:last-child { grid-column: auto; }
    .dashboard-heading h1 { font-size: 24px; }
    .heading-actions { width: 100%; }
    .metric-card { min-height: 100px; }
    .trend-chart { height: 148px; }
    .operation-note { padding: 10px 12px; align-items: flex-start; }
    .operation-state { border-right: 0; }
    .incident-row { grid-template-columns: 50px 1fr; }
    .section-heading { padding: 14px; }
    .filters { align-items: stretch; }
    .filter-control { width: 100%; }
    .search-field input,
    .filters select,
    .clear-filters { width: 100%; }
}

/* Dashboard limpio */
.app-shell { grid-template-columns: 218px minmax(0, 1fr); }
.sidebar { padding-top: 16px; }
.content-area { width: min(1480px, 100%); padding: 26px clamp(18px, 2.4vw, 36px) 56px; }
.dashboard-heading { display: flex; justify-content: space-between; gap: 24px; min-height: 100px; }
.clean-heading .heading-actions { align-self: center; display: flex; }
.clean-metrics { gap: 12px; }
.clean-metrics .metric-card { min-height: 98px; border-radius: 7px; box-shadow: none; }
.clean-metrics .metric-card.is-selected { border-color: #aaaab0; box-shadow: none; }
.clean-metrics .metric-card.metric-review > strong { color: var(--pro-amber); }
.clean-metrics .metric-card.metric-critical > strong { color: var(--pro-red); }

.performance-strip { margin-top: 14px; display: grid; grid-template-columns: minmax(180px, .7fr) minmax(0, 2.3fr); align-items: stretch; overflow: hidden; border: 1px solid var(--pro-line); border-radius: 8px; background: #fff; }
.performance-strip > header { padding: 16px 18px; display: flex; align-items: center; border-right: 1px solid var(--pro-line-soft); }
.performance-strip h2 { margin: 0; font-size: 13px; }
.performance-strip p { margin: 4px 0 0; color: var(--pro-muted); font-size: 9px; }
.performance-values { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.performance-values article { min-width: 0; padding: 15px 18px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--pro-line-soft); }
.performance-values article:last-child { border-right: 0; }
.performance-values span { color: var(--pro-muted); font-size: 9px; }
.performance-values strong { margin-top: 5px; color: var(--pro-text); font-size: 17px; line-height: 1; letter-spacing: -.025em; }
.performance-values strong.is-critical { color: var(--pro-red); }

.attention-section,
.monitoring-section { box-shadow: none; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.plain-count { min-width: 28px; text-align: center; }
.clean-list .table-heading { align-items: flex-end; }
.clean-list .monitoring-table { min-width: 880px; }
.clean-list .site-diagnostic { max-width: 360px; }
.clean-list .diagnostic-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-row-blocked { box-shadow: inset 3px 0 #607d9b; }
.site-row-checking { box-shadow: inset 3px 0 #9a8d68; }
.status-pill.status-blocked { color: #41627f; background: #edf3f8 !important; }
.status-pill.status-checking { color: #71633d; background: #f5f1e6 !important; }
.status-pill.status-pending,
.status-pill.status-paused { color: #666c75; background: #f0f1f3 !important; }
.stat-dot.blocked { background: #607d9b; box-shadow: 0 0 0 6px rgba(96, 125, 155, .1); }
.stat-dot.checking { background: #9a8d68; box-shadow: 0 0 0 6px rgba(154, 141, 104, .1); }
.alert-notice { color: #5e512d; border-color: #ddd2b4; background: #faf7ee; }
.site-status { white-space: nowrap; }
.site-reviewed { white-space: nowrap; }

@media (max-width: 1100px) {
    .performance-strip { grid-template-columns: 1fr; }
    .performance-strip > header { border-right: 0; border-bottom: 1px solid var(--pro-line-soft); }
}

@media (max-width: 820px) {
    .app-shell { display: block; }
    .dashboard-heading { min-height: auto; margin-bottom: 18px; }
    .performance-values { grid-template-columns: 1fr 1fr; }
    .performance-values article:nth-child(2) { border-right: 0; }
    .performance-values article:nth-child(-n+2) { border-bottom: 1px solid var(--pro-line-soft); }
    .clean-list .table-heading { align-items: stretch; flex-direction: column; }
    .filters { width: 100%; }
    .filter-control.search-field { flex: 1; }
    .search-field input { width: 100%; }
}

@media (max-width: 700px) {
    .clean-list .table-wrap { overflow: visible; }
    .clean-list .monitoring-table,
    .clean-list .monitoring-table tbody { min-width: 0; display: block; }
    .clean-list .monitoring-table thead { display: none; }
    .clean-list .monitoring-table tr { margin: 0; padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; border-bottom: 1px solid var(--pro-line-soft); box-shadow: none; }
    .clean-list .monitoring-table tr:last-child { border-bottom: 0; }
    .clean-list .monitoring-table td { padding: 0; display: block; border: 0; }
    .clean-list .site-primary { grid-column: 1; }
    .clean-list .site-status { grid-column: 2; grid-row: 1; text-align: right; }
    .clean-list .site-diagnostic { grid-column: 1 / -1; max-width: none; }
    .clean-list .site-diagnostic .diagnostic-text { white-space: normal; }
    .clean-list .site-http,
    .clean-list .site-response { display: none; }
    .clean-list .site-reviewed { grid-column: 1; grid-row: 3; color: var(--pro-muted); font-size: 8px; }
    .clean-list .site-reviewed::before { content: "Revisión "; }
    .clean-list .site-action { grid-column: 2; grid-row: 3; text-align: right; }
    .clean-list .site-hosting { display: none !important; }
}

@media (max-width: 620px) {
    .clean-heading .heading-actions { width: 100%; }
    .clean-heading .heading-actions .button { flex: 1; }
    .performance-values { grid-template-columns: 1fr 1fr; }
    .filters { flex-direction: column; }
    .incident-row { grid-template-columns: 48px minmax(0, 1fr); }
    .incident-row time { grid-column: 2; }
}
