/* ============================================================
   DentalCYR/Roma System — Global Styles
   Mobile-first, responsive
   ============================================================ */

:root {
  --color-primary:   #0077b6;
  --color-secondary: #00b4d8;
  --color-accent:    #90e0ef;
  --color-dark:      #1a1a2e;
  --color-success:   #2d6a4f;
  --color-warning:   #f4a261;
  --color-danger:    #e63946;
  --color-bg:        #f8f9fa;
  --color-surface:   #ffffff;
  --color-border:    #dee2e6;
  --color-text:      #212529;
  --color-muted:     #6c757d;
  --sidebar-width:   260px;
  --topbar-height:   56px;
  --radius:          8px;
  --shadow:          0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg:       0 4px 20px rgba(0,0,0,0.14);
  --transition:      0.2s ease;
}

/* Roma theme override */
.theme-roma {
  --color-primary:   #1a1a2e;
  --color-secondary: #2d6a4f;
  --color-accent:    #52b788;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ── Typography ── */
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 1rem;   font-weight: 600; }

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-dark) 100%);
  padding: 1rem;
}

.login-card {
  background: var(--color-surface);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo img { max-height: 80px; }

.login-logo h1 {
  color: var(--color-primary);
  font-size: 1.4rem;
  margin-top: 0.5rem;
}

.login-logo p {
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* ── App Shell ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transform: translateX(-100%);
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar.open { transform: translateX(0); }

@media (min-width: 768px) {
  .sidebar { transform: translateX(0); }
  .main-content { margin-left: var(--sidebar-width); }
}

.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--topbar-height);
}

.sidebar-header img { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; }

.sidebar-header .clinic-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}

.sidebar-header .clinic-sub {
  font-size: 0.72rem;
  opacity: 0.75;
}

.sidebar-nav { flex: 1; padding: 0.5rem 0; }

.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.6;
  padding: 0.75rem 1.25rem 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.25rem;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
  font-size: 0.92rem;
}

.nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.nav-item.active {
  background: rgba(255,255,255,0.15);
  border-left-color: var(--color-accent);
  color: #fff;
  font-weight: 600;
}

.nav-item .icon { font-size: 1.1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.8rem;
}

.user-info { display: flex; align-items: center; gap: 0.6rem; }

.user-avatar {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-details .name { font-weight: 600; font-size: 0.85rem; }
.user-details .role { opacity: 0.75; font-size: 0.72rem; }

/* ── Topbar ── */
.topbar {
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.menu-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--color-text);
  padding: 0.25rem;
  display: flex;
  align-items: center;
}

@media (min-width: 768px) { .menu-btn { display: none; } }

.topbar-title { font-weight: 700; font-size: 1rem; flex: 1; }

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

