/* ============================================================
   DLTS — Diş Laboratuvarı Ortodonti Takip Sistemi
   Design System & Component Library
   ============================================================ */

/* ------------------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
   ------------------------------------------------------------ */
:root {
  /* Colors — base surfaces */
  --color-bg: #FAF9F7;
  --color-surface: #FFFFFF;
  --color-border: #E5E0D8;
  --color-border-focus: #E8770A;

  /* Primary — Orange */
  --color-primary: #E8770A;
  --color-primary-dark: #C45F00;
  --color-primary-light: #FFF4E8;
  --color-primary-ring: rgba(232, 119, 10, 0.18);

  /* Text */
  --color-text-primary: #1E1A16;
  --color-text-secondary: #6B5F52;
  --color-text-muted: #9D8E7E;
  --color-text-inverse: #FFFFFF;

  /* Status — Success */
  --color-success: #059669;
  --color-success-bg: #ECFDF5;
  --color-success-border: #A7F3D0;

  /* Status — Warning (amber/gold, distinct from primary orange) */
  --color-warning: #B45309;
  --color-warning-bg: #FFFBEB;
  --color-warning-border: #FDE68A;

  /* Status — Danger */
  --color-danger: #DC2626;
  --color-danger-bg: #FEF2F2;
  --color-danger-border: #FECACA;

  /* Status — Info */
  --color-info: #0891B2;
  --color-info-bg: #ECFEFF;
  --color-info-border: #A5F3FC;

  /* Status — Pending */
  --color-pending: #7C3AED;
  --color-pending-bg: #F5F3FF;
  --color-pending-border: #DDD6FE;

  /* Sidebar — dark warm-slate */
  --sidebar-bg: #1C1814;
  --sidebar-text: #D4C8BC;
  --sidebar-text-muted: #7A6A5A;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: rgba(232, 119, 10, 0.20);
  --sidebar-active-text: #FFB264;
  --sidebar-width: 240px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 13px;
  --font-size-base: 14px;
  --font-size-md: 15px;
  --font-size-lg: 17px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.10), 0 4px 10px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Topbar */
  --topbar-height: 60px;
}


/* ------------------------------------------------------------
   2. Reset & Base
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text-primary);
}

/* ------------------------------------------------------------
   3. Layout — App Shell
   ------------------------------------------------------------ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition-slow);
}

/* Main wrapper — offset by sidebar */
.main-wrapper {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

.topbar-user {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* Page Content */
.page-content {
  flex: 1;
  padding: var(--space-8) var(--space-8);
}

/* ------------------------------------------------------------
   4. Sidebar Components
   ------------------------------------------------------------ */
.sidebar-brand {
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.brand-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}

.brand-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: #F1F5F9;
  display: block;
  line-height: 1.2;
}

.brand-sub {
  font-size: var(--font-size-xs);
  color: var(--sidebar-text-muted);
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.sidebar a:hover {
  text-decoration: none !important;
}

.nav-section {
  display: flex;
  flex-direction: column;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-text-muted);
  padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px var(--space-4);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: #F1F5F9;
  text-decoration: none;
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--color-primary);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.nav-label {
  flex: 1;
}

/* Sidebar User */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.15);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 700;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: #F1F5F9;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: var(--font-size-xs);
  color: var(--sidebar-text-muted);
  display: block;
}

.user-logout {
  font-size: 18px;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
  text-decoration: none;
  padding: var(--space-1);
}

.user-logout:hover {
  color: var(--color-danger);
}

/* Hamburger / Overlay */
.hamburger-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-secondary);
  border-radius: 2px;
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 90;
}

/* ------------------------------------------------------------
   5. Cards
   ------------------------------------------------------------ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.card-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--color-text-primary);
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

#savedPdfsCard {
  margin-top: 20px;
}

/* Stat Cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card-icon {
  font-size: 28px;
  margin-bottom: var(--space-3);
}

.stat-card-value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.stat-card-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.primary::after {
  background: var(--color-primary);
}

.stat-card.success::after {
  background: var(--color-success);
}

.stat-card.warning::after {
  background: var(--color-warning);
}

.stat-card.info::after {
  background: var(--color-info);
}

.stat-card.danger::after {
  background: var(--color-danger);
}

/* ------------------------------------------------------------
   6. Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px var(--space-4);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--transition-fast), box-shadow var(--transition-fast),
    border-color var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: 0 1px 3px rgba(232, 119, 10, 0.30);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  box-shadow: 0 4px 12px rgba(232, 119, 10, 0.38);
}

.btn-success {
  background: var(--color-success);
  color: white;
  border-color: var(--color-success);
}

.btn-success:hover {
  background: #047857;
  border-color: #047857;
}

.btn-danger {
  background: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background: #B91C1C;
  border-color: #B91C1C;
}

.btn-warning {
  background: var(--color-warning);
  color: white;
  border-color: var(--color-warning);
}

.btn-warning:hover {
  background: #B45309;
}

.btn-outline {
  background: transparent;
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

.btn-outline:hover {
  background: var(--color-bg);
  border-color: var(--color-border-focus);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--color-bg);
  color: var(--color-text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: var(--font-size-xs);
}

.btn-lg {
  padding: 12px var(--space-6);
  font-size: var(--font-size-md);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

/* Hasta Dosyaları seçim çubuğu — Aktar/Sil/Tümünü Seç/Seçimi Kaldır
   butonları görünürlük durumu değiştiğinde (JS ile display + opacity
   birlikte yönetilir) sert bir kesme yerine yumuşak bir fade ile
   görünüp kaybolsun. */
