* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family-sans);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
}

a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: 1100px;
  min-width: 1100px;
  max-width: 1100px;
  min-height: 100vh;
  margin: 0 auto;
  padding-top: 104px;
}

.timeline-strip {
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-default);
}

.app-header {
  background: transparent;
  border-bottom: 0;
}

.filters-bar {
  background: transparent;
  border-bottom: 0;
}

.timeline-strip {
  background: linear-gradient(135deg, #E3F0FF 0%, #CFE4FF 52%, #B8D7FF 100%);
  border-radius: 2.1rem;
  overflow: hidden;
  margin-top: 15px;
  box-shadow: 0 10px 26px rgba(79, 129, 201, 0.10);
}

.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: 1100px;
  min-width: 1100px;
  max-width: 1100px;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-6);
  background: rgba(245, 247, 251, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
}

.brand-block,
.header-actions,
.profile-badge,
.study-card-header,
.key-value-row,
.access-row,
.timeline-strip-header {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 10px;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-brand-primary), var(--color-brand-secondary));
}

.brand-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.brand-subtitle,
.welcome-label,
.profile-email,
.muted-text,
.timeline-month-meta,
.study-subtitle,
.panel-body,
.latest-study span,
.diagnosis-item span,
.file-name {
  color: var(--color-text-tertiary);
}

.welcome-block {
  min-width: 10rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.welcome-name {
  font-weight: 600;
}

.search-form {
  flex: 1;
}

.search-input,
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  background: var(--color-bg-tertiary);
  padding: 0.75rem 1rem;
  outline: none;
}

.search-input:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--color-brand-primary);
}

.header-actions {
  gap: var(--space-4);
  align-items: center;
  margin-left: auto;
}

.profile-badge {
  gap: var(--space-3);
  align-items: center;
}

.profile-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: var(--color-study-imaging-light);
  color: var(--color-study-imaging);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.button-primary {
  color: #fff;
  background: var(--color-brand-primary);
}

.button-secondary {
  background: #fff;
  border-color: var(--color-border-default);
  color: var(--color-text-primary);
}

.button-ghost {
  background: transparent;
  border-color: var(--color-border-default);
  color: var(--color-text-secondary);
}

.button-small {
  padding: 0.5rem 0.75rem;
}

.filters-bar,
.timeline-strip,
.vertical-timeline {
  padding: var(--space-6);
}

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.76rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--study-color, var(--color-border-default)) 18%, white);
  background: transparent;
  color: var(--study-color, var(--color-text-primary));
  font-size: 0.86rem;
}

.filter-chip.is-active {
  color: #fff;
  background: var(--study-color, var(--color-neutral-900));
  border-color: var(--study-color, var(--color-neutral-900));
}

.filter-count {
  min-width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.28rem;
  font-size: 0.72rem;
}

.filter-chip:not(.is-active) .filter-count {
  background: color-mix(in srgb, var(--study-color, var(--color-neutral-100)) 14%, white);
}

.timeline-strip-header {
  position: relative;
  justify-content: flex-end;
  margin-bottom: var(--space-3);
}

.section-title {
  display: none;
}