/* ── Main Content ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-content {
  flex: 1;
  padding: 1.25rem;
}

@media (min-width: 768px) { .page-content { padding: 1.5rem 2rem; } }

/* ── Overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
}
.sidebar-overlay.show { display: block; }
@media (min-width: 768px) { .sidebar-overlay { display: none !important; } }

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-title { font-size: 1rem; font-weight: 600; }

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-card .stat-icon { font-size: 1.8rem; margin-bottom: 0.25rem; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--color-primary); }
.stat-card .stat-label { font-size: 0.75rem; color: var(--color-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: filter var(--transition), transform var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover { filter: brightness(0.92); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--color-primary);   color: #fff; }
.btn-secondary { background: var(--color-secondary); color: #fff; }
.btn-success   { background: var(--color-success);   color: #fff; }
.btn-danger    { background: var(--color-danger);    color: #fff; }
.btn-warning   { background: var(--color-warning);   color: #fff; }
.btn-outline   {
  background: transparent;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
}
.btn-ghost {
  background: transparent;
  color: var(--color-muted);
}
.btn-ghost:hover { background: var(--color-bg); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 0.4rem; min-width: unset; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--color-text);
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition);
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0,119,182,0.12);
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1rem;
}
@media (min-width: 480px) {
  .form-row.cols-2 { grid-template-columns: 1fr 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}

.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check input { width: 1rem; height: 1rem; cursor: pointer; }

/* ── Tables ── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  background: var(--color-bg);
}

tr:hover td { background: #f0f7ff; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.6em;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-scheduled  { background: #dbeafe; color: #1d4ed8; }
.badge-confirmed  { background: #d1fae5; color: #065f46; }
.badge-in-progress{ background: #fef3c7; color: #92400e; }
.badge-completed  { background: #d1fae5; color: #065f46; }
.badge-cancelled  { background: #fee2e2; color: #991b1b; }
.badge-primary    { background: #dbeafe; color: #1d4ed8; }
.badge-success    { background: #d1fae5; color: #065f46; }
.badge-warning    { background: #fef3c7; color: #92400e; }
.badge-danger     { background: #fee2e2; color: #991b1b; }
.badge-secondary  { background: #f3f4f6; color: #374151; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal {
  background: var(--color-surface);
  border-radius: 12px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

.modal-lg { max-width: 800px; }
.modal-sm { max-width: 380px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0;
}

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

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--color-muted);
  line-height: 1;
  padding: 0.25rem;
}

.modal-body { padding: 1rem 1.5rem; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 1.5rem 1.25rem;
  flex-wrap: wrap;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  gap: 0;
}

.tab-btn {
  padding: 0.6rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}

.tab-btn:hover { color: var(--color-primary); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Calendar ── */
.calendar-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

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

.calendar-title { font-weight: 600; font-size: 1rem; min-width: 180px; text-align: center; }

.calendar-view-btns { display: flex; gap: 2px; }

.view-btn {
  padding: 0.3rem 0.65rem;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--color-muted);
  transition: all var(--transition);
}
.view-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cal-day-label {
  background: var(--color-bg);
  padding: 0.4rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
}

.cal-cell {
  min-height: 80px;
  padding: 0.3rem;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}