.file-sel-btn {
  transition: opacity 0.18s ease, transform 0.18s ease, background var(--transition-fast),
    box-shadow var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  flex: 0 0 auto;
}

/* Dar ekranlarda butonlar sıkışıp metni kesilmesin (ör. "Seçilenleri Sil")
   diye küçülmek yerine satır sarar — mobil kurallar aşağıdaki media query'de. */
#fileSelectionBar {
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* ------------------------------------------------------------
   7. Forms
   ------------------------------------------------------------ */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.form-label .required {
  color: var(--color-danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 9px var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background: var(--color-surface);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.form-control:disabled {
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

select.form-control {
  cursor: pointer;
}

.form-control.is-invalid {
  border-color: var(--color-danger);
}

.form-error {
  font-size: var(--font-size-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

/* Checkbox */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.form-check-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
}

/* Tarih Girişi (gg.aa.yyyy) — native <input type="date"> öğesinin yerine
   assets/js/main.js (DateInputEnhancer) tarafından otomatik takılır. */
.date-input-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.date-input-text {
  padding-right: 34px !important;
  cursor: text;
}

.date-input-cal-btn {
  position: absolute;
  top: 1.5px;
  right: 1.5px;
  bottom: 1.5px;
  width: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  border-radius: 0 calc(var(--radius-md) - 1.5px) calc(var(--radius-md) - 1.5px) 0;
}

.date-input-cal-btn:hover {
  background: var(--color-bg);
}

.date-input-cal-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.date-input-calendar {
  position: fixed;
  width: 240px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
  /* odontogram.js, modal'ı (#globalModal) kendi popup'ının üstüne
     çıkarmak için z-index: 10000 !important enjekte ediyor — takvim
     bunun altında kalmasın diye o değerin üstünde tutuluyor. */
  z-index: 10050;
  font-size: var(--font-size-sm);
}

.dic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.dic-title {
  font-weight: 600;
  color: var(--color-text-primary);
}

.dic-nav {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  color: var(--color-text-secondary);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
}

.dic-nav:hover {
  background: var(--color-bg);
}

.dic-weekdays,
.dic-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}

.dic-weekdays span {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  padding: 2px 0;
}

.dic-day {
  padding: 6px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-primary);
}

.dic-day:not(.dic-empty):hover {
  background: var(--color-bg);
}

.dic-day.dic-empty {
  cursor: default;
}

.dic-day.dic-today {
  font-weight: 700;
  color: var(--color-primary);
}

.dic-day.dic-selected {
  background: var(--color-primary);
  color: #fff;
}

.dic-footer {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.dic-today-btn {
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
}

.dic-today-btn:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------
   8. Tables
   ------------------------------------------------------------ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

thead {
  background: var(--color-bg);
}

th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-primary);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:nth-child(even) {
  background: var(--color-bg);
}

tbody tr:hover {
  background: var(--color-primary-light);
}

/* Gizli hastalar: kilit açıkken listede farklı (gri) satır rengiyle ayırt edilir */
tbody tr.patient-row-hidden {
  background: #EDEAE4;
}

.table-summary {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.table-summary strong {
  color: var(--color-text-primary);
}

/* ------------------------------------------------------------
   9. Badges
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success-border);
}

.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid var(--color-warning-border);
}

.badge-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid var(--color-danger-border);
}

.badge-info {
  background: var(--color-info-bg);
  color: var(--color-info);
  border: 1px solid var(--color-info-border);
}

.badge-pending {
  background: var(--color-pending-bg);
  color: var(--color-pending);
  border: 1px solid var(--color-pending-border);
}

.badge-secondary {
  background: #F5F0EB;
  color: #6B5F52;
  border: 1px solid #E5DDD4;
}

.badge-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid rgba(232, 119, 10, 0.25);
}

/* ------------------------------------------------------------
   10. Modal
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: var(--space-4);
  animation: fadeIn var(--transition-base) ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Bildirimler / Aktivite Logları: polling ile canlı eklenen satır/öğe */
@keyframes liveItemIn {
  0% {
    opacity: 0;
    transform: translateY(-8px);
    background-color: var(--color-info-bg);
  }

  60% {
    opacity: 1;
    transform: translateY(0);
  }

  100% {
    background-color: transparent;
  }
}

.is-live-new {
  animation: liveItemIn 1.1s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp var(--transition-base) ease;
}

.modal-box.modal-sm {
  max-width: 400px;
}

.modal-box.modal-lg {
  max-width: 760px;
}

.modal-box.modal-xl {
  max-width: 1240px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--font-size-md);
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   11. Timeline (Treatment Stages)
   ------------------------------------------------------------ */
.timeline {
  position: relative;
  padding-left: 36px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--color-primary), var(--color-border));
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-5);
  animation: slideUp 0.3s ease forwards;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -34px;
  top: 4px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  border: 2px solid var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 1;
}

.timeline-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-base);
}

.timeline-content:hover {
  box-shadow: var(--shadow-sm);
}

.timeline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.timeline-stage-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-primary);
}

