/* ==========================================================================
   Clinicia-style theme for Sethu's Dental House
   Coral top bar · white grouped sidebar · soft grey canvas · white cards
   ========================================================================== */
:root {
  --brand: #ee4b47;
  --brand-dark: #d93b37;
  --brand-soft: #fdeeef;
  --canvas: #f4f6f9;
  --ink: #2c3e50;
  --muted: #77838f;
  --line: #e8ecf1;
  --topbar-h: 58px;
}

* {
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Open Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-canvas {
  background: var(--canvas);
  color: var(--ink);
  padding-top: var(--topbar-h);
}

/* ------------------------------------------------------------- top bar */
.app-topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.9rem;
  background: var(--brand);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
}

.topbar-icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  height: 34px;
  width: 34px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  transition: background 0.15s;
}
.topbar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.topbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.18);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.topbar-chip:hover {
  background: rgba(255, 255, 255, 0.28);
}

.topbar-search {
  position: relative;
  align-items: center;
}
.topbar-search input {
  width: 250px;
  height: 34px;
  border-radius: 7px;
  border: 0;
  background: #fff;
  padding: 0 34px 0 12px;
  font-size: 12.5px;
  color: #334155;
  outline: none;
}
.topbar-search input::placeholder {
  color: #9aa6b2;
}
.topbar-search i {
  position: absolute;
  right: 12px;
  font-size: 12px;
  color: #3f4a56;
  pointer-events: none;
}

.topbar-avatar {
  display: grid;
  place-items: center;
  height: 32px;
  width: 32px;
  border-radius: 999px;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.topbar-badge {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #27313d;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
}

.profile-menu {
  position: absolute;
  right: 0;
  top: 42px;
  width: 224px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}
.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  font-size: 13px;
  color: #404b57;
}
.profile-menu-item:hover {
  background: #f7f9fb;
}

/* ------------------------------------------------------------- sidebar */
.app-sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}

.sidebar-section {
  margin: 14px 0 5px;
  padding: 0 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a3aeb9;
}
.sidebar-section:first-child {
  margin-top: 12px;
}

.nav-link {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
  border-radius: 7px;
  padding: 0.5rem 0.6rem;
  font-size: 13px;
  font-weight: 500;
  color: #556070;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover {
  background: #f5f7fa;
  color: #22303f;
}
.nav-link-active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.nav-icon {
  width: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--brand);
  opacity: 0.85;
}
.nav-link-active .nav-icon {
  opacity: 1;
}

.nav-chevron {
  display: grid;
  place-items: center;
  height: 26px;
  width: 26px;
  border-radius: 6px;
  color: #a3aeb9;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.nav-chevron:hover {
  background: #f1f4f8;
  color: #556070;
}
.nav-chevron[aria-expanded='true'] {
  color: var(--brand);
}
.nav-chevron[aria-expanded='true'] i {
  transform: rotate(45deg);
}

.nav-children {
  margin: 2px 0 4px 0;
  padding-left: 10px;
}
.nav-child {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 12.5px;
  color: #6b7787;
}
.nav-child:hover {
  background: #f5f7fa;
  color: #22303f;
}
.nav-child-dot {
  height: 5px;
  width: 5px;
  border-radius: 999px;
  background: #cbd5e1;
}

