/* =====================================================
   DENTAL CRM PRO — app.css v1.0
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

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

:root {
  --navy:       #0B1E36;
  --navy2:      #0F2845;
  --teal:       #536B8C;
  --teal-dk:    #3D5270;
  --teal-lt:    #E4E9F0;
  --gold:       #B8975A;
  --bg:         #F0F4F8;
  --surface:    #FFFFFF;
  --border:     #E2E9F0;
  --text:       #1A2332;
  --muted:      #6B7888;
  --danger:     #E53E3E;
  --success:    #38A169;
  --warning:    #D69E2E;
  --sidebar-w:  264px;
  --nav-h:      56px;
  --radius:     10px;
  --shadow:     0 2px 16px rgba(11,30,54,.07);
  --shadow-lg:  0 8px 32px rgba(11,30,54,.14);
}

/* ── ROOT ── */
#dcrm-page-wrap {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: block !important;
  pointer-events: auto !important;
  isolation: isolate;
}

#dcrm-app {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
}

/* ── TOPNAV ── */
.dcrm-nav {
  background: var(--navy);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(11,30,54,.4);
  gap: 10px;
  z-index: 200;
  position: relative;
}
.dcrm-nav-brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.dcrm-nav-logo { height: 32px; max-width: 160px; object-fit: contain; display: block; }
.dcrm-nav-icon {
  width: 28px; height: 28px; background: var(--teal);
  border-radius: 7px; display: flex; align-items: center; justify-content: center;
}
.dcrm-nav-icon svg { width: 16px; height: 16px; stroke: #fff; fill: none; }
.dcrm-nav-brand .dcrm-clinic-name { font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap; }

.dcrm-nav-views {
  display: flex; gap: 2px;
  background: rgba(255,255,255,.08); padding: 3px; border-radius: 9px;
}
.dcrm-view-btn {
  background: none; border: none; color: rgba(255,255,255,.65);
  padding: 5px 14px; border-radius: 7px;
  font-family: 'Outfit', sans-serif; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
.dcrm-view-btn.active, .dcrm-view-btn:hover { background: #536B8C; color: #fff; }

.dcrm-nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.dcrm-nav-link {
  position: relative; overflow: visible;
  background: none; border: 1.5px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.65); padding: 5px 12px; border-radius: 7px;
  font-family: 'Outfit', sans-serif; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.dcrm-nav-link:hover { border-color: var(--teal); color: #fff; }
.dcrm-badge {
  position: absolute; top: -6px; right: -8px;
  background: #E53E3E; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(229,62,62,.4);
  animation: dcrm-badge-pop .3s ease-out;
}
.dcrm-badge-dropdown {
  position: static; margin-left: 8px; vertical-align: middle;
}
@keyframes dcrm-badge-pop { 0%{transform:scale(0)} 60%{transform:scale(1.2)} 100%{transform:scale(1)} }

/* ── BUTTONS ── */
.dcrm-btn {
  font-family: 'Outfit', sans-serif; font-size: 13px; font-weight: 600;
  padding: 7px 16px; border-radius: 8px; border: none; cursor: pointer;
  transition: all .15s; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; text-decoration: none;
}
.dcrm-btn-primary   { background: #536B8C; color: #fff; }
.dcrm-btn-primary:hover   { backdrop-filter: brightness(120%) contrast(100%) saturate(102%) blur(10px) hue-rotate(0deg); background: #6280A0; }
.dcrm-btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.dcrm-btn-secondary:hover { background: var(--border); }
.dcrm-btn-danger    { background: var(--danger); color: #fff; }
.dcrm-btn-danger:hover    { background: #c53030; }
.dcrm-btn-success   { background: var(--success); color: #fff; }
.dcrm-btn-ghost     { background: none; border: none; color: var(--teal); font-family: 'Outfit', sans-serif; font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 0; }
.dcrm-btn-full      { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
.dcrm-btn:disabled  { opacity: .55; cursor: not-allowed; transform: none !important; }
.dcrm-btn:focus-visible, .dcrm-nav-link:focus-visible, .dcrm-view-btn:focus-visible,
.dcrm-doc-avatar-btn:focus-visible, .dcrm-page-btn:focus-visible {
  outline: 2px solid #536B8C; outline-offset: 2px;
}
.dcrm-btn-ghost:hover { color: var(--teal-dk); }

/* ── USER MENU ── */
.dcrm-user-menu { position: relative; }
.dcrm-user-btn {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 8px;
  transition: background .12s;
}
.dcrm-user-btn:hover { background: rgba(255,255,255,.06); }
.dcrm-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.dcrm-user-name { font-size: 12px; color: rgba(255,255,255,.75); font-weight: 500; }
.dcrm-user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 190px; overflow: hidden; z-index: 999;
}
.dcrm-dropdown-info {
  padding: 13px 15px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.dcrm-dropdown-info strong { font-size: 13px; color: var(--text); }
.dcrm-dropdown-info span { font-size: 11px; color: var(--muted); }
.dcrm-dropdown-item {
  display: block; width: 100%; padding: 10px 15px;
  font-family: 'Outfit', sans-serif; font-size: 13px;
  background: none; border: none; text-align: left;
  cursor: pointer; color: var(--danger); transition: background .12s;
}
.dcrm-dropdown-item:hover { background: #fff5f5; }
.dcrm-dropdown-nav-item {
  display: none; width: 100%; padding: 10px 15px;
  font-family: 'Outfit', sans-serif; font-size: 13px;
  background: none; border: none; border-bottom: 1px solid var(--border);
  text-align: left; cursor: pointer; color: var(--navy); transition: background .12s;
}
.dcrm-dropdown-nav-item:hover { background: var(--bg); }

/* ── LAYOUT ── */
.dcrm-layout { display: flex; flex: 1; overflow: hidden; }

/* ── SIDEBAR ── */
.dcrm-sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--navy);
  display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden;
  border-right: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.dcrm-sidebar-head {
  padding: 13px 12px 10px; border-bottom: 1px solid rgba(255,255,255,.07); flex-shrink: 0;
}
.dcrm-sidebar-title-row {
  display: flex; align-items: center; gap: 7px; margin-bottom: 11px; flex-wrap: wrap;
}
.dcrm-sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: rgba(255,255,255,.55);
}
.dcrm-sidebar-date { font-size: 11px; color: rgba(255,255,255,.6); flex: 1; }
.dcrm-today-count {
  background: var(--teal); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px;
}

/* Doctor avatar grid */
.dcrm-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 4px;
}
.dcrm-doc-avatar-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  padding: 6px 4px; border-radius: 7px; transition: opacity .15s, background .12s;
  min-width: 44px;
}
.dcrm-doc-avatar-btn:hover { background: rgba(255,255,255,.06); }
.dcrm-doc-avatar-btn:not(.active) { opacity: .35; filter: grayscale(.7); }
.dcrm-doc-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
  border: 2px solid transparent; transition: border-color .15s;
}
.dcrm-doc-avatar-btn.active .dcrm-doc-avatar { border-color: rgba(255,255,255,.3); }
.dcrm-doc-avatar-name {
  font-size: 8px; color: rgba(255,255,255,.5);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 46px; text-align: center;
}

/* ── TIMELINE ── */
.dcrm-timeline-wrap {
  flex: 1; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}
.dcrm-timeline-wrap::-webkit-scrollbar { width: 3px; }
.dcrm-timeline-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

.dcrm-timeline-canvas { position: relative; padding-bottom: 20px; }

.dcrm-tl-hour-marker {
  position: absolute; left: 0; right: 0;
  display: flex; align-items: flex-start; pointer-events: none;
}
.dcrm-tl-hour-label {
  width: 42px; min-width: 42px; font-size: 9px; font-weight: 600;
  color: rgba(255,255,255,.2); padding: 2px 6px 0 10px; flex-shrink: 0;
}
.dcrm-tl-hour-line {
  flex: 1; border-top: 1px solid rgba(255,255,255,.05); margin-top: 5px;
}

.dcrm-tl-appt {
  position: absolute; border-radius: 6px; padding: 4px 8px; cursor: pointer;
  border-left: 3px solid transparent; overflow: hidden; min-height: 18px;
  transition: filter .12s, transform .12s, box-shadow .12s;
}
.dcrm-tl-appt:hover {
  filter: brightness(1.15); transform: translateX(2px);
  box-shadow: 0 4px 14px rgba(0,0,0,.3); z-index: 10;
}
.dcrm-tl-appt-name   { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcrm-tl-appt-detail { font-size: 9.5px; color: rgba(255,255,255,.65); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.dcrm-tl-appt-time   { font-size: 9px; color: rgba(255,255,255,.5); margin-top: 1px; }
.dcrm-tl-appt.tiny .dcrm-tl-appt-detail,
.dcrm-tl-appt.tiny .dcrm-tl-appt-time { display: none; }

.dcrm-now-line  { position: absolute; left: 42px; right: 0; height: 2px; background: var(--gold); z-index: 20; pointer-events: none; }
.dcrm-now-dot   { position: absolute; left: 35px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); transform: translateY(-4px); z-index: 21; box-shadow: 0 0 6px rgba(184,151,90,.5); }
.dcrm-now-label { position: absolute; right: 8px; font-size: 9px; font-weight: 700; color: var(--gold); z-index: 21; }

/* ── MAIN ── */
.dcrm-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 16px 18px; }

.dcrm-cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 13px; flex-shrink: 0;
}
.dcrm-cal-title { font-size: 19px; font-weight: 700; color: var(--navy); text-transform: capitalize; }

.dcrm-cal-nav { display: flex; gap: 5px; align-items: center; }
.dcrm-nav-arrow {
  background: var(--surface); border: 1.5px solid var(--border);
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; color: var(--navy); transition: all .15s;
  font-family: 'Outfit', sans-serif;
}
.dcrm-nav-arrow:hover { background: var(--teal); color: #fff; border-color: var(--teal); }
.dcrm-today-nav-btn { width: auto; padding: 0 12px; font-size: 11px; font-weight: 600; }

/* ── CALENDAR GRID ── */
.dcrm-cal-wrap { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.dcrm-cal-grid-wrap {
  background: var(--surface); border-radius: var(--radius);
  border: 1.5px solid var(--border); box-shadow: var(--shadow);
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.dcrm-weekrow {
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--navy); border-radius: 9px 9px 0 0; flex-shrink: 0;
}
.dcrm-wday {
  padding: 10px 0; text-align: center;
  font-size: 12px; font-weight: 600; letter-spacing: .7px;
  color: rgba(255,255,255,.45); text-transform: uppercase;
}

.dcrm-daygrid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  flex: 1; overflow-y: auto;
}
.dcrm-day-cell {
  position: relative;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 7px 6px 5px; min-height: 90px; transition: background .1s;
}
.dcrm-day-cell[role="button"] { cursor: pointer; }
.dcrm-day-cell[role="button"]:hover { background: rgba(83,107,140,.03); }
.dcrm-day-cell:nth-child(5n) { border-right: none; }
.dcrm-day-cell.dcrm-other-month { background: rgba(0,0,0,.01); }
.dcrm-day-cell.dcrm-other-month .dcrm-day-num { color: #cdd5de; }
.dcrm-day-cell.dcrm-today { background: linear-gradient(135deg,#FFFDF5,#FFF8E7); }
.dcrm-day-cell.dcrm-weekend-cell { background: rgba(0,0,0,.007); }
.dcrm-day-cell.dcrm-day-closed {
  background: repeating-linear-gradient(135deg, transparent, transparent 4px, rgba(0,0,0,.03) 4px, rgba(0,0,0,.03) 8px);
  pointer-events: none;
}
.dcrm-day-cell.dcrm-day-closed .dcrm-day-num { color: #c0c7d0; }
.dcrm-day-cell.dcrm-day-closed.dcrm-today { pointer-events: auto; }

.dcrm-day-num {
  font-size: 13px; font-weight: 600; color: var(--navy);
  width: 24px; height: 24px; display: flex; align-items: center;
  justify-content: center; border-radius: 50%; margin-bottom: 4px;
}
.dcrm-today .dcrm-day-num { background: var(--gold); color: #fff; font-weight: 700; }

.dcrm-day-appts { display: flex; flex-direction: column; gap: 2px; }
.dcrm-cal-appt {
  border-radius: 5px; padding: 3px 6px; font-size: 12px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; gap: 4px;
  border-left: 3px solid transparent; white-space: nowrap; overflow: hidden;
  transition: transform .1s, box-shadow .1s;
}
.dcrm-cal-appt:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.1); z-index: 2; position: relative; }
.dcrm-cal-appt-dot  { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.dcrm-cal-appt-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.dcrm-cal-appt-time { font-size: 11px; opacity: .7; flex-shrink: 0; }
.dcrm-cal-more {
  font-size: 11px; color: var(--muted); font-weight: 600;
  padding: 2px 6px; background: var(--bg); border-radius: 4px;
  cursor: pointer; text-align: center; margin-top: 1px;
}
.dcrm-cal-more:hover { color: var(--teal); background: var(--teal-lt); }
.dcrm-day-count {
  position: absolute; top: 4px; right: 4px;
  font-size: 9px; font-weight: 700; color: #fff;
  background: var(--teal); border-radius: 10px;
  min-width: 18px; height: 18px; line-height: 18px;
  text-align: center; padding: 0 4px; cursor: pointer;
  transition: transform .12s;
}
.dcrm-day-count:hover { transform: scale(1.15); }

/* ── WEEK VIEW ── */
.dcrm-week-grid {
  display: grid; grid-template-columns: 48px repeat(5, 1fr);
  flex: 1; overflow-y: auto; position: relative;
}
.dcrm-week-header {
  display: grid; grid-template-columns: 48px repeat(5, 1fr);
  background: var(--navy); border-radius: 9px 9px 0 0; flex-shrink: 0;
}
.dcrm-week-header-cell {
  padding: 9px 0; text-align: center;
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,.45);
  text-transform: uppercase; letter-spacing: .5px;
}
.dcrm-week-time-col { border-right: 1px solid var(--border); }
.dcrm-week-hour {
  height: 60px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; padding: 2px 6px;
  font-size: 10px; font-weight: 600; color: var(--muted);
}
.dcrm-week-day-col { position: relative; border-right: 1px solid var(--border); }
.dcrm-week-day-col:last-child { border-right: none; }
.dcrm-week-appt {
  position: absolute; left: 2px; right: 2px;
  border-radius: 5px; padding: 3px 6px; cursor: pointer;
  border-left: 3px solid; overflow: hidden; font-size: 12px; font-weight: 500;
  transition: filter .1s, box-shadow .1s;
}
.dcrm-week-appt:hover { filter: brightness(1.1); box-shadow: 0 3px 10px rgba(0,0,0,.15); z-index: 5; }

/* ── DAY VIEW ── */
.dcrm-day-grid { display: flex; flex: 1; overflow-y: auto; }
.dcrm-day-time-col {
  width: 50px; flex-shrink: 0; border-right: 1px solid var(--border);
}
.dcrm-day-hour-label {
  height: 70px; display: flex; align-items: flex-start;
  padding: 3px 8px 0; font-size: 10px; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.dcrm-day-events { flex: 1; position: relative; }
.dcrm-day-hour-line {
  height: 70px; border-bottom: 1px solid var(--border);
}
.dcrm-day-appt-block {
  position: absolute; left: 8px; right: 8px;
  border-radius: 7px; padding: 6px 10px; cursor: pointer;
  border-left: 4px solid; overflow: hidden;
  transition: filter .1s, box-shadow .1s, transform .1s;
}
.dcrm-day-appt-block:hover { filter: brightness(1.08); box-shadow: 0 4px 16px rgba(0,0,0,.15); transform: translateX(2px); }
.dcrm-day-appt-name   { font-size: 12px; font-weight: 600; }
.dcrm-day-appt-detail { font-size: 10.5px; opacity: .7; margin-top: 2px; }
.dcrm-day-appt-time   { font-size: 10px; opacity: .55; margin-top: 2px; }

/* ── MODAL ── */
.dcrm-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(11,30,54,.55);
  z-index: 10000; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  font-family: 'Outfit', sans-serif;
  animation: dcrm-fade-in .15s ease-out;
}

.dcrm-modal {
  background: var(--surface); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%; max-width: 560px; max-height: calc(100vh - 40px);
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  position: relative;
  animation: dcrm-slide-up .15s ease-out;
}

@keyframes dcrm-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes dcrm-slide-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.dcrm-modal.dcrm-modal-lg { max-width: 860px; }

.dcrm-modal-close {
  position: sticky; top: 12px; float: right; margin: 12px 12px 0 10px;
  background: var(--bg); border: none; border-radius: 50%;
  width: 28px; height: 28px; cursor: pointer; font-size: 14px; color: var(--muted);
  display: flex; align-items: center; justify-content: center; z-index: 5;
  transition: background .12s;
}
.dcrm-modal-close:hover { background: var(--border); }
.dcrm-modal-body { padding: 8px 24px 24px; }

/* Modal detail layout */
.dcrm-modal-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.dcrm-modal-color-bar { width: 4px; height: 52px; border-radius: 2px; flex-shrink: 0; margin-top: 4px; }
.dcrm-modal-title    { font-size: 19px; font-weight: 700; color: var(--navy); }
.dcrm-modal-subtitle { font-size: 13px; color: var(--muted); margin-top: 3px; }

.dcrm-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.dcrm-detail-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.dcrm-detail-item  { display: flex; flex-direction: column; gap: 3px; }
.dcrm-detail-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.dcrm-detail-value { font-size: 13px; font-weight: 500; color: var(--text); }

.dcrm-detail-notes {
  background: var(--bg); border-radius: 8px; padding: 12px 14px;
  margin-bottom: 16px; border-left: 3px solid var(--border);
}
.dcrm-detail-notes .dcrm-detail-label { margin-bottom: 5px; }
.dcrm-detail-notes p { font-size: 13px; color: var(--text); line-height: 1.6; }

.dcrm-modal-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }

/* ── FORMS ── */
.dcrm-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.dcrm-field label {
  font-size: 11px; font-weight: 700; color: var(--text);
  text-transform: uppercase; letter-spacing: .5px;
}
.dcrm-field input,
.dcrm-field select,
.dcrm-field textarea {
  font-family: 'Outfit', sans-serif; font-size: 14px;
  border: 1.5px solid var(--border); border-radius: 8px;
  padding: 9px 12px; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
.dcrm-field input:focus,
.dcrm-field select:focus,
.dcrm-field textarea:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(83,107,140,.12);
}
.dcrm-field textarea { resize: vertical; min-height: 80px; }
#dcrm-app input::placeholder,
#dcrm-app textarea::placeholder,
#dcrm-modal-overlay input::placeholder,
#dcrm-modal-overlay textarea::placeholder,
.dcrm-chat-widget input::placeholder { color: #b0b8c4 !important; opacity: 1 !important; }
.dcrm-field input[type="color"] { padding: 4px; height: 42px; cursor: pointer; }
.dcrm-field-error { font-size: 11px; color: var(--danger); }

.dcrm-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dcrm-form-section {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--muted); margin: 16px 0 10px;
  padding-bottom: 7px; border-bottom: 1px solid var(--border);
}

/* Duration selector */
.dcrm-duration-row { display: flex; gap: 8px; align-items: center; }
.dcrm-duration-row select { flex: 1; }
.dcrm-time-preview { font-size: 12px; color: var(--teal); font-weight: 600; margin-top: 4px; }

/* Patient search dropdown */
.dcrm-pt-search-wrap { position: relative; }
.dcrm-pt-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-lg); z-index: 50;
  max-height: 200px; overflow-y: auto;
}
.dcrm-pt-dropdown-item {
  padding: 9px 12px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--border); transition: background .1s;
  display: flex; justify-content: space-between; align-items: center;
}
.dcrm-pt-dropdown-item:last-child { border-bottom: none; }
.dcrm-pt-dropdown-item:hover { background: var(--bg); }
.dcrm-pt-dropdown-item strong { color: var(--text); }
.dcrm-pt-dropdown-item span { font-size: 11px; color: var(--muted); }
.dcrm-pt-selected-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--teal-lt); color: var(--teal);
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px;
  margin-top: 5px;
}

/* ── ALERTS & TOAST ── */
.dcrm-alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.dcrm-alert-error   { background: #FFF5F5; color: var(--danger); border: 1px solid #FED7D7; }
.dcrm-alert-success { background: #F0FFF4; color: var(--success); border: 1px solid #C6F6D5; }
.dcrm-alert-warning { background: #FFFBEB; color: var(--warning); border: 1px solid #FBD38D; }

.dcrm-toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--navy); color: #fff;
  padding: 12px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  z-index: 99999; animation: slideInRight .25s ease;
  display: flex; align-items: center; gap: 10px; max-width: 320px;
}
.dcrm-toast.success { border-left: 4px solid var(--success); }
.dcrm-toast.error   { border-left: 4px solid var(--danger); }
@keyframes slideInRight { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── STATUS BADGES ── */
.dcrm-status {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 10.5px; font-weight: 600;
}
.dcrm-status-confirmed { background: #DAFAF0; color: #1A7A55; }
.dcrm-status-pending   { background: #FFF8E1; color: #B7791F; }
.dcrm-status-cancelled { background: #FFF5F5; color: var(--danger); }
.dcrm-status-completed { background: #EEF2FF; color: #4C51BF; }
.dcrm-status-new       { background: var(--teal-lt); color: var(--teal-dk); }

/* ── LOGIN ── */
.dcrm-login-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #193a5e 100%); padding: 20px;
}
.dcrm-login-box {
  background: var(--surface); border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35); width: 100%; max-width: 400px; overflow: hidden;
}
.dcrm-login-logo {
  background: var(--navy); padding: 24px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.dcrm-login-logo-img {
  max-height: 48px; max-width: 260px; object-fit: contain; display: block;
}

/* Logo upload in settings */
.dcrm-logo-preview {
  display: flex; flex-direction: column; align-items: flex-start;
}
.dcrm-logo-preview-img {
  max-height: 56px; max-width: 240px; object-fit: contain; border-radius: 6px;
  border: 1px solid var(--border); padding: 8px; background: var(--bg);
}
.dcrm-logo-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed var(--border); border-radius: 10px; padding: 24px;
  transition: border-color .2s, background .2s; cursor: pointer; text-align: center;
}
.dcrm-logo-dropzone:hover, .dcrm-logo-dropzone.drag-over {
  border-color: var(--teal); background: rgba(83,107,140,.06);
}
/* Schedule editor */
.dcrm-sched-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.dcrm-sched-row:last-child { border-bottom: none; }
.dcrm-sched-day { min-width: 120px; padding-top: 5px; }
.dcrm-sched-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.dcrm-sched-toggle input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--teal); cursor: pointer;
}
.dcrm-sched-day-name { font-size: 13px; font-weight: 600; color: var(--text); }
.dcrm-sched-shifts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; }
.dcrm-sched-shift { display: flex; align-items: center; gap: 4px; }
.dcrm-sched-time {
  width: 86px; padding: 5px 4px; font-size: 13px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer;
}
.dcrm-sched-sep { color: var(--muted); font-size: 13px; }
.dcrm-sched-rm {
  background: none; border: none; color: var(--danger); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0 4px; opacity: .6; transition: opacity .15s;
}
.dcrm-sched-rm:hover { opacity: 1; }
.dcrm-sched-add {
  font-size: 11px !important; padding: 3px 8px !important; color: var(--teal) !important;
}
.dcrm-sched-closed { font-size: 12px; color: var(--muted); font-style: italic; padding-top: 5px; }

.dcrm-logo-icon {
  width: 44px; height: 44px; background: var(--teal);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
}
.dcrm-logo-icon svg { width: 24px; height: 24px; stroke: #fff; fill: none; }
.dcrm-login-logo .dcrm-clinic-name { font-size: 17px; font-weight: 700; color: #fff; display: block; }
.dcrm-logo-sub { font-size: 11px; color: rgba(255,255,255,.4); display: block; margin-top: 2px; }
.dcrm-login-form-wrap { padding: 28px; }
.dcrm-login-form-wrap h2 { font-size: 18px; font-weight: 700; color: var(--navy); margin-bottom: 20px; }

/* ── PANEL (patients, settings, etc.) ── */
.dcrm-panel { padding: 0 4px; }
.dcrm-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dcrm-panel-title  { font-size: 18px; font-weight: 700; color: var(--navy); }

.dcrm-search-row { display: flex; gap: 8px; margin-bottom: 14px; }
.dcrm-search-row input { flex: 1; }

.dcrm-table { width: 100%; border-collapse: collapse; }
.dcrm-table th {
  text-align: left; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px; color: var(--muted);
  padding: 8px 10px; border-bottom: 1.5px solid var(--border);
}
.dcrm-table td { padding: 10px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
.dcrm-table tr:hover td { background: var(--bg); cursor: pointer; }
.dcrm-table tr:last-child td { border-bottom: none; }

.dcrm-pagination { display: flex; gap: 5px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.dcrm-page-btn {
  background: var(--bg); border: 1.5px solid var(--border);
  padding: 5px 12px; border-radius: 7px; font-size: 12px;
  cursor: pointer; font-family: 'Outfit', sans-serif; transition: all .12s;
}
.dcrm-page-btn.active, .dcrm-page-btn:hover { background: #536B8C; color: #fff; border-color: #536B8C; }

/* Patient history */
.dcrm-history-list { display: flex; flex-direction: column; gap: 0; }
.dcrm-history-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.dcrm-history-item:last-child { border-bottom: none; }
.dcrm-history-bar  { width: 4px; border-radius: 2px; min-height: 40px; flex-shrink: 0; }
.dcrm-history-info { flex: 1; min-width: 0; }
.dcrm-history-name { font-size: 13px; font-weight: 600; color: var(--text); }
.dcrm-history-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.dcrm-history-date { font-size: 11px; color: var(--muted); flex-shrink: 0; text-align: right; }

/* ── SETTINGS ── */
.dcrm-settings-tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1.5px solid var(--border); padding-bottom: 0; }
.dcrm-tab-btn {
  background: none; border: none; border-bottom: 2.5px solid transparent;
  padding: 8px 14px; font-family: 'Outfit', sans-serif; font-size: 13px;
  font-weight: 600; cursor: pointer; color: var(--muted); margin-bottom: -1.5px;
  transition: all .15s;
}
.dcrm-tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }
.dcrm-tab-btn:hover  { color: var(--text); }
.dcrm-tab-panel { display: none; }
.dcrm-tab-panel.active { display: block; }

.dcrm-settings-section {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.dcrm-settings-section h3 {
  font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 14px;
  padding-bottom: 9px; border-bottom: 1px solid var(--border);
}

/* Treatment type list */
.dcrm-tt-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.dcrm-tt-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; background: var(--bg); border-radius: 8px;
  border: 1px solid var(--border);
}
.dcrm-tt-color { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.dcrm-tt-name  { flex: 1; font-size: 13px; font-weight: 500; }
.dcrm-tt-delete { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 14px; padding: 2px 5px; border-radius: 4px; }
.dcrm-tt-delete:hover { color: var(--danger); background: #FFF5F5; }

/* Doctor list in settings */
.dcrm-doctor-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--bg); border-radius: 8px;
  border: 1px solid var(--border); margin-bottom: 8px;
}
.dcrm-doctor-card-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.dcrm-doctor-card-info { flex: 1; }
.dcrm-doctor-card-name { font-size: 13px; font-weight: 700; color: var(--text); }
.dcrm-doctor-card-spec { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* Booking requests */
.dcrm-request-card {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 14px; margin-bottom: 10px;
}
.dcrm-request-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.dcrm-request-name { font-size: 14px; font-weight: 700; color: var(--text); }
.dcrm-request-meta { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.7; }
.dcrm-request-actions { display: flex; gap: 7px; margin-top: 10px; }

/* Import */
.dcrm-import-steps { display: flex; gap: 0; margin-bottom: 20px; }
.dcrm-import-step {
  flex: 1; text-align: center; padding: 10px 6px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid var(--border); position: relative;
}
.dcrm-import-step.active { color: var(--teal); border-bottom-color: var(--teal); }
.dcrm-import-step.done   { color: var(--success); border-bottom-color: var(--success); }

.dcrm-import-preview-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 10px; }
.dcrm-import-preview-table th { background: var(--bg); padding: 7px 10px; text-align: left; font-weight: 600; border-bottom: 1px solid var(--border); }
.dcrm-import-preview-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); }

/* SMS log */
.dcrm-sms-log-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.dcrm-sms-log-item:last-child { border-bottom: none; }
.dcrm-sms-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dcrm-sms-status-dot.sent   { background: var(--success); }
.dcrm-sms-status-dot.failed { background: var(--danger); }
.dcrm-sms-status-dot.pending { background: var(--warning); }

/* ── SPINNER ── */
@keyframes spin { to { transform: rotate(360deg); } }
.dcrm-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; vertical-align: middle;
}
.dcrm-spinner-dark { border-color: rgba(0,0,0,.15); border-top-color: var(--teal); }

/* Loading overlay */
.dcrm-loading-overlay {
  position: absolute; inset: 0; background: rgba(255,255,255,.65);
  display: flex; align-items: center; justify-content: center;
  border-radius: inherit; z-index: 50;
}

/* ── SCROLLBARS ── */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 230px; }
  .dcrm-nav-link { font-size: 12px; padding: 5px 10px; }
}

/* ── Mobile doctor filter (hidden on desktop) ── */
.dcrm-mobile-filter-btn { display: none; }
.dcrm-mobile-doc-filter {
  width: 100%; padding: 8px 12px; background: var(--bg);
  border-radius: 8px; display: flex; flex-wrap: wrap; gap: 6px 14px;
  border: 1px solid var(--border); margin-top: 8px;
}
.dcrm-mobile-doc-opt {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--navy); cursor: pointer; white-space: nowrap;
}
.dcrm-mobile-doc-opt input { accent-color: var(--primary); width: 15px; height: 15px; }
.dcrm-mobile-doc-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

@media (max-width: 768px) {
  .dcrm-sidebar { display: none !important; }
  .dcrm-user-name { display: none; }
  .dcrm-nav-link  { display: none; }
  .dcrm-dropdown-nav-item { display: block; }
  .dcrm-nav-views .dcrm-view-btn { padding: 5px 9px; font-size: 12px; }
  .dcrm-main { padding: 10px 8px; }
  .dcrm-cal-title { font-size: 16px; }
  .dcrm-modal-overlay { padding: 0; align-items: flex-end; }
  .dcrm-modal { border-radius: 14px 14px 0 0; max-height: 94vh; max-width: 100%; }
  .dcrm-detail-grid, .dcrm-detail-grid-3 { grid-template-columns: 1fr; }
  .dcrm-form-row { grid-template-columns: 1fr; }
  .dcrm-day-cell { min-height: 58px; }
  .dcrm-cal-appt-time { display: none; }
  .dcrm-btn { font-size: 12px; padding: 6px 12px; }
  .dcrm-mobile-filter-btn { display: inline-flex; font-size: 16px; }
}

@media (max-width: 480px) {
  .dcrm-nav { padding: 0 10px; gap: 6px; }
  .dcrm-nav-brand .dcrm-clinic-name { display: none; }
  .dcrm-cal-toolbar { flex-wrap: wrap; gap: 8px; }
  .dcrm-daygrid { font-size: 10px; }
  .dcrm-cal-appt-name { font-size: 9.5px; }
}

/* ── Skeleton loading states ─────────────────────────────────────────────── */
.dcrm-skeleton-wrap { padding: 8px 0; }
.dcrm-skel {
    background: linear-gradient(90deg, var(--border) 25%, #d5dce4 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: dcrm-shimmer 1.4s infinite;
    border-radius: 6px;
    margin-bottom: 12px;
}
.dcrm-skel-title  { height: 26px; width: 55%; }
.dcrm-skel-row    { height: 16px; width: 100%; }
.dcrm-skel-chart  { height: 80px; width: 100%; margin-top: 8px; }
@keyframes dcrm-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Reminders ───────────────────────────────────────────────────────────── */
.dcrm-reminder-list {
    display: flex; flex-direction: column; gap: 8px;
}
.dcrm-reminder-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; background: var(--bg); border-radius: 8px; border: 1px solid var(--border);
    transition: opacity .2s;
}
.dcrm-reminder-item.completed {
    opacity: .5;
}
.dcrm-reminder-item.completed .dcrm-reminder-title {
    text-decoration: line-through;
}
.dcrm-reminder-check {
    flex-shrink: 0; padding-top: 2px;
}
.dcrm-reminder-check input[type="checkbox"] {
    width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary);
}
.dcrm-reminder-body {
    flex: 1; min-width: 0;
}
.dcrm-reminder-title {
    font-size: 14px; font-weight: 600; color: var(--navy);
}
.dcrm-reminder-meta {
    font-size: 12px; color: var(--muted); margin-top: 2px;
}
.dcrm-reminder-notes {
    font-size: 12.5px; color: var(--text); margin-top: 4px; line-height: 1.4;
}
.dcrm-reminder-actions {
    flex-shrink: 0; display: flex; gap: 4px; align-items: center;
}

