/* Therapist dashboard — Speech Sathi */

:root {
  --td-bg: #fff1f0;
  --td-sidebar: #fff5f3;
  --td-white: #ffffff;
  --td-text: #1a1a1a;
  --td-muted: #5c5c5c;
  --td-red: #c62828;
  --td-red-dark: #b71c1c;
  --td-teal: #00838f;
  --td-blue: #1565c0;
  --td-green: #2e7d32;
  --td-pulse-bg: #4e342e;
  --td-radius: 14px;
  --td-radius-lg: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.td-page {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, sans-serif;
  color: var(--td-text);
  background: var(--td-bg);
}

body.td-page a {
  text-decoration: none;
  color: inherit;
}

.td-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.td-sidebar {
  background: var(--td-sidebar);
  border-right: 1px solid #f0ded8;
  padding: 22px 16px 20px;
  display: flex;
  flex-direction: column;
}

.td-sidebar-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 26px;
}

.td-sidebar-brand img {
  height: 44px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.td-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.td-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #5c4c4a;
  border-right: 4px solid transparent;
}

.td-nav a:hover {
  background: rgba(255, 255, 255, 0.85);
}

.td-nav a.active {
  background: #ffe8e6;
  color: var(--td-red);
  border-right-color: var(--td-red);
}

.td-nav svg {
  width: 18px;
  height: 18px;
  opacity: 0.88;
}

.td-sidebar-bottom {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.td-btn-new {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #d32f2f, var(--td-red));
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 18px rgba(198, 40, 40, 0.28);
}

.td-btn-new:hover {
  filter: brightness(1.04);
}

.td-help-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--td-muted);
  padding: 8px;
}

.td-help-link:hover {
  color: var(--td-red);
}

/* Main */
.td-main {
  background: var(--td-white);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.td-top {
  padding: 22px 28px 18px;
  border-bottom: 1px solid #f0e8e5;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.td-greet h1 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 800;
}

.td-greet p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--td-muted);
  max-width: 520px;
  line-height: 1.45;
}

.td-top-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.td-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #edd5d0;
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #4a4a4a;
  padding: 0;
}

.td-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.td-profile img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.td-profile strong {
  display: block;
  font-size: 0.95rem;
}

.td-profile span {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--td-muted);
}

.td-content {
  padding: 24px 28px 36px;
  flex: 1;
}

/* KPI row */
.td-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.td-kpi {
  background: var(--td-white);
  border: 1px solid #f0e8e5;
  border-radius: var(--td-radius-lg);
  padding: 18px 18px 16px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.04);
}

.td-kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.td-kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.td-kpi-icon.red {
  background: #ffebee;
  color: var(--td-red);
}

.td-kpi-icon.teal {
  background: #e0f7fa;
  color: var(--td-teal);
}

.td-kpi-icon.blue {
  background: #e3f2fd;
  color: var(--td-blue);
}

.td-kpi-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.td-kpi-tag.up {
  background: #e8f5e9;
  color: var(--td-green);
}

.td-kpi-tag.week {
  background: #e0f2f1;
  color: var(--td-teal);
}

.td-kpi-tag.high {
  background: #ffebee;
  color: var(--td-red);
}

.td-kpi label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--td-muted);
  margin-bottom: 4px;
}

.td-kpi .value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.td-kpi-pulse {
  background: linear-gradient(145deg, #5d4037 0%, var(--td-pulse-bg) 50%, #3e2723 100%);
  color: #fff;
  border: none;
  position: relative;
  overflow: hidden;
}

.td-pulse-wave {
  width: 100%;
  height: 40px;
  margin: 10px 0 12px;
  opacity: 0.95;
}

.td-kpi-pulse label {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  margin-bottom: 0;
}

.td-kpi-pulse .pulse-status {
  font-size: 0.95rem;
  font-weight: 700;
  opacity: 0.95;
}

/* Mid grid */
.td-mid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 22px;
  margin-bottom: 24px;
}

.td-card {
  background: var(--td-white);
  border: 1px solid #f0e8e5;
  border-radius: var(--td-radius-lg);
  padding: 20px 22px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.04);
}

.td-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.td-card-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.td-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--td-red);
}

.td-link:hover {
  text-decoration: underline;
}

.td-session {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-radius: var(--td-radius);
  border: 1px solid #f0e8e5;
  margin-bottom: 12px;
  overflow: hidden;
  background: #fff;
}

.td-session:last-child {
  margin-bottom: 0;
}

.td-session-accent {
  width: 5px;
  flex-shrink: 0;
}

.td-session-accent.red {
  background: var(--td-red);
}

.td-session-accent.teal {
  background: var(--td-teal);
}

.td-session-accent.grey {
  background: #78909c;
}

.td-session-body {
  flex: 1;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.td-session-time {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--td-muted);
  min-width: 72px;
}

.td-session-info strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.td-session-info span {
  font-size: 0.82rem;
  color: var(--td-muted);
}

.td-session-icon {
  color: var(--td-red);
  flex-shrink: 0;
}

/* Chart card */
.td-chart-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.td-chart-head h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 800;
}

.td-chart-head p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--td-muted);
}

.td-toggle {
  display: inline-flex;
  border-radius: 999px;
  background: #f5f0ef;
  padding: 4px;
  gap: 4px;
}

.td-toggle button {
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: var(--td-muted);
}

.td-toggle button.active {
  background: var(--td-red);
  color: #fff;
}

.td-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 160px;
  padding: 12px 4px 36px;
  margin-top: 12px;
}

.td-bar {
  flex: 1;
  min-width: 0;
  max-width: 28px;
  margin: 0 auto;
  border-radius: 6px 6px 0 0;
  position: relative;
}

.td-bar.pink {
  background: #ffcdd2;
}

.td-bar.red {
  background: var(--td-red);
}

.td-bar.teal {
  background: var(--td-teal);
}

.td-bar span {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%) rotate(-45deg);
  transform-origin: center;
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--td-muted);
  white-space: nowrap;
}

/* Quick actions */
.td-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.td-action {
  border-radius: var(--td-radius-lg);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid transparent;
}

.td-action.pink {
  background: #fff0ee;
  border-color: #f8d4cf;
}

.td-action.blue {
  background: #e8eaf6;
  border-color: #d1d6f0;
}

.td-action-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  display: grid;
  place-items: center;
  color: var(--td-red);
}

.td-action.blue .td-action-icon {
  color: var(--td-blue);
}

.td-action h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.td-action p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--td-muted);
  line-height: 1.45;
  flex: 1;
}

.td-action a {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--td-red);
}

.td-action.blue a {
  color: var(--td-blue);
}

@media (max-width: 1100px) {
  .td-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .td-mid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .td-shell {
    grid-template-columns: 1fr;
  }

  .td-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid #f0ded8;
  }

  .td-nav {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
  }

  .td-sidebar-bottom {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .td-btn-new {
    width: auto;
    flex: 1;
    min-width: 160px;
  }
}

@media (max-width: 640px) {
  .td-kpis {
    grid-template-columns: 1fr;
  }

  .td-actions {
    grid-template-columns: 1fr;
  }

  .td-bars {
    height: 120px;
  }

  .td-bar span {
    display: none;
  }
}
