/* ========================================================
   CLIUS (クリアス) EMR MVP - Modern Clinical UI Stylesheet
   ======================================================== */

:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --primary-dark: #075985;
  --secondary: #0d9488;
  --secondary-light: #ccfbf1;
  --accent: #6366f1;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --success: #10b981;
  --success-light: #d1fae5;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #38bdf8;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ================= Header ================= */
.app-header {
  min-height: 56px;
  height: auto;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px 0 16px;
  gap: 6px 16px;
  flex-shrink: 0;
  z-index: 20;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
  order: 1;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--primary);
  letter-spacing: -0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  flex-shrink: 0;
}

.clinic-badge {
  font-size: 0.75rem;
  background: #f1f5f9;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  white-space: nowrap;
  order: 2;
  margin-left: auto;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  order: 3;
  width: calc(100% + 32px);
  margin: 0 -16px;
  padding: 4px 16px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  overflow-x: auto;
  scrollbar-width: none;
}

.header-nav::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.nav-tab.active {
  background: var(--primary-light);
  color: var(--primary);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.badge-counter {
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 9999px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ================= Main Layout ================= */
.app-container {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  position: relative;
}

.view-section {
  display: none;
  width: 100%;
  height: 100%;
}

.view-section.active {
  display: flex;
}

/* ================= 1. Reception View ================= */
.reception-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
  overflow-y: auto;
}

.reception-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.stat-card {
  background: white;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  font-feature-settings: "tnum";
}

.reception-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.search-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  width: 280px;
  outline: none;
}
.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.patient-table-wrap {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex: 1;
  overflow: auto;
  box-shadow: var(--shadow-sm);
}

