:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1d2733;
  --muted: #6b7280;
  --line: #dfe5ec;
  --brand: #1f8f76;
  --brand-dark: #166b59;
  --blue: #2878d9;
  --danger: #d94343;
  --warn: #c98316;
  --ok: #238c4a;
  --shadow: 0 8px 24px rgba(29, 39, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--blue);
  color: white;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.96);
}

button.secondary {
  background: #eef2f7;
  color: var(--ink);
}

button.success {
  background: var(--ok);
}

button.danger {
  background: var(--danger);
}

button.ghost,
a.ghost {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  background: transparent;
  color: var(--blue);
  padding: 6px 8px;
  text-decoration: none;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 10px 14px;
  background: #eef2f7;
  color: var(--ink);
  text-decoration: none;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #e5f2ef 0%, #f5f7fb 55%, #e9eef8 100%);
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 32px;
}

.login-card p {
  margin: 0 0 26px;
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 14px;
}

.compact-form {
  max-width: 720px;
}

.form-stack label {
  display: grid;
  gap: 6px;
  font-weight: 650;
}

.form-stack label[hidden] {
  display: none !important;
}

.checkbox-row {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 10px !important;
}

.checkbox-row input {
  width: auto;
}

.login-remember {
  font-weight: 500 !important;
  color: var(--muted);
  cursor: pointer;
}

.branch-checkbox-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.branch-checkbox {
  display: flex !important;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 10px !important;
  padding: 8px;
  font-weight: 500 !important;
  cursor: pointer;
}

.branch-checkbox[hidden] {
  display: none !important;
}

.branch-checkbox input {
  width: auto;
  margin-top: 3px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 70px;
  padding: 0 32px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(29, 39, 51, 0.05);
}

.brand {
  font-size: 24px;
  font-weight: 800;
  color: var(--brand);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.role-pill,
.status-pill,
.version-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: #e8f4f1;
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 13px;
}

.status-new {
  background: #eaf2ff;
  color: #1d5ca8;
}

.version-pill {
  background: #eef2f7;
  color: #3d4652;
  font-size: 12px;
  white-space: nowrap;
}

.status-in_progress,
.status-callback {
  background: #fff4de;
  color: #8a580d;
}

.status-booked {
  background: #e5f7eb;
  color: #1b743d;
}

.status-rejected,
.status-duplicate {
  background: #ffe8e8;
  color: #a62f2f;
}

.page {
  width: min(1480px, calc(100vw - 48px));
  margin: 32px auto 80px;
}

.page-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.page-title-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
}

.inline-field {
  display: grid;
  gap: 6px;
  min-width: 250px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.page-title h1 {
  margin: 0;
  font-size: 38px;
}

.page-title p {
  margin: 6px 0 0;
  color: var(--muted);
}

.summary-grid,
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card,
.section-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-card {
  padding: 22px;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  color: var(--brand);
  font-size: 34px;
}

.summary-card span {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
}

.section-card {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: var(--brand);
  color: white;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.panel {
  padding: 24px;
  margin-bottom: 22px;
}

.subpanel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 16px;
}

.integration-provider-details {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
  font-size: 26px;
}

.compact-head {
  align-items: flex-start;
}

.compact-head h2 {
  font-size: 22px;
}

.integration-source-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 16px 0;
}

.integrations-stack {
  display: grid;
  gap: 18px;
}

.integration-card {
  display: grid;
  gap: 14px;
}

.integration-webhook-button {
  justify-self: start;
}

.integration-webhook-modal {
  display: grid;
  gap: 16px;
  min-width: min(760px, calc(100vw - 48px));
}