/* ── Chat Widget ─────────────────────────────────────────────────────────── */
.dcrm-chat-widget {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  font-family: 'Outfit', sans-serif;
}
.dcrm-chat-toggle {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--navy); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  transition: transform .15s, box-shadow .15s;
  position: relative;
}
.dcrm-chat-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.dcrm-chat-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  padding: 0 5px; border: 2px solid #fff;
}
.dcrm-chat-box {
  position: absolute; bottom: 62px; right: 0;
  width: 350px; height: 420px;
  background: var(--surface); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: dcrm-slide-up .15s ease-out;
}
.dcrm-chat-header {
  background: var(--navy); color: #fff;
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.dcrm-chat-title { font-size: 15px; font-weight: 700; }
.dcrm-chat-close {
  background: none; border: none; color: rgba(255,255,255,.6); cursor: pointer;
  font-size: 20px; padding: 0; line-height: 1;
}
.dcrm-chat-close:hover { color: #fff; }
.dcrm-chat-messages {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
}
.dcrm-chat-msg {
  max-width: 82%; padding: 8px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.45; word-wrap: break-word;
}
.dcrm-chat-msg-other {
  align-self: flex-start; background: var(--bg); color: var(--text);
  border-bottom-left-radius: 4px;
}
.dcrm-chat-msg-own {
  align-self: flex-end; background: var(--navy); color: #fff;
  border-bottom-right-radius: 4px;
}
.dcrm-chat-msg-sender {
  font-size: 10px; font-weight: 700; color: var(--teal);
  margin-bottom: 2px; text-transform: uppercase; letter-spacing: .3px;
}
.dcrm-chat-msg-own .dcrm-chat-msg-sender { color: rgba(255,255,255,.5); }
.dcrm-chat-msg-time {
  font-size: 9px; opacity: .5; margin-top: 2px; text-align: right;
}
.dcrm-chat-input-bar {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border); flex-shrink: 0; background: var(--surface);
}
.dcrm-chat-input-bar input {
  flex: 1; border: 1.5px solid var(--border); border-radius: 20px;
  padding: 8px 14px; font-size: 13px; outline: none;
  font-family: 'Outfit', sans-serif;
}
.dcrm-chat-input-bar input:focus { border-color: var(--teal); }
.dcrm-chat-send-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--navy); color: #fff; border: none; cursor: pointer;
  font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .12s;
}
.dcrm-chat-send-btn:hover { background: var(--teal); }
.dcrm-chat-date-sep {
  text-align: center; font-size: 10px; color: var(--muted);
  padding: 6px 0; font-weight: 600;
}
@media (max-width: 480px) {
  .dcrm-chat-box { width: calc(100vw - 24px); right: -8px; height: 360px; }
}

/* ── Appointment resize handle (week/day views) ────── */
.dcrm-appt-resize {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 8px; cursor: ns-resize;
}
.dcrm-appt-resize::after {
  content: ''; display: block; width: 26px; height: 3px;
  margin: 2px auto 0; border-radius: 2px;
  background: currentColor; opacity: 0; transition: opacity .12s;
}
.dcrm-cal-appt:hover .dcrm-appt-resize::after { opacity: .5; }