.timeline-date {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.timeline-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.timeline-meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

.timeline-empty {
  text-align: center;
  padding: var(--space-8);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

/* ------------------------------------------------------------
   12. Toast Notifications
   ------------------------------------------------------------ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 100000;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  pointer-events: auto;
  animation: toastIn 0.3s ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.toast-exit {
  animation: toastOut 0.25s ease forwards;
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
}

.toast-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-bottom: 2px;
}

.toast-msg {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.toast-success {
  border-left: 4px solid var(--color-success);
}

.toast-error {
  border-left: 4px solid var(--color-danger);
}

.toast-warning {
  border-left: 4px solid var(--color-warning);
}

.toast-info {
  border-left: 4px solid var(--color-info);
}

/* ZIP indirme durumu paneli — sağ alt köşe (toast ile aynı konum, ayrı bileşen
   çünkü metni yerinde güncelleyip tek pencerede hazırlanıyor/indiriliyor/
   tamamlandı adımlarını göstermesi gerekiyor). */
.dl-progress {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.dl-progress-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dl-progress-done {
  border-left: 4px solid var(--color-success);
}

.dl-progress-error {
  border-left: 4px solid var(--color-danger);
}

.dl-progress-spinner {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary, #4f46e5);
  border-radius: 50%;
  animation: dlProgressSpin 0.7s linear infinite;
}

.dl-progress-text {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dl-progress-cancel {
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs, 12px);
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  margin-left: auto;
}

.dl-progress-cancel:hover {
  color: var(--color-danger);
}

@keyframes dlProgressSpin {
  to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------
   13. Alerts
   ------------------------------------------------------------ */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  border: 1px solid;
  margin-bottom: var(--space-4);
}

.alert-success {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success);
}

.alert-danger {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
  color: var(--color-danger);
}

.alert-warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  color: var(--color-warning);
}

.alert-info {
  background: var(--color-info-bg);
  border-color: var(--color-info-border);
  color: var(--color-info);
}

/* ------------------------------------------------------------
   14. Page Header
   ------------------------------------------------------------ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.page-header-left p {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* ------------------------------------------------------------
   15. Patient Profile Layout
   ------------------------------------------------------------ */
.patient-hero {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.patient-hero-top {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.patient-avatar {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.patient-avatar-xs {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), #7C3AED);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.patient-avatar-xs[data-preview] {
  cursor: zoom-in;
}

/* Ad Soyad sütununda mini profil resmine hover'da beliren büyütülmüş önizleme */
.avatar-hover-preview {
  position: fixed;
  width: 130px;
  height: 130px;
  border-radius: var(--radius-full);
  background-size: cover;
  background-position: center;
  background-color: var(--color-surface);
  border: 3px solid var(--color-surface);
  box-shadow: var(--shadow-xl);
  z-index: 100000;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.avatar-hover-preview-visible {
  opacity: 1;
  transform: scale(1);
}

.patient-avatar-wrap {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.patient-avatar-wrap.uploading::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: var(--radius-full);
  background: conic-gradient(
    from 90deg,
    var(--color-primary) calc(var(--upload-progress, 0) * 3.6deg),
    var(--color-border) 0deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  transition: background 0.08s linear;
  pointer-events: none;
}

.patient-avatar-wrap.uploading .patient-avatar {
  opacity: 0.55;
}

.patient-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s;
}

.patient-avatar-wrap:hover .patient-avatar-overlay {
  opacity: 1;
}

.patient-hero-info h2 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.patient-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.patient-hero-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.patient-mini-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-4);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}

.mini-stat {
  text-align: center;
  padding: var(--space-3);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.mini-stat-value {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-primary);
  display: block;
}

.mini-stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
  display: block;
}

/* Section Tabs */
.section-tabs {
  display: flex;
  gap: var(--space-1);
  position: relative;
  margin-bottom: var(--space-6);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Taban çizgi — tüm sekme barının altında sabit, tam genişlikte. Aktif
   sekmenin göstergesi (.section-tab.active::after) tam bunun üzerine, aynı
   satıra gelecek şekilde konumlanır (tek çizgi gibi görünsün, iki ayrı
   çizgi üst üste değil). */
.section-tabs::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.section-tab {
  position: relative;
  padding: 10px var(--space-5);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast);
  background: none;
  border: none;
  font-family: var(--font-family);
}

.section-tab:hover {
  color: var(--color-primary);
}

.section-tab.active {
  color: var(--color-primary);
  font-weight: 600;
}

.section-tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--color-primary);
  z-index: 1;
}

.section-panel {
  display: none;
}

.section-panel.active {
  display: block;
}

/* ------------------------------------------------------------
   16. Search & Filter Bar
   ------------------------------------------------------------ */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 15px;
  pointer-events: none;
}

.search-input-wrapper .form-control {
  padding-left: 34px;
}

/* Hasta listesi — arama & filtre kartı */
.patients-filter-toolbar {
  gap: var(--space-4);
  flex-wrap: wrap;
}

.patients-filter-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.patients-filter-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.patients-filter-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.patients-filter-reset-icon {
  font-size: 13px;
  line-height: 1;
}

.patients-filter-reset:not(:disabled):hover {
  color: var(--color-danger);
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
}

.patients-filter-reset:disabled {
  opacity: .45;
  cursor: default;
}

.patients-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.patients-filter-search {
  flex: 2;
  min-width: 240px;
}

.patients-filter-search .form-control {
  height: 40px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 170px;
}

