.button-secondary { border: 1px solid var(--border); background: var(--surface); color: var(--primary-dark); }
.button-secondary:hover { background: var(--primary-soft); }
.nav-group { min-width: 0; }
.nav-group > summary { cursor: pointer; list-style: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-chevron { margin-left: auto; font-size: 10px; transition: transform 150ms; }
.nav-group[open] .nav-chevron { transform: rotate(180deg); }
.nav-submenu { margin: 0 0 6px 24px; padding-left: 9px; border-left: 1px solid var(--border); }
.nav-submenu .nav-link { padding: 8px 12px; font-size: 13px; }
.record-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.record-actions .record-action { display: inline-grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); font-size: 13px; transition: background-color 150ms, border-color 150ms, color 150ms, transform 150ms; }
.record-actions .record-action:hover { transform: translateY(-1px); border-color: #e4cbd2; background: #f3e2e7; color: var(--primary); }
.record-actions .record-action:focus-visible { outline: 3px solid rgb(135 51 72 / 28%); outline-offset: 2px; }
.record-actions .record-action-delete { background: #fbefef; color: #a64c55; }
.record-actions .record-action-delete:hover { border-color: #edc9cd; background: #f7dfe1; color: #8e303b; }
.record-actions .record-action-copy { background: #eef2ea; color: #536d46; }
.record-actions .record-action-copy:hover { border-color: #d3ddc9; background: #e2eadb; color: #405738; }
.invoice-integration-card { display: flex; max-width: 720px; flex-direction: column; align-items: flex-start; gap: 12px; }
.invoice-integration-card h2, .invoice-integration-card p { margin: 0; }
.invoice-integration-card > .icon-tile { width: 48px; height: 48px; font-size: 19px; }
.invoice-integration-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 4px 0; font-size: 12px; }
.patient-details { margin-top: 20px; }
.patient-records { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.patient-records > section { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 12px; }
.patient-records h3 { font-size: 15px; }
.patient-records .muted { font-size: 12px; }
.patient-record-list { margin: 0; padding-left: 18px; font-size: 13px; overflow-wrap: anywhere; }
.patient-record-list li { margin-bottom: 8px; }
.patient-service-button { margin-top: 14px; }
.patient-exam-select { margin: 16px 0; padding: 16px 20px; }
.patient-exam-select .field { margin-top: 0; }
.patient-exam-select .demo-note { margin-top: 10px; }
.patient-exam-select a, .patient-records a { text-decoration: underline; }
.profile-control { position: relative; }
.profile-trigger { display: flex; align-items: center; gap: 10px; max-width: min(320px, 75vw); padding: 5px 12px 5px 6px; border: 1px solid var(--border); border-radius: 30px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 650; }
.profile-trigger > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-trigger > i { font-size: 10px; color: var(--muted); }
.profile-logo { width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid var(--border); border-radius: 50%; background: white; object-fit: cover; }
.profile-menu { position: absolute; z-index: 10; top: calc(100% + 8px); right: 0; width: 230px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.profile-menu button, .profile-menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; }
.profile-menu button:hover, .profile-menu a:hover { background: var(--primary-soft); color: var(--primary-dark); }
.demo-mode-label { white-space: nowrap; }
.whatsapp-demo-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.whatsapp-demo-header h2 { margin: 12px 0 4px; }
.whatsapp-demo-header .muted { margin: 0; }
.whatsapp-account { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 20px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.whatsapp-account i { color: #63866d; font-size: 16px; }
.whatsapp-layout { display: grid; grid-template-columns: minmax(220px, .75fr) minmax(0, 1.5fr); overflow: hidden; min-height: 340px; border: 1px solid var(--border); border-radius: 12px; }
.whatsapp-contact-list { border-right: 1px solid var(--border); background: var(--surface); }
.whatsapp-contact { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 14px; border-bottom: 1px solid var(--border); }
.whatsapp-contact.active { background: var(--primary-soft); }
.whatsapp-contact > span:nth-child(2), .whatsapp-conversation-title > span:last-child { display: grid; flex: 1; min-width: 0; gap: 4px; }
.whatsapp-contact strong, .whatsapp-conversation-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.whatsapp-contact small, .whatsapp-conversation-title small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.whatsapp-contact time { color: var(--muted); font-size: 10px; }
.whatsapp-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 50%; background: #f1e4e8; color: var(--primary-dark); font-size: 10px; font-weight: 700; }
.whatsapp-conversation { display: flex; min-width: 0; flex-direction: column; background: #fbf8f6; }
.whatsapp-conversation-title { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.whatsapp-messages { display: flex; flex: 1; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 10px; padding: 18px; background: radial-gradient(#e9dfd9 .7px, transparent .7px); background-size: 12px 12px; }
.whatsapp-message { max-width: min(85%, 360px); margin: 0; padding: 10px 12px 6px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); font-size: 12px; line-height: 1.5; }
.whatsapp-message.outgoing { align-self: flex-end; border-color: #e7d4da; background: #f8ecef; }
.whatsapp-message time { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; text-align: right; }
.whatsapp-composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: var(--surface); }
.whatsapp-composer input { min-width: 0; flex: 1; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--background); color: var(--muted); font: inherit; font-size: 11px; }
.whatsapp-composer .button { padding: 8px 12px; font-size: 11px; }
.whatsapp-composer .button:disabled { cursor: not-allowed; opacity: .6; }
.edit-dialog { width: min(460px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow-y: auto; padding: 28px; border: 1px solid var(--border); border-radius: 18px; color: var(--text); box-shadow: var(--shadow); }
.edit-dialog::backdrop { background: rgb(52 34 41 / 45%); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dialog-close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font-size: 24px; }
.edit-dialog > form > .muted { font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 7px; margin-top: 18px; }
.field label { font-size: 13px; font-weight: 650; }
.field input, .field select, .filter-field select { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; }
.field small { font-size: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.edit-dialog .error { margin: 14px 0 0; font-size: 12px; }
.logo-upload { display: flex; align-items: center; gap: 16px; }
.logo-upload img { width: 72px; height: 72px; border: 1px solid var(--border); border-radius: 50%; background: white; object-fit: cover; }
.logo-upload input { min-width: 0; font-size: 12px; }
.appointment-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.home-welcome { position: relative; display: flex; justify-content: space-between; align-items: center; overflow: hidden; margin-bottom: 30px; padding: 32px 38px; border: 1px solid #ead4da; border-radius: 20px; background: linear-gradient(112deg, #fbf0f2, #f7e9ec 57%, #edf0e8); }
.welcome-copy { position: relative; z-index: 1; max-width: 610px; }
.welcome-copy > .muted { max-width: 480px; font-size: 14px; }
.welcome-label { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.welcome-label .eyebrow { margin: 0; }
.welcome-label .avatar { width: 30px; height: 30px; background: rgb(255 255 255 / 65%); font-size: 10px; }
.today-label { display: flex; align-items: center; gap: 8px; color: var(--primary-dark); font-size: 12px; text-transform: capitalize; }
.welcome-copy .button { margin-top: 8px; }
.welcome-art { display: grid; flex: 0 0 190px; height: 190px; place-items: center; border: 1px solid rgb(135 51 72 / 15%); border-radius: 50%; margin-left: 25px; }
.welcome-art > span { display: grid; width: 120px; height: 120px; place-items: center; border: 1px solid rgb(135 51 72 / 20%); border-radius: 50%; background: rgb(255 255 255 / 50%); color: var(--primary); font-size: 50px; }
.home-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.home-section-heading .eyebrow { margin-bottom: 4px; }
.home-section-heading h2 { margin: 0; }
.home-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.home-stat { min-width: 0; padding: 18px 14px; gap: 12px; color: var(--text); transition: transform 150ms, border-color 150ms; }
.home-stat:hover, .shortcut-card:hover { transform: translateY(-2px); border-color: #d7b6c0; }
.home-stat > div { min-width: 0; }
.home-stat p { font-size: 11px; }
.home-stat strong { font-size: 24px; }
.home-stat .home-currency { font-size: 18px; white-space: nowrap; }
.home-content-grid, .finance-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr); gap: 18px; margin-bottom: 28px; }
.home-panel, .chart-card, .payment-card, .data-card { min-width: 0; padding: 24px; }
.home-panel .section-heading { align-items: flex-start; gap: 12px; }
.home-panel .section-heading h2 { margin-bottom: 4px; }
.home-panel .section-heading .eyebrow { margin-bottom: 4px; }
.home-panel .muted, .chart-card .muted, .payment-card .muted, .data-card .muted { font-size: 12px; }
.text-link { flex-shrink: 0; font-size: 12px; font-weight: 700; }
.text-link:hover { text-decoration: underline; }
.home-appointment { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); color: var(--text); }
.home-appointment:hover { background: var(--background); }
.home-appointment-time { color: var(--primary-dark); font-size: 11px; font-weight: 700; }
.home-appointment-details { display: flex; flex-direction: column; min-width: 0; gap: 3px; }
.home-appointment-details strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.home-appointment-details small { color: var(--muted); font-size: 10px; }
.home-card-action { display: flex; align-items: center; justify-content: center; min-height: 40px; margin-top: 14px; border: 1px solid var(--border); border-radius: 9px; font-size: 12px; font-weight: 700; }
.home-card-action:hover { background: var(--primary-soft); }
.home-balance { display: flex; flex-direction: column; gap: 4px; padding: 19px; border-radius: 13px; background: linear-gradient(120deg, #f8ecef, #f6f1ef); }
.home-balance span, .home-balance small { color: var(--muted); font-size: 11px; }
.home-balance strong { color: var(--primary-dark); font-size: 28px; letter-spacing: -.7px; }
.home-finance-details { display: flex; justify-content: space-between; gap: 12px; padding: 18px 0 5px; }
.home-finance-details > div { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 11px; }
.home-finance-details strong { color: var(--text); font-size: 13px; }
.home-shortcuts { margin-bottom: 28px; }
.home-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.home-chart { min-width: 0; padding: 24px; }
.home-chart h3 { margin-bottom: 3px; }
.home-chart > p { font-size: 12px; }
.home-chart-bars { display: grid; gap: 16px; margin-top: 22px; }
.home-chart-row-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.home-chart-row-heading strong { color: var(--text); white-space: nowrap; }
.home-chart-track { height: 9px; overflow: hidden; border-radius: 9px; background: var(--primary-soft); }
.home-chart-bar { display: block; height: 100%; border-radius: inherit; }
.chart-confirmed { background: var(--primary); }
.chart-pending { background: #89977a; }
.chart-cancelled { background: #b6a6aa; }
.shortcut-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.shortcut-card { display: flex; align-items: center; min-width: 0; gap: 12px; padding: 16px 14px; color: var(--text); transition: transform 150ms, border-color 150ms; }
.shortcut-card > span:last-child { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.shortcut-card strong { font-size: 12px; }
.shortcut-card small { color: var(--muted); font-size: 10px; }
.shortcut-card .icon-tile { width: 38px; height: 38px; font-size: 17px; }
.filter-field { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.data-table th { padding: 11px 14px; color: var(--muted); font-size: 10px; letter-spacing: .7px; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 15px 14px; border-top: 1px solid var(--border); white-space: nowrap; }
.data-table td small { display: block; color: var(--muted); font-size: 11px; }
.data-table tr:hover { background: #fdfafb; }
.status-pill { display: inline-flex; padding: 5px 9px; border-radius: 20px; font-size: 10px; font-weight: 700; }
.status-confirmed, .trend-pill { background: var(--accent-soft); color: #536444; }
.status-pending { background: #fff3df; color: #8a5a17; }
.status-cancelled { background: #f8e9e9; color: #9c3d3d; }
.appointment-action { padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--primary-dark); font-size: 11px; cursor: pointer; }
.appointment-action:hover { background: var(--primary-soft); }
.table-empty { padding: 28px 14px; color: var(--muted); text-align: center; font-size: 13px; }
.demo-note { margin: 18px 0 0; color: var(--muted); font-size: 11px; }
.finance-stat { padding: 20px; }
.finance-stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.finance-stat p { margin-bottom: 4px; font-size: 12px; }
.finance-stat > strong { display: block; font-size: clamp(20px, 2.2vw, 27px); letter-spacing: -.7px; }
.finance-stat > small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.trend-pill { display: inline-block; padding: 5px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.expense-icon { color: #aa7041; background: #fbf0e5; }
.balance-icon { color: #637b58; background: var(--accent-soft); }
.chart-legend { display: flex; gap: 16px; color: var(--muted); font-size: 11px; }
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.expense-dot { background: #d7b6a0; }
.bar-chart { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; height: 180px; margin-top: 18px; border-bottom: 1px solid var(--border); background: repeating-linear-gradient(to bottom, transparent 0, transparent 44px, var(--border) 45px, transparent 46px); }
.chart-month { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.bar-pair { display: flex; flex: 1; align-items: flex-end; justify-content: center; gap: 5px; width: 100%; }
.bar { display: block; width: min(22px, 36%); border-radius: 5px 5px 0 0; }
.income-bar { background: linear-gradient(180deg, #a95569, var(--primary)); }
.expense-bar { background: #d9c0b3; }
.payment-total { display: flex; flex-direction: column; margin: 18px 0 22px; }
.payment-total strong { font-size: 26px; }
.payment-total span { font-size: 11px; }
.payment-row { margin-top: 18px; }
.payment-row > div:first-child { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 12px; }
.progress-track { height: 7px; overflow: hidden; border-radius: 10px; background: var(--background); }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.amount-positive { color: #536d46; font-weight: 700; }
.amount-negative { color: #9c5961; font-weight: 700; }
.upload-box { border-color: #ddc4ca; background: #fdfafb; }
@media (max-width: 1200px) {
  .home-stats, .shortcut-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-content-grid, .finance-grid, .home-charts, .patient-records { grid-template-columns: 1fr; }
  .welcome-art { flex-basis: 150px; height: 150px; }
}
@media (max-width: 760px) {
  .home-welcome { padding: 26px 22px; }
  .welcome-art { position: absolute; right: -70px; opacity: .35; }
  .welcome-copy { max-width: 90%; }
  .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-heading { flex-direction: column; align-items: flex-start; }
  .home-panel, .data-card, .chart-card, .payment-card, .home-chart { padding: 18px; }
  .home-appointment { grid-template-columns: 78px minmax(0, 1fr); }
  .home-appointment .status-pill { grid-column: 2; justify-self: start; }
  .filter-field { width: 100%; }
  .whatsapp-layout { grid-template-columns: 1fr; }
  .whatsapp-contact-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .whatsapp-contact { align-items: flex-start; flex-wrap: wrap; padding: 10px; }
  .whatsapp-contact > span:nth-child(2) { flex-basis: calc(100% - 48px); }
  .whatsapp-contact time { margin-left: 46px; }
}
@media (max-width: 420px) {
  .home-stats, .shortcut-grid, .appointment-fields { grid-template-columns: 1fr; }
  .home-section-heading { flex-direction: column; align-items: flex-start; }
  .edit-dialog { padding: 22px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
  .welcome-copy { max-width: 100%; }
  .whatsapp-demo-header { flex-direction: column; }
  .whatsapp-contact-list { grid-template-columns: 1fr; }
  .whatsapp-contact { align-items: center; flex-wrap: nowrap; }
  .whatsapp-contact time { margin-left: 0; }
  .whatsapp-messages { padding: 12px; }
}
