/* ================================================================
   BIOMAGNETISMO PARA TODOS — ARSENAL v14.0
   Clinical Intelligence Layer: Command Palette, Scan Wizard,
   Intelligence Dashboard, Pair Comparator, Anatomical Atlas
   ================================================================ */

:root {
    --ars-glass: rgba(255, 255, 255, 0.72);
    --ars-glass-brd: rgba(255, 255, 255, 0.5);
    --ars-scrim: rgba(15, 23, 42, 0.55);
    --ars-ring: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

[data-theme="dark"] {
    --ars-glass: rgba(30, 41, 59, 0.78);
    --ars-glass-brd: rgba(148, 163, 184, 0.18);
    --ars-scrim: rgba(2, 6, 23, 0.72);
    --ars-ring: 0 0 0 3px rgba(129, 140, 248, 0.3);
}

/* =================== SHARED PRIMITIVES =================== */
.ars-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}

.ars-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.ars-section-head h3 {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.01em;
}

.ars-section-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.ars-section-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0 0 12px;
}

.ars-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.ars-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.ars-btn:active { transform: translateY(0); }
.ars-btn:focus-visible { outline: none; box-shadow: var(--ars-ring); }

.ars-btn-primary {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.ars-btn-primary:hover { color: #fff; box-shadow: var(--glow-primary); }

.ars-btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.ars-btn-ghost:hover { background: var(--bg-surface); color: var(--primary); }

.ars-btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

.ars-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
}

.ars-empty {
    text-align: center;
    padding: 26px 14px;
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.6;
}
.ars-empty i { font-size: 1.6rem; display: block; margin-bottom: 8px; opacity: 0.55; }

/* =================== COMMAND PALETTE =================== */
.cmdk-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: var(--ars-scrim);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 16px 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.cmdk-overlay.active { opacity: 1; pointer-events: auto; }

.cmdk-panel {
    width: 100%;
    max-width: 620px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transform: translateY(-12px) scale(0.98);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    max-height: 74vh;
}

.cmdk-overlay.active .cmdk-panel { transform: translateY(0) scale(1); }

.cmdk-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.cmdk-input-row > i { color: var(--primary); font-size: 0.95rem; }

.cmdk-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    min-width: 0;
}
.cmdk-input::placeholder { color: var(--text-muted); font-weight: 400; }

.cmdk-esc {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    padding: 3px 7px;
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.cmdk-results { overflow-y: auto; padding: 6px; -webkit-overflow-scrolling: touch; }

.cmdk-group-label {
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 10px 10px 5px;
}

.cmdk-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.12s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: var(--font);
    color: var(--text);
}

.cmdk-item:hover { background: var(--bg-surface); }
.cmdk-item.selected { background: var(--primary-bg); }
.cmdk-item.selected .cmdk-item-title { color: var(--primary); }

.cmdk-item-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--bg-surface);
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.cmdk-item.selected .cmdk-item-icon { background: var(--primary); color: #fff; }

.cmdk-item-body { flex: 1; min-width: 0; }

.cmdk-item-title {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmdk-item-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.cmdk-item mark { background: rgba(99, 102, 241, 0.22); color: inherit; border-radius: 3px; padding: 0 1px; }

.cmdk-item-badge {
    font-size: 0.64rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    color: var(--text-muted);
    flex-shrink: 0;
}

.cmdk-footer {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 9px 14px;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.cmdk-footer kbd {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    margin-right: 3px;
}

/* =================== CLINIC TAB / HUB =================== */
.clinic-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    padding: 20px 18px;
    margin-bottom: 14px;
    background: var(--gradient-hero);
    color: #fff;
    box-shadow: var(--shadow-md);
}

.clinic-hero::after {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    right: -70px;
    top: -90px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.28), transparent 68%);
    pointer-events: none;
}

.clinic-hero h2 {
    font-size: 1.12rem;
    font-weight: 800;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
    position: relative;
}

.clinic-hero p {
    font-size: 0.83rem;
    opacity: 0.93;
    line-height: 1.55;
    margin: 0;
    max-width: 46ch;
    position: relative;
}

.clinic-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.clinic-tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 12px;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-family: var(--font);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.clinic-tool-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.clinic-tool-card:focus-visible { outline: none; box-shadow: var(--ars-ring); }

