/* ═══════════════════════════════════════════════════════════════════════
   PrefCard v1.0 — Surgical Steel Design System
   Phone-first design for OR staff with gloves.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    --bg: #080c14;
    --surface: #0f1520;
    --surface-2: #161e2e;
    --surface-3: #1c2640;
    --border: #243049;
    --border-light: #2d3d5c;
    --text: #e8ecf4;
    --text-dim: #94a3b8;
    --text-muted: #64748b;
    --accent: #14b8a6;
    --accent-dim: #0d4f47;
    --accent-glow: rgba(20, 184, 166, 0.15);
    --green: #22c55e;
    --green-dim: #14532d;
    --yellow: #f59e0b;
    --yellow-dim: #78350f;
    --red: #ef4444;
    --red-dim: #7f1d1d;
    --orange: #f97316;
    --purple: #a78bfa;
    --cyan: #22d3ee;
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
    --tap-min: 48px;
    --nav-height: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --top-bar-height: 56px;
    --card-bg: var(--surface);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* ── Layout ──────────────────────────────────────────────────────────── */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Bar */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--top-bar-height);
    padding: 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
    cursor: pointer;
    color: var(--accent);
    text-shadow: 0 0 24px var(--accent-glow);
}

.breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.hamburger-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 8px;
    display: none;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.15s;
}

.user-badge-info:hover { background: var(--surface-2); }

.user-name {
    font-size: 13px;
    font-weight: 600;
}

.user-role {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sidebar (desktop only) */
.sidebar {
    display: none;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
}

/* Bottom Nav (mobile) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    min-width: var(--tap-min);
    min-height: var(--tap-min);
    transition: color 0.15s;
}

.bottom-nav-btn.active { color: var(--accent); }
.bottom-nav-btn:hover { color: var(--text); }

.bottom-nav-label {
    font-size: 10px;
    font-weight: 600;
}

.bottom-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Camera FAB */
.camera-fab {
    position: relative;
}

.camera-fab-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #0ea5e9);
    color: #fff;
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.4), 0 0 40px rgba(20, 184, 166, 0.1);
    margin-top: -20px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.camera-fab:hover .camera-fab-inner {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(20, 184, 166, 0.5), 0 0 60px rgba(20, 184, 166, 0.15);
}

.camera-fab .bottom-nav-label { display: none; }

/* ── Stats Bar ───────────────────────────────────────────────────────── */

.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.stat-card .label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.stat-card .value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 2px;
    letter-spacing: -1px;
}

.stat-card .value.blue { color: var(--accent); }
.stat-card .value.green { color: var(--green); }
.stat-card .value.purple { color: var(--purple); }
.stat-card .value.cyan { color: var(--cyan); }

.stat-addon {
    display: block;
    font-size: 10px;
    color: var(--red);
    font-weight: 600;
    margin-top: 2px;
}

/* ── Section Header ──────────────────────────────────────────────────── */

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

.section-header h2 {
    font-size: 18px;
    font-weight: 700;
}

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

.search-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 10px;
}

.search-wrap svg { color: var(--text-muted); flex-shrink: 0; }

.search-input {
    padding: 8px 0;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    width: 120px;
    outline: none;
}

.filter-select {
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
}

/* ── Card Grid & Tiles ───────────────────────────────────────────────── */

.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.pref-card-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}

.pref-card-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.pref-card-tile:hover { border-color: var(--accent); box-shadow: 0 4px 20px rgba(20, 184, 166, 0.08); }
.pref-card-tile:hover::before { opacity: 1; }
.pref-card-tile:active { transform: scale(0.98); }

.tile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tile-uses {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--mono);
}

.procedure-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
    line-height: 1.3;
}

.surgeon-name {
    font-size: 13px;
    color: var(--text-dim);
}

