@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

/* ── Base ── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f8fafc;
    color: #0f172a;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body.has-bottom-nav .container {
    padding-bottom: 88px;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* ── Header (login page wordmark area) ── */
.header {
    text-align: center;
    margin-bottom: 28px;
    padding: 32px 0 0;
}

.header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.3px;
}

.header p {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 3px;
    font-weight: 500;
}

/* ── Cards ── */
.card {
    background: #ffffff;
    border-radius: 16px;
    padding: 28px 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 16px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #f8fafc;
    color: #0f172a;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.form-group input:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    width: 100%;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary:disabled {
    background: #bfdbfe;
    color: #93c5fd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
    border-radius: 12px;
    width: auto !important;
    display: inline-block !important;
}

.btn-outline {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    color: #374151;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
}

.btn-outline:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}

.btn-outline.editing {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.btn-outline.editing:hover {
    background: #1d4ed8;
}

/* ── Messages ── */
.error-msg {
    color: #dc2626;
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
    display: none;
}

.error-msg.visible {
    display: block;
}

.success-msg {
    color: #16a34a;
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
    display: none;
}

.success-msg.visible {
    display: block;
}

.link {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
}

.link a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

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

/* ── Status Pills ── */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.pill-green {
    background: #dcfce7;
    color: #15803d;
}

.pill-red {
    background: #fee2e2;
    color: #dc2626;
}

.pill-amber {
    background: #fef3c7;
    color: #b45309;
}

.pill-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.pill-grey {
    background: #f1f5f9;
    color: #64748b;
}

/* ── Skeleton Loaders ── */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-line {
    height: 14px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.skeleton-line.wide { width: 70%; }
.skeleton-line.medium { width: 50%; }
.skeleton-line.short { width: 30%; }

.skeleton-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 12px;
}

/* ── Top Nav Bar (login / detail pages) ── */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
}

.nav-bar a {
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s;
}

.nav-bar a:hover {
    color: #2563eb;
}

.nav-bar .logout-btn {
    color: #94a3b8;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    transition: color 0.15s;
}

.nav-bar .logout-btn:hover {
    color: #ef4444;
}

/* ── Bottom Navigation Bar ── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    z-index: 500;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: #94a3b8;
    transition: color 0.15s;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    padding: 8px 0;
}

.bottom-nav-item:hover {
    color: #64748b;
}

.bottom-nav-item.active {
    color: #2563eb;
}

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

.bottom-nav-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}

.bottom-nav-item.active .bottom-nav-icon svg {
    stroke-width: 2.2;
}

.bottom-nav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ── Recording Ring (consult listening state) ── */
.recording-ring-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 0 24px;
}

.recording-ring {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.recording-ring-svg {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
}

.recording-ring-circle {
    fill: none;
    stroke: #ef4444;
    stroke-width: 3;
    stroke-linecap: round;
    transform-origin: 70px 70px;
    animation: ring-pulse 2s ease-in-out infinite;
}

@keyframes ring-pulse {
    0%, 100% { opacity: 1; stroke-width: 3; r: 62; }
    50% { opacity: 0.4; stroke-width: 2; r: 58; }
}

.recording-ring-outer {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 2px solid rgba(239, 68, 68, 0.2);
    animation: ring-outer-pulse 2s ease-in-out infinite;
}

@keyframes ring-outer-pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.08); opacity: 0.2; }
}