.clinic-tool-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.clinic-tool-title { font-size: 0.86rem; font-weight: 700; color: var(--text); }
.clinic-tool-desc { font-size: 0.72rem; color: var(--text-muted); line-height: 1.45; }

/* KPI strip */
.ars-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.ars-kpi {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 8px;
    text-align: center;
}

.ars-kpi-num {
    font-family: var(--font-mono);
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
}

.ars-kpi-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 3px;
}

/* =================== CHARTS =================== */
.ars-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.ars-chart-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.ars-chart-box { width: 100%; height: 300px; }
.ars-chart-box.tall { height: 380px; }

/* Body heatmap */
.ars-heatmap-wrap {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ars-heatmap-view {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border);
}

.ars-heatmap-view img {
    width: 100%;
    display: block;
    opacity: 0.9;
}

[data-theme="dark"] .ars-heatmap-view img { filter: brightness(0.86) contrast(1.05); }

.ars-heat-dot {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    mix-blend-mode: multiply;
}

[data-theme="dark"] .ars-heat-dot { mix-blend-mode: screen; }

.ars-heatmap-label {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 0.64rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: var(--ars-glass);
    color: var(--text);
    border: 1px solid var(--ars-glass-brd);
    backdrop-filter: blur(6px);
    z-index: 2;
}

.ars-heat-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.ars-heat-bar {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #3B82F6, #10B981, #F59E0B, #EF4444);
}

/* =================== SCAN WIZARD =================== */
.scan-progress-track {
    height: 6px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 6px;
}

.scan-progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0;
}

.scan-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 14px;
}

.scan-step-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}

.scan-step-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0 0 14px;
}

.scan-options { display: flex; flex-direction: column; gap: 8px; }

.scan-option {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
    text-align: left;
    width: 100%;
}

.scan-option:hover { border-color: var(--primary); background: var(--primary-bg); }
.scan-option:focus-visible { outline: none; box-shadow: var(--ars-ring); }

.scan-option.checked { border-color: var(--primary); background: var(--primary-bg); }

.scan-option-box {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    border: 2px solid var(--border);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    color: transparent;
    font-size: 0.62rem;
    transition: var(--transition);
}