.filter-field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Özel ok ikonlu select — tarayıcı varsayılanı yerine marka tutarlı bir görünüm */
.filter-select {
  height: 40px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--color-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239D8E7E' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

.patients-sort-group {
  display: flex;
  align-items: stretch;
}

.patients-sort-group .filter-select {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
  flex: 1;
  min-width: 0;
}

.patients-sort-dir-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  flex-shrink: 0;
  border: 1.5px solid var(--color-border);
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.patients-sort-dir-btn:hover {
  border-color: var(--color-border-focus);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

/* ------------------------------------------------------------
   17. Pagination
   ------------------------------------------------------------ */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  justify-content: center;
  padding: var(--space-4) 0;
}

.page-btn {
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
}

.page-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.page-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ------------------------------------------------------------
   18. Loading Spinner
   ------------------------------------------------------------ */
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  gap: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

/* ------------------------------------------------------------
   19. Empty State
   ------------------------------------------------------------ */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-6);
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: var(--font-size-sm);
}

/* ------------------------------------------------------------
   20. Login Page
   ------------------------------------------------------------ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1C1814 0%, #2D1E0F 50%, #1A1008 100%);
  padding: var(--space-6);
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-6);
}

.login-logo-icon {
  font-size: 48px;
  display: block;
  margin-bottom: var(--space-3);
}

.login-logo h1 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.login-logo p {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* ------------------------------------------------------------
   20b. Auth Layout — split brand/form screen (login.php)
   ------------------------------------------------------------ */
.auth-shell {
  min-height: 100vh;
  display: flex;
}

.auth-brand-panel {
  flex: 0 0 44%;
  max-width: 560px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 48px;
  background: linear-gradient(160deg, #1C1814 0%, #2D1E0F 55%, #1A1008 100%);
  color: #FFFFFF;
  overflow: hidden;
}

.auth-brand-panel::before,
.auth-brand-panel::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  will-change: transform;
}

.auth-brand-panel::before {
  width: 420px;
  height: 420px;
  background: rgba(232, 119, 10, 0.40);
  top: -140px;
  left: -60px;
  animation: authGlowOrbit1 24s ease-in-out infinite;
}

.auth-brand-panel::after {
  width: 320px;
  height: 320px;
  background: rgba(232, 119, 10, 0.22);
  bottom: -120px;
  left: 40px;
  animation: authGlowOrbit2 30s ease-in-out infinite;
}

@keyframes authGlowOrbit1 {
  0%   { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(220px, 60px) scale(1.1); }
  50%  { transform: translate(120px, 280px) scale(0.9); }
  75%  { transform: translate(-60px, 120px) scale(1.05); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes authGlowOrbit2 {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(160px, -80px) scale(1.15); }
  66%  { transform: translate(260px, -260px) scale(0.9); }
  100% { transform: translate(0, 0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-brand-panel::before,
  .auth-brand-panel::after {
    animation: none;
  }
}

.auth-brand-top,
.auth-brand-mid,
.auth-brand-footer {
  position: relative;
  z-index: 1;
}

.auth-brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand-logo-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(232, 119, 10, 0.45));
}

.auth-brand-logo-text {
  font-family: 'Sora', var(--font-family);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.auth-brand-title {
  font-family: 'Sora', var(--font-family);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.35;
  margin: 40px 0 16px;
  max-width: 400px;
  color: #FFFFFF;
}

.auth-brand-desc {
  font-size: var(--font-size-md);
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.6;
  max-width: 380px;
  margin-bottom: 32px;
}

.auth-brand-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0;
  margin: 0;
}

.auth-brand-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.88);
}

.auth-brand-features .auth-feature-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(232, 119, 10, 0.22);
  color: #FFB264;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-brand-footer {
  font-size: var(--font-size-xs);
  color: rgba(255, 255, 255, 0.4);
}

.auth-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--color-bg);
}

.auth-form-wrap {
  width: 100%;
  max-width: 380px;
}

.auth-form-brand-mobile {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-form-header {
  margin-bottom: 32px;
}

.auth-form-header h1 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}

.auth-form-header p {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.auth-input-wrap {
  position: relative;
}

.auth-input-wrap .form-control {
  padding-left: 42px;
}

.auth-input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  display: flex;
  pointer-events: none;
}

.auth-input-wrap.has-toggle .form-control {
  padding-right: 42px;
}

.auth-input-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--color-text-muted);
  display: flex;
  border-radius: var(--radius-sm);
}

.auth-input-toggle:hover {
  color: var(--color-text-secondary);
  background: var(--color-bg);
}

.auth-form-footer {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 28px;
}

@media (max-width: 900px) {
  .auth-brand-panel {
    display: none;
  }
  .auth-form-brand-mobile {
    display: flex;
  }
}

@media (max-width: 480px) {
  .auth-form-panel {
    padding: var(--space-4);
  }
}

/* ------------------------------------------------------------
   21. Dashboard Grid
   ------------------------------------------------------------ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-6);
  margin-top: var(--space-6);
}

.dashboard-grid > .card {
  min-width: 0;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------
   22. Status Color Dots
   ------------------------------------------------------------ */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.devam_ediyor {
  background: var(--color-info);
}

.status-dot.tamamlandi {
  background: var(--color-success);
}

.status-dot.tekrar {
  background: var(--color-warning);
}

.status-dot.beklemede {
  background: var(--color-pending);
}

.status-dot.iptal {
  background: var(--color-danger);
}

/* ------------------------------------------------------------
   23. Utility Classes
   ------------------------------------------------------------ */