.link-action {
  color: var(--color-brand-primary);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.timeline-months {
  display: flex;
  gap: var(--space-8);
  overflow-x: auto;
}

.timeline-month {
  position: relative;
  z-index: 1;
  min-width: 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-align: center;
}

.timeline-node {
  position: relative;
  z-index: 1;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: var(--color-neutral-200);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.timeline-month.is-selected .timeline-node {
  transform: scale(1.26);
  background: #D6E6FF;
  color: #0F4FD6;
  box-shadow: 0 12px 28px rgba(21, 93, 252, 0.24);
}

.timeline-month-label {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.dashboard-main {
  display: grid;
  grid-template-columns: 780px 320px;
  min-height: calc(100vh - 13rem);
}

.dashboard-content {
  overflow: auto;
}

.dashboard-sidebar {
  border-left: 1px solid var(--color-border-default);
  background: transparent;
  padding: var(--space-6);
}

.study-card {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.study-card-rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.study-card-rail::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: -1.5rem;
  width: 2px;
  background: var(--color-neutral-200);
}

.study-card-node {
  position: relative;
  z-index: 1;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #fff;
  background: var(--study-light, var(--color-neutral-100));
  color: var(--study-color, var(--color-neutral-900));
  font-size: var(--font-size-xs);
  font-weight: 700;
}

.study-card-surface,
.sidebar-card,
.modal-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.study-card-surface {
  padding: 1.25rem;
}

.study-card-header {
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.study-card-meta,
.study-tags,
.study-files,
.sidebar-stack,
.diagnosis-list,
.sidebar-actions,
.modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.study-card-meta {
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
}

.study-title {
  margin: 0 0 var(--space-1);
  font-size: var(--font-size-xl);
}

.study-subtitle {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-sm);
}

.study-tags {
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.study-tag,
.study-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.study-tag {
  background: var(--color-neutral-100);
  color: var(--color-text-secondary);
}

.study-badge {
  background: var(--study-light, var(--color-neutral-100));
  color: var(--study-color, var(--color-neutral-900));
}

.study-files {
  margin-top: var(--space-4);
}

.file-tile,
.study-panel,
.latest-study {
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  background: var(--color-bg-tertiary);
  padding: var(--space-4);
}

.file-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  background: #fff;
}

.file-kind,
.panel-title,
.sidebar-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.panel-title {
  margin-bottom: var(--space-2);
}

.panel-body {
  margin: 0;
}

.access-list,
.key-value-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.key-value-row,
.access-row {
  justify-content: space-between;
  gap: var(--space-3);
}

.sidebar-card {
  padding: var(--space-6);
}

.sidebar-gradient {
  background: linear-gradient(135deg, var(--color-study-consultation-light), var(--color-study-imaging-light));
}

.diagnosis-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  background: var(--study-light, var(--color-neutral-100));
  color: var(--study-color, var(--color-text-primary));
}

.latest-study {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.modal-shell {
  display: none;
}

.study-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.study-type-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: 0.7rem 0.85rem;
  background: #fff;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.empty-state {
  padding: 5rem 2rem;
  text-align: center;
}

.empty-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  background: var(--color-neutral-100);
  color: var(--color-neutral-500);
  font-size: var(--font-size-2xl);
}

.empty-title {
  margin: 0 0 var(--space-2);
}

.empty-description {
  margin: 0;
  color: var(--color-text-tertiary);
}

.study-type--imaging {
  --study-color: var(--color-study-imaging);
  --study-light: var(--color-study-imaging-light);
}

.study-type--lab {
  --study-color: var(--color-study-lab);
  --study-light: var(--color-study-lab-light);
}

.study-type--consultation {
  --study-color: var(--color-study-consultation);
  --study-light: var(--color-study-consultation-light);
}

.study-type--treatment {
  --study-color: var(--color-study-treatment);
  --study-light: var(--color-study-treatment-light);
}

.study-type--neutral {
  --study-color: var(--color-neutral-900);
  --study-light: var(--color-neutral-100);
}

@media (max-width: 1080px) {
  .dashboard-main {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    border-left: 0;
    border-top: 1px solid var(--color-border-default);
  }
}

@media (max-width: 840px) {
  .app-header {
    flex-wrap: wrap;
  }

  .welcome-block {
    display: none;
  }

  .study-card {
    grid-template-columns: 1fr;
  }

  .study-card-rail {
    display: none;
  }
}

.status-banner {
  padding: 0.875rem 1.5rem;
  background: #FEF3C7;
  color: #92400E;
  border-bottom: 1px solid #FCD34D;
  font-size: var(--font-size-sm);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120' viewBox='0 0 240 120'%3E%3Cpath d='M0 60 H38 L50 60 L60 42 L72 82 L86 30 L100 60 H240' fill='none' stroke='%2393C5FD' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round' opacity='0.62'/%3E%3Cpath d='M0 92 H150 L162 92 L170 80 L180 104 L192 68 L206 92 H240' fill='none' stroke='%23BFDBFE' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' opacity='0.48'/%3E%3C/svg%3E") 0 0 / 240px 120px repeat,
    linear-gradient(180deg, rgba(37, 99, 235, 0.07), rgba(59, 130, 246, 0.03)),
    radial-gradient(circle at top left, var(--color-study-consultation-light), transparent 28rem),
    radial-gradient(circle at bottom right, var(--color-study-imaging-light), transparent 24rem),
    var(--color-bg-primary);
}

.login-card {
  width: min(100%, 32rem);
  padding: 2rem;
  border: 1px solid var(--color-border-default);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-md);
}

.login-brand {
  margin-bottom: var(--space-4);
}

