:root {
  --bg: #f0faf7;
  --surface: #ffffff;
  --border: #c5ebe0;
  --text: #0A3C30;
  --muted: #3a6b5e;
  --primary: #00674F;
  --primary-hover: #0A3C30;
  --accent: #73E6CB;
  --secondary: #3EBB9E;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #3EBB9E;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --radius: 10px;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2d3340;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --primary: #3EBB9E;
  --primary-hover: #73E6CB;
  --accent: #73E6CB;
  --secondary: #00674F;
  --danger: #ef4444;
  --danger-hover: #f87171;
  --success: #3EBB9E;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar h2 {
  font-size: 1rem;
  margin: 0 0 1.5rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar nav {
  flex: 1;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
}

.sidebar-footer-version {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.sidebar-footer-copy,
.sidebar-footer-powered {
  margin-top: 0.15rem;
}

.sidebar-footer-powered {
  font-weight: 500;
}

.nav-link {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(115, 230, 203, 0.25);
  color: var(--primary);
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
  background: rgba(62, 187, 158, 0.2);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 1.25rem;
  margin: 0;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.content {
  padding: 1.5rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.card-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background 0.15s;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-secondary.active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.12);
}

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

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 0.4rem 0.6rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.login-card p {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
}

.alert {
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.alert-success {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
  border: 1px solid rgba(22, 163, 74, 0.2);
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
}

tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-super-admin {
  background: #4a148c;
  color: #fff;
}

.badge-admin {
  background: rgba(37, 99, 235, 0.15);
  color: var(--primary);
}

.badge-user {
  background: rgba(107, 114, 128, 0.15);
  color: var(--muted);
}

.badge-active {
  background: rgba(22, 163, 74, 0.15);
  color: var(--success);
}

.badge-disabled {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

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

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.modal-confirm {
  max-width: 460px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.page-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.user-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.section-card {
  margin-top: 1.5rem;
}

.section-card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-group-full {
  grid-column: 1 / -1;
}

textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: stretch;
}

.search-row input {
  flex: 1;
  min-width: 200px;
}

.phone-input {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  background: var(--input-bg, var(--surface));
  overflow: hidden;
}

.phone-input:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: color-mix(in srgb, var(--border) 55%, var(--surface));
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  border-right: 1px solid var(--border);
  user-select: none;
  white-space: nowrap;
}

.phone-input input,
.search-row .phone-input input {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  letter-spacing: 0.04em;
}

.phone-input input:focus {
  outline: none;
  box-shadow: none;
}

.text-muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}

.detail-grid dt {
  font-weight: 600;
  color: var(--muted);
}

.detail-grid dd {
  margin: 0;
}

.appointment-detail {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.appointment-detail h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.bill-receipt {
  margin-top: 1rem;
}

.bill-receipt-inner {
  max-width: 480px;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.bill-header {
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.bill-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.bill-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.bill-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.bill-table th,
.bill-table td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.bill-table tfoot td {
  border-bottom: none;
  padding-top: 0.75rem;
}

.bill-footer {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.calendar-card {
  margin-top: 1.5rem;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.calendar-label {
  font-weight: 600;
  min-width: 140px;
  text-align: center;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
}

.calendar-day {
  position: relative;
  min-height: 52px;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.calendar-day.empty {
  border: none;
  background: transparent;
  cursor: default;
}

.calendar-day.today {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.calendar-day.has-appointment {
  background: rgba(37, 99, 235, 0.08);
}

.calendar-day .day-num {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
}

.calendar-day .day-badge {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 0.65rem;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}

.day-appointments {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.day-appointments h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.day-appointments ul {
  margin: 0;
  padding-left: 1.25rem;
}

.day-appointments li {
  margin-bottom: 0.5rem;
}

.chart-controls {
  display: flex;
  gap: 0.5rem;
}

.chart-meta {
  margin-bottom: 0.75rem;
}

.summary-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.summary-chart-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem;
}

.summary-chart-title {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.summary-chart-canvas {
  position: relative;
  height: 260px;
}

.summary-chart-canvas canvas {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 900px) {
  .summary-charts {
    grid-template-columns: 1fr;
  }
}

.help-content ol.help-steps {
  margin: 1rem 0 0;
  padding-left: 1.25rem;
}

.help-steps li {
  margin-bottom: 1.25rem;
}

.help-steps h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.help-steps p {
  margin: 0;
  color: var(--muted);
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.filter-tab:hover,
.filter-tab.active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}

.slot-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.slot-btn {
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.slot-btn:hover,
.slot-btn.selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}

.form-section-title {
  margin: 0;
  font-size: 1rem;
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}

.text-success {
  color: var(--success);
}

.clinic-settings-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.clinic-settings-row .form-group {
  margin-bottom: 0;
  min-width: 200px;
}

.sms-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.sms-toggle input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

.bill-page {
  background: var(--bg);
}

.bill-page-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.5rem;
}

.bill-page-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

@media print {
  body.printing-bill .sidebar,
  body.printing-bill .topbar,
  body.printing-bill .section-card:not(#bill-section),
  body.printing-bill #generate-bill-btn,
  body.printing-bill #print-bill-btn,
  body.printing-bill #bill-placeholder,
  body.printing-bill #page-alert {
    display: none !important;
  }

  body.printing-bill .layout,
  body.printing-bill .main,
  body.printing-bill .content {
    display: block !important;
  }

  body.printing-bill #bill-section {
    border: none;
    box-shadow: none;
    margin: 0;
    padding: 0;
  }

  body.printing-bill .bill-receipt-inner {
    border: none;
    max-width: 100%;
  }

  body.bill-page .no-print,
  body.bill-page #page-alert {
    display: none !important;
  }

  body.bill-page .bill-page-wrap {
    max-width: 100%;
    padding: 0;
  }

  body.bill-page .bill-receipt-inner {
    border: none;
    box-shadow: none;
  }
}

/* Date picker */
.date-picker {
  position: relative;
  width: 100%;
}

.date-picker-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.date-picker-input {
  width: 100%;
  padding: 0.55rem 2.5rem 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.date-picker-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.date-picker-suffix {
  position: absolute;
  right: 0.65rem;
  color: var(--muted);
  pointer-events: none;
  display: flex;
}

.date-picker-clear {
  position: absolute;
  right: 1.85rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.25rem;
  border-radius: 4px;
}

.date-picker-clear:hover {
  color: var(--text);
  background: var(--bg);
}

.date-picker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  min-width: 280px;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.date-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.date-picker-month-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.date-picker-nav {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.date-picker-nav:hover {
  background: var(--bg);
  color: var(--primary);
}

.date-picker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 0.35rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.date-picker-cell {
  width: 100%;
  aspect-ratio: 1;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.date-picker-cell:hover:not(.disabled):not(.empty) {
  background: rgba(37, 99, 235, 0.1);
}

.date-picker-cell.today:not(.selected) {
  border: 1px solid var(--primary);
  color: var(--primary);
}

.date-picker-cell.selected {
  background: var(--primary);
  color: #fff;
}

.date-picker-cell.disabled {
  color: var(--border);
  cursor: not-allowed;
}

.date-picker-cell.empty {
  pointer-events: none;
}

/* Branding */
.brand-block {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.5rem;
  text-decoration: none;
  color: inherit;
}

.brand-block .brand-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: normal;
  text-transform: none;
}

.brand-block .brand-name small {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.brand-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.brand-icon img,
.brand-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.login-brand {
  text-align: center;
  margin-bottom: 1.25rem;
}

.login-brand .brand-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.5rem;
}

.login-brand .brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.login-footer-link {
  text-align: center;
  margin-top: 1.25rem !important;
  font-size: 0.875rem !important;
}

.nav-link-external::after {
  content: " ↗";
  font-size: 0.75em;
  opacity: 0.6;
}

.bill-brand-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 0.5rem;
}

/* Patient list & detail */
.table-row-clickable {
  cursor: pointer;
}

.table-row-clickable:hover {
  background: rgba(115, 230, 203, 0.15);
}

.patient-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.patient-header h2 {
  margin: 0 0 0.5rem;
  color: var(--primary);
}

.patient-header-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.patient-header-meta dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.patient-header-meta dd {
  margin: 0;
  font-weight: 500;
}

.timeline {
  position: relative;
  padding-left: 1.75rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.45rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.25rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -1.75rem;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--accent);
}

.timeline-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}

.timeline-content h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--primary);
}

.timeline-content .timeline-meta {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.timeline-content .timeline-actions {
  margin-top: 0.75rem;
}

.timeline-empty {
  color: var(--muted);
  font-style: italic;
  padding: 1rem 0;
}

/* Help documentation */
.help-doc {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.help-doc-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.help-doc-header .brand-block {
  margin-bottom: 0;
  justify-content: center;
}

.help-doc-header .brand-icon {
  width: 44px;
  height: 44px;
}

.help-doc-header .brand-name {
  font-size: 1.2rem;
}

.help-doc-layout {
  display: flex;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  gap: 2rem;
}

.help-doc-toc {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 1.5rem;
  align-self: flex-start;
}

.help-doc-toc h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.help-doc-toc a {
  display: block;
  padding: 0.4rem 0;
  color: var(--text);
  font-size: 0.875rem;
}

.help-doc-toc a:hover {
  color: var(--primary);
}

.help-doc-main {
  flex: 1;
  min-width: 0;
}

.help-doc-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.help-doc-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.help-doc-section p {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.help-doc-section p:last-child {
  margin-bottom: 0;
}

.help-screenshot {
  position: relative;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}

.help-screenshot img {
  display: block;
  width: 100%;
  height: auto;
}

.help-pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 103, 79, 0.4);
  border: 2px solid #fff;
}

.help-legend {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.help-legend li {
  margin-bottom: 0.35rem;
}

@media (max-width: 768px) {
  .help-doc-layout {
    flex-direction: column;
  }

  .help-doc-toc {
    width: 100%;
    position: static;
  }
}

@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