.text-primary {
  color: var(--color-text-primary);
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-muted {
  color: var(--color-text-muted);
}

.text-success {
  color: var(--color-success);
}

.text-danger {
  color: var(--color-danger);
}

.text-warning {
  color: var(--color-warning);
}

.text-info {
  color: var(--color-info);
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.font-medium {
  font-weight: 500;
}

.text-sm {
  font-size: var(--font-size-sm);
}

.text-xs {
  font-size: var(--font-size-xs);
}

.text-lg {
  font-size: var(--font-size-lg);
}

.d-flex {
  display: flex;
}

.align-center {
  align-items: center;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.flex-wrap {
  flex-wrap: wrap;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-3 {
  margin-bottom: var(--space-3);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-5 {
  margin-bottom: var(--space-5);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-6 {
  margin-top: var(--space-6);
}

.w-full {
  width: 100%;
}

.text-center {
  text-align: center;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-5) 0;
}

/* Action buttons group in table */
.action-btns {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

/* Retainer section */
.retainer-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

/* ------------------------------------------------------------
   24. Responsive — Mobile
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .hamburger-btn {
    display: flex;
  }

  .section-tabs {
    flex-direction: column;
    gap: 2px;
  }

  .section-tabs::after {
    display: none;
  }

  .section-tab {
    width: 100%;
    text-align: left;
    white-space: normal;
    border-left: 3px solid transparent;
    border-radius: var(--radius-sm);
  }

  .section-tab.active {
    border-left-color: var(--color-primary);
    background: var(--color-primary-light);
  }

  .section-tab.active::after {
    display: none;
  }

  .page-content {
    padding: var(--space-5) var(--space-4);
  }

  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .patient-hero-top {
    flex-direction: column;
  }

  .patient-avatar-wrap {
    align-self: center;
  }

  /* Ad Soyad, Hasta Kodu, Tedavi Etiketi ve Tedavi Durumu her biri kendi
     satırında, ortalı — .d-flex ve .patient-hero-meta sarmalayıcıları
     "display:contents" ile kaldırılıp hepsi tek bir dikey akışa (bu kartın
     kendisi) katılır; sıra "order" ile belirlenir, DOM hiç değişmez. */
  .patient-hero-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    align-self: stretch;
    text-align: center;
    gap: var(--space-2);
  }

  .patient-hero-info .d-flex {
    display: contents;
  }

  .patient-hero-info h2 {
    order: -4;
  }

  .hero-badge-dept {
    order: -2;
  }

  .hero-badge-status,
  .patient-status-badge {
    order: -1;
  }

  .patient-hero-meta {
    display: contents;
  }

  .patient-hero-meta span:first-child {
    order: -3;
  }

  .patient-hero-back {
    align-self: center;
  }

  .patient-mini-stats {
    grid-template-columns: 1fr;
  }

  .topbar-user {
    display: none;
  }

  .patients-table th:not(:nth-child(2)):not(:last-child),
  .patients-table td:not(:nth-child(2)):not(:last-child) {
    display: none;
  }
}

@media (max-width: 480px) {
  .stat-cards {
    grid-template-columns: 1fr;
  }

  .patient-mini-stats {
    grid-template-columns: 1fr;
  }

  .modal-box {
    border-radius: var(--radius-lg);
  }

  .login-card {
    padding: var(--space-6);
  }
}

/* ── Aranabilir Ülke Seçici ─────────────────────────────── */
.country-select-wrap {
  position: relative;
}

.country-dropdown {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  max-height: 220px;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
}

.country-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text);
  transition: background 0.12s;
}

.country-item:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}


/* ========================================================== */
/* Hasta Dosyaları - Galeri, Drop Zone, Lightbox              */
/* ========================================================== */

/* Klasör breadcrumb — masaüstünde tam yol, mobilde Kök › … › Seçili */
.bc-full {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}

.bc-mobile {
  display: none;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.bc-mobile span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Klasör Gezgini üst çubuğundaki işlem butonları — masaüstünde tek tek,
   mobilde tek bir "☰" menüsünün altında toplanır */
.file-actions-full {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.file-actions-mobile {
  display: none;
  position: relative;
}

.file-actions-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  min-width: 230px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
}

.file-actions-dropdown.open {
  display: flex;
}

.file-actions-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
}

.file-actions-dropdown button:hover {
  background: var(--color-bg);
}

/* Seçim çubuğundaki "☰ İşlemler" menüsü — İndir/Aktar/Profil Fotoğrafı Yap/
   Tarihi Düzenle/Seçilenleri Sil butonları tek tek dizilince alana sığmadığı
   için .file-actions-dropdown deseni yeniden kullanılır. */
.file-sel-menu-wrap {
  position: relative;
  flex: 0 0 auto;
}

.file-sel-dropdown {
  min-width: 210px;
}

.file-sel-dropdown button.danger {
  color: var(--color-danger);
  border-top: 1px solid var(--color-border);
  margin-top: 4px;
  padding-top: 10px;
}

.file-sel-dropdown button.danger:hover {
  background: var(--color-danger-bg);
}

@media (max-width: 768px) {
  .bc-full {
    display: none;
  }

  .bc-mobile {
    display: flex;
  }

  .file-actions-full {
    display: none;
  }

  .file-actions-mobile {
    display: inline-flex;
  }

  /* Seçim çubuğu: breadcrumb/☰ satırının altına, tam genişlikte ayrı bir
     satır olarak düşer; sayı etiketi de kendi satırını alır ki butonlar
     "12 dosya seçildi" metniyle aynı dar satıra sıkışıp üst üste binmesin. */
  #fileSelectionBar {
    flex-basis: 100%;
    gap: 8px;
  }

  #fileSelectionCount {
    flex-basis: 100%;
    white-space: nowrap;
  }

  /* 3 Boyutlu Dosyalar satırı: isim/tarih/ikonlar tek satırda sıkışıp iç içe
     geçmesin diye ikinci satıra (aksiyon butonları) sarılır — checkbox+ikon+
     isim/meta ilk satırda kalır, "flex-basis:100%" aksiyonları zorla yeni bir
     flex satırına düşürür. */
  .file-3d-row {
    flex-wrap: wrap;
  }

  .file-3d-meta {
    flex-wrap: wrap;
  }

  .file-3d-actions {
    flex-basis: 100%;
    justify-content: flex-end;
    margin-top: 6px;
  }
}