.login-brand .brand-mark {
  width: 5rem;
  height: 5rem;
  border-radius: 1.35rem;
}

.login-brand .icon-brand {
  width: 2.7rem;
  height: 2.7rem;
}

.login-brand .brand-title {
  font-size: 1.5rem;
}

.login-brand .brand-subtitle {
  font-size: 1rem;
}

.login-copy {
  margin-bottom: var(--space-4);
}

.login-title {
  margin: 0 0 var(--space-2);
  font-size: 1.875rem;
  line-height: 1.2;
}

.auth-error {
  margin-bottom: var(--space-4);
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-lg);
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FCA5A5;
  font-size: var(--font-size-sm);
}

.login-submit {
  width: 100%;
}

.login-hint {
  margin-top: var(--space-4);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-xs);
}

.status-banner-success {
  background: #D1FAE5;
  color: #065F46;
  border-bottom-color: #6EE7B7;
}

.create-study-shell {
  padding: var(--space-8);
}

.jpeg-series-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-5);
}

.create-study-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-4);
}

.page-eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--color-brand-primary);
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.create-study-title {
  margin: 0 0 var(--space-2);
  font-size: 2rem;
  line-height: 1.1;
}

.create-study-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21rem;
  gap: var(--space-6);
}

.study-form-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}

.study-form-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.study-type-option.is-selected {
  box-shadow: inset 0 0 0 2px var(--study-color, var(--color-brand-primary));
}

.study-type-option input {
  margin: 0;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

@media (max-width: 980px) {
  .create-study-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .create-study-shell {
    padding: var(--space-4);
  }

  .create-study-header {
    flex-direction: column;
  }
}

.button-disabled {
  opacity: 0.65;
  cursor: default;
  pointer-events: none;
}

.share-selection,
.share-card-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.share-study-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 24rem;
  overflow: auto;
}

.share-study-item,
.share-card-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  background: #fff;
}

.share-study-item span {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.share-study-item small {
  color: var(--color-text-tertiary);
}

.form-row-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

@media (max-width: 720px) {
  .form-row-two {
    grid-template-columns: 1fr;
  }
}

.profile-avatar-image,
.avatar-preview-image {
  object-fit: cover;
}

.profile-avatar-image {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid var(--color-border-default);
}

.profile-section-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 1.25rem;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  background: var(--color-bg-tertiary);
}

.profile-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.avatar-editor {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.avatar-preview-shell {
  width: 5.5rem;
  height: 5.5rem;
  flex: 0 0 auto;
}

.avatar-preview-image,
.avatar-preview-fallback {
  width: 100%;
  height: 100%;
  border-radius: 1.25rem;
  border: 1px solid var(--color-border-default);
  box-shadow: var(--shadow-sm);
}

.avatar-preview-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-study-consultation-light), var(--color-study-imaging-light));
  color: var(--color-brand-primary);
  font-size: 1.4rem;
  font-weight: 700;
}

.avatar-field {
  flex: 1;
}

@media (max-width: 720px) {
  .avatar-editor {
    flex-direction: column;
    align-items: flex-start;
  }
}

.profile-badge-link {
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--color-border-default);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.profile-badge-link:hover,
.profile-badge-link:focus-visible {
  background: var(--color-bg-tertiary);
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  outline: none;
}
.icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.icon-sm {
  width: 1rem;
  height: 1rem;
}

.icon-brand {
  width: 1.35rem;
  height: 1.35rem;
}

.icon-study-node {
  width: 1.25rem;
  height: 1.25rem;
}

.search-form-shell {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-tertiary);
  pointer-events: none;
}

.search-input-with-icon {
  padding-left: 2.75rem;
}

.filter-chip-icon,
.sidebar-title-with-icon,
.file-tile-content,
.panel-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-title-with-icon {
  margin: 0;
}

.file-tile-content {
  min-width: 0;
}

.file-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
}

.file-icon-document {
  background: #FEF2F2;
  color: #DC2626;
}

.file-icon-image {
  background: var(--color-study-imaging-light);
  color: var(--color-study-imaging);
}

.file-thumb-shell {
  width: 3.25rem;
  height: 3.25rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 2px;
  border-radius: var(--radius-lg);
  border: 1px solid #BFDBFE;
  background: var(--color-study-imaging-light);
}