.scan-option.checked .scan-option-box {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.scan-option-body { flex: 1; min-width: 0; }
.scan-option-title { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.scan-option-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }

.scan-nav {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.scan-nav .ars-btn { flex: 1; justify-content: center; }

/* Scan result / plan */
.plan-summary {
    background: var(--primary-bg);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 13px;
    margin-bottom: 13px;
}

.plan-summary-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.plan-summary-text { font-size: 0.79rem; color: var(--text-secondary); line-height: 1.55; }

.plan-phase { margin-bottom: 14px; }

.plan-phase-head {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 8px;
}

.plan-phase-num {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: var(--gradient-primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.plan-phase-title { font-size: 0.87rem; font-weight: 700; color: var(--text); }
.plan-phase-count { font-size: 0.7rem; color: var(--text-muted); margin-left: auto; font-weight: 600; }

.plan-pair-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    margin-bottom: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.plan-pair-row:hover { border-color: var(--primary); transform: translateX(2px); }

.plan-pair-score {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 6px;
    background: var(--green-bg);
    color: var(--green);
    flex-shrink: 0;
}
.plan-pair-score.mid { background: var(--amber-bg); color: var(--amber); }
.plan-pair-score.low { background: var(--bg-surface); color: var(--text-muted); }

.plan-pair-info { flex: 1; min-width: 0; }
.plan-pair-name {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.plan-pair-why { font-size: 0.7rem; color: var(--text-muted); margin-top: 1px; line-height: 1.4; }

.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* =================== PAIR COMPARATOR =================== */
.cmp-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.cmp-slot {
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    padding: 12px;
    min-height: 86px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
    background: var(--bg-card);
}

.cmp-slot.filled { border-style: solid; border-color: var(--primary); }

.cmp-slot-empty {
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 0.76rem;
    text-align: center;
    height: 100%;
    gap: 5px;
    cursor: pointer;
}

.cmp-slot-name { font-size: 0.82rem; font-weight: 700; color: var(--text); line-height: 1.3; padding-right: 20px; }
.cmp-slot-meta { font-size: 0.7rem; color: var(--text-muted); line-height: 1.45; }

.cmp-slot-remove {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.62rem;
    display: grid;
    place-items: center;
}
.cmp-slot-remove:hover { background: var(--red-bg); color: var(--red); }

.cmp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.cmp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    min-width: 420px;
}

.cmp-table th, .cmp-table td {
    padding: 9px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    line-height: 1.5;
}

.cmp-table th {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 800;
    background: var(--bg-surface);
    white-space: nowrap;
}

.cmp-table td:first-child { font-weight: 700; color: var(--text-secondary); white-space: nowrap; }
.cmp-table tr:last-child td { border-bottom: none; }
.cmp-diff { background: var(--amber-bg); }

/* =================== ANATOMICAL ATLAS =================== */
.atlas-search-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

.atlas-input {
    flex: 1;
    min-width: 160px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.84rem;
    outline: none;
}
.atlas-input:focus { border-color: var(--primary); box-shadow: var(--ars-ring); }

.atlas-region-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.atlas-region-btn {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.atlas-region-btn:hover { border-color: var(--primary); color: var(--primary); }
.atlas-region-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.atlas-point-list { display: flex; flex-direction: column; gap: 7px; }

.atlas-point {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    overflow: hidden;
}

.atlas-point-head {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 12px;
    cursor: pointer;
    transition: var(--transition);
}
.atlas-point-head:hover { background: var(--bg-surface); }

.atlas-point-name { font-size: 0.85rem; font-weight: 700; color: var(--text); flex: 1; min-width: 0; }
.atlas-point-count {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: var(--primary-bg);
    color: var(--primary);
    flex-shrink: 0;
}

.atlas-point-body {
    padding: 0 12px 12px;
    border-top: 1px solid var(--border);
    display: none;
}
.atlas-point.open .atlas-point-body { display: block; }

.atlas-pair-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.79rem;
    color: var(--text-secondary);
    margin-top: 7px;
    background: var(--bg-surface);
}
.atlas-pair-link:hover { background: var(--primary-bg); color: var(--primary); }

/* =================== RELATED PAIRS (detail view) =================== */
.rel-wrap {
    background: var(--bg-surface);
    border-radius: var(--radius);
    padding: 13px;
    margin-top: 12px;
}

.rel-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 9px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.rel-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }

.rel-card {
    flex: 0 0 auto;
    width: 158px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-family: var(--font);
}
.rel-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.rel-card-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rel-card-reason { font-size: 0.68rem; color: var(--text-muted); line-height: 1.4; }

/* =================== PROTOCOL BUILDER SHEET =================== */
.ars-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 3600;
    background: var(--ars-scrim);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.ars-sheet-overlay.active { opacity: 1; pointer-events: auto; }

.ars-sheet {
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.ars-sheet-overlay.active .ars-sheet { transform: translateY(0); }

.ars-sheet-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ars-sheet-head h3 { font-size: 0.98rem; font-weight: 800; margin: 0; flex: 1; color: var(--text); }

.ars-sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.ars-sheet-close:hover { background: var(--red-bg); color: var(--red); }

.ars-sheet-body { overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }

.ars-sheet-grab {
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin: 8px auto 0;
    flex-shrink: 0;
}

/* =================== 5-ITEM BOTTOM NAV FIT =================== */
@media (max-width: 400px) {
    .nav-item { font-size: 0.56rem; gap: 3px; }
    .nav-item i { font-size: 1.02rem; }
}

/* =================== RESPONSIVE =================== */
@media (min-width: 720px) {
    .ars-chart-box { height: 340px; }
    .clinic-hero h2 { font-size: 1.28rem; }
}

@media (max-width: 420px) {
    .ars-heatmap-wrap { grid-template-columns: 1fr; }
    .clinic-tools-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
    .cmdk-overlay { padding: 6vh 10px 10px; }
}

/* =================== PRINT =================== */
@media print {
    .cmdk-overlay, .ars-sheet-overlay, .scan-nav, .plan-actions { display: none !important; }
    .ars-section, .ars-chart-card { border: 1px solid #ddd; box-shadow: none; break-inside: avoid; }
}

/* =================== MOTION PREFERENCES =================== */
@media (prefers-reduced-motion: reduce) {
    .cmdk-panel, .ars-sheet, .scan-progress-fill, .clinic-tool-card, .ars-btn { transition: none !important; }
}