/* Drop Zone */
.file-drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--color-bg);
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 5%, transparent);
}

.file-drop-zone-disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.file-drop-zone-disabled:hover {
  border-color: var(--color-border);
  background: none;
}

.file-drop-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.file-drop-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.file-drop-hint {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin: 0;
}

/* File Groups */
.file-group {
  margin-bottom: 28px;
}

.file-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* File Card */
.file-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
  transition: box-shadow 0.18s, transform 0.18s;
  display: flex;
  flex-direction: column;
}

.file-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.file-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--color-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

.file-card-thumb:hover img {
  transform: scale(1.04);
}

.file-card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s;
}

.file-card-thumb:hover .file-card-overlay {
  opacity: 1;
}

/* Video thumb */
.file-card-video {
  background: #1a0f07;
  cursor: pointer;
}

.file-play-btn {
  font-size: 42px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 12px rgba(0, 0, 0, .5);
  position: absolute;
  z-index: 1;
}

/* 3D Model thumb */
.file-card-model {
  background: linear-gradient(135deg, #2d1a0f, #3d2510);
}

.file-model-icon {
  font-size: 46px;
}

.file-model-ext {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  margin-top: 4px;
  letter-spacing: 1px;
}

/* Card Info */
.file-card-info {
  padding: 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-card-meta {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.file-card-desc {
  font-size: 11px;
  color: var(--color-text-secondary);
  font-style: italic;
}

.file-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.btn-xs {
  padding: 3px 9px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  height: auto;
  line-height: 1.6;
}

.btn-log-detail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.15s, border-color 0.15s;
}

.btn-log-detail:hover {
  background: var(--color-bg);
  border-color: var(--color-primary, #4f46e5);
}

/* Hasta Dosyaları: tarihli klasör kutucuğundaki not rozeti + tıklanınca açılan not balonu */
.folder-note-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--color-pending-border);
  border-radius: 50%;
  background: var(--color-pending-bg);
  color: var(--color-pending);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.folder-note-tip {
  position: fixed;
  z-index: 1000;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-text, #1e293b);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  animation: fadeIn .12s ease;
}

/* Seçili dosya kartı/satırı (çoklu seçim çubuğu ile birlikte kullanılır) */
.file-card.file-row-selected,
.file-3d-row.file-row-selected {
  border-color: var(--color-primary, #4f46e5);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

/* 3 Boyutlu Dosyalar listesi — kart görünümlü satırlar */
.file-3d-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-3d-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  cursor: pointer;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}

.file-3d-row:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--color-primary, #4f46e5);
}

.file-3d-checkbox {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.file-3d-checkbox input {
  width: 17px;
  height: 17px;
  cursor: pointer;
}

.file-3d-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #2d1a0f, #3d2510);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.file-3d-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.file-3d-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-3d-meta {
  font-size: 11px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-3d-ext-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
}

.file-3d-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Lightbox */
.file-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.file-lightbox-inner {
  position: relative;
  max-width: min(96vw, 1100px);
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.file-lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.15s;
}

.file-lightbox-close:hover {
  background: var(--color-danger, #ef4444);
  color: #fff;
}

.file-lightbox-caption {
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
  max-width: 80%;
  word-break: break-all;
}

.file-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s, transform 0.15s;
}

.file-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.28);
}

.file-lightbox-nav-prev { left: 16px; }
.file-lightbox-nav-next { right: 16px; }

.file-lightbox-nav[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .file-lightbox-nav { width: 42px; height: 42px; font-size: 24px; }
  .file-lightbox-nav-prev { left: 6px; }
  .file-lightbox-nav-next { right: 6px; }
}

/* Lightbox görüntü yakınlaştırma (zoom / pan) */
.file-lightbox-content {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.file-lightbox-img {
  cursor: zoom-in;
  transition: transform 0.08s linear;
  user-select: none;
  -webkit-user-drag: none;
}

.file-lightbox-content.is-panning .file-lightbox-img {
  transition: none;
}

.file-lightbox-zoom-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 92vw;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 5px 10px;
  z-index: 3;
}

.lb-tool-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lb-tool-sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.18);
}

.file-lightbox-zoom-bar .lb-tool-label {
  font-size: 13px;
  color: #cbd5e1;
  min-width: auto;
}

.file-lightbox-zoom-bar button:not(.btn) {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.file-lightbox-zoom-bar button:not(.btn):hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Kaydet — toolbar'da sabit bir yer kaplar (görünüp kaybolarak diğer
   butonları kaydırmasın diye), değişiklik yapılana kadar sadece soluk/pasif
   görünür; herhangi bir düzenleme yapılınca renklenip tıklanabilir olur. */