.file-thumb-image {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: calc(var(--radius-lg) - 2px);
  object-fit: cover;
  background: #FFFFFF;
}

.file-thumb-shell-pdf {
  flex-direction: column;
  gap: 0.25rem;
  background: linear-gradient(180deg, #EFF6FF 0%, #DBEAFE 100%);
  color: #BE123C;
  border-color: #BFDBFE;
}

.file-thumb-shell-video {
  flex-direction: column;
  gap: 0.2rem;
  background: linear-gradient(180deg, #EEF2FF 0%, #DBEAFE 100%);
  color: #2563EB;
  border-color: #BFDBFE;
}

.file-thumb-pdf-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.file-thumb-pdf-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-thumb-video-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.file-thumb-video-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar {
  background: var(--color-study-imaging-light);
  color: var(--color-study-imaging);
}
.modal-open {
  overflow: hidden;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.modal-shell.is-open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(2px);
}

.modal-card-form {
  position: relative;
  z-index: 1;
  width: min(100% - 2rem, 520px);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  margin: 1rem auto;
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

.modal-header-spaced {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.modal-title {
  margin: 0 0 var(--space-2);
  font-size: 2rem;
  line-height: 1.1;
}

.modal-close-button {
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close-button:hover {
  background: var(--color-neutral-100);
}

.modal-form-compact {
  gap: var(--space-3);
}

.study-type-grid-modal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.study-type-option-modal {
  position: relative;
  min-height: 3rem;
}

.study-type-option-modal input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.study-type-option-icon {
  display: inline-flex;
  color: var(--study-color, var(--color-brand-primary));
}

.upload-dropzone-shell {
  position: relative;
  border: 2px dashed var(--color-border-medium);
  border-radius: 1rem;
  background: #fff;
  overflow: hidden;
}

.upload-dropzone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 8.5rem;
  padding: 1.5rem;
  text-align: center;
}

.icon-upload {
  width: 1.75rem;
  height: 1.75rem;
  color: #9CA3AF;
}

.upload-dropzone-title {
  color: #2563EB;
  font-weight: 600;
}

.upload-dropzone-title span {
  color: var(--color-text-secondary);
  font-weight: 500;
}

.upload-dropzone-hint {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
}

.modal-actions-split {
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .study-type-grid-modal {
    grid-template-columns: 1fr;
  }

  .modal-card-form {
    width: min(100% - 1rem, 520px);
    margin: 0.5rem auto;
    padding: 1rem;
  }

  .modal-title {
    font-size: 1.5rem;
  }
}
.modal-card-form {
  border-radius: 1.2rem;
  border-color: #E6E8EF;
  background: #FFFFFF;
}

.modal-subtitle {
  max-width: 24rem;
  font-size: 0.92rem;
}

.modal-title {
  font-size: 1.7rem;
  font-weight: 700;
}

.modal-label {
  font-weight: 600;
  color: #111827;
}

.modal-input {
  border-color: #E5E7EB;
  background: #F5F7FB;
  min-height: 3rem;
}

.modal-input::placeholder,
.modal-textarea::placeholder {
  color: #8A90A2;
}

.modal-textarea {
  min-height: 3.5rem;
  resize: vertical;
}

.study-type-option-modal {
  min-height: 2.8rem;
  border-color: #DDE2EA;
  border-radius: 0.9rem;
  background: #FFFFFF;
  font-weight: 600;
  color: #4B5563;
}

.study-type-option-modal.is-selected {
  background: #FCFAFF;
  box-shadow: inset 0 0 0 2px var(--study-color, var(--color-brand-primary));
}

.upload-dropzone-shell {
  border-color: #D7DCE6;
  border-radius: 1rem;
  background: #FFFFFF;
}

.upload-dropzone-shell:hover {
  border-color: var(--color-brand-primary);
}

.upload-dropzone-content {
  min-height: 6.5rem;
}

.upload-dropzone-title {
  color: var(--color-brand-primary);
}

.modal-close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6B7280;
  font-size: 1rem;
  font-weight: 700;
}

.modal-cancel-button {
  min-width: 5.2rem;
}

.modal-submit-button {
  min-width: 8.2rem;
  background: #8E92A0;
}

.modal-submit-button:hover {
  background: #7C8292;
}
.welcome-name {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.welcome-logout {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.welcome-logout:hover,
.welcome-logout:focus-visible {
  color: var(--color-brand-primary);
  outline: none;
}
.study-card-collapsible {
  padding: 1.25rem;
  cursor: pointer;
}

.study-card-collapsible.is-expanded {
  cursor: default;
}

.study-card-toggle {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-tertiary);
  cursor: pointer;
}

.study-card-toggle:hover {
  background: var(--color-neutral-100);
}

.study-card-toggle-icon {
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s ease;
}

.study-card-collapsible.is-expanded .study-card-toggle-icon,
.study-card-toggle[aria-expanded="true"] .study-card-toggle-icon {
  transform: rotate(180deg);
}

.study-card-quick-actions,
.study-card-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.study-card-details {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-default);
}

.study-panel-section + .study-panel-section {
  margin-top: var(--space-4);
}

.study-card-details .panel-body {
  padding: 0.95rem 1rem;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  background: #fff;
}

.study-card-details .access-row {
  padding: 0.95rem 1rem;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  background: #fff;
}
.study-card-details {
  transition: height 0.28s ease, opacity 0.22s ease;
  will-change: height, opacity;
}

.study-card-collapsible {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.study-card-collapsible:hover {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
.button-danger {
  color: #fff;
  background: #DC2626;
}

.button-danger:hover {
  background: #B91C1C;
}

.modal-actions-between {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.edit-file-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.edit-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0.85rem 1rem;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  background: #fff;
}

.edit-file-remove {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.edit-file-remove input {
  width: auto;
}


@media (max-width: 640px) {
  .modal-actions-between {
    flex-wrap: wrap;
  }
}

.modal-actions-between {
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--space-3);
}

@media (max-width: 640px) {
  .modal-actions-between {
    flex-wrap: wrap;
  }
}
.button-icon {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 0.9rem;
}

.button-icon-danger {
  color: #DC2626;
  background: #FEF2F2;
  border: 1px solid #FECACA;
}

.button-icon-danger:hover {
  color: #FFFFFF;
  background: #DC2626;
  border-color: #DC2626;
}
.upload-dropzone-shell.has-files {
  border-color: #86B7FE;
  background: #EFF6FF;
}

.upload-dropzone-shell.has-files .upload-dropzone-icon {
  color: var(--color-brand-primary);
}

.upload-dropzone-feedback {
  max-width: 100%;
  color: #1D4ED8;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  word-break: break-word;
}
.upload-dropzone-shell.is-dragover {
  border-color: #155DFC;
  background: #DBEAFE;
  box-shadow: 0 0 0 4px rgba(21, 93, 252, 0.08);
}

.upload-dropzone-shell.is-dragover .upload-dropzone-icon,
.upload-dropzone-shell.is-dragover .upload-dropzone-title {
  color: #155DFC;
}

.upload-progress-shell {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border: 1px solid #BFDBFE;
  border-radius: 0.95rem;
  background: #EFF6FF;
}

.upload-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.upload-progress-label,
.upload-progress-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1D4ED8;
}

.upload-progress-track {
  width: 100%;
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.18);
}

.upload-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563EB 0%, #60A5FA 100%);
  transition: width 0.18s ease;
}

.modal-submit-button {
  min-width: 8.2rem;
  background: var(--color-brand-primary);
}

.modal-submit-button:hover {
  background: var(--color-brand-primary-hover);
}
.search-live-summary {
  margin-top: 0.55rem;
  padding-left: 0.1rem;
  color: var(--color-text-secondary);
  font-size: 0.84rem;
  line-height: 1.4;
}

.empty-state-inline {
  margin: 0 var(--space-6) var(--space-6);
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--color-border-default);
  border-radius: var(--radius-xl);
  background: var(--color-bg-secondary);
}
.timeline-months {
  position: relative;
  padding-bottom: 0.25rem;
}

.timeline-months::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: calc(3.15rem - 3px);
  height: 2px;
  background: var(--color-neutral-200);
  pointer-events: none;
}