.patient-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.patient-table th {
  background: #f8fafc;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

.patient-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.patient-table tr:hover {
  background-color: #f8fafc;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-checked_in { background: #e2e8f0; color: #334155; }
.status-waiting_consultation { background: #fef3c7; color: #b45309; }
.status-in_consultation { background: #dbeafe; color: #1d4ed8; }
.status-waiting_billing { background: #f3e8ff; color: #6b21a8; }
.status-completed { background: #d1fae5; color: #047857; }

.patient-label-tag {
  display: inline-block;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 4px;
  white-space: nowrap;
}

/* ================= 2. EMR Consultation 3-Pane View ================= */
.emr-container {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px 1fr 340px;
  overflow: hidden;
  background: #ffffff;
}

/* Left Pane: Patient Summary & History */
.emr-left-pane {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: #fafafa;
  overflow-y: auto;
}

.patient-hero-card {
  padding: 16px;
  background: white;
  border-bottom: 1px solid var(--border);
}

.patient-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.patient-name {
  font-size: 1.15rem;
  font-weight: 700;
}

.patient-kana {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.patient-meta-row {
  display: flex;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.insurance-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 6px;
}

.alert-box {
  background: var(--danger-light);
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.clipboard-card {
  margin: 12px;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 10px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.clipboard-title {
  font-weight: 700;
  color: #b45309;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.vitals-preview-card {
  margin: 0 12px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}

.history-list {
  padding: 0 12px 12px;
}

.history-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.history-date {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--primary);
  display: flex;
  justify-content: space-between;
}

/* Center Pane: SOAP Input & AI Assist */
.emr-center-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  background: #ffffff;
}

.consultation-toolbar {
  padding: 8px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-assistant-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  padding: 12px 16px;
  border-radius: 8px;
  margin: 12px 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-wave-container {
  display: none;
  align-items: center;
  gap: 3px;
  height: 20px;
}
.ai-wave-bar {
  width: 3px;
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  animation: wave 1s infinite ease-in-out;
}
.ai-wave-bar:nth-child(2) { animation-delay: 0.2s; }
.ai-wave-bar:nth-child(3) { animation-delay: 0.4s; }
.ai-wave-bar:nth-child(4) { animation-delay: 0.1s; }
.ai-wave-bar:nth-child(5) { animation-delay: 0.3s; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.2); }
  50% { transform: scaleY(1); }
}

.soap-container {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.soap-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  transition: border-color 0.15s;
}

.soap-block:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.1);
}

.soap-header {
  padding: 6px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: 7px;
  border-top-right-radius: 7px;
}

.soap-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-weight: 800;
  margin-right: 6px;
}
.soap-tag.s { background: #fee2e2; color: #991b1b; }
.soap-tag.o { background: #dbeafe; color: #1e40af; }
.soap-tag.a { background: #fef3c7; color: #92400e; }
.soap-tag.p { background: #d1fae5; color: #065f46; }

.soap-textarea {
  width: 100%;
  border: none;
  outline: none;
  padding: 10px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}

/* Right Pane: Sets, Orders, Diagnoses, WebORCA */
.emr-right-pane {
  border-left: 1px solid var(--border);
  background: #fafafa;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.right-section {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: white;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-set-pill {
  display: inline-block;
  padding: 4px 8px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  margin: 2px;
  transition: all 0.15s;
}

.quick-set-pill:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.order-item-row {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.order-item-name {
  font-weight: 600;
}

.order-item-usage {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.orca-preview-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
}

.orca-point-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.orca-total {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-dark);
  border-top: 1px dashed #93c5fd;
  padding-top: 6px;
  margin-top: 6px;
}

/* ================= Buttons ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.75rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: white;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-ai {
  background: linear-gradient(135deg, #0284c7 0%, #6366f1 100%);
  color: white;
  border: none;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}
.btn-ai:hover {
  opacity: 0.95;
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover {
  background: #059669;
}

/* ================= Modal ================= */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

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

.modal-content {
  background: white;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ================= Patient Portal Simulator ================= */
.portal-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: #e2e8f0;
}

.phone-mockup {
  width: 375px;
  height: 720px;
  background: white;
  border-radius: 36px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 10px solid #1e293b;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.phone-notch {
  height: 24px;
  background: #1e293b;
  display: flex;
  justify-content: center;
  align-items: center;
}
.notch-camera {
  width: 60px;
  height: 12px;
  background: #0f172a;
  border-radius: 8px;
}

.phone-screen {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ================= Signage View ================= */
.signage-container {
  width: 100%;
  height: 100%;
  background: #0f172a;
  color: white;
  display: flex;
  flex-direction: column;
  padding: 40px;
}

.signage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #334155;
  padding-bottom: 20px;
}

.signage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 30px;
  flex: 1;
}

.signage-card {
  background: #1e293b;
  border-radius: 16px;
  padding: 24px;
  border-left: 8px solid var(--primary);
  display: flex;
  flex-direction: column;
}

.signage-status-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 16px;
}

.signage-num-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.signage-num-badge {
  font-size: 2.2rem;
  font-weight: 900;
  padding: 6px 16px;
  background: #334155;
  border-radius: 8px;
  letter-spacing: 1px;
}
.signage-num-badge.active {
  background: #0284c7;
  color: white;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ================= Multi-patient Tabs ================= */
.patient-tab-bar {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border);
  padding: 4px 12px 0;
  gap: 4px;
  overflow-x: auto;
}

.patient-tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: #e2e8f0;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.patient-tab-item:hover {
  background: #f8fafc;
  color: var(--text-main);
}

.patient-tab-item.active {
  background: white;
  color: var(--primary);
  border-color: var(--border);
  box-shadow: 0 -2px 4px rgba(0,0,0,0.02);
}

/* ================= Clerk Draft Banner ================= */
.clerk-draft-banner {
  background: #fefce8;
  border: 1px solid #fef08a;
  border-left: 5px solid #eab308;
  padding: 10px 16px;
  margin: 12px 16px 0;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ================= Schema Canvas Editor ================= */
.schema-canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.schema-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #f8fafc;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 0 0 1px #cbd5e1;
  transition: transform 0.1s;
}

.color-dot.active {
  transform: scale(1.2);
  box-shadow: 0 0 0 2px var(--primary);
}

#schema-canvas {
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}

/* ================= Lab Results Table ================= */
.lab-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.lab-table th {
  background: #f8fafc;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  color: var(--text-muted);
}

.lab-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
}

.lab-val-high {
  color: #dc2626;
  font-weight: 700;
  background: #fee2e2;
  padding: 1px 4px;
  border-radius: 3px;
}

.lab-val-low {
  color: #2563eb;
  font-weight: 700;
  background: #dbeafe;
  padding: 1px 4px;
  border-radius: 3px;
}

/* ================= Medical Document A4 Layout ================= */
.doc-editor-container {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: 100%;
  overflow: hidden;
  background: #f1f5f9;
}

.doc-form-pane {
  background: white;
  border-right: 1px solid var(--border);
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-preview-pane {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.a4-paper-preview {
  width: 210mm;
  min-height: 297mm;
  padding: 20mm;
  background: white;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  border-radius: 2px;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "MS PMincho", serif;
  font-size: 11pt;
  line-height: 1.8;
  color: #111827;
  position: relative;
  box-sizing: border-box;
}

.a4-title {
  text-align: center;
  font-size: 18pt;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid #111827;
  padding-bottom: 8px;
}

.a4-header-grid {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.a4-section-box {
  border: 1px solid #374151;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.a4-section-label {
  font-weight: 700;
  border-bottom: 1px dashed #9ca3af;
  padding-bottom: 4px;
  margin-bottom: 6px;
  font-size: 10pt;
}

@media print {
  body * {
    visibility: hidden;
  }
  .a4-paper-preview, .a4-paper-preview * {
    visibility: visible;
  }
  .a4-paper-preview {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 15mm;
    box-shadow: none;
  }
}

/* ================= Homecare / Visiting Schedule ================= */
.homecare-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s ease;
}

.homecare-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.homecare-time-badge {
  font-size: 0.85rem;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  padding: 4px 10px;
  border-radius: 6px;
}

/* ================= Telemedicine (オンライン診療) ================= */
.telemed-container {
  display: grid;
  grid-template-columns: 460px 1fr;
  height: 100%;
  overflow: hidden;
  background: #0f172a;
}

.telemed-video-panel {
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  background: #1e293b;
  border-right: 1px solid #334155;
  color: white;
}

.video-screen {
  flex: 1;
  background: #090d16;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #334155;
}

.video-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: 0 0 20px rgba(2, 132, 199, 0.4);
}

.video-pip-doctor {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 110px;
  height: 80px;
  background: #1e293b;
  border-radius: 8px;
  border: 2px solid #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #94a3b8;
}

.video-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 8px 0;
}

.btn-video-control {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #334155;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-video-control:hover {
  background: #475569;
}

.btn-video-control.end-call {
  background: #ef4444;
}
.btn-video-control.end-call:hover {
  background: #dc2626;
}

/* ================= PACS / DICOM Viewer ================= */
.pacs-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  background: white;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pacs-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.pacs-canvas-box {
  background: #000;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  height: 380px;
  position: relative;
}

.pacs-tool-bar {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  align-items: center;
}

/* ================= Electronic Prescription Voucher ================= */
.eprescription-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  font-size: 0.8rem;
}

.hpki-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.72rem;
}