.lb-save-btn {
  color: rgba(255, 255, 255, 0.3);
}

.lb-save-btn:disabled {
  cursor: default;
}

.lb-save-btn:not(:disabled) {
  background: var(--color-primary, #4f46e5);
  color: #fff;
}

.lb-save-btn:not(:disabled):hover {
  background: var(--color-primary-dark, #4338ca);
}

/* Serbest döndürme (straighten) cetveli */
.lb-straighten-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0 2px;
}

.lb-straighten-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 150px;
  height: 22px;
  margin: 0;
  background:
    repeating-linear-gradient(
      to right,
      rgba(255, 255, 255, 0.35) 0,
      rgba(255, 255, 255, 0.35) 1px,
      transparent 1px,
      transparent 9px
    );
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 10px;
  border-radius: 3px;
  cursor: pointer;
  outline: none;
}

.lb-straighten-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 3px;
  height: 22px;
  border-radius: 2px;
  background: #fff;
  cursor: grab;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.lb-straighten-slider::-moz-range-thumb {
  width: 3px;
  height: 22px;
  border: none;
  border-radius: 2px;
  background: #fff;
  cursor: grab;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.lb-straighten-slider::-moz-range-track {
  background: transparent;
  height: 22px;
}

/* Kırpma araç çubuğu — koyu zemin üzerinde .btn-outline'ın varsayılan (koyu
   metin/şeffaf zemin) hâli okunmaz olurdu, bu yüzden burada geçersiz kılınır. */
#lbCropToolbar .btn-outline {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}
#lbCropToolbar .btn-outline:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Kırpma overlay'i */
#lbCropOverlay {
  position: fixed;
  z-index: 20;
  overflow: hidden;
}

.lb-crop-rect {
  position: absolute;
  box-sizing: border-box;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  cursor: move;
  touch-action: none;
}

.lb-crop-grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.lb-crop-grid-v1, .lb-crop-grid-v2 {
  top: 0;
  bottom: 0;
  width: 1px;
}
.lb-crop-grid-v1 { left: 33.333%; }
.lb-crop-grid-v2 { left: 66.667%; }

.lb-crop-grid-h1, .lb-crop-grid-h2 {
  left: 0;
  right: 0;
  height: 1px;
}
.lb-crop-grid-h1 { top: 33.333%; }
.lb-crop-grid-h2 { top: 66.667%; }

.lb-crop-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 1.5px solid rgba(0, 0, 0, 0.45);
  border-radius: 3px;
  z-index: 2;
}
.lb-crop-handle-nw { left: -7px; top: -7px; cursor: nwse-resize; }
.lb-crop-handle-ne { right: -7px; top: -7px; cursor: nesw-resize; }
.lb-crop-handle-sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.lb-crop-handle-se { right: -7px; bottom: -7px; cursor: nwse-resize; }

.file-lightbox-zoom-bar span {
  font-size: 12px;
  color: #e2e8f0;
  min-width: 42px;
  text-align: center;
}

/* Mesajlar + Görüşme Talepleri kartları (patient.php → Hasta Portalı sekmesi)
   yan yana — dar ekranda (768px altı) tek sütuna düşer, bkz. hemen altındaki
   mobil override. (Not: bu kural .section-24 mobil bloğunun İÇİNDE DEĞİL, burada
   tanımlanıyor çünkü CSS cascade'de aynı özgüllükteki kurallarda sonra gelen kazanır —
   media query'li kural dosyada bu temel kuraldan önce olsaydı hep ezilirdi.) */
.pm-pcr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  align-items: start;
}

@media (max-width: 768px) {
  .pm-pcr-grid {
    grid-template-columns: 1fr;
  }
}

/* Hasta Portalı Erişimi — E-posta ve Karekod artık ayrı iki kutu (bkz. patient.php). */
.ppa-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

@media (max-width: 768px) {
  .ppa-grid {
    grid-template-columns: 1fr;
  }
}

.ppa-box {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.ppa-box-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: var(--space-3);
}

/* Karekod yazdırma modalı — kutuya yapıştırılacak 4cm x 2cm etiket önizlemesi
   (bkz. patient.php → _ppaOpenQr / _ppaPrintQr). Fiziksel boyutları cm/mm
   birimiyle verildiği için ekrandaki önizleme, yazdırılan haliyle birebir eşleşir. */
.ppa-qr-label {
  width: 4cm;
  height: 2cm;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 0 0 1px var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5mm;
  padding: 1mm 2mm;
  box-sizing: border-box;
}

.ppa-qr-label-caption {
  font-size: 1.9mm;
  line-height: 1.15;
  text-align: center;
  color: #000;
}

.ppa-qr-canvas-wrap {
  width: 1.3cm;
  height: 1.3cm;
}

.ppa-qr-canvas-wrap img,
.ppa-qr-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Mesajlar kart başlığındaki Paylaş/Arşivle/Sohbeti Sil butonları — masaüstünde
   düz bir satır, dar ekranda (768px altı) tek bir "☰" menüsünün altında toplanır
   (bkz. .file-actions-dropdown ile aynı aç/kapa deseni, patient.php → Hasta Dosyaları). */
.pm-header-actions {
  position: relative;
}

.pm-header-actions-trigger {
  display: none;
}