.timeline-month {
  position: relative;
  z-index: 1;
  min-width: 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-align: center;
}

.timeline-node {
  position: relative;
  z-index: 1;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: var(--color-neutral-200);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}
.study-card-meta > span:first-child {
  font-size: 1rem;
  font-weight: 500;
}
.study-card[hidden] {
  display: none !important;
}
.app-header {
  padding-top: 0;
}
html,
body {
  background: #F5F7FB;
}

.app-shell {
  background: var(--color-bg-primary);
}
body.app-body {
  margin: 0 !important;
  padding: 0 !important;
}

body.app-body > .app-shell {
  margin-top: 0 !important;
  padding-top: 104px !important;
}

.app-shell,
.app-header {
  margin-top: 0 !important;
}
.app-header {
  padding-top: var(--space-6) !important;
  padding-bottom: var(--space-6) !important;
}

.admin-shell {
  padding: var(--space-6);
}

.admin-header-card,
.admin-hero-card,
.admin-module-card,
.admin-table-card,
.admin-doctor-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.admin-header-card,
.admin-header-row,
.admin-hero-card,
.admin-doctor-card,
.admin-doctor-main,
.admin-header-actions,
.admin-user-chip,
.admin-doctor-actions {
  display: flex;
  align-items: center;
}

.admin-header-card,
.admin-header-row,
.admin-hero-card,
.admin-doctor-card {
  justify-content: space-between;
  gap: var(--space-4);
}