.card-meta {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.dept-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dept-badge.ortho { background: var(--accent-dim); color: var(--accent); }
.dept-badge.ent { background: var(--green-dim); color: var(--green); }
.dept-badge.general { background: var(--yellow-dim); color: var(--yellow); }
.dept-badge.plastics { background: #2e1065; color: var(--purple); }
.dept-badge.spine { background: #083344; color: var(--cyan); }
.dept-badge.cardio { background: var(--red-dim); color: #fca5a5; }
.dept-badge.vascular { background: #451a03; color: #fdba74; }
.dept-badge.urology { background: #1e1b4b; color: #818cf8; }
.dept-badge.obgyn { background: #831843; color: #f9a8d4; }
.dept-badge.ophtho { background: #064e3b; color: #6ee7b7; }

/* ═══════════════════════════════════════════════════════════════════════
   BINDER CARD VIEW
   ═══════════════════════════════════════════════════════════════════════ */

.card-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.toolbar-right {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.binder-card {
    background: #fefefe;
    color: #1a1a1a;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    font-family: Arial, 'Helvetica Neue', sans-serif;
    font-size: 12.5px;
    line-height: 1.4;
}

.binder-card .card-title {
    font-size: 18px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #000;
    border-bottom: 2px solid #000;
    padding-bottom: 6px;
    margin-bottom: 6px;
}

.binder-card .card-subtitle {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 4px;
}

.team-gloves { font-size: 11px; font-weight: 700; }
.team-gloves .member { margin-bottom: 2px; }
.update-info { text-align: right; font-size: 10px; color: #666; }
.cerner-ref { font-size: 9px; color: #999; font-style: italic; }

/* Desktop binder columns */
.binder-columns {
    display: none;
}

/* Mobile section swiper */
.section-swiper {
    margin-bottom: 12px;
}

.swiper-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    scrollbar-width: none;
}

.swiper-track::-webkit-scrollbar { display: none; }

.swiper-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    padding: 0 4px;
}

.swiper-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: background 0.2s;
}

.dot.active { background: var(--accent); }

/* Binder sections */
.binder-section { margin-bottom: 10px; }

.binder-section .section-title {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #000;
    border-bottom: 1px solid #ccc;
    padding-bottom: 3px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.binder-section .section-title.red { color: #c00; }

.item-list { list-style: none; }

.item-list li {
    padding: 3px 0;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
}

.item-list li .catalog { color: #888; font-size: 10px; }
.ref-num { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: #0369a1; background: #e0f2fe; padding: 1px 5px; border-radius: 3px; margin-left: 4px; white-space: nowrap; }
.item-link { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent); }
.item-link:hover, .item-link:active { color: var(--green); border-color: var(--green); }
.item-aka { font-size: 0.75rem; color: #8b5cf6; font-style: italic; margin-left: 4px; }
.nick-add-btn { background: none; border: none; color: #64748b; cursor: pointer; padding: 0 2px; vertical-align: middle; opacity: 0.4; transition: opacity 0.2s; }
.nick-add-btn:hover { opacity: 1; color: #8b5cf6; }
.item-list li.hold-item { color: #b45309; font-weight: 600; }
.item-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; margin-right: 6px; vertical-align: middle; border: 1px solid #e2e8f0; flex-shrink: 0; }
.item-list li { display: flex; align-items: center; }

/* Edit mode */
.binder-card.edit-mode { border: 2px dashed #3b82f6; }

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 0;
    border-radius: 3px;
    transition: background 0.1s;
    min-height: var(--tap-min);
}

.item-row:hover { background: #f0f0f0; }
.item-text { flex: 1; font-size: 12px; }

.item-actions {
    display: flex;
    gap: 4px;
}

.item-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
}

.item-btn.edit { background: #e0e7ff; color: #3b82f6; }
.item-btn.edit:hover { background: #3b82f6; color: #fff; }
.item-btn.delete { background: #fee2e2; color: #ef4444; }
.item-btn.delete:hover { background: #ef4444; color: #fff; }

.section-add-btn {
    width: 24px;
    height: 24px;
    border: 1px dashed #999;
    border-radius: 4px;
    background: transparent;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.section-add-btn:hover { border-color: #3b82f6; color: #3b82f6; background: #e0e7ff; }

/* Hold tag */
.hold-tag { color: #b45309 !important; font-weight: 600; font-size: 10px; }
.hold-tag-sm { color: var(--orange); font-size: 10px; font-weight: 600; }

/* Bin location */
.bin-loc {
    display: inline-block;
    background: #e8f4ff;
    color: #1e40af;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--mono);
    margin-left: 4px;
    vertical-align: middle;
}

/* ── Notes Panel ─────────────────────────────────────────────────────── */

.binder-notes {
    background: #f8f8f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 12px;
    margin-top: 10px;
}

.binder-notes .notes-title {
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.note-item {
    padding: 4px 0;
    font-size: 12px;
    position: relative;
}

.note-item.warning {
    color: #c00;
    font-weight: 700;
    border-left: 3px solid #c00;
    padding-left: 8px;
}

.note-author, .note-meta {
    font-size: 10px;
    color: #999;
    margin-left: 8px;
}

.note-delete {
    position: absolute;
    right: 0;
    top: 2px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
}

/* Note tabs */
.note-tabs-panel {
    margin-top: 10px;
    background: #f8f8f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.note-tabs-bar {
    display: flex;
    border-bottom: 1px solid #ddd;
    overflow-x: auto;
    scrollbar-width: none;
}

.note-tabs-bar::-webkit-scrollbar { display: none; }

.note-tab {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #666;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.note-tab.active { color: #000; border-bottom-color: var(--accent); }
.note-tab:hover { color: #333; }

.note-count {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 9px;
    padding: 0 5px;
    border-radius: 8px;
    margin-left: 4px;
}

.note-tab-content { padding: 10px 12px; }
.note-tab-desc { font-size: 10px; color: #999; margin-bottom: 6px; font-style: italic; }
.note-empty { font-size: 12px; color: #999; padding: 8px 0; }

.note-add-form { margin-top: 8px; border-top: 1px solid #ddd; padding-top: 8px; }

.note-add-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font);
    resize: vertical;
    color: #333;
    background: #fff;
}

.note-add-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.note-warning-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #666;
    cursor: pointer;
}

/* ── Suggestions Panel ───────────────────────────────────────────────── */

.suggestions-panel {
    background: var(--surface);
    border: 1px solid var(--yellow-dim);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.suggestions-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--yellow);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.suggestion-item {
    padding: 8px;
    background: var(--surface-2);
    border-radius: 6px;
    margin-bottom: 6px;
}

.suggestion-type {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
}

.suggestion-text { font-size: 13px; display: block; margin: 4px 0; }

.suggestion-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

/* ── Pull Board ──────────────────────────────────────────────────────── */

.pull-board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

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

.pull-date-label { font-size: 13px; color: var(--text-dim); }
.pull-stat { font-size: 12px; color: var(--green); font-weight: 600; }

.date-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.case-list { display: flex; flex-direction: column; gap: 6px; }

.case-block { margin-bottom: 4px; }

.case-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: border-color 0.15s;
    min-height: var(--tap-min);
}

.case-row:hover { border-color: var(--accent); }

.case-block .case-row:has(+ .pull-detail[style*="block"]) {
    border-radius: 10px 10px 0 0;
    border-bottom: none;
}

.case-time {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--mono);
    color: var(--accent);
    min-width: 50px;
}

.case-info { flex: 1; min-width: 0; }
.case-procedure { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.case-surgeon { font-size: 11px; color: var(--text-dim); }

.case-room {
    background: var(--surface-3);
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.addon-block .case-row { border-left: 3px solid var(--red); }

.expand-arrow {
    color: var(--text-muted);
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Status badges */
.status-badge {
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge.pending { background: var(--surface-3); color: var(--text-muted); }
.status-badge.in_progress { background: var(--yellow-dim); color: var(--yellow); }
.status-badge.pulled { background: var(--green-dim); color: var(--green); }
.status-badge.partial { background: var(--yellow-dim); color: var(--orange); }
.status-badge.addon { background: var(--red-dim); color: var(--red); }

/* Pull detail */
.pull-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 12px;
    animation: slideDown 0.2s ease-out;
}

.pull-loading { color: var(--text-muted); font-size: 13px; }

.pull-progress-bar-wrap {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.pull-progress-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.pull-progress-info strong { color: var(--green); }
.pull-progress-info a { color: var(--accent); text-decoration: none; margin-left: auto; font-size: 11px; }
.unavail-count { color: var(--yellow); font-weight: 600; }

.pull-progress-track { width: 100%; height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.pull-progress-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width 0.3s; }

.pull-checklist { columns: 1; }

.pull-section { break-inside: avoid; margin-bottom: 8px; }

.pull-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    padding-bottom: 2px;
    margin-bottom: 3px;
}

.pull-section-title.red { color: var(--red); }

.pull-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 4px;
    min-height: var(--tap-min);
}

.pull-item:hover { background: var(--surface-2); }
.pull-item.pulled .pull-item-name { color: var(--text-muted); text-decoration: line-through; }
.pull-item.unavailable { background: rgba(234, 179, 8, 0.08); }
.pull-item.unavailable .pull-item-name { color: var(--yellow); }

.pull-item-name { font-size: 12px; flex: 1; }

/* Pull checkboxes — glove-friendly 48px */
.pull-check {
    width: var(--tap-min);
    height: var(--tap-min);
    border: 2px solid var(--border-light);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
    font-size: 18px;
    font-weight: 700;
}

.pull-check:hover { border-color: var(--accent); background: rgba(59, 130, 246, 0.1); }

.pull-check.pulled {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.pull-check.pulled::after { content: '✓'; }

.pull-check.unavailable {
    background: var(--yellow);
    border-color: var(--yellow);
    color: #000;
}

.pull-check.unavailable::after { content: '!'; }

.debrief-btn { margin-top: 12px; width: 100%; }

/* ── Buttons ─────────────────────────────────────────────────────────── */

.btn {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--tap-min);
}

.btn-sm { padding: 6px 12px; font-size: 12px; min-height: 36px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0d9488; }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-back {
    background: var(--surface-2);
    color: var(--text-dim);
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.btn-back:hover { color: var(--text); }

/* ── Modal ───────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease-out;
}

.modal h3 { font-size: 16px; margin-bottom: 12px; }
.modal-hint { font-size: 12px; color: var(--text-dim); margin-bottom: 12px; }

.modal label {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 4px;
    margin-top: 10px;
}

.modal input, .modal select, .modal textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    min-height: 42px;
}

.modal textarea { min-height: 60px; resize: vertical; }

.modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.form-row { display: flex; gap: 10px; }
.form-col { flex: 1; }

/* ── Auth Screens ────────────────────────────────────────────────────── */

.auth-container {
    max-width: 400px;
    margin: 20px auto;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.auth-container h2 { font-size: 22px; margin-bottom: 8px; }
.auth-subtitle { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }
.auth-switch { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 16px; }
.auth-switch a { color: var(--accent); text-decoration: none; }

.auth-container label {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 4px;
    margin-top: 12px;
}

.auth-container input, .auth-container select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    min-height: 44px;
}

.auth-buttons { display: flex; gap: 10px; margin-top: 16px; }

/* PIN pad */
.pin-pad-container { margin-top: 8px; }

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    transition: all 0.15s;
}

.pin-dot.filled { background: var(--accent); border-color: var(--accent); }

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 260px;
    margin: 0 auto;
}

.pin-key {
    height: 56px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin-key:hover { background: var(--surface-3); }
.pin-key:active { transform: scale(0.95); background: var(--accent-dim); }
.pin-key.empty { border: none; background: transparent; cursor: default; }

/* ── Profile ─────────────────────────────────────────────────────────── */

.profile-card {
    max-width: 400px;
    margin: 20px auto;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: center;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.profile-role {
    font-size: 13px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 4px 0;
}

.profile-facility {
    font-size: 13px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.profile-stats { display: flex; justify-content: center; gap: 16px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.profile-stat { text-align: center; }
.profile-stat .stat-value { display: block; font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.profile-stat .stat-label { font-size: 0.7rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }
.profile-no-stats { color: #64748b; font-size: 0.85rem; margin-top: 16px; font-style: italic; }

/* ── Upload ──────────────────────────────────────────────────────────── */

.upload-container {
    max-width: 600px;
    margin: 0 auto;
}

.upload-container h2 { margin-bottom: 12px; }

.upload-preview {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    max-height: 300px;
}

.upload-preview img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    background: var(--surface-2);
}

.upload-source-select {
    margin-bottom: 16px;
}

.upload-source-select select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
}

.upload-status { text-align: center; padding: 24px 0; }
.upload-status p { margin-top: 12px; color: var(--text-dim); }

.upload-error {
    text-align: center;
    color: var(--red);
}

.upload-error p { margin: 12px 0; }

.phi-warning {
    text-align: center;
    padding: 24px;
    color: var(--red);
}

.phi-warning h3 { margin: 12px 0 8px; }
.phi-warning ul { text-align: left; margin: 12px auto; max-width: 300px; }
.phi-warning li { margin-bottom: 4px; }

.phi-strip-notice {
    background: var(--yellow-dim);
    color: var(--yellow);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.extraction-review { margin-top: 16px; }
.extraction-header { margin-bottom: 12px; }
.extraction-header h3 { color: var(--green); display: flex; align-items: center; gap: 8px; }
.ext-meta { margin-top: 8px; font-size: 14px; }
.ext-meta-row { margin-bottom: 4px; color: var(--text-dim); }
.ext-meta-row strong { color: var(--text); }

.ext-target-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}
.ext-target-card label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 6px; }
.ext-target-card select {
    width: 100%;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
}

.ext-items-list { margin-bottom: 16px; }

.ext-section-group { margin-bottom: 12px; }
.ext-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
    letter-spacing: 0.05em;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}

.ext-item-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 4px;
}

.ext-item-main { display: flex; flex-direction: column; gap: 4px; }

.ext-item-card input {
    padding: 6px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    width: 100%;
    box-sizing: border-box;
}

.ext-item-details {
    display: flex;
    gap: 8px;
}
.ext-item-details label {
    flex: 1;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}
.ext-item-details input { margin-top: 2px; font-size: 13px; }

.extraction-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 16px 0;
    position: sticky;
    bottom: 0;
    background: var(--bg);
}

/* ── Debrief ─────────────────────────────────────────────────────────── */

.debrief-ratings {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.debrief-radio {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: border-color 0.15s;
}

.debrief-radio:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.debrief-radio input { display: none; }

/* ── Landing Page ────────────────────────────────────────────────────── */

.landing-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 0 40px;
}

.landing-hero {
    text-align: center;
    padding: 48px 16px 40px;
    position: relative;
}

.landing-hero::before {
    content: '';
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.landing-hero h1 {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -1px;
    margin-bottom: 16px;
    line-height: 1.15;
    background: linear-gradient(135deg, #fff 30%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-subtitle {
    font-size: 16px;
    color: var(--text-dim);
    max-width: 520px;
    margin: 0 auto 28px;
    line-height: 1.6;
}

.landing-cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.landing-cta .btn-primary {
    background: linear-gradient(135deg, var(--accent), #0ea5e9);
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.3);
}

.landing-cta .btn-primary:hover {
    box-shadow: 0 6px 28px rgba(20, 184, 166, 0.4);
    transform: translateY(-1px);
}

/* Pain Points Section */
.landing-pain {
    margin: 40px 0 32px;
    padding: 0 16px;
}

.landing-pain h2 {
    font-size: 20px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.pain-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.pain-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.pain-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pain-card h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.pain-card p {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
}

/* How It Works Section */
.landing-how {
    margin: 40px 0;
    padding: 0 16px;
}

.landing-how h2 {
    font-size: 20px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

.how-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.how-step {
    display: flex;
    gap: 16px;
    align-items: center;
}

.step-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid var(--accent);
}

.step-text h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.step-text p {
    font-size: 12px;
    color: var(--text-dim);
}

/* Feature Cards */
.landing-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 32px 16px;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: border-color 0.2s, transform 0.15s;
}

.feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.feature-icon {
    color: var(--accent);
    margin-bottom: 12px;
}

.feature-card h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

/* Audience Section */
.landing-audience {
    margin: 40px 16px;
    text-align: center;
}

.landing-audience h2 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 16px;
}

.audience-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.audience-tag {
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-dim);
    font-weight: 500;
}

.landing-footer {
    text-align: center;
    padding: 32px 16px 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 32px;
}

.landing-footer strong {
    color: var(--accent);
}

/* Leaderboard */
.leaderboard-section {
    margin: 32px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.leaderboard-section h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.leaderboard-row:last-child { border-bottom: none; }

.leaderboard-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

.leaderboard-rank.gold { background: #78350f; color: #fbbf24; }
.leaderboard-rank.silver { background: #1e293b; color: #cbd5e1; }
.leaderboard-rank.bronze { background: #431407; color: #fb923c; }
.leaderboard-rank.other { background: var(--surface-2); color: var(--text-muted); }

.leaderboard-name { flex: 1; font-size: 13px; font-weight: 600; }
.leaderboard-facility { font-size: 10px; color: var(--text-muted); }
.leaderboard-points { font-size: 14px; font-weight: 700; color: var(--accent); font-family: var(--mono); }

/* Merge Modal */
.merge-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.merge-card-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.merge-card-option:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* Activity Feed */
.activity-feed {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.activity-feed h3 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
}

.activity-item {
    font-size: 12px;
    color: var(--text-dim);
    padding: 4px 0;
    line-height: 1.5;
}

.activity-link {
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
}

.activity-link:hover { text-decoration: underline; }

.activity-time {
    color: var(--text-muted);
    font-size: 11px;
}

/* ── Utilities ───────────────────────────────────────────────────────── */

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}

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

.empty-state h3 { font-size: 16px; color: var(--text-dim); margin: 8px 0; }
.icon-large { margin-bottom: 8px; color: var(--text-muted); }
.icon-large svg { width: 48px; height: 48px; }

/* Surgeon detail */
.surgeon-header { margin-bottom: 16px; }
.surgeon-detail { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

/* Toast */
.toast {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
    right: 16px;
    left: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    z-index: 2000;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { background: var(--green-dim); color: var(--green); border: 1px solid var(--green); }
.toast-error { background: var(--red-dim); color: var(--red); border: 1px solid var(--red); }

/* Mobile visibility */
.desktop-only { display: none !important; }
.mobile-only { display: block; }

/* ── Animations ──────────────────────────────────────────────────────── */

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 2000px; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn 0.2s ease-out; }

/* ═══════════════════════════════════════════════════════════════════════
   TABLET (768px+)
   ═══════════════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
    .stats-bar { grid-template-columns: repeat(4, 1fr); gap: 12px; }
    .card-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .pull-checklist { columns: 2; column-gap: 20px; }
    .landing-features { grid-template-columns: repeat(3, 1fr); }
    .pain-grid { grid-template-columns: repeat(2, 1fr); }
    .how-steps { flex-direction: row; }
    .how-step { flex-direction: column; text-align: center; flex: 1; }

    .landing-hero h1 { font-size: 36px; }
    .landing-hero { padding: 64px 24px 48px; }
    .landing-pain, .landing-how { padding: 0 24px; }

    .modal {
        border-radius: 12px;
        margin: auto;
    }

    .modal-overlay {
        align-items: center;
    }

    .toast {
        left: auto;
        right: 24px;
        max-width: 360px;
        margin: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   DESKTOP (1024px+)
   ═══════════════════════════════════════════════════════════════════════ */

@media (min-width: 1024px) {
    .app-container {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .top-bar {
        position: sticky;
        top: 0;
        width: 100%;
    }

    .sidebar {
        display: flex;
        flex-direction: column;
        width: 240px;
        position: fixed;
        top: var(--top-bar-height);
        bottom: 0;
        left: 0;
        background: var(--surface);
        border-right: 1px solid var(--border);
        z-index: 50;
        overflow-y: auto;
    }

    .sidebar-nav { padding: 12px; }

    .nav-section { margin-bottom: 16px; }

    .nav-section-title {
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 1.5px;
        color: var(--text-muted);
        padding: 8px 12px 4px;
        font-weight: 600;
    }

    .nav-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.15s;
        font-size: 13px;
        color: var(--text-dim);
    }

    .nav-item:hover { background: var(--surface-2); color: var(--text); }
    .nav-item.active { background: var(--accent-dim); color: #fff; }

    .nav-icon { display: flex; align-items: center; }

    .nav-info {
        font-size: 11px;
        color: var(--text-muted);
        padding: 8px 12px;
        line-height: 1.4;
    }

    .main-content {
        margin-left: 240px;
        padding: 24px 32px;
        padding-bottom: 24px;
    }

    .bottom-nav { display: none; }

    .card-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

    .desktop-only { display: block !important; }
    .mobile-only { display: none !important; }

    /* Desktop binder columns */
    .binder-columns {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 20px;
        margin-bottom: 12px;
    }

    .binder-card {
        padding: 28px 32px;
        max-width: 900px;
    }

    .binder-card .card-title { font-size: 22px; }

    .hamburger-btn { display: block; }

    .toast {
        bottom: 24px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════ */

@media print {
    body { background: #fff; color: #000; }
    .sidebar, .top-bar, .bottom-nav, .stats-bar, .card-toolbar,
    .section-header, .search-wrap, .filter-select, .toast,
    .note-tabs-panel, .suggestions-panel { display: none !important; }
    .app-container { display: block; }
    .main-content { padding: 0; margin: 0; }
    .binder-card {
        box-shadow: none;
        padding: 12px;
        max-width: 100%;
        border: none;
    }
    .binder-card.edit-mode { border: none; }
    .item-actions { display: none !important; }
    .section-add-btn { display: none !important; }
    .section-swiper { display: block; }
    .swiper-track { display: block; overflow: visible; }
    .swiper-slide { flex: none; }
    .swiper-dots { display: none; }
}

/* ── Cross-Reference Builder ────────────────────────────────────────── */

.btn-accent { background: var(--accent); color: #fff; border: none; }
.btn-accent:hover { background: #2563eb; }

/* ── Discover / Sharing Network ─────────────────────────────────────── */
.discover-page { padding: 12px; max-width: 800px; margin: 0 auto; }
.discover-desc { color: #94a3b8; font-size: 0.9rem; margin-bottom: 16px; }
.search-lg { max-width: 100%; }
.search-lg .search-input { font-size: 1rem; padding: 12px 12px 12px 36px; }
.discover-card { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: var(--card-bg); border-radius: 12px; margin-bottom: 8px; gap: 12px; }
.discover-card.own-facility { border-left: 3px solid var(--green); }
.discover-procedure { font-weight: 600; font-size: 0.95rem; }
.discover-surgeon { font-size: 0.85rem; color: #94a3b8; }
.discover-facility { font-size: 0.75rem; color: #64748b; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.discover-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

.cross-ref-page { padding: 12px; max-width: 800px; margin: 0 auto; }
.cross-ref-desc { color: #94a3b8; font-size: 0.9rem; margin-bottom: 16px; }

.xref-source-picker { background: var(--card-bg); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.xref-source-picker > label { font-weight: 600; display: block; margin-bottom: 8px; }
.xref-card-checkboxes { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.xref-card-option { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg); border-radius: 8px; cursor: pointer; font-size: 0.9rem; }
.xref-card-option:hover { background: #1e293b; }
.xref-card-option input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

.xref-hint { color: #64748b; font-style: italic; text-align: center; padding: 24px; }

.xref-summary { background: var(--card-bg); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.xref-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.xref-source-badge { font-size: 0.75rem; padding: 4px 10px; border-radius: 20px; font-weight: 600; }
.xref-stats { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.8rem; color: #94a3b8; }
.xref-stats .in-all-badge { color: #10b981; }
.xref-stats .conflict-badge { color: #f59e0b; }
.xref-stats .only-one-badge { color: #64748b; }

.xref-actions-top { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

.xref-items-list { display: flex; flex-direction: column; gap: 12px; }

.xref-section { background: var(--card-bg); border-radius: 12px; overflow: hidden; }
.xref-section-header { padding: 10px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 0.85rem; }
.xref-select-all { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.xref-select-all input { accent-color: var(--accent); }

.xref-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.xref-item:last-child { border-bottom: none; }
.xref-item:hover { background: #1e293b; }
.xref-item.in-all { }
.xref-item.only-one { opacity: 0.7; }
.xref-item.has-conflict { border-left: 3px solid #f59e0b; }
.xref-item input[type="checkbox"] { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }

.xref-item-info { flex: 1; min-width: 0; }
.xref-item-name { font-size: 0.9rem; word-break: break-word; }
.xref-item-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 0.75rem; color: #64748b; flex-wrap: wrap; }
.xref-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.xref-qty { font-weight: 600; }
.xref-vendor { color: #8b5cf6; }
.xref-conflict { color: #f59e0b; font-weight: 600; cursor: help; }
.xref-alt-names { font-size: 0.75rem; color: #8b5cf6; font-style: italic; margin-top: 2px; }
.xref-match-badge { font-size: 0.65rem; padding: 1px 6px; border-radius: 8px; font-weight: 600; vertical-align: middle; margin-left: 4px; }
.xref-match-badge.nickname { background: #8b5cf620; color: #8b5cf6; }
.xref-match-badge.fuzzy { background: #f59e0b20; color: #f59e0b; }
.xref-match-badge.ai { background: #10b98120; color: #10b981; }

.xref-save-panel { position: sticky; bottom: 0; background: var(--card-bg); border-radius: 12px 12px 0 0; padding: 16px; margin-top: 16px; border-top: 2px solid var(--accent); }
.xref-target { margin-bottom: 12px; }
.xref-target label { font-weight: 600; margin-right: 8px; }
.xref-target select { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; width: 100%; font-size: 0.9rem; }
.xref-new-card-fields { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.xref-new-card-fields select, .xref-new-card-fields input { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 0.9rem; }
.xref-save-panel .btn-primary { width: 100%; }

/* ── My Room ──────────────────────────────────────────────────────────── */

.room-header { padding: 16px; background: var(--card-bg); border-radius: var(--radius); margin-bottom: 16px; }
.room-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.room-title-row h2 { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; margin: 0; }
.room-date-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px; }
.room-date-label { font-weight: 600; font-size: 0.95rem; min-width: 100px; text-align: center; }
.room-progress { margin-top: 4px; }
.room-progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.room-progress-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width 0.3s; }
.room-progress-text { font-size: 0.8rem; color: #64748b; margin-top: 4px; display: block; text-align: center; }

.room-cases { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.room-case { background: var(--card-bg); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.room-case.in_progress { border-left: 3px solid #0ea5e9; }
.room-case.completed { border-left: 3px solid var(--green); opacity: 0.7; }

.room-case-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; cursor: pointer; min-height: var(--tap-min); }
.room-case-header:active { background: rgba(0,0,0,0.03); }
.room-case-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.room-case-time { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--accent); font-weight: 600; }
.room-case-surgeon { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-case-proc { font-size: 0.8rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-case-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.room-case-progress { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: #64748b; }
.room-case-status { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.room-delete { color: #dc2626 !important; opacity: 0.5; }
.room-delete:hover { opacity: 1; }

.room-case-items { padding: 0 12px 12px; border-top: 1px solid var(--border); }
.room-case-actions-bar { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.room-section-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); padding: 8px 0 4px; }

.room-check-item { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 4px; cursor: pointer; min-height: var(--tap-min); transition: background 0.1s; }
.room-check-item:active { background: rgba(0,0,0,0.03); }
.room-check-item.checked { opacity: 0.5; }
.room-check-item.checked .room-check-name { text-decoration: line-through; }
.room-check-box { color: #64748b; flex-shrink: 0; }
.room-check-item.checked .room-check-box { color: var(--green); }
.room-check-name { flex: 1; font-size: 0.85rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-check-qty { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: #64748b; }

.room-add-btn { width: 100%; margin-top: 8px; }

.btn-xs { padding: 2px 8px; font-size: 0.7rem; min-height: 28px; }