.pm-header-actions-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .pm-header-actions-trigger {
    display: inline-flex;
  }

  .pm-header-actions-list {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    min-width: 200px;
    padding: 6px;
    flex-direction: column;
    gap: 2px;
  }

  .pm-header-actions-list.open {
    display: flex;
  }

  .pm-header-actions-list .btn {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ------------------------------------------------------------
   Hasta Mesajları (patient.php → "💬 Mesajlar" paneli)
   Hasta Portalı tarafındaki (assets/css/patient-portal.css) .pp-msg-*
   ile aynı görsel tasarım — iki ayrı sayfa/stylesheet olduğu için
   kurallar bilinçli olarak burada .pm- önekiyle tekrarlanır.
   ------------------------------------------------------------ */
.pm-thread {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 4px 14px;
  margin-bottom: 10px;
}

.pm-bubble {
  max-width: 70%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
}

.pm-mine {
  align-self: flex-end;
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.pm-theirs {
  align-self: flex-start;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  border-bottom-left-radius: 4px;
}

.pm-sender {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 3px;
  opacity: 0.75;
}

.pm-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.pm-time {
  font-size: 10px;
  margin-top: 5px;
  opacity: 0.65;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.pm-del-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  opacity: 0.7;
}

.pm-del-btn:hover {
  opacity: 1;
}

.pm-compose {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.pm-compose textarea {
  flex: 1;
  resize: vertical;
  min-height: 42px;
}

.pm-attach-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
}

.pm-attach-preview button {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-muted);
  padding: 0 2px;
}

.pm-attach-img {
  display: block;
  max-width: 220px;
  max-height: 220px;
  border-radius: 10px;
  margin-top: 6px;
  cursor: pointer;
}

.pm-attach-video {
  display: block;
  max-width: 240px;
  max-height: 240px;
  border-radius: 10px;
  margin-top: 6px;
}

.pm-attach-doc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 7px 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.pm-theirs .pm-attach-doc {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.pm-attach-progress-track {
  flex: 1;
  height: 6px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.pm-attach-progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 999px;
  transition: width 0.15s ease;
}

.pm-attach-progress-pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  min-width: 32px;
  text-align: right;
}

.pcr-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pcr-item {
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-bg);
  font-size: 13px;
}

.pcr-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.pcr-item-when {
  font-size: 13px;
  color: var(--color-text-primary);
  font-weight: 600;
}

.pcr-item-note,
.pcr-item-staff-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--color-text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.pcr-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
/* ================================================================
   25. Dashboard — Overview Redesign (index.php)
   ================================================================ */

/* Welcome banner */
.dash-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.dash-welcome-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0 0 4px;
}

.dash-welcome-sub {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin: 0;
}

.dash-welcome-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.dash-date-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.dash-date-pill-icon {
  font-size: 18px;
}

.dash-date-pill-main {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.2;
}

.dash-date-pill-sub {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.dash-clock {
  font-variant-numeric: tabular-nums;
}

.dash-clock-colon {
  animation: dash-clock-blink 1s step-start infinite;
}

@keyframes dash-clock-blink {
  50% {
    opacity: 0;
  }
}

/* Status stage row ("Tedavi Durumu Dağılımı") */
.status-stage-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.status-stage-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.status-stage-chip:hover {
  border-color: var(--color-border-focus);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.status-stage-chip--static {
  cursor: default;
}

.status-stage-chip--static:hover {
  border-color: var(--color-border);
  box-shadow: none;
}

.status-stage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-stage-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.status-stage-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.status-stage-count {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text-primary);
}

/* Main 2-column layout */
.dash-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-6);
  align-items: start;
}

.dash-col-main,
.dash-col-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

/* Lab performance card */
.perf-chip-row {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}

.perf-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.perf-chip-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.perf-chip-value {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.1;
}

.perf-chip-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* Bar chart (daily deliveries) */
.bar-chart-wrap {
  position: relative;
  overflow-x: auto;
}

.bar-chart-svg {
  display: block;
  min-width: 100%;
}

.bar-chart-bar {
  fill: var(--color-primary);
  transition: fill var(--transition-fast);
  cursor: pointer;
}

.bar-chart-bar:hover,
.bar-chart-bar.is-active {
  fill: var(--color-primary-dark);
}

.bar-chart-gridline {
  stroke: var(--color-border);
  stroke-width: 1;
}

.bar-chart-axis-label {
  font-size: 10px;
  fill: var(--color-text-muted);
  font-family: var(--font-family);
}

.bar-chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--color-text-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transform: translate(-50%, -100%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 5;
  top: 0;
  left: 0;
}

.bar-chart-tooltip.is-visible {
  opacity: 1;
}

/* Right column: today / notifications */
.side-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.side-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

a.side-item:hover {
  text-decoration: none;
}

.side-item-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.side-item-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.side-item-body {
  min-width: 0;
  flex: 1;
}

.side-item-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-item-sub {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-item-right {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  text-align: right;
  flex-shrink: 0;
}

.side-item-right.is-overdue {
  color: var(--color-danger);
  font-weight: 600;
}

.recent-patient-link {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.recent-patient-link:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* Quick actions */
.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.quick-action-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--space-4) var(--space-2);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--color-text-primary);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-align: center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.quick-action-tile:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  text-decoration: none;
}

.quick-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Responsive */
@media (max-width: 1100px) {
  .dash-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .dash-welcome {
    flex-direction: column;
    align-items: stretch;
  }

  .dash-welcome-right {
    justify-content: space-between;
  }
}