.admin-header-card,
.admin-hero-card,
.admin-table-card {
  padding: 1.5rem;
}

.admin-header-row {
  margin-bottom: var(--space-4);
}

.admin-header-actions {
  gap: var(--space-3);
  flex-wrap: wrap;
}

.admin-user-chip {
  gap: var(--space-3);
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--color-border-default);
  border-radius: 999px;
  background: var(--color-bg-tertiary);
}

.admin-hero-card {
  margin-top: var(--space-4);
  margin-bottom: var(--space-6);
}

.admin-hero-meta,
.admin-grid,
.admin-doctor-list,
.admin-module-meta {
  display: flex;
}

.admin-hero-meta {
  gap: var(--space-3);
  flex-wrap: wrap;
}

.admin-stat-tile {
  min-width: 10rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.admin-stat-tile strong {
  font-size: 1.5rem;
}

.admin-grid,
.admin-doctor-list {
  flex-direction: column;
  gap: var(--space-4);
}

.admin-module-card {
  padding: 1.5rem;
}

.admin-module-card-muted {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
}

.admin-bullet-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--color-text-secondary);
}

.admin-bullet-list li + li {
  margin-top: 0.45rem;
}

.admin-table-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.admin-doctor-card {
  padding: 1rem 1.15rem;
}

.admin-doctor-main {
  gap: var(--space-4);
}

.admin-avatar-shell {
  width: 4.5rem;
  height: 4.5rem;
}

.admin-doctor-name {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.admin-form-grid {
  grid-template-columns: minmax(0, 1fr) 18rem;
}

@media (max-width: 980px) {
  .admin-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .admin-shell {
    padding: var(--space-4);
  }

  .admin-header-card,
  .admin-hero-card,
  .admin-doctor-card,
  .admin-header-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
.file-preview-modal-card {
  width: min(100% - 2rem, 800px);
}

.file-preview-title {
  font-size: 1.35rem;
}

.file-preview-body {
  min-height: 24rem;
  border: 1px solid var(--color-border-default);
  border-radius: 1rem;
  background: #F8FAFC;
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.file-preview-frame,
.file-preview-image,
.file-preview-video {
  width: 100%;
  height: 62vh;
  border: 0;
  display: block;
  background: #FFFFFF;
}

.file-preview-image {
  object-fit: contain;
}

.file-preview-video {
  object-fit: contain;
}

.copy-field-shell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.copy-field-shell .modal-input {
  flex: 1 1 auto;
}

.file-preview-empty {
  min-height: 24rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}
.file-tile-button {
  width: 100%;
  border: 1px solid var(--color-border-default);
  cursor: pointer;
  text-align: left;
}

.file-tile-button:hover {
  border-color: var(--color-brand-primary);
  box-shadow: 0 10px 24px rgba(21, 93, 252, 0.08);
}

.file-tile-action {
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
}
.external-link-tile {
  align-items: flex-start;
}

.external-link-content {
  flex: 1;
  align-items: flex-start;
}

.external-link-copy {
  min-width: 0;
  flex: 1;
}

.external-link-icon {
  flex: 0 0 auto;
}

.external-link-url {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.5;
}

.external-link-tile .file-tile-action {
  flex: 0 0 auto;
  margin-top: 0.15rem;
}

.file-gallery-tile {
  align-items: center;
}

.file-gallery-stack {
  width: 5rem;
  height: 5rem;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid rgba(147, 197, 253, 0.5);
  border-radius: 1rem;
  background: linear-gradient(135deg, #EFF6FF 0%, #F8FBFF 100%);
  overflow: hidden;
}

.file-gallery-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  border-radius: 0.7rem;
  overflow: hidden;
  background: #FFFFFF;
}

.file-gallery-thumb .file-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.study-youtube-shell {
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid var(--color-border-default);
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.study-youtube-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}
.timeline-strip-header .link-action {
  display: none;
}

.timeline-month-meta {
  font-size: 0.98rem;
  line-height: 1.15;
}
.timeline-month.is-selected .timeline-month-label {
  color: #0F4FD6;
}

.sidebar-summary-action {
  margin-top: var(--space-4);
}

.sidebar-summary-button {
  width: 100%;
}

.sidebar-patient-hero {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: var(--space-4);
  padding: 0.2rem 0;
}

.sidebar-patient-avatar {
  width: 4.5rem;
  height: 4.5rem;
  flex: 0 0 auto;
  border-radius: 1.1rem;
  object-fit: cover;
  border: 1px solid var(--color-border-default);
  box-shadow: var(--shadow-sm);
  background: #fff;
}

.sidebar-patient-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-study-consultation-light), var(--color-study-imaging-light));
  color: var(--color-brand-primary);
  font-size: 1.5rem;
  font-weight: 700;
}