.integration-source-card {
  border: 1px solid var(--line, #d8dee8);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface, #fff);
}

.integration-source-card h3 {
  margin: 0;
}

.lead-webhooks-panel {
  margin-top: 18px;
}

.lead-webhook-card {
  display: grid;
  gap: 10px;
}

.lead-webhook-card input {
  min-width: 0;
}

.marquiz-csv-import {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.marquiz-csv-import label {
  flex: 1 1 320px;
  min-width: 240px;
}

.marquiz-csv-import input[type="file"] {
  display: block;
  width: 100%;
  margin: 8px 0 0;
}

.marquiz-csv-import .help-text {
  flex: 1 1 100%;
  margin: 0;
}

.jivo-mailbox-panel {
  margin-top: 18px;
}

.compact-split {
  gap: 12px;
}

.jivo-mailbox-preview {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.jivo-mailbox-sample {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #f8fafc;
}

.jivo-mailbox-sample pre {
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.integration-source-stats {
  margin-top: 10px;
  color: var(--text, #223044);
}

.integration-source-stats strong {
  font-size: 1.35rem;
}

.webhook-card {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.webhook-add-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  align-items: end;
  gap: 12px;
}

.webhook-add-form[hidden] {
  display: none !important;
}

.webhook-add-form label {
  margin: 0;
}

.webhook-source-list {
  display: grid;
  gap: 10px;
}

.webhook-source-row {
  display: grid;
  grid-template-columns: minmax(110px, 150px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.webhook-source-row input {
  min-width: 0;
}

@media (max-width: 760px) {
  .integration-source-panels {
    grid-template-columns: 1fr;
  }
  .webhook-add-form {
    grid-template-columns: 1fr;
  }

  .webhook-source-row {
    grid-template-columns: 1fr;
  }
}

.current-calls-list {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.current-calls-list.compact {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  max-height: 260px;
}

.current-call-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.current-call-item > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.current-call-item strong {
  font-size: 18px;
}

.current-call-item span,
.current-call-item small {
  color: var(--muted);
}

.current-call-item p {
  margin: 0;
}

.inline-copy {
  padding: 2px 6px;
  background: transparent;
  color: var(--blue);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.toolbar > * {
  max-width: 260px;
}

.muted {
  color: var(--muted);
}

.analytics-request-diagnostics {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 0.78rem;
}

.analytics-request-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--muted);
}

.analytics-request-row > span {
  width: 16px;
  color: #218739;
  font-weight: 700;
}

.analytics-request-row.is-error > span,
.analytics-request-row.is-error small {
  color: #b42318;
}

.analytics-request-row small {
  color: var(--muted);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  background: #e9eef4;
  color: var(--ink);
}

.tab.active {
  background: var(--brand);
  color: white;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #3d4652;
  font-size: 13px;
  text-transform: uppercase;
  background: #f8fafc;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.week-range {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 170px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #eef3f9;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.current-week-button {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .week-range {
    min-width: 0;
    flex: 1 1 150px;
  }
}

.schedule-panel {
  overflow: hidden;
  padding: 0;
}

.schedule-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 20px 8px;
  color: var(--muted);
  font-size: 13px;
}

.schedule-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.schedule-legend i {
  width: 12px;
  height: 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.schedule-legend i.appointment {
  border-color: var(--blue);
  background: #e7f0ff;
}

.schedule-legend i.external {
  border-color: #98a4b0;
  background: #eef1f4;
}

.schedule-hint {
  margin: 0;
  padding: 4px 20px 12px;
  color: var(--muted);
  font-size: 13px;
}

.schedule-calendar {
  max-height: calc(100vh - 300px);
  min-height: 520px;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: white;
}

.calendar-header,
.calendar-body {
  display: grid;
  grid-template-columns: 68px repeat(7, minmax(150px, 1fr));
  min-width: 1120px;
}

.calendar-header {
  position: sticky;
  top: 0;
  z-index: 8;
  min-height: 52px;
  background: white;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(29, 39, 51, 0.06);
}

.calendar-corner,
.calendar-day-heading {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.calendar-corner {
  position: sticky;
  left: 0;
  z-index: 9;
  color: var(--muted);
  font-size: 11px;
}

.calendar-day-heading {
  border-left: 1px solid var(--line);
}

.calendar-day-heading.today {
  background: #e6f4ef;
  color: var(--brand-dark);
}

.calendar-day-heading.drag-target-day-heading {
  background: #dbe9ff;
  color: #185baa;
}

.calendar-body {
  position: relative;
  border-bottom: 1px dashed #aeb7c1;
}

.calendar-time-axis,
.calendar-day {
  position: relative;
  height: var(--calendar-height);
}

.calendar-time-axis {
  position: sticky;
  left: 0;
  z-index: 4;
  background: white;
  border-right: 1px solid var(--line);
}

.calendar-time-axis span {
  position: absolute;
  right: 10px;
  color: var(--muted);
  font-size: 11px;
  transform: translateY(-50%);
}

.calendar-time-axis span.start {
  transform: translateY(8px);
}

.calendar-time-axis span.end {
  transform: translateY(-100%);
}

.calendar-day {
  min-width: 0;
  border-right: 1px solid var(--line);
  background-color: white;
  background-image:
    repeating-linear-gradient(to bottom, transparent 0, transparent 43px, #e8edf2 43px, #e8edf2 44px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 87px, #d5dde5 87px, #d5dde5 88px);
  transition: background-color 0.12s ease;
}

.calendar-day.drag-target-day {
  background-color: #eef5ff;
}

.calendar-event {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
  padding: 7px 8px 6px 11px;
  border: 1px solid #86b3ea;
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #e7f0ff;
  color: var(--ink);
  text-align: left;
  touch-action: none;
  transition: opacity 0.12s ease, box-shadow 0.12s ease;
}

.calendar-event strong,
.calendar-event b,
.calendar-event small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event strong {
  color: #1d66b7;
  font-size: 12px;
}

.calendar-event b {
  font-size: 13px;
}

.calendar-event small {
  color: #516273;
  font-size: 11px;
}

.calendar-event.appointment:hover {
  z-index: 3;
  filter: none;
  box-shadow: 0 5px 14px rgba(36, 86, 140, 0.18);
}

.calendar-event.diagnostics {
  border-color: #86b3ea;
  border-left-color: var(--blue);
  background: #e7f0ff;
}

.calendar-event.consultation {
  border-color: #83cbb8;
  border-left-color: var(--brand);
  background: #e5f5ef;
}

.calendar-event.consultation strong {
  color: var(--brand-dark);
}

.calendar-free-area {
  position: absolute;
  z-index: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.calendar-free-area:hover {
  background: rgba(111, 123, 137, 0.14);
  box-shadow: inset 0 1px rgba(111, 123, 137, 0.25), inset 0 -1px rgba(111, 123, 137, 0.25);
  filter: none;
}

.calendar-free-area:focus-visible {
  background: rgba(111, 123, 137, 0.14);
  outline: 2px solid rgba(111, 123, 137, 0.45);
  outline-offset: -2px;
}

.calendar-doctor-off {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(241, 243, 246, 0.82);
  color: #66717f;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.calendar-doctor-off span {
  padding: 8px 10px;
  border: 1px solid #d8dee6;
  border-radius: 6px;
  background: #f1f3f6;
}

.calendar-event.external-appointment {
  cursor: grab;
}

.calendar-event.external-appointment:active {
  cursor: grabbing;
}

.calendar-event.operation {
  border-color: #b7a4df;
  border-left-color: #7052b8;
  background: #f0ebfc;
}

.calendar-event.operation strong {
  color: #6242aa;
}

.calendar-event.correction {
  border-color: #e1bb70;
  border-left-color: var(--warn);
  background: #fff2d6;
}

.calendar-event.correction strong {
  color: #a86608;
}

.calendar-event.external-busy {
  align-items: center;
  justify-content: center;
  flex-direction: row;
  padding: 4px 6px;
  border-color: #b9c1c9;
  border-left-color: #8995a1;
  background: #eef1f4;
}

.external-busy-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
  max-width: 100%;
  overflow: hidden;
  color: #65717d;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-busy-line strong {
  display: inline;
  flex: 0 0 auto;
  color: inherit;
  font-size: inherit;
}

.calendar-utilization {
  position: absolute;
  right: 4px;
  left: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #b8d8cc;
  border-left: 4px solid #4d9f85;
  border-radius: 5px;
  background: #edf7f3;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
}

.calendar-utilization:hover,
.calendar-utilization:focus-visible {
  z-index: 3;
  border-color: var(--brand);
  box-shadow: 0 3px 10px rgba(35, 119, 93, 0.16);
}

.calendar-utilization.medium {
  border-color: #e2c171;
  border-left-color: #c68918;
  background: #fff7df;
}

.calendar-utilization.high {
  border-color: #e4a1a1;
  border-left-color: #c84b4b;
  background: #fff0f0;
}

.calendar-utilization strong {
  font-size: 12px;
}

.calendar-utilization span {
  overflow: hidden;
  color: #526273;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-overview-doctors {
  display: grid;
  gap: 8px;
  margin: 18px 0 24px;
}

.schedule-overview-doctors button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  text-align: left;
}

.schedule-overview-doctors button span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.calendar-event.dragging-origin {
  opacity: 0.25;
}

.calendar-event.saving {
  opacity: 0.55;
  cursor: wait;
}

.calendar-resize-handle {
  position: absolute;
  left: 50%;
  z-index: 4;
  width: 38px;
  height: 7px;
  border-radius: 4px;
  background: currentColor;
  opacity: 0;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.calendar-resize-handle.top {
  top: 1px;
}

.calendar-resize-handle.bottom {
  bottom: 1px;
}

.calendar-event:hover .calendar-resize-handle,
.calendar-event:focus-visible .calendar-resize-handle {
  opacity: 0.65;
}

.calendar-drag-preview {
  right: 4px;
  left: 4px !important;
  width: auto !important;
  z-index: 7;
  overflow: visible;
  border-width: 2px;
  border-style: solid;
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(40, 120, 217, 0.18);
}

.calendar-drag-preview.invalid {
  border-color: var(--danger);
  background: #fff0f0;
}

.calendar-drop-edge {
  position: absolute;
  right: 2px;
  padding: 2px 5px;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: white;
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.calendar-drop-edge.start {
  top: -24px;
}

.calendar-drop-edge.end {
  bottom: -24px;
}

.calendar-now-line {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 6;
  height: 0;
  border-top: 1px dashed var(--blue);
  pointer-events: none;
}

.calendar-now-line span {
  position: absolute;
  bottom: 3px;
  left: 7px;
  padding: 1px 3px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--blue);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.schedule-dragging,
.schedule-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
}

.modal-backdrop.open {
  display: flex;
}

.modal-backdrop.drawer {
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
}

.modal-backdrop.drawer .modal {
  width: min(480px, 100%);
  max-height: 100vh;
  border-radius: 0;
  padding: 30px;
}

.modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: white;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
}

.modal:has(.markdown-editor) {
  width: min(980px, 100%);
}

.modal:has(#umc-settings-form) {
  width: min(880px, 100%);
}

.modal:has(.task-detail-modal),
.modal:has(.task-editor-modal) {
  width: min(1120px, 100%);
}

.task-board-title {
  align-items: end;
}

.task-board-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.task-board-controls .inline-field {
  min-width: 250px;
}

.task-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  align-items: start;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.task-board-chat {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.6fr);
  min-height: 280px;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.task-board-chat-compose {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  border-right: 1px solid var(--line);
}

.task-board-chat-compose h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.task-board-chat-compose p {
  margin: 0;
}

.task-board-chat-compose textarea {
  min-height: 120px;
  resize: vertical;
}

.task-chat-input {
  position: relative;
}

.task-mention-picker {
  position: absolute;
  z-index: 12;
  top: calc(100% - 2px);
  right: 0;
  left: 0;
  max-height: 210px;
  overflow-y: auto;
  border: 1px solid #c9d1dc;
  border-radius: 6px;
  background: white;
  box-shadow: 0 8px 22px rgba(29, 39, 51, 0.16);
}

.task-mention-picker button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.task-mention-picker button:hover,
.task-mention-picker button:focus-visible {
  background: #edf3f8;
}

.task-mention-picker span {
  color: var(--muted);
  font-size: 12px;
}

.task-chat-mention {
  border-radius: 3px;
  padding: 1px 3px;
  background: #e2eefc;
  color: #1f5f9f;
  font-weight: 700;
}

.task-board-chat-feed {
  max-height: 420px;
  overflow-y: auto;
  padding: 10px 20px;
}

.task-board-message {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.task-board-message:last-child {
  border-bottom: 0;
}

.task-board-message header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-board-message time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.task-board-message p {
  margin: 10px 0 0;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-board-chat-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.task-board-chat-heading .checkbox-row {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.task-board-activity-message {
  color: #747d89;
  font-size: 12px;
}

.task-board-activity-message .task-member {
  opacity: 0.8;
}

.task-column {
  display: flex;
  flex-direction: column;
  min-width: 230px;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf1f5;
  transition: border-color 120ms ease, background 120ms ease;
}

.task-column.drag-over {
  border-color: var(--blue);
  background: #e6f0fc;
}

.task-column > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
}

.task-column > header h2 {
  margin: 0;
  font-size: 16px;
}

.task-column > header span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.task-column-list {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 100px;
  padding: 0 9px 9px;
}

.task-card {
  min-width: 0;
  border: 1px solid #d8dee7;
  border-radius: 7px;
  padding: 12px;
  background: white;
  box-shadow: 0 2px 7px rgba(29, 39, 51, 0.07);
  cursor: grab;
}

.task-card:hover {
  border-color: #aeb9c7;
}

.task-card.dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.task-card h3 {
  margin: 10px 0 14px;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task-card-meta {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.task-add-card {
  margin: auto 9px 9px;
  text-align: left;
}

.task-labels,
.task-members {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.task-label {
  display: inline-flex;
  min-height: 6px;
  max-width: 100%;
  border-radius: 3px;
  padding: 3px 7px;
  color: white;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.task-member {
  display: inline-flex;
  align-items: center;
  max-width: 170px;
  border-left: 4px solid currentColor;
  padding: 2px 6px;
  background: #f0f3f7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.task-role-root { background-color: #3f4650; }
.task-role-admin { background-color: #b8423e; }
.task-role-organization-owner { background-color: #247b65; }
.task-role-call-center { background-color: #2d6fbb; }
.task-role-marketer { background-color: #7a4ba3; }
.task-role-umc-service { background-color: #b56813; }
.task-role-unknown { background-color: #69717c; }

.task-member.task-role-root { color: #3f4650; background: #edf0f2; }
.task-member.task-role-admin { color: #a43a36; background: #faeeee; }
.task-member.task-role-organization-owner { color: #1f725e; background: #eaf5f1; }
.task-member.task-role-call-center { color: #2865aa; background: #edf4fc; }
.task-member.task-role-marketer { color: #6d438f; background: #f5eef9; }
.task-member.task-role-umc-service { color: #9a590f; background: #fff3e2; }
.task-member.task-role-unknown { color: #5d6570; background: #eef0f2; }

.task-archive {
  display: grid;
  gap: 8px;
}

.task-archive-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  width: 100%;
  border: 1px solid var(--line);
  padding: 14px 16px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.task-archive-row > span:first-child {
  display: grid;
  gap: 8px;
}

.task-archive-row > span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.modal-heading,
.task-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.modal-heading h2,
.task-detail-header h2 {
  margin: 0 0 5px;
}

.task-role-fieldset {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.task-role-fieldset legend {
  padding: 0 5px;
  font-weight: 650;
}

.task-role-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-role-option {
  display: inline-flex !important;
  align-items: center;
  gap: 7px !important;
  border-radius: 4px;
  padding: 7px 9px;
  color: white;
  font-size: 13px;
  cursor: pointer;
}

.task-role-option input {
  width: auto;
  margin: 0;
}

.task-markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #f7f9fb;
}

.task-markdown-toolbar button {
  position: relative;
  width: 34px;
  height: 32px;
  padding: 0;
}

.task-markdown-toolbar button::after {
  position: absolute;
  z-index: 20;
  top: calc(100% + 7px);
  left: 50%;
  border: 1px solid #c9d1dc;
  border-radius: 4px;
  padding: 5px 7px;
  background: white;
  box-shadow: 0 3px 10px rgba(29, 39, 51, 0.14);
  color: var(--ink);
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  visibility: hidden;
  white-space: nowrap;
}

.task-markdown-toolbar button:hover::after,
.task-markdown-toolbar button:focus-visible::after {
  opacity: 1;
  transition: opacity 80ms ease 250ms, visibility 0s linear 250ms;
  visibility: visible;
}

.task-markdown-input {
  min-height: 170px;
  border-radius: 0 0 6px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.task-markdown-note {
  margin: -4px 0 0;
  font-size: 12px;
}

.task-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  gap: 24px;
  margin-top: 22px;
}

.task-detail-main,
.task-comments {
  min-width: 0;
}

.task-detail-block {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.task-detail-block h3,
.task-comments h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.task-comments {
  border-left: 1px solid var(--line);
  padding-left: 22px;
}

.task-comment-form {
  display: grid;
  gap: 8px;
}

.task-comment-form textarea {
  min-height: 78px;
}

.task-comment-list,
.task-activity-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.task-comment {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #f8fafc;
}

.task-comment header,
.task-activity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.task-comment p,
.task-activity p {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.task-comment time,
.task-activity time {
  color: var(--muted);
  font-size: 11px;
}

.task-activity {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.task-activity p {
  margin: 0;
  font-size: 13px;
}

.task-markdown-preview {
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.task-markdown-preview pre {
  overflow: auto;
  border-radius: 6px;
  padding: 12px;
  background: #202730;
  color: #f7f9fb;
}

.task-markdown-preview code {
  border-radius: 4px;
  padding: 2px 4px;
  background: #edf1f5;
}

.task-markdown-preview pre code {
  padding: 0;
  background: transparent;
}

.task-markdown-preview blockquote {
  margin: 12px 0;
  border-left: 3px solid var(--brand);
  padding-left: 12px;
  color: var(--muted);
}

.task-details-hidden [data-task-extra-details] {
  display: none;
}

@media (max-width: 900px) {
  .task-board {
    grid-template-columns: repeat(4, minmax(270px, 270px));
  }

  .task-board-chat {
    grid-template-columns: 1fr;
  }

  .task-board-chat-compose {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .task-detail-layout {
    grid-template-columns: 1fr;
  }

  .task-comments {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 18px;
    padding-left: 0;
  }

  .task-archive-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.schedule-drawer-content {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 60px);
}

.schedule-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.schedule-drawer-head h2 {
  margin-top: 16px;
}

.schedule-details-list {
  display: grid;
  gap: 0;
  margin: 26px 0;
}

.schedule-details-list div {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.schedule-details-list dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.schedule-details-list dd {
  margin: 0;
  font-weight: 600;
}

.schedule-drawer-actions {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.notice {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.notice.error {
  border-color: #efb4b4;
  background: #fff4f4;
}

[data-schedule-change-error][hidden] {
  display: none;
}

.success-note {
  border-color: #a6dac9;
  background: #effaf6;
}

.patient-results {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.patient-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: #eef3f8;
  color: var(--ink);
}

.appointment-details {
  margin-top: 16px;
}

.appointment-timeline {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.timeline-track {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: #dbe5ef;
}

.timeline-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 6px;
  background: #278f4e;
}

.appointment-timeline label {
  display: grid;
  gap: 4px;
}

.timeline-times {
  display: flex;
  justify-content: space-between;
}

.analytics-workspace {
  overflow: hidden;
}

.analytics-snapshots {
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border, #dfe5ec);
  padding-bottom: 1rem;
}

.analytics-sync-status {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border, #dfe5ec);
  padding-top: 1rem;
}

.analytics-sync-row {
  display: grid;
  grid-template-columns: minmax(11rem, 1fr) minmax(15rem, 1.5fr) auto;
  align-items: center;
  gap: 1rem;
  min-height: 3.25rem;
  border-top: 1px solid var(--border, #dfe5ec);
}

.analytics-sync-row > div {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.analytics-sync-row .icon-button {
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: .25rem .55rem;
  border: 0;
  background: transparent;
  color: #2777d8;
  font-size: 1.45rem;
  cursor: pointer;
}

.analytics-sync-row .icon-button:hover {
  background: #eef5ff;
}

.analytics-snapshots-head,
.analytics-snapshot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.analytics-snapshots-head h2,
.analytics-snapshot-month h3 {
  margin: 0;
}

.analytics-latest-report {
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border, #dfe5ec);
  padding-bottom: 1rem;
}

.analytics-snapshot-month + .analytics-snapshot-month {
  margin-top: 1rem;
}

.analytics-snapshot-month h3 {
  margin-bottom: .35rem;
  text-transform: capitalize;
}

.analytics-snapshot-row {
  min-height: 3rem;
  border-top: 1px solid var(--border, #dfe5ec);
}

.analytics-snapshot-row > div:first-child {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.analytics-snapshot-actions {
  display: flex;
  gap: .35rem;
}

.analytics-snapshot-actions .icon-button {
  min-width: 2rem;
  min-height: 2rem;
  padding: .25rem .5rem;
  border: 0;
  background: transparent;
  color: #2777d8;
  font-size: 1.4rem;
  cursor: pointer;
}

.analytics-snapshot-actions .icon-button:hover {
  background: #eef5ff;
}

.analytics-snapshot-actions .icon-button.is-spinning {
  animation: analytics-loading-spin .8s linear infinite;
  opacity: .65;
}

.analytics-compare-period {
  display: inline-block;
  padding: .45rem .6rem;
  color: #687385;
  font-size: .95rem;
}

.analytics-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
  cursor: wait;
}

.analytics-loading-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 12px;
  max-width: 420px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  color: var(--ink);
}

.analytics-loading-card strong,
.analytics-loading-card > span:last-child {
  grid-column: 2;
}

.analytics-loading-card > span:last-child {
  color: var(--muted);
  line-height: 1.4;
}

.analytics-loading-spinner {
  grid-row: 1 / span 2;
  width: 24px;
  height: 24px;
  border: 3px solid #cbd5e1;
  border-top-color: #278f4e;
  border-radius: 50%;
  animation: analytics-loading-spin 0.8s linear infinite;
}

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

.section-loading {
  display: grid;
  gap: 14px;
  min-height: 180px;
  align-content: start;
}

.section-loading > strong {
  color: var(--ink);
}

.section-loading-line {
  display: block;
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(90deg, #edf1f5 25%, #f8fafc 50%, #edf1f5 75%);
  background-size: 200% 100%;
  animation: section-loading-shimmer 1.2s ease-in-out infinite;
}

.section-loading-line-wide { width: 78%; }
.section-loading-line-medium { width: 58%; }
.section-loading-line-short { width: 34%; }

@keyframes section-loading-shimmer {
  to { background-position: -200% 0; }
}

.analytics-toolbar,
.analytics-report-bar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.analytics-toolbar label,
.analytics-toolbar fieldset {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.analytics-toolbar fieldset {
  grid-template-columns: repeat(2, minmax(145px, 1fr));
  padding: 8px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.analytics-toolbar legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.analytics-report-bar {
  align-items: center;
  justify-content: space-between;
}

.segmented-control {
  display: inline-flex;
  padding: 3px;
  border-radius: 6px;
  background: #e9eef4;
}

.segmented-control button {
  background: transparent;
  color: var(--ink);
}

.segmented-control button.active {
  background: white;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.analytics-table-wrap {
  max-height: 65vh;
  border: 1px solid var(--line);
}

.analytics-table {
  min-width: 1250px;
}

.analytics-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.analytics-table th {
  white-space: nowrap;
  text-align: center;
}

.analytics-table th:first-child,
.analytics-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 320px;
  background: white;
}

.analytics-table th:first-child {
  z-index: 3;
  background: #f8fafc;
}

.analytics-table td {
  white-space: nowrap;
}

.analytics-source-summary {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.analytics-source-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.analytics-source-summary h2 {
  margin: 0;
  font-size: 22px;
}

.analytics-summary-table {
  min-width: 520px;
}

.analytics-summary-table th,
.analytics-summary-table td {
  white-space: nowrap;
}

.analytics-summary-table th:not(:first-child),
.analytics-summary-table td:not(:first-child) {
  text-align: right;
}

.analytics-level-source td {
  background: #effaf6;
  font-weight: 700;
}

.analytics-level-source td:first-child {
  background: #effaf6;
}

.analytics-label {
  display: inline-block;
  padding-left: calc(var(--depth) * 20px);
}

.analytics-tree-toggle {
  width: 24px;
  height: 24px;
  margin-right: 6px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  color: var(--ink);
  font-weight: 700;
  line-height: 1;
}

.analytics-tree-spacer {
  display: inline-block;
  width: 30px;
}

.metric-delta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.metric-delta.up {
  color: #16805b;
}

.metric-delta.down {
  color: #c63d3d;
}

.development-pill {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: #fff2cf;
  color: #875b00;
  font-size: 11px;
  font-weight: 700;
}

.analytics-inline-caveat {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-left: 6px;
  border-radius: 50%;
  background: #fff0c7;
  color: #875b00;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
  cursor: help;
}

.analytics-development {
  margin-top: 20px;
}

.analytics-development-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.analytics-development-head h2,
.analytics-development-head p,
.analytics-development-item h3,
.analytics-development-item p {
  margin: 0;
}

.analytics-development-head p {
  margin-top: 4px;
}

.analytics-readiness-group {
  padding-top: 18px;
}

.analytics-readiness-group > h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.analytics-development-item {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.analytics-development-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.analytics-development-item h3 {
  font-size: 16px;
}

.analytics-development-item p {
  color: var(--muted);
  line-height: 1.45;
}

.analytics-metric-notes {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.analytics-umc-summary {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf8;
}

.analytics-umc-summary > p {
  margin: 0;
}

.analytics-metric-notes-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px;
}

.analytics-metric-note {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.analytics-metric-note h3,
.analytics-metric-note p {
  margin: 0;
}

.analytics-metric-note h3 {
  font-size: 16px;
}

.analytics-metric-note p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
}

.analytics-debug-panel {
  margin-top: 20px;
  border: 1px solid #c8d4e3;
  border-radius: 6px;
  background: #f8fafc;
}

.analytics-debug-panel summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--ink);
  font-weight: 700;
}

.analytics-debug-content {
  display: grid;
  gap: 18px;
  padding: 0 16px 18px;
}

.analytics-debug-content h3,
.analytics-debug-content h4 {
  margin: 0 0 8px;
}

.analytics-debug-content pre {
  max-height: 360px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  color: var(--ink);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.analytics-debug-table {
  min-width: 760px;
}

.analytics-debug-table td,
.analytics-debug-table th {
  white-space: normal;
  vertical-align: top;
}

.analytics-debug-samples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.modal h2 {
  margin: 0 0 18px;
}

.toast,
.outgoing-sticker,
.outgoing-notification,
.current-calls-sticker,
.current-calls-notification {
  position: fixed;
  right: 22px;
  z-index: 20;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toast {
  bottom: 22px;
  display: none;
  padding: 12px 16px;
  background: var(--ink);
  color: white;
}

.toast.open {
  display: block;
}

.outgoing-sticker {
  top: 330px;
  width: min(320px, calc(100vw - 44px));
  background: #fff7e8;
  border: 1px solid #ffdca4;
  padding: 14px;
}

.outgoing-sticker-head,
.current-calls-sticker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.outgoing-sticker h3,
.current-calls-sticker h3 {
  margin: 0;
}

.outgoing-sticker p,
.current-calls-sticker p {
  margin: 10px 0 14px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.icon-button:hover {
  background: rgba(29, 39, 51, 0.08);
}

.outgoing-notification {
  top: 330px;
}

.outgoing-notification-btn,
.current-calls-notification-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 14px;
  background: #fff7e8;
  color: var(--ink);
  border: 1px solid #ffdca4;
  box-shadow: var(--shadow);
}

.outgoing-notification-btn span,
.current-calls-notification-btn span {
  font-weight: 800;
}

.outgoing-notification-btn strong,
.current-calls-notification-btn strong {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--warn);
  color: white;
}

.current-calls-sticker {
  top: 86px;
  width: min(380px, calc(100vw - 44px));
  max-height: calc(100vh - 130px);
  overflow: hidden;
  background: #eefbf7;
  border: 1px solid #b8ead9;
  padding: 14px;
}

.current-calls-sticker-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.current-calls-floating-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
  margin: 12px 0;
}

.current-call-toast {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid #d5eee6;
  border-radius: 8px;
  background: white;
}

.current-call-toast > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.current-call-toast span,
.current-call-toast small,
.current-calls-notification-btn small {
  color: var(--muted);
}

.current-call-toast .actions {
  gap: 6px;
}

.current-call-toast button {
  padding: 8px 10px;
}

.current-calls-notification {
  top: 86px;
}

.current-calls-notification-btn {
  background: #eefbf7;
  color: var(--ink);
  border: 1px solid #b8ead9;
}

.current-calls-notification-btn strong {
  background: var(--brand);
}

.empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.error {
  color: var(--danger);
}

.progress-status {
  margin-top: 14px;
}

.sync-progress-summary,
.sync-progress-row {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.sync-progress-summary span,
.sync-progress-row small {
  color: var(--muted);
}

.sync-progress-row {
  grid-template-columns: minmax(150px, 220px) 110px 1fr;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.sync-progress-row span {
  color: var(--muted);
  font-size: 14px;
}

.sync-progress-error,
.sync-progress-error span,
.sync-progress-error small {
  color: var(--danger);
}

.integration-sync-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 16px 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.integration-sync-status strong {
  color: var(--ink);
}

.progress-status p {
  margin: 8px 0 0;
  color: var(--muted);
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef4;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.2s ease;
}

.progress-bar.done span {
  background: var(--ok);
}

.markdown-editor {
  min-height: min(62vh, 680px);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
}

.document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.document-row p {
  margin: 6px 0 0;
}

@media (max-width: 860px) {
  .topbar {
    padding: 12px 16px;
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-user {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-user > span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .topbar-user button,
  .topbar-user a.ghost {
    flex: 0 0 auto;
  }

  .page {
    width: min(100vw - 24px, 1480px);
    margin-top: 20px;
  }

  .page-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-title-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .schedule-toolbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: end;
  }

  .schedule-toolbar .inline-field,
  .schedule-toolbar .current-week-button {
    grid-column: 1 / -1;
  }

  .schedule-toolbar .week-range {
    min-height: 44px;
    height: 44px;
    flex: none;
  }

  .inline-field {
    min-width: 0;
    width: 100%;
  }

  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .page-title h1 {
    font-size: 32px;
  }

  .panel {
    padding: 16px;
  }

  .analytics-toolbar,
  .analytics-report-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .analytics-toolbar label,
  .analytics-toolbar fieldset,
  .analytics-report-bar input,
  .segmented-control {
    width: 100%;
    min-width: 0;
  }

  .analytics-toolbar fieldset {
    grid-template-columns: 1fr;
  }

  .segmented-control button {
    flex: 1 1 0;
    min-width: 0;
  }

  .analytics-table th:first-child,
  .analytics-table td:first-child {
    min-width: 220px;
  }

  .analytics-development-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .analytics-metric-notes-list {
    grid-template-columns: 1fr;
  }

  .analytics-loading-card {
    width: min(100%, 420px);
  }
}
