/* ══════════════════════════════════════════════════════════
   Dashboard View
   ══════════════════════════════════════════════════════════ */
.dashboard-view {
  flex: 1;
  overflow-y: auto;
  background: var(--background);
  padding: 2rem 1.5rem;
}

.dashboard-inner {
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Hero ─────────────────────────────────────────────────── */
.dashboard-hero {
  margin-bottom: 2rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-hero-left h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--cpod-primary);
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.dashboard-welcome {
  font-size: 0.9rem;
  color: var(--cpod-text-muted);
  margin: 0;
}

/* ── Stats ────────────────────────────────────────────────── */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--cpod-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cpod-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.4rem;
}

/* ── Search toolbar ───────────────────────────────────────── */
.dashboard-search-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.dashboard-search-wrap {
  position: relative;
  flex: 1;
}

.dashboard-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cpod-text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

.dashboard-search-input {
  width: 100%;
  padding: 0.625rem 0.75rem 0.625rem 2.25rem;
  border: 1.5px solid var(--input);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--card);
  color: var(--foreground);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dashboard-search-input:focus {
  outline: none;
  border-color: var(--cpod-primary);
  box-shadow: 0 0 0 3px rgba(31,92,89,0.12);
}

/* ── Patient grid ─────────────────────────────────────────── */
.dashboard-patient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.dashboard-patient-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

