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

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  background: var(--accent);
  color: white;
  padding: 0.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
}

.logo h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.logo h1 span {
  color: var(--accent);
  font-weight: 400;
}

.header-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--background);
  padding: 0.35rem 0.75rem;
  border-radius: 2rem;
  border: 1px solid var(--border);
}

.main-content {
  flex: 1;
  padding: 0.75rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1rem;
  flex: 1;
  height: calc(100vh - 80px);
  min-height: 0;
}

.calendar-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calendar-header {
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.calendar-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.calendar-controls button {
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 500;
}

.calendar-controls button:hover {
  background: var(--background);
}

.calendar-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto repeat(6, 1fr);
}

.weekday-header {
  padding: 0.75rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.825rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.calendar-day {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.25rem;
  transition: all 0.2s ease;
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.period-bars {
  position: absolute;
  top: 1.6rem;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 5;
  pointer-events: none;
}

.period-bar {
  width: 100%;
  opacity: 0.85;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.period-bar.has-label {
  height: 15px;
  border-radius: 4px;
}

.period-bar.no-label {
  height: 4px;
  border-radius: 2px;
  margin: 4px 0;
}

.period-bar-label {
  font-size: 0.65rem;
  color: white;
  font-weight: bold;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 2px;
}

.calendar-day:nth-child(7n) { border-right: none; }

.calendar-day:hover {
  background-color: #f1f5f9;
  cursor: pointer;
}

.calendar-day .add-hint {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  color: var(--accent);
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.calendar-day:hover .add-hint {
  opacity: 1;
}

.calendar-day.outside {
  background-color: #fdfdfd;
  color: #cbd5e1;
}

.calendar-day.today {
  background-color: #eff6ff;
}

.calendar-day.today .day-number {
  background: var(--accent);
  color: white;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.day-number {
  font-size: 0.875rem;
  font-weight: 500;
}

.today .day-number {
  background: var(--accent);
  color: white !important;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.day-events {
  margin-top: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}
.day-events::-webkit-scrollbar {
  width: 4px;
}
.day-events::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.event-tag {
  font-size: 0.625rem;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}

.mini-delete {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  font-size: 10px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-delete:hover {
  opacity: 1;
}

.event-tag.admission { background: #fee2e2; color: #991b1b; border-left: 3px solid #ef4444; }
.event-tag.discharge { background: #dcfce7; color: #166534; border-left: 3px solid #22c55e; }
.event-tag.terminal { background: #fef9c3; color: #854d0e; border-left: 3px solid #eab308; }
.event-tag.death { background: #f3f4f6; color: #1f2937; border-left: 3px solid #1f2937; }

.task-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.5rem;
}

.sidebar-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
}

.badge {
  background: var(--danger);
  color: white;
  padding: 2px 10px;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.task-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.5rem;
}

.task-card {
  position: relative;
  background: white;
  padding: 0;
  border-radius: 1rem;
  display: flex;
  gap: 0;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.task-main-body {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.task-delete-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.task-delete-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

.task-card.priority-high {
  border-left: 4px solid var(--danger);
}

.task-card.priority-medium {
  border-left: 4px solid var(--warning);
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent-light);
}

.task-card.completed {
  background: white;
  border-left-color: var(--border);
}

.task-card.completed h4 {
  color: #0f172a;
}

.task-check .circle {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
}

.task-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

.task-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.task-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.deadline {
  font-size: 0.75rem;
  color: var(--danger);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.addon-badge {
  font-size: 0.7rem;
  background: #eff6ff;
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 1rem;
  width: fit-content;
  border: 1px solid #dbeafe;
  font-weight: 700;
}

.addon-badge.error-badge {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.addon-badge.success-badge {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #bbf7d0;
}

.priority-tag {
  font-size: 0.65rem;
  color: var(--danger);
  background: #fee2e2;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 800;
  text-transform: uppercase;
}

.priority-tag.error-tag {
  background: #dc2626;
  color: white;
}

.priority-tag.warning-tag {
  background: #f59e0b;
  color: white;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: white;
  padding: 0;
  border-radius: 1.25rem;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
}

.modal-header-main {
  padding: 1.5rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.modal-scroll-area {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-content.wide-modal {
  max-width: 840px;
}

.modal-subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.type-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: white;
}

.type-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.chip {
  padding: 0.4rem 1rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 2rem;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.chip:hover {
  background: var(--background);
}

.chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.record-evidence {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.evidence-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.evidence-value {
  color: var(--primary);
  font-weight: 600;
}

.task-card.has-record {
  border-left-width: 6px;
  background: #f0fdf4;
}

.status-badge-success {
  font-size: 0.65rem;
  background: var(--success);
  color: white;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: auto;
}

.status-badge-warning {
  font-size: 0.65rem;
  background: var(--warning);
  color: white;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: auto;
}

.compact-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-group.span-2 {
  grid-column: span 2;
}

.compact-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  outline: none;
}

.compact-input.mini-bottom {
  margin-bottom: 0.4rem;
}

.chip-group.mini {
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.chip.mini {
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
}

.chip.master-chip {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
  padding: 0.4rem 0.8rem;
}

.chip.master-chip:hover {
  background: #e0f2fe;
  transform: scale(1.02);
}

.chip.master-chip strong {
  margin-right: 0.25rem;
}

.chip.active-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.chip.active-warning {
  background: var(--warning);
  color: white;
  border-color: var(--warning);
}

.chip.active-premium {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border-color: #6366f1;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.linkage-count-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #fdf2f8;
  color: #db2777;
  border: 1px solid #fbcfe8;
  border-radius: 99px;
  font-size: 0.65rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.mt-2 { margin-top: 0.5rem; }

.compact-textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.825rem;
  min-height: 60px;
  outline: none;
  resize: none;
  background: #fafafa;
}

.discharge-extra {
  background: #fffbfa;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px dashed #fdba74;
}

.evidence-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.25rem 0;
}

.mini-tag {
  font-size: 0.6rem;
  background: #f1f5f9;
  color: #475569;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

/* Timeline in Task Card */
.activity-timeline {
  margin-top: 0.75rem;
  padding-left: 0.5rem;
  border-left: 2px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.timeline-item {
  position: relative;
  padding-left: 1rem;
}

.timeline-marker {
  position: absolute;
  left: -1.1rem;
  top: 0.4rem;
  width: 8px;
  height: 8px;
  background: white;
  border: 2px solid var(--accent);
  border-radius: 50%;
}

.timeline-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.1rem;
}

.timeline-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.timeline-type {
  font-size: 0.6rem;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.timeline-type.conf { background: #fee2e2; color: #ef4444; }
.timeline-type.info { background: #f0f9ff; color: #0ea5e9; }
.timeline-type.visit-type { background: #ecfdf5; color: #059669; }

.terminal-summary {
  font-size: 0.7rem;
  font-weight: 700;
  color: #059669;
  background: #f0fdf4;
  padding: 2px 8px;
  border-radius: 99px;
  width: fit-content;
  margin: 0.25rem 0;
  border: 1px solid #bbf7d0;
}

.timeline-desc {
  font-size: 0.75rem;
  color: var(--text-main);
}

/* File Upload */
.file-upload-area {
  margin-bottom: 0.5rem;
}

.hidden-input { display: none; }

.file-upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 2px dashed var(--border);
  border-radius: 0.75rem;
  cursor: pointer;
  font-size: 0.825rem;
  color: var(--text-muted);
  transition: all 0.2s;
}

.file-upload-label:hover {
  background: white;
  border-color: var(--accent);
  color: var(--accent);
}

/* Kasan requirement hint box */
.kasan-requirement-info {
  background: #fefce8;
  border: 1px solid #fde047;
  padding: 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
  color: #854d0e;
}

.kasan-requirement-info h4 {
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 700;
}

.kasan-requirement-info ul {
  padding-left: 1.5rem;
  list-style-type: disc;
}

.kasan-requirement-info li {
  margin-bottom: 0.15rem;
}

/* History Tags in Modal */
.current-history {
  background: #f1f5f9;
  padding: 0.75rem;
  border-radius: 0.75rem;
}

.history-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.history-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: white;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
}

.btn-reset {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 2px 8px;
  border-radius: 4px;
}

.btn-reset:hover {
  background: #fee2e2;
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.month-nav h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  min-width: 140px;
  text-align: center;
}

.month-nav button {
  background: white;
  border: 1px solid var(--border);
  color: var(--primary);
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.terminal-entry-box {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1rem 0;
}

.visit-entry-section, .death-entry-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.entry-row {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.btn-action {
  padding: 0.6rem 1.25rem;
  background: white;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 0.5rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-action:hover {
  background: #eff6ff;
  transform: translateY(-1px);
}

.btn-action.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-action.primary:hover {
  background: #1d4ed8;
  box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.requirement-status.mini {
  margin-top: 0.25rem;
}

.btn-secondary {
  padding: 0.6rem 1.5rem;
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
}

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

.btn-primary {
  padding: 0.6rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 700;
  cursor: pointer;
}

.delete-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-weight: bold;
  cursor: pointer;
  padding: 0 4px;
  margin-left: 4px;
  transition: all 0.2s;
}

.delete-btn:hover {
  color: #ef4444;
}

.terminal-extra {
  background: #f8fafc;
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
}

.death-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.start-date {
  color: #64748b !important;
  font-weight: 700;
}

.death-date-indicator {
  margin-top: 0.5rem;
  font-size: 0.825rem;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 4px 8px;
  background: #f1f5f9;
  border-radius: 6px;
  width: fit-content;
}

.requirement-status {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: white;
  border-radius: 0.5rem;
  border: 1px solid #cbd5e1;
  font-size: 0.825rem;
}

.requirement-status strong {
  color: var(--accent);
  font-size: 1.1rem;
}

.status-label {
  font-size: 0.7rem;
  background: #10b981;
  color: white;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 700;
}
/* Unit Summary Card */
.unit-summary-card {
  margin: 1rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-radius: 16px;
  color: white;
  box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.3);
  position: relative;
  overflow: hidden;
}

.unit-summary-card::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.summary-label {
  font-size: 0.875rem;
  opacity: 0.9;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.summary-main {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.summary-value {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1;
}

.summary-unit {
  font-size: 0.875rem;
  font-weight: 600;
  opacity: 0.8;
}

.summary-sub {
  font-size: 0.875rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.summary-sub span {
  font-weight: 700;
  font-size: 1rem;
}

.summary-count {
  font-size: 0.75rem;
  margin-top: 0.5rem;
  opacity: 0.7;
  text-align: right;
}

.summary-details {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

.detail-name {
  opacity: 0.85;
}

.detail-value {
  font-weight: 500;
}

.detail-value strong {
  font-weight: 700;
  font-size: 0.8rem;
}

@media (max-width: 1024px) {
  .unit-summary-card {
    margin: 0.5rem 0;
  }
}

/* hospitalization Episode Unified Card Styles */
.hospitalization-card {
  border-left: 4px solid var(--primary) !important;
  background: linear-gradient(to right, #f0f7ff, #ffffff);
}

.hospitalization-icon {
  background: #e0f2fe !important;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hospitalization-steps {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hosp-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  padding: 4px 6px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none; /* Firefox */
}

.hosp-step::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

.hosp-step.done {
  background: #f0fdf4;
  border-color: #bcf0da;
}

.hosp-step-label {
  font-weight: 700;
  color: #1e293b;
  flex-shrink: 0;
}

.hosp-step-date {
  color: #64748b;
  flex-shrink: 0;
}

.hosp-step-name {
  flex: 1;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.step-label {
  color: #64748b;
  font-weight: 600;
  width: 45px;
}

.step-date {
  color: #1e293b;
  font-family: monospace;
}

.step-badge {
  margin-left: auto;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #64748b;
}

.step-badge.success {
  background: #dcfce7;
  color: #166534;
}

/* Wide Modal for Hospitalization Management */
.wide-modal {
  max-width: 850px !important;
  width: 95% !important;
}

.hosp-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 10px 0;
}

.hosp-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hosp-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
  color: var(--primary);
}

.hosp-section-header h4 {
  margin: 0;
  font-size: 0.95rem;
}

.admission-side {
  border-right: 1px dashed #e2e8f0;
  padding-right: 12px;
}

.mini-box {
  background: #f8fafc;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.btn-full {
  width: 100%;
}

.mini-bottom {
  margin-bottom: 8px;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }

@media (max-width: 768px) {
  .hosp-modal-grid {
    grid-template-columns: 1fr;
  }
  .admission-side {
    border-right: none;
    border-bottom: 1px dashed #e2e8f0;
    padding-right: 0;
    padding-bottom: 20px;
  }
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  padding: 0 1rem;
  gap: 8px;
}

.modal-tab-btn {
  padding: 0.85rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-tab-btn:hover {
  color: var(--accent);
}

.modal-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Quick buttons */
.quick-date-buttons {
  display: flex;
  gap: 6px;
}

.btn-quick-date {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: white;
  color: #475569;
  font-weight: 500;
  line-height: 1.2;
}

.btn-quick-date:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Record status box */
.record-status-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  margin-top: 1rem;
}

.record-status-title {
  font-weight: 700;
  color: #166534;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.record-status-details {
  font-size: 0.8rem;
  color: #3f6212;
  margin-bottom: 0.75rem;
}

.record-status-row {
  margin-bottom: 4px;
}

/* AddEventModal Premium Chips */
.chip-group .chip.active-admission {
  background-color: #2563eb !important;
  border-color: #2563eb !important;
  color: white !important;
}

.chip-group .chip.active-discharge {
  background-color: #059669 !important;
  border-color: #059669 !important;
  color: white !important;
}

.chip-group .chip.active-terminal {
  background-color: #6d28d9 !important;
  border-color: #6d28d9 !important;
  color: white !important;
}

.chip-group .chip.active-death {
  background-color: #475569 !important;
  border-color: #475569 !important;
  color: white !important;
}

.chip-group .chip:not([class*="active-"]):hover {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}