.cal-cell:hover { background: #f0f7ff; }
.cal-cell.today { background: #eff6ff; }
.cal-cell.other-month { background: var(--color-bg); opacity: 0.6; }

.cal-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 0.2rem;
}

.cal-cell.today .cal-day-num {
  background: var(--color-primary);
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
}

.cal-event {
  font-size: 0.68rem;
  padding: 1px 4px;
  border-radius: 3px;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.cal-event.scheduled   { background: #dbeafe; color: #1d4ed8; }
.cal-event.confirmed   { background: #d1fae5; color: #065f46; }
.cal-event.in-progress { background: #fef3c7; color: #92400e; }
.cal-event.completed   { background: #e5e7eb; color: #374151; }
.cal-event.cancelled   { background: #fee2e2; color: #991b1b; text-decoration: line-through; }

/* Day view */
.day-view { display: flex; flex-direction: column; gap: 0.5rem; }

.day-slot {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.day-slot-time {
  min-width: 60px;
  font-size: 0.8rem;
  color: var(--color-muted);
  font-weight: 600;
  padding-top: 2px;
}

.day-slot-content { flex: 1; }

/* Week view */
.week-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.week-header-cell {
  padding: 0.4rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  font-size: 0.78rem;
}

/* ── Agenda Layout (dentabash-style) ── */
.agenda-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.agenda-legend-panel {
  width: 170px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  position: sticky;
  top: calc(var(--topbar-height) + 1rem);
}

.legend-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: 0.6rem;
}

.legend-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.8rem;
  color: var(--color-text);
}

.legend-dot-status {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.agenda-main {
  flex: 1;
  min-width: 0;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.agenda-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--color-surface);
  position: sticky;
  top: var(--topbar-height);
  z-index: 10;
}

/* New dentabash-style week view */
.week-view-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.week-header-row {
  display: grid;
  grid-template-columns: 64px repeat(7, 1fr);
  border-bottom: 2px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 5;
}

.week-time-label-header {
  border-right: 1px solid var(--color-border);
  padding: 0.5rem;
  min-width: 64px;
}

.week-day-header {
  padding: 0.5rem 0.25rem;
  text-align: center;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.week-day-header.week-day-today {
  background: #eff6ff;
}

.week-day-name {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.week-day-num {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.week-day-num-today {
  background: var(--color-primary);
  color: #fff;
}

.week-body {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.week-time-row {
  display: grid;
  grid-template-columns: 64px repeat(7, 1fr);
  border-bottom: 1px solid #f0f0f0;
  min-height: 42px;
}

.week-time-row:nth-child(odd) {
  background: #fafafa;
}

.week-time-label {
  font-size: 0.68rem;
  color: var(--color-muted);
  font-weight: 500;
  padding: 0.3rem 0.4rem;
  border-right: 1px solid var(--color-border);
  white-space: nowrap;
  display: flex;
  align-items: flex-start;
  padding-top: 0.4rem;
  min-width: 64px;
}

.week-time-cell {
  padding: 2px 3px;
  border-right: 1px solid #eee;
  cursor: pointer;
  transition: background 0.15s;
  vertical-align: top;
  min-height: 42px;
  position: relative;
}

.week-time-cell:hover {
  background: #f0f7ff;
}

.week-time-cell.week-time-cell-today {
  background: rgba(0, 119, 182, 0.03);
}

.week-time-cell.week-time-cell-today:hover {
  background: rgba(0, 119, 182, 0.08);
}

/* Appointment blocks in week view */
.appt-block {
  border-radius: 4px;
  padding: 3px 5px;
  margin-bottom: 2px;
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1.3;
  transition: filter 0.15s, box-shadow 0.15s;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.appt-block:hover {
  filter: brightness(0.93);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  white-space: normal;
  z-index: 2;
  position: relative;
}

.appt-block-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appt-block-time {
  font-size: 0.65rem;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  .agenda-layout {
    flex-direction: column;
  }
  .agenda-legend-panel {
    width: 100%;
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
  }
  .legend-section {
    flex: 1;
    min-width: 140px;
  }
  .week-body {
    max-height: 60vh;
  }
}

/* ── Odontogram ── */
.odontogram-container {
  overflow-x: auto;
  padding: 0.5rem;
}

.odontogram-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 2px;
  margin-bottom: 2px;
}

.odontogram-row:nth-child(4),
.odontogram-row:nth-child(5) {
  align-items: flex-start;
}

.tooth {
  cursor: pointer;
  position: relative;
  transition: transform 0.15s;
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.tooth:hover { transform: scale(1.12); filter: brightness(0.92); }

.tooth svg { display: block; }

.tooth-number {
  text-align: center;
  font-size: 0.6rem;
  color: var(--color-muted);
  margin-top: 1px;
  line-height: 1;
}

.odontogram-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 1rem;
  font-size: 0.78rem;
}

.legend-item { display: flex; align-items: center; gap: 0.35rem; }
.legend-dot  { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* Tooth condition colors */
.tooth-sano       { fill: #ffffff; stroke: #9ca3af; }
.tooth-caries     { fill: #ef4444; stroke: #b91c1c; }
.tooth-corona     { fill: #f59e0b; stroke: #d97706; }
.tooth-extraccion { fill: #6b7280; stroke: #374151; }
.tooth-endodoncia { fill: #8b5cf6; stroke: #6d28d9; }
.tooth-implante   { fill: #06b6d4; stroke: #0891b2; }
.tooth-obturacion { fill: #3b82f6; stroke: #2563eb; }
.tooth-fractura   { fill: #f97316; stroke: #ea580c; }
.tooth-ausente    { fill: #e5e7eb; stroke: #9ca3af; stroke-dasharray: 3,2; }
.tooth-protesis   { fill: #ec4899; stroke: #db2777; }
.tooth-sellante   { fill: #10b981; stroke: #059669; }
.tooth-otro       { fill: #d1d5db; stroke: #6b7280; }

/* ── Progress Bar ── */
.progress {
  height: 8px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ── Search & Filters ── */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 180px;
  position: relative;
}

.search-input input {
  padding-left: 2.2rem;
}

.search-input::before {
  content: '🔍';
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  pointer-events: none;
}

/* ── Photo Gallery ── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
}

.photo-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  background: var(--color-border);
  box-shadow: var(--shadow);
}

.photo-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.photo-item:hover img { transform: scale(1.04); }

.photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: flex-end;
  padding: 0.4rem;
  transition: background 0.2s;
}

.photo-item:hover .photo-overlay { background: rgba(0,0,0,0.35); }

.photo-meta {
  color: #fff;
  font-size: 0.68rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.photo-item:hover .photo-meta { opacity: 1; }

.photo-del {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px; height: 24px;
  cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
  font-size: 0.75rem;
}

.photo-item:hover .photo-del { display: flex; }

/* ── Upload Drop Zone ── */
.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--color-primary);
  background: #eff6ff;
}

.drop-zone p { color: var(--color-muted); font-size: 0.875rem; }
.drop-zone .drop-icon { font-size: 2rem; margin-bottom: 0.5rem; }

/* ── Alerts / Toast ── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger  { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info    { background: #dbeafe; color: #1d4ed8; }

.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 320px;
}

.toast {
  background: var(--color-dark);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-danger); }
.toast.warning { background: var(--color-warning); color: #333; }

/* ── Bot Status Indicators ── */
.bot-status-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 0.4rem;
  flex-shrink: 0;
}
.dot-ready        { background: #10b981; box-shadow: 0 0 4px #10b981; }
.dot-qr_pending   { background: #f59e0b; }
.dot-authenticated{ background: #60a5fa; }
.dot-initializing { background: #9ca3af; animation: pulse 1.5s infinite; }
.dot-disconnected { background: #ef4444; }
.dot-error        { background: #dc2626; }

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

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.qr-container img { max-width: 220px; border: 8px solid #fff; border-radius: 8px; box-shadow: var(--shadow); }

/* ── Loading ── */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-lg { width: 36px; height: 36px; border-width: 4px; }

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

.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.7);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.loading-overlay.show { display: flex; flex-direction: column; gap: 1rem; }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.empty-state p  { font-size: 0.875rem; }

/* ── Utilities ── */
.d-flex  { display: flex; }
.d-none  { display: none !important; }
.gap-1   { gap: 0.25rem; }
.gap-2   { gap: 0.5rem; }
.gap-3   { gap: 0.75rem; }
.mt-1    { margin-top: 0.25rem; }
.mt-2    { margin-top: 0.5rem; }
.mt-3    { margin-top: 1rem; }
.mb-1    { margin-bottom: 0.25rem; }
.mb-2    { margin-bottom: 0.5rem; }
.mb-3    { margin-bottom: 1rem; }
.text-muted   { color: var(--color-muted); }
.text-small   { font-size: 0.8rem; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.font-bold    { font-weight: 700; }
.w-full       { width: 100%; }
.flex-1       { flex: 1; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap    { flex-wrap: wrap; }

/* ── Responsive tweaks ── */
@media (max-width: 480px) {
  .hide-xs { display: none !important; }
  .btn-lg  { padding: 0.6rem 1rem; font-size: 0.9rem; }
  .modal   { border-radius: 12px 12px 0 0; position: fixed; bottom: 0; max-height: 92vh; width: 100%; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  @keyframes modalIn {
    from { opacity: 0; transform: translateY(100%); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* ── Print ── */
@media print {
  .sidebar, .topbar, .btn, .modal-overlay { display: none !important; }
  .main-content { margin-left: 0 !important; }
}