.dashboard-patient-card:hover {
  border-color: var(--cpod-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.dashboard-patient-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--cpod-primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.dashboard-patient-info {
  flex: 1;
  min-width: 0;
}

.dashboard-patient-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-patient-meta {
  font-size: 0.72rem;
  color: var(--cpod-text-muted);
  margin-top: 0.15rem;
}

.dashboard-patient-arrow {
  color: var(--cpod-text-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.dashboard-patient-card.active {
  border-color: var(--cpod-primary);
  background: rgba(31,92,89,0.04);
}

/* ── Free plan section ────────────────────────────────────── */
.quick-chart-cta {
  background: linear-gradient(135deg, var(--cpod-primary) 0%, #2d7d7a 100%);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  color: #fff;
}

.quick-chart-cta h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.quick-chart-cta p {
  font-size: 0.85rem;
  opacity: 0.85;
  margin: 0 0 1.25rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.btn-quick-chart {
  background: #fff;
  color: var(--cpod-primary);
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 1.75rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-quick-chart:hover {
  background: #f0faf9;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}

/* ── Teaser: locked patient list ─────────────────────────── */
.dashboard-teaser {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
}

.dashboard-teaser-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.dashboard-teaser-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--foreground);
  margin: 0 0 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-pro {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--cpod-primary);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  vertical-align: middle;
  margin-left: 0.1rem;
}

.dashboard-teaser-sub {
  font-size: 0.78rem;
  color: var(--cpod-text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ── Locked patient cards ─────────────────────────────────── */
.locked-card {
  cursor: default;
  pointer-events: none;
  opacity: 0.55;
}

.locked-card:hover {
  transform: none !important;
  box-shadow: var(--shadow-sm) !important;
  border-color: var(--border) !important;
}

.locked-avatar {
  background: var(--muted) !important;
  color: var(--cpod-text-muted) !important;
}

.locked-badge {
  font-size: 0.7rem;
  color: var(--cpod-text-muted);
  flex-shrink: 0;
  background: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.dashboard-teaser-footer {
  font-size: 0.72rem;
  color: var(--cpod-text-muted);
  margin: 0.875rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ══════════════════════════════════════════════════════════
   Quick Chart Banner (editor view, free users)
   ══════════════════════════════════════════════════════════ */
.quick-chart-banner {
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  color: #92400e;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  flex-wrap: wrap;
  border-bottom: 1px solid #f59e0b;
}

.quick-chart-banner-text {
  flex: 1;
  min-width: 200px;
}

.quick-chart-banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════
   Editor View Topbar
   ══════════════════════════════════════════════════════════ */
.editor-topbar {
  max-width: 1400px;
  margin: 0 auto 1.25rem;
  padding: 0.625rem 1.5rem 0.875rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: transparent;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.editor-patient-label {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════════════════
   Odontogram Top Row (toggle + bridge btn)
   ══════════════════════════════════════════════════════════ */
.odontogram-toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0 0.125rem;
}

/* Bridge button matches dentition-toggle appearance */
.bridge-mode-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  padding: 0.28rem 0.6rem 0.28rem 0.5rem !important;
  background: rgba(31,92,89,0.07) !important;
  border: 1px solid rgba(31,92,89,0.2) !important;
  border-radius: 20px !important;
  color: var(--cpod-primary) !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  font-family: inherit !important;
  cursor: pointer !important;
  transition: background 0.15s, border-color 0.15s !important;
  white-space: nowrap !important;
  line-height: 1 !important;
}
.bridge-mode-btn:hover {
  background: rgba(31,92,89,0.13) !important;
  border-color: var(--cpod-primary) !important;
}

/* ══════════════════════════════════════════════════════════
   Editor Actions Dropdown (elipsis)
   ══════════════════════════════════════════════════════════ */
.editor-actions-group {
  position: relative;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--muted);
  border-color: var(--cpod-primary);
  color: var(--cpod-primary);
}

.editor-actions-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  display: none;
  overflow: hidden;
}

.editor-actions-group.open .editor-actions-menu {
  display: block;
}

.editor-actions-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.625rem 1rem;
  border: none;
  background: transparent;
  color: var(--foreground);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.editor-actions-item:hover {
  background: var(--muted);
}

.editor-actions-item i {
  width: 1rem;
  text-align: center;
  color: var(--cpod-text-muted);
  font-size: 0.8rem;
}

.editor-actions-item.danger {
  color: #ef4444;
}

.editor-actions-item.danger i {
  color: #ef4444;
}

.editor-actions-item.danger:hover {
  background: rgba(239,68,68,0.06);
}

.editor-actions-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

/* ══════════════════════════════════════════════════════════
   Patient Info Card: View / Edit Modes
   ══════════════════════════════════════════════════════════ */
.patient-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 2px solid var(--cpod-mint);
}

.patient-card-header .card-title {
  margin: 0;
  padding: 0;
  border: none;
}

.patient-view-mode {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.patient-name-static {
  font-size: 1rem;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.3;
}

.patient-name-static.empty {
  color: var(--cpod-text-muted);
  font-weight: 400;
  font-style: italic;
  font-size: 0.875rem;
}

.patient-birthdate-static {
  font-size: 0.78rem;
  color: var(--cpod-text-muted);
}

.patient-since-static {
  font-size: 0.72rem;
  color: var(--cpod-text-muted);
  opacity: 0.75;
}

.patient-notes-static {
  font-size: 0.8rem;
  color: var(--foreground);
  white-space: pre-wrap;
  margin-top: 0.35rem;
  padding: 0.5rem 0.625rem;
  background: var(--muted);
  border-radius: calc(var(--radius) - 2px);
  max-height: 80px;
  overflow-y: auto;
  display: none;
  line-height: 1.5;
}

.patient-notes-static.has-content {
  display: block;
}

/* ── Daily notes area ─────────────────────────────────────── */
.daily-notes-area {
  display: none;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.daily-notes-area.visible {
  display: flex;
}

.daily-notes-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--cpod-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.daily-notes-label-date {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--cpod-primary);
}

.daily-notes-textarea {
  width: 100%;
  min-height: 70px;
  padding: 0.45rem 0.6rem;
  font-size: 0.78rem;
  font-family: inherit;
  color: var(--foreground);
  background: var(--muted);
  border: 1.5px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.5;
  transition: border-color 0.15s, background 0.15s;
}

.daily-notes-textarea:focus {
  outline: none;
  border-color: var(--cpod-primary);
  background: var(--card);
}

.daily-notes-textarea::placeholder {
  color: var(--cpod-text-muted);
}

.daily-notes-save-hint {
  font-size: 0.65rem;
  color: var(--cpod-text-muted);
  text-align: right;
  height: 1em;
  transition: opacity 0.2s;
}

/* ── Date group "ver todos" button ───────────────────────── */
.date-group-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.62rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--cpod-text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}

.date-group-view-btn:hover {
  background: var(--accent);
  color: var(--cpod-primary);
  border-color: var(--cpod-primary);
}

/* ── Clear selection button ──────────────────────────────── */
.clear-day-btn {
  display: none;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--cpod-text-muted);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}

.clear-day-btn.visible {
  display: inline-flex;
}

.clear-day-btn:hover {
  background: var(--muted);
  color: var(--cpod-primary);
  border-color: var(--cpod-primary);
}

.patient-edit-footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ── Dentition suggestion hint ─────────────────────────────── */
.dentition-hint {
  margin-top: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: rgba(51,195,243,0.08);
  border: 1px solid rgba(51,195,243,0.3);
  border-radius: calc(var(--radius) - 2px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--foreground);
  flex-wrap: wrap;
}

.dentition-hint i {
  color: var(--cpod-blue);
  flex-shrink: 0;
}

.dentition-hint span {
  flex: 1;
}

.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: calc(var(--radius) - 4px);
  border: 1.5px solid var(--cpod-primary);
  background: transparent;
  color: var(--cpod-primary);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.btn-xs:hover {
  background: var(--cpod-primary);
  color: #fff;
}

/* ══════════════════════════════════════════════════════════
   Document Actions Card
   ══════════════════════════════════════════════════════════ */
.document-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.doc-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem 0.4rem;
  border: 1.5px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
  font-size: 0.67rem;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.15s;
  text-align: center;
  line-height: 1.2;
}

.doc-action-btn i {
  font-size: 1rem;
  color: var(--cpod-primary);
}

.doc-action-btn:hover {
  border-color: var(--cpod-primary);
  background: var(--accent);
}

.doc-action-btn:active {
  transform: scale(0.96);
}

.doc-action-btn.danger i { color: #ef4444; }
.doc-action-btn.danger:hover { border-color: #ef4444; background: rgba(239,68,68,0.06); }

.doc-action-btn.btn-locked {
  opacity: 0.45;
  cursor: not-allowed;
  position: relative;
}

.doc-action-btn.btn-locked i::after {
  content: '\f023';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.55rem;
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  color: var(--cpod-text-muted);
}

/* ══════════════════════════════════════════════════════════
   New Patient Dashboard Modal
   ══════════════════════════════════════════════════════════ */
.arcada-suggestion-hint {
  font-size: 0.75rem;
  color: var(--cpod-text-muted);
  margin-top: 0.25rem;
  font-style: italic;
}

/* ══════════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .dashboard-view { padding: 1.25rem 0.875rem; }

  .dashboard-hero { flex-direction: column; gap: 0.75rem; }
  .dashboard-hero-left h2 { font-size: 1.25rem; }

  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 1.5rem;
  }

  .dashboard-patient-grid {
    grid-template-columns: 1fr;
  }

  .document-actions-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .doc-action-btn { font-size: 0.62rem; padding: 0.625rem 0.25rem; }
  .doc-action-btn i { font-size: 0.875rem; }

  .editor-topbar { padding: 0.5rem 0.875rem; }

  .quick-chart-banner { padding: 0.625rem 0.875rem; }
}

@media (max-width: 480px) {
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
  .dashboard-search-toolbar { flex-direction: column; align-items: stretch; }
  .document-actions-grid { grid-template-columns: repeat(2, 1fr); }
}