/* --------------------------------------------------------- page header */
.page-greeting {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* ------------------------------------------------------------ KPI cards */
.kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  padding: 16px 18px;
  transition: box-shadow 0.16s, transform 0.16s;
}
.kpi-card:hover {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}
.kpi-icon {
  display: grid;
  place-items: center;
  height: 42px;
  width: 42px;
  flex: 0 0 42px;
  border-radius: 999px;
  color: #fff;
  font-size: 17px;
}
.kpi-value {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
}
.kpi-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}
.kpi-clickable {
  position: relative;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.kpi-clickable .kpi-go {
  margin-left: auto;
  font-size: 10px;
  color: #c3ccd6;
  transition: transform 0.16s, color 0.16s;
}
.kpi-clickable:hover .kpi-go {
  color: var(--brand);
  transform: translateX(2px);
}
.kpi-clickable:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* -------------------------------------------------------------- panels */
.panel {
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

.chart-toolbar {
  display: inline-flex;
  overflow: hidden;
  border-radius: 7px;
  border: 1px solid #dfe5ec;
}
.chart-btn {
  padding: 5px 13px;
  font-size: 11.5px;
  font-weight: 600;
  color: #7b8794;
  background: #fff;
}
.chart-btn:hover {
  background: #f4f6f9;
}
.chart-btn-active {
  background: #b6bec7;
  color: #fff;
}

/* --------------------------------------------------------- date-range picker */
.range-picker {
  position: relative;
  display: inline-block;
  text-align: left;
}
.range-trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #4b5563;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: background 0.15s, box-shadow 0.15s;
}
.range-trigger:hover {
  background: #f7f9fb;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.range-trigger i.fa-calendar-days {
  color: var(--brand);
}
.range-trigger .range-caret {
  font-size: 10px;
  color: #9aa5b1;
}
.range-menu {
  position: absolute;
  right: 0;
  z-index: 50;
  margin-top: 6px;
  width: 216px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}
.range-menu.hidden {
  display: none;
}
.range-item {
  display: block;
  width: 100%;
  border-radius: 6px;
  padding: 9px 12px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 500;
  color: #4b5563;
  cursor: pointer;
}
.range-item:hover {
  background: #f4f6f9;
}
.range-item.range-active {
  background: #2f9bf0;
  color: #fff;
}
.range-custom {
  padding: 8px 6px 4px;
}
.range-custom.hidden {
  display: none;
}
.range-custom label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.range-custom input {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  border-radius: 6px;
  border: 1px solid #dfe5ec;
  padding: 6px 8px;
  font-size: 12px;
  color: #334155;
}

/* ------------------------------------------------------- patient profile */
.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 7px;
  border: 1px solid var(--brand);
  background: #fff;
  padding: 0.35rem 0.7rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  transition: background 0.15s, color 0.15s;
}
.profile-pill:hover {
  background: var(--brand);
  color: #fff;
}
.profile-pill i {
  font-size: 11px;
}

.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}
.profile-tab {
  position: relative;
  border: 0;
  background: transparent;
  padding: 9px 13px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #8a95a1;
  cursor: pointer;
  transition: color 0.15s;
}
.profile-tab:hover {
  color: var(--brand);
}
.profile-tab.is-active {
  color: var(--brand);
}
.profile-tab.is-active::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

/* -------------------------------------------------------------- buttons */
.btn-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 7px;
  background: var(--brand);
  padding: 0.5rem 0.85rem;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  transition: background 0.15s;
}
.btn-brand:hover {
  background: var(--brand-dark);
}
.btn-outline-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 7px;
  border: 1px solid #dfe5ec;
  background: #fff;
  padding: 0.5rem 0.85rem;
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
  transition: background 0.15s;
}
.btn-outline-brand:hover {
  background: #f7f9fb;
}

/* ------------------------------------------------------- floating action */
.fab-whatsapp {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 45;
  display: grid;
  place-items: center;
  height: 52px;
  width: 52px;
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  font-size: 26px;
  box-shadow: 0 8px 22px rgba(37, 211, 102, 0.42);
  transition: transform 0.16s;
}
.fab-whatsapp:hover {
  transform: scale(1.06);
}

/* ------------------------------------------------------------- animations */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.toast-in {
  animation: toastIn 0.2s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.modal-in {
  animation: modalIn 0.16s ease-out;
}

/* ----------------------------------------------------------- tooth chart */
.tooth {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.6rem;
  border-radius: 0.45rem 0.45rem 0.9rem 0.9rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 0.6rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  user-select: none;
}
.tooth:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}
.tooth[data-status='completed'] {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}
.tooth[data-status='in_progress'] {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}
.tooth[data-status='planned'] {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #075985;
}
.tooth-selected {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.tooth-missing {
  opacity: 0.45;
  background: #f1f5f9;
}

/* ------------------------------------------------------------------ misc */
@media print {
  .no-print {
    display: none !important;
  }
  .app-canvas {
    padding-top: 0;
  }
  .lg\:ml-\[218px\] {
    margin-left: 0 !important;
  }
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
  background-clip: content-box;
}