.sidebar-patient-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-patient-meta strong {
  font-size: 1rem;
  line-height: 1.25;
}

.sidebar-patient-meta span {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  overflow-wrap: anywhere;
}

.doctor-contact-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.doctor-contact-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  background: #fff;
}

.doctor-contact-item span {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.4;
}

.doctor-contact-link {
  color: var(--color-brand-primary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.doctor-contact-action {
  margin-top: 0.35rem;
}

.doctor-magic-link-card {
  margin-top: 0.65rem;
  padding: 0.75rem;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 0.95rem;
  background: rgba(239, 246, 255, 0.78);
}

.doctor-magic-link-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.doctor-magic-link-header strong {
  font-size: 0.9rem;
}

.jpeg-series-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.jpeg-series-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.jpeg-series-group {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 8.5rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--color-border-default);
  border-radius: 1rem;
  background: #fff;
}

.jpeg-series-group strong {
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  line-height: 1.35;
}

.jpeg-series-group span {
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
}

.jpeg-series-group.is-active {
  border-color: var(--color-brand-primary);
  background: #EFF6FF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.jpeg-series-toolbar,
.jpeg-series-actions,
.jpeg-series-counter {
  display: flex;
  align-items: center;
}

.jpeg-series-toolbar {
  justify-content: space-between;
  gap: var(--space-3);
}

.jpeg-series-actions {
  gap: var(--space-2);
}

.jpeg-series-counter {
  gap: 0.35rem;
  color: var(--color-text-secondary);
}

.jpeg-series-stage {
  position: relative;
  min-height: 32rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 4rem;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  background: #0F172A;
  overflow: hidden;
}

.jpeg-series-main-image {
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border-radius: 0.9rem;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.34);
}

.jpeg-series-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #0F172A;
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
}

.jpeg-series-nav-left {
  left: 1rem;
}

.jpeg-series-nav-right {
  right: 1rem;
}

.jpeg-series-caption {
  color: var(--color-text-secondary);
}

.jpeg-series-study-date {
  margin-top: 0.35rem;
}

.jpeg-series-pagination,
.jpeg-series-pagination-label {
  display: flex;
  align-items: center;
}

.jpeg-series-pagination {
  justify-content: space-between;
  gap: var(--space-3);
}

.jpeg-series-pagination-label {
  gap: 0.35rem;
  color: var(--color-text-secondary);
}

.jpeg-series-thumb-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: var(--space-2);
  max-height: 18rem;
  overflow: auto;
}

.jpeg-series-thumb {
  padding: 0.25rem;
  border: 1px solid var(--color-border-default);
  border-radius: 0.9rem;
  background: #fff;
}

.jpeg-series-thumb.is-active {
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.jpeg-series-thumb img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  border-radius: 0.7rem;
}

@media (max-width: 720px) {
  .jpeg-series-brand-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .jpeg-series-stage {
    min-height: 18rem;
    padding: 1rem 3.25rem;
  }

  .jpeg-series-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .jpeg-series-thumb-strip {
    grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  }
}