.recording-ring-inner {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.recording-mic-icon {
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recording-mic-icon svg {
    width: 32px;
    height: 32px;
}

.recording-timer {
    font-size: 42px;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 6px;
}

.recording-status {
    font-size: 14px;
    font-weight: 500;
    color: #ef4444;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.recording-dot {
    width: 7px;
    height: 7px;
    background: #ef4444;
    border-radius: 50%;
    animation: blink 1s step-start infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.recording-label {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    text-align: center;
    margin-top: 4px;
}

.recording-patient-info {
    font-size: 14px;
    color: #64748b;
    text-align: center;
    margin-top: 4px;
}

/* Keep old .timer + .pulse-dot for backward compat */
.pulse-dot {
    width: 18px;
    height: 18px;
    background: #ef4444;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 1.5s infinite;
    margin-bottom: 14px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
}

.timer {
    font-size: 38px;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    margin-bottom: 6px;
}

.listening-label {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
    font-weight: 500;
}

/* ── Listening / Setup panels ── */
.listening-panel {
    padding: 8px 0;
    display: none;
}

.listening-panel.active {
    display: block;
}

.setup-panel {
    display: block;
}

.setup-panel.hidden {
    display: none;
}

/* ── Sections ── */
.section {
    margin-bottom: 24px;
}

.section h2 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1.5px solid #f1f5f9;
    letter-spacing: -0.01em;
}

.section h3 {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.section-content {
    font-size: 15px;
    color: #334155;
    white-space: pre-wrap;
    line-height: 1.75;
}

/* ── SOAP ── */
.soap-grid {
    display: grid;
    gap: 12px;
}

.soap-item {
    background: #fff;
    border-radius: 12px;
    padding: 16px 18px;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #2563eb;
}

.soap-item h3 {
    margin-bottom: 8px;
}

.red-flags-box {
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 16px 18px;
    border-left: 3px solid #ef4444;
}

/* ── Patient Badge ── */
.patient-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 15px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.patient-badge strong {
    color: #1e40af;
    font-weight: 600;
}

/* ── Processing Overlay ── */
.processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(248, 250, 252, 0.96);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
    backdrop-filter: blur(4px);
}

.processing-overlay.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.processing-text {
    font-size: 17px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.processing-subtext {
    font-size: 14px;
    color: #64748b;
}

/* ── Consult List (history page) ── */
.consult-list {
    list-style: none;
}

.consult-list li {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.consult-list li:hover {
    border-color: #bfdbfe;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.consult-list-content {
    flex: 1;
    min-width: 0;
}

.consult-list-name {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 3px;
}

.consult-meta {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 3px;
    font-weight: 400;
}

.consult-list-chevron {
    color: #cbd5e1;
    flex-shrink: 0;
}

/* ── Patient Results / Search ── */
.patient-results {
    margin-bottom: 12px;
}

.patient-searching {
    font-size: 14px;
    color: #64748b;
    padding: 8px 0;
}

.patient-list-label {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.patient-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.patient-option:hover {
    background: #eff6ff;
    border-color: #2563eb;
}

.patient-option-name {
    font-size: 15px;
    font-weight: 500;
    color: #0f172a;
}

.patient-option-phone {
    font-size: 13px;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

.patient-option-new {
    background: #fff;
    border-style: dashed;
    border-color: #cbd5e1;
}

.patient-option-new .patient-option-name {
    color: #2563eb;
    font-weight: 600;
}

.selected-patient-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: 10px;
    padding: 11px 14px;
    margin-bottom: 14px;
    font-size: 15px;
    font-weight: 500;
    color: #1e40af;
}

.clear-selection {
    background: none;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.clear-selection:hover {
    color: #ef4444;
}

/* ── Collapsible Cards ── */
.collapsible-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 10px;
    overflow: hidden;
}

.collapsible-header {
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #fff;
    transition: background 0.15s;
    user-select: none;
}

.collapsible-header:hover {
    background: #f8fafc;
}

.collapsible-header span:first-child {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.toggle-icon {
    font-size: 11px;
    color: #94a3b8;
    transition: transform 0.2s;
}

.collapsible-content {
    display: none;
    padding: 0 18px 18px;
    border-top: 1px solid #f1f5f9;
}

.collapsible-content .section-content {
    margin-top: 14px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.collapsible-content .section-content::-webkit-scrollbar {
    width: 4px;
}

.collapsible-content .section-content::-webkit-scrollbar-thumb {
    background-color: #e2e8f0;
    border-radius: 4px;
}

/* ── Chunk status + transcript ── */
.chunk-status {
    font-size: 13px;
    color: #2563eb;
    margin-bottom: 10px;
    display: none;
    font-weight: 500;
}

.live-transcript-section {
    margin-top: 16px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.live-transcript-header {
    padding: 13px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #fff;
    user-select: none;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    transition: background 0.15s;
}

.live-transcript-header:hover {
    background: #f8fafc;
}

.live-transcript-panel {
    display: block;
    border-top: 1px solid #f1f5f9;
}

.live-transcript-content {
    padding: 14px 18px;
    max-height: 220px;
    overflow-y: auto;
    font-size: 14px;
    color: #334155;
    line-height: 1.75;
}

.live-transcript-content::-webkit-scrollbar {
    width: 4px;
}

.live-transcript-content::-webkit-scrollbar-thumb {
    background-color: #e2e8f0;
    border-radius: 4px;
}

.transcript-placeholder {
    color: #94a3b8;
    font-style: italic;
    font-size: 14px;
}

.transcript-entry {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    white-space: pre-wrap;
}

.transcript-entry:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* ── Nudges ── */
.nudge-container {
    margin-top: 12px;
}

.nudge-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 8px;
    animation: slideIn 0.25s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.nudge-alert {
    background: #fff5f5;
    border: 1px solid #fecaca;
}

.nudge-question {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.nudge-reminder {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.nudge-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.nudge-alert .nudge-icon {
    background: #ef4444;
    color: #fff;
}

.nudge-question .nudge-icon {
    background: #2563eb;
    color: #fff;
}

.nudge-reminder .nudge-icon {
    background: #16a34a;
    color: #fff;
}

.nudge-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.55;
    color: #334155;
}

.nudge-dismiss {
    background: none;
    border: none;
    font-size: 16px;
    color: #cbd5e1;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}

.nudge-dismiss:hover {
    color: #475569;
}

.nudge-content {
    flex: 1;
    min-width: 0;
}

.nudge-section-wrapper {
    margin-top: 14px;
}

.nudge-section-header {
    padding: 9px 14px;
    background: #f8fafc;
    border-radius: 10px 10px 0 0;
    border: 1px solid #e2e8f0;
    border-bottom: none;
}

.nudge-section-header span {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.nudge-section-wrapper .nudge-container {
    margin-top: 0;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 10px 10px;
    padding: 8px;
    background: #fff;
}

/* ── Visual Aids ── */
.visual-aids-section {
    margin-top: 14px;
}

.visual-aids-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: #eff6ff;
    border-radius: 10px 10px 0 0;
    border: 1px solid #bfdbfe;
    border-bottom: none;
}

.visual-aids-header span {
    font-size: 11px;
    font-weight: 700;
    color: #2563eb;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.visual-aids-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border: 1px solid #bfdbfe;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    background: #fff;
}

.visual-aids-empty {
    padding: 20px 16px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
    font-style: italic;
}

.visual-aid-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
    animation: slideIn 0.25s ease;
}

.visual-aid-card:last-child {
    border-bottom: none;
}

.visual-aid-thumb {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.visual-aid-body {
    flex: 1;
    min-width: 0;
}

.visual-aid-caption {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
    text-transform: capitalize;
}

.visual-aid-extract {
    font-size: 12px;
    color: #64748b;
    line-height: 1.45;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.visual-aid-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.visual-aid-dismiss {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 15px;
    color: #cbd5e1;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s;
}

.visual-aid-dismiss:hover {
    color: #64748b;
}

.nudge-show-patient-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.nudge-show-patient-btn:hover {
    background: #1d4ed8;
}

.nudge-wiki-link {
    font-size: 11px;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
}

.nudge-wiki-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

@media (min-width: 500px) {
    .visual-aids-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .visual-aid-card {
        flex-direction: column;
        align-items: stretch;
        border-bottom: none;
        border-right: 1px solid #f1f5f9;
    }

    .visual-aid-card:last-child {
        border-right: none;
    }

    .visual-aid-thumb {
        width: 100%;
        height: 100px;
        object-fit: cover;
        border-radius: 8px;
    }
}

/* ── Visual Overlay ── */
.visual-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.visual-overlay-content {
    background: #fff;
    border-radius: 20px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.visual-overlay-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: #f1f5f9;
    border: none;
    font-size: 18px;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    z-index: 1;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.visual-overlay-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.visual-overlay-img {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 12px;
    background: #f8fafc;
    margin-bottom: 16px;
}

.visual-overlay-caption {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
    text-transform: capitalize;
    letter-spacing: -0.01em;
}

.visual-overlay-extract {
    font-size: 14px;
    color: #475569;
    line-height: 1.65;
    margin-bottom: 12px;
}

.visual-overlay-wiki {
    display: inline-block;
    font-size: 13px;
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.visual-overlay-wiki:hover {
    text-decoration: underline;
}

/* ── Admin panel button actions ── */
.btn-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* ── Results page action bar ── */
.results-action-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.save-soap-bar {
    display: none;
    margin-top: 12px;
    gap: 8px;
    align-items: center;
}

.save-soap-bar.visible {
    display: flex;
}

.save-msg {
    font-size: 13px;
    font-weight: 500;
}

.save-msg.ok { color: #16a34a; }
.save-msg.err { color: #dc2626; }

.copy-success {
    font-size: 13px;
    color: #16a34a;
    font-weight: 500;
    display: none;
}

.copy-success.visible {
    display: inline;
}

/* ── SOAP Edit textarea ── */
.soap-edit {
    width: 100%;
    min-height: 80px;
    padding: 8px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.65;
    color: #334155;
    resize: vertical;
    display: none;
    background: #f8fafc;
    transition: border-color 0.15s;
}

.soap-edit:focus {
    outline: none;
    border-color: #2563eb;
    background: #fff;
}

.soap-edit.visible {
    display: block;
}

.section-content.hidden {
    display: none;
}

/* ── Print header (results page) ── */
.print-header {
    display: none;
    margin-bottom: 20px;
}

.print-header-title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.print-header-sub {
    font-size: 13px;
    color: #555;
    margin-top: 2px;
}

.print-header-patient {
    font-size: 14px;
    color: #333;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

/* ── Admin-specific ── */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1.5px solid #e2e8f0;
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
    color: #334155;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: #f8fafc;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    margin-bottom: 16px;
}

.table-scroll .admin-table {
    min-width: 600px;
}

.expand-row td,
.expand-panel {
    padding: 0 !important;
    border: none !important;
    background: #f8fafc !important;
}

.expand-panel-inner {
    padding: 16px 20px;
}

.card-expand-panel {
    display: none;
    padding: 14px 0 4px;
    border-top: 1px solid #f1f5f9;
    margin-top: 12px;
}

.expand-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.quota-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.quota-form .form-group {
    flex: 1;
    min-width: 100px;
    margin-bottom: 0;
}

.quota-form .note-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    outline: none;
    color: #334155;
}

.quota-form .note-input:focus {
    border-color: #2563eb;
}

.quota-form input[type="number"] {
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    outline: none;
    color: #334155;
    width: 100%;
}

.quota-form input[type="number"]:focus {
    border-color: #2563eb;
}

.quota-green { color: #16a34a; font-weight: 600; }
.quota-amber { color: #d97706; font-weight: 600; }
.quota-red { color: #dc2626; font-weight: 600; }

.status-active {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    background: #dcfce7;
    color: #15803d;
}

.status-inactive {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    color: #64748b;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #94a3b8;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 12px;
}

.doctor-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 10px;
}

.doctor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.doctor-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.doctor-card-creds {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

.doctor-card-meta {
    font-size: 13px;
    color: #94a3b8;
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* Admin quota log timeline */
.log-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    align-items: flex-start;
}

.log-item:last-child { border-bottom: none; }

.log-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.log-dot-credit { background: #16a34a; }
.log-dot-usage { background: #64748b; }

.log-meta { color: #94a3b8; font-size: 12px; margin-top: 2px; }
.log-amount-credit { color: #16a34a; font-weight: 600; }
.log-amount-usage { color: #64748b; font-weight: 600; }

/* ── Landing page ── */
.landing-body {
    background: #fff;
}

.landing-nav {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e2e8f0;
    z-index: 100;
}

.landing-nav-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.landing-logo {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    text-decoration: none;
    letter-spacing: -0.3px;
}

.landing-nav-login {
    font-size: 14px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    padding: 8px 20px;
    border: 1.5px solid #2563eb;
    border-radius: 10px;
    transition: all 0.15s;
}

.landing-nav-login:hover {
    background: #2563eb;
    color: #fff;
}

.hero {
    background: linear-gradient(135deg, #eff6ff 0%, #e8f0fe 50%, #f8fafc 100%);
    padding: 80px 24px 72px;
    text-align: center;
}

.hero-inner {
    max-width: 720px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 100px;
    margin-bottom: 24px;
    letter-spacing: 0.3px;
}

.hero h1 {
    font-size: 40px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.hero-sub {
    font-size: 17px;
    color: #475569;
    line-height: 1.7;
    margin-bottom: 32px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    margin-bottom: 20px;
}

.hero-btn {
    display: inline-block;
    width: auto;
    padding: 14px 40px;
    font-size: 16px;
    border-radius: 12px;
    text-decoration: none;
}

.hero-note {
    font-size: 13px;
    color: #94a3b8;
}

.landing-section {
    padding: 72px 24px;
}

.landing-container {
    max-width: 1080px;
    margin: 0 auto;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.section-subtitle {
    font-size: 15px;
    color: #64748b;
    text-align: center;
    margin-bottom: 48px;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.step-card {
    text-align: center;
    padding: 32px 24px;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.step-number {
    width: 44px;
    height: 44px;
    background: #2563eb;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.step-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.step-card p {
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
}

.features-section {
    background: #f8fafc;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card {
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px;
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.2s;
}

.feature-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.feature-icon {
    width: 44px;
    height: 44px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.feature-icon.icon-alert { background: #fef2f2; color: #dc2626; }
.feature-icon.icon-note { background: #f0fdf4; color: #16a34a; }
.feature-icon.icon-history { background: #fefce8; color: #ca8a04; }
.feature-icon.icon-specialty { background: #faf5ff; color: #7c3aed; }
.feature-icon.icon-shield { background: #f0fdfa; color: #0d9488; }

.feature-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
}

.cta-section {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    padding: 64px 24px;
}

.cta-btn {
    background: #fff;
    color: #1e40af;
    margin-top: 16px;
}

.cta-btn:hover {
    background: #f0f5ff;
}

.landing-footer {
    text-align: center;
    padding: 32px 24px;
    border-top: 1px solid #e2e8f0;
    font-size: 14px;
    color: #64748b;
}

.waitlist-form-wrap {
    max-width: 480px;
    margin: 0 auto;
}

.waitlist-form input {
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    margin-bottom: 12px;
}

.waitlist-form input::placeholder {
    color: #94a3b8;
}

.waitlist-form input:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

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

.waitlist-success {
    max-width: 400px;
    margin: 0 auto;
    animation: slideIn 0.4s ease;
}

.waitlist-check {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.waitlist-success h3 {
    color: #fff;
    font-size: 22px;
    margin-bottom: 8px;
}

.waitlist-success p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
}

@media (max-width: 768px) {
    .hero {
        padding: 56px 20px 48px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .hero-sub {
        font-size: 15px;
    }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .landing-section {
        padding: 48px 20px;
    }

    .section-title {
        font-size: 22px;
    }

    .waitlist-row {
        grid-template-columns: 1fr;
    }
}

/* ── Print styles ── */
@media print {
    body {
        background: #fff;
        color: #000;
        font-size: 12px;
        font-family: 'Inter', -apple-system, sans-serif;
    }

    .nav-bar,
    .bottom-nav,
    .no-print,
    .collapsible-card,
    .btn,
    button {
        display: none !important;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .print-header {
        display: block !important;
        border-bottom: 2px solid #000;
        padding-bottom: 12px;
        margin-bottom: 20px;
    }

    .soap-item {
        border-left: 3px solid #000;
        page-break-inside: avoid;
    }

    .red-flags-box {
        border: 1px solid #000;
        background: #fff;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .section h2 {
        font-size: 14px;
        border-bottom: 1px solid #000;
    }

    textarea.soap-edit {
        border: none;
        resize: none;
        padding: 0;
        font-family: inherit;
        font-size: inherit;
        color: inherit;
        background: transparent;
    }

    .print-page-break {
        page-break-after: always;
    }
}
