/* ==========================================================================
   Doctrack — app.css (design system)
   Hand-rolled, framework-free, mobile-first. No imports, no CDNs.
   Themes: default (admin, blue) + [data-theme="doctor"] (green).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  --primary: #1E6BE8;
  --primary-h: #1B5FD0;
  --primary-soft: #E8F0FE;

  --bg: #F5F7FA;
  --card: #FFFFFF;
  --border: #E5E9F0;
  --border-2: #D5DBE4;
  --text: #111827;
  --text-2: #4B5563;
  --text-3: #9AA3AF;

  --danger: #DC2626;
  --danger-h: #B91C1C;
  --danger-soft: #FEE2E2;
  --warning: #D97706;
  --warning-soft: #FEF3C7;
  --success: #16A34A;
  --success-soft: #DCFCE7;

  --focus-ring: 0 0 0 3px rgba(30, 107, 232, .35);

  --r: 10px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 2px 8px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .16);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
          'Helvetica Neue', Arial, sans-serif;
}

[data-theme="doctor"] {
  --primary: #0FA36B;
  --primary-h: #0C8A5A;
  --primary-soft: #E6F7F0;
  --focus-ring: 0 0 0 3px rgba(15, 163, 107, .35);
}

/* --------------------------------------------------------------------------
   Doctor Shell (Mobile Webapp width on Big Screens)
   -------------------------------------------------------------------------- */
body[data-theme="doctor"] {
  background: #F1F5F9;
}

.doc-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
}

@media (min-width: 520px) {
  .doc-shell {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.08);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  body[data-theme="doctor"] .doc-topbar,
  body[data-theme="doctor"] .doc-main {
    max-width: 500px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  body[data-theme="doctor"] .bottom-nav {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  body[data-theme="doctor"] .toast-root,
  body[data-theme="doctor"] #toast-root {
    top: 16px;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: 100%;
    max-width: 480px;
    padding: 0 16px;
    align-items: center !important;
  }
}

/* --------------------------------------------------------------------------
   2. Base reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
p, ul, ol, figure {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

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

a:hover,
a:focus,
a:active {
  text-decoration: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

table {
  border-collapse: collapse;
}

::placeholder {
  color: var(--text-3);
  opacity: 1;
}

:focus-visible {
  outline: none;
}

/* --------------------------------------------------------------------------
   3. Icons (sprite consumers)
   -------------------------------------------------------------------------- */
.icon {
  display: inline-block;
  vertical-align: -0.18em;
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 28px; height: 28px; }

/* --------------------------------------------------------------------------
   4. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition: background .15s ease, border-color .15s ease,
              color .15s ease, box-shadow .15s ease, transform .05s ease;
}

.btn:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  box-shadow: var(--focus-ring);
}

.btn .icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.btn-primary,
.btn-primary:visited,
.btn-primary:focus,
.btn-primary:active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF !important;
}

.btn-primary:hover {
  background: var(--primary-h);
  border-color: var(--primary-h);
  color: #FFFFFF !important;
}

.btn-primary .icon {
  color: #FFFFFF !important;
}

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

.btn-outline:hover {
  background: var(--bg);
  border-color: var(--border-2);
  color: var(--text);
}

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

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #FFFFFF;
}

.btn-danger:hover {
  background: var(--danger-h);
  border-color: var(--danger-h);
  color: #FFFFFF;
}

.btn-sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-sm .icon {
  width: 14px;
  height: 14px;
}

.btn-lg {
  min-height: 46px;
  padding: 0 20px;
  font-size: 15px;
}

.btn-icon {
  width: 38px;
  min-height: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--r);
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
  min-height: 32px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn[disabled],
.btn.disabled,
.btn[aria-disabled="true"] {
  opacity: .55;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   5. Forms
   -------------------------------------------------------------------------- */
.field {
  display: block;
  margin-bottom: 14px;
}

.field > label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.req::after {
  content: " *";
  color: var(--danger);
  font-weight: 700;
}

.input,
select.input,
textarea.input {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea.input {
  min-height: 88px;
  resize: vertical;
}

select.input {
  padding-right: 32px;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239AA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.input:hover {
  border-color: var(--text-3);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.input[disabled],
.input[readonly] {
  background: var(--bg);
  color: var(--text-2);
}

.input-icon-group {
  position: relative;
  display: block;
}

.input-icon-group > .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-3);
  pointer-events: none;
}

.input-icon-group .input {
  padding-left: 40px;
}

.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--danger);
}

.field-error .icon {
  width: 13px;
  height: 13px;
  flex: none;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.check input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
  flex: none;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

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

  .form-grid .span-2 {
    grid-column: span 2;
  }
}

/* --------------------------------------------------------------------------
   6. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   7. Badges + chips
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.badge .icon {
  width: 12px;
  height: 12px;
}

.badge-success { background: #DCFCE7; color: #166534; }
.badge-error   { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-info    { background: #DBEAFE; color: #1E40AF; }
.badge-inactive { background: #FCE7F3; color: #9D174D; }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #EEF1F5;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.chip .icon {
  width: 12px;
  height: 12px;
}

.chip-days-ok {
  background: #DCFCE7;
  color: #166534;
}

.chip-days-bad {
  background: #FEE2E2;
  color: #991B1B;
}

/* --------------------------------------------------------------------------
   8. Tables
   -------------------------------------------------------------------------- */
.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  font-size: 13.5px;
  text-align: left;
}

.table thead th {
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: var(--bg);
}

.table .cell-strong {
  color: var(--text);
  font-weight: 700;
}

.table .cell-actions {
  text-align: right;
  white-space: nowrap;
}

/* Mobile: rows become stacked cards with td::before labels (data-label). */
@media (max-width: 767px) {
  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tbody tr {
    padding: 4px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--card);
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
  }

  .table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
    text-align: right;
  }

  .table tbody td:last-child {
    border-bottom: 0;
  }

  .table tbody td::before {
    content: attr(data-label);
    flex: none;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-3);
    text-align: left;
  }

  .table tbody tr:hover {
    background: var(--card);
  }
}

/* --------------------------------------------------------------------------
   9. Searchbar / filters / pager
   -------------------------------------------------------------------------- */
.searchbar {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.searchbar > .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-3);
  pointer-events: none;
}

.searchbar .input {
  flex: 1;
  min-height: 42px;
  padding: 10px 40px 10px 42px;
  border-radius: 999px;
}

.searchbar-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-3);
}

.searchbar-clear .icon {
  width: 14px;
  height: 14px;
}

.searchbar-clear:hover {
  background: var(--bg);
  color: var(--text-2);
}

.searchbar-clear.visible,
.searchbar-clear.show {
  display: inline-flex;
}

.filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter select {
  min-height: 36px;
  padding: 6px 30px 6px 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239AA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}

.filter select:focus-visible {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
  outline: none;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.pager-info {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
}

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

/* --------------------------------------------------------------------------
   10. Modal system
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: fadeIn .18s ease both;
}

.modal {
  display: block;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 22px 22px 20px;
  animation: slideUp .22s cubic-bezier(.2, .8, .3, 1) both;
}

.modal[role="dialog"] {
  outline: none;
}

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

.modal-head-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-x {
  flex: none;
}

.modal-icon-wrap {
  display: flex;
  justify-content: center;
  margin: -16px 0 14px;
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.modal-icon .icon {
  width: 26px;
  height: 26px;
}

.modal-title {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  margin-bottom: 6px;
}

.modal-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-2);
  text-align: center;
}

.modal-body {
  padding: 2px 0 0;
}

.modal-errors {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--danger-soft);
  border-radius: var(--r);
  text-align: left;
}

.modal-errors li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #991B1B;
  line-height: 1.45;
}

.modal-errors li + li {
  margin-top: 5px;
}

.modal-errors .icon {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  flex: none;
  color: var(--danger);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.modal-actions .btn {
  flex: 1;
}

@media (max-width: 639px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    animation: sheetUp .26s cubic-bezier(.2, .8, .3, 1) both;
  }

  .modal-actions {
    flex-direction: column;
    gap: 8px;
  }

  .modal-actions .btn {
    width: 100%;
    min-height: 44px;
  }
}

/* --------------------------------------------------------------------------
   10b. Photo options bottom sheet (camera / gallery)
   -------------------------------------------------------------------------- */
.sheet-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.sheet-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  text-align: left;
  transition: background .15s ease, border-color .15s ease;
}

.sheet-option:hover {
  background: var(--bg);
}

.sheet-option:active {
  transform: translateY(1px);
}

.sheet-option:focus-visible {
  box-shadow: var(--focus-ring);
}

.so-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.so-icon .icon {
  width: 20px;
  height: 20px;
}

.so-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.so-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.so-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 1px;
}

/* --------------------------------------------------------------------------
   11. Progress
   -------------------------------------------------------------------------- */
.progress {
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress .bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--primary);
  transition: width .25s ease;
}

/* --------------------------------------------------------------------------
   12. Toasts
   -------------------------------------------------------------------------- */
.toast-root,
#toast-root {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 380px;
  padding: 10px 12px 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn .25s cubic-bezier(.2, .8, .3, 1) both;
}

.toast.leaving {
  animation: fadeIn .2s ease reverse both;
}

.t-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.t-icon .icon {
  width: 15px;
  height: 15px;
}

.t-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.t-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.t-msg {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.4;
  margin-top: 0;
}

.t-title + .t-msg {
  margin-top: 2px;
}

.t-close {
  flex: none;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-3);
  align-self: center;
}

.t-close .icon {
  width: 13px;
  height: 13px;
}

.t-close:hover {
  background: var(--bg);
  color: var(--text-2);
}

@media (min-width: 640px) {
  body[data-theme="admin"] .toast-root,
  body[data-theme="admin"] #toast-root {
    top: 16px;
    left: auto;
    right: 16px;
    transform: none;
    align-items: flex-end;
    width: auto;
  }
}

/* --------------------------------------------------------------------------
   13. Tabs (segmented control)
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #EEF1F5;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.tab .icon {
  width: 15px;
  height: 15px;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.tab:focus-visible {
  box-shadow: var(--focus-ring);
}

/* --------------------------------------------------------------------------
   14. Bottom navigation (mobile doctor shell)
   -------------------------------------------------------------------------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, .08);
}

@media (min-width: 480px) {
  .bottom-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

.bottom-nav-inner {
  display: flex;
  align-items: flex-end;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px 9px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-decoration: none;
  transition: color .15s ease;
}

.bn-item .icon {
  width: 20px;
  height: 20px;
}

.bn-item:hover {
  color: var(--text-2);
  text-decoration: none;
}

.bn-item.active {
  color: var(--primary);
}

.bn-add {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.bn-add-btn,
.bn-add-btn:visited,
.bn-add-btn:focus,
.bn-add-btn:active {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #FFFFFF !important;
  transform: translateY(-14px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .28);
  transition: background .15s ease, transform .05s ease;
}

.bn-add-btn .icon {
  width: 22px;
  height: 22px;
  color: #FFFFFF !important;
}

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

.bn-add-btn:active {
  transform: translateY(-12px);
}

.bn-add-btn:focus-visible {
  box-shadow: 0 8px 20px rgba(15, 23, 42, .28), var(--focus-ring);
}

/* Reserve space for the fixed bottom nav when the layout opts in
   (body.has-bottom-nav) or when the nav is present in the DOM (:has). */
body.has-bottom-nav main,
body:has(.bottom-nav) .doc-main,
.doc-shell:has(.bottom-nav) .doc-main {
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

/* --------------------------------------------------------------------------
   15. Doctor home
   -------------------------------------------------------------------------- */
.doc-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, .95);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

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

.doc-topbar-title {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
}

.doc-topbar-sub {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  margin-top: 1px;
}

.doc-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.doc-back {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex: none;
}

.doc-back:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.doc-back:focus-visible {
  box-shadow: var(--focus-ring);
}

.doc-back .icon {
  width: 17px;
  height: 17px;
}

.doc-main {
  display: block;
  flex: 1;
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

.doc-hero {
  background: linear-gradient(135deg, #0FA36B, #0C8A5A);
  color: #FFFFFF;
  border-radius: 0 0 24px 24px;
  padding: 24px 16px 52px;
}

.doc-hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.doc-hello {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, .85);
}

.doc-name {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.25;
  margin-top: 2px;
}

.doc-clinic {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, .9);
}

.doc-clinic .icon {
  width: 13px;
  height: 13px;
}

.doc-bell {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .18);
  color: #FFFFFF;
  flex: none;
}

.doc-bell .icon {
  width: 17px;
  height: 17px;
}

.doc-bell .dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #FACC15;
  border: 1.5px solid rgba(12, 138, 90, .9);
}

.doc-stats {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: -32px;
  padding: 0 14px;
}

.doc-stat {
  position: relative;
  z-index: 11;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 8px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.doc-stat .v {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--primary);
}

.doc-stat .l {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  margin-top: 3px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 22px;
  padding: 0 14px;
}

.quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 13px 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  transition: box-shadow .15s ease, transform .05s ease;
}

.quick-item:hover {
  box-shadow: var(--shadow);
  text-decoration: none;
}

.quick-item:active {
  transform: translateY(1px);
}

.quick-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.quick-icon .icon {
  width: 20px;
  height: 20px;
}

.quick-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  text-align: center;
  line-height: 1.25;
}

/* --------------------------------------------------------------------------
   Doctor Dashboard - Subscription Expiry Warning Banner (<= 7 days)
   -------------------------------------------------------------------------- */
.sub-alert-card {
  margin: 18px 14px 4px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-left: 4px solid #DC2626;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.08);
}

.sub-alert-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.sub-alert-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #FEE2E2;
  color: #DC2626;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sub-alert-icon-box .icon {
  width: 20px;
  height: 20px;
}

.sub-alert-titles {
  flex: 1;
  min-width: 0;
}

.sub-alert-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #991B1B;
  background: #FEE2E2;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 3px;
}

.sub-alert-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 800;
  color: #991B1B;
  line-height: 1.25;
}

.sub-alert-body {
  margin-bottom: 12px;
}

.sub-alert-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #7F1D1D;
}

.sub-alert-text strong {
  color: #991B1B;
  font-weight: 700;
}

.sub-alert-action {
  display: flex;
  justify-content: flex-end;
}

.sub-alert-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #DC2626;
  color: #FFFFFF !important;
  font-size: 12.5px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background .15s ease, transform .05s ease;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.sub-alert-btn:hover {
  background: #B91C1C;
  color: #FFFFFF !important;
  text-decoration: none;
}

.sub-alert-btn:active {
  transform: translateY(1px);
}

.sub-alert-btn .icon {
  width: 13px;
  height: 13px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  margin-top: 26px;
  margin-bottom: 12px;
}

.section-head h2 {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
}

.section-head a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
  text-decoration: none;
}

.section-head a .icon {
  width: 14px;
  height: 14px;
}

/* --------------------------------------------------------------------------
   16. List cards / rows / thumbs / avatars
   -------------------------------------------------------------------------- */
.list-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none !important;
}

.list-row,
.list-row:hover,
.list-row:focus,
.list-row * {
  text-decoration: none !important;
}

.list-row + .list-row {
  border-top: 1px solid var(--border);
}

.list-row:hover {
  background: var(--bg);
}

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

.row-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.2;
  color: var(--text-3);
}

.row-sub .icon {
  width: 13px;
  height: 13px;
  flex: none;
}

.row-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: none;
}

.thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.rx-thumb {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: zoom-in;
  background: var(--bg);
}

.rx-thumb-none {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  border: 2px dashed var(--border-2);
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.rx-thumb-none .icon {
  width: 15px;
  height: 15px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
  text-transform: uppercase;
  user-select: none;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.avatar-lg {
  width: 52px;
  height: 52px;
  font-size: 18px;
}

.avatar-c0 { background: #7C3AED; }
.avatar-c1 { background: #16A34A; }
.avatar-c2 { background: #2563EB; }
.avatar-c3 { background: #EA580C; }
.avatar-c4 { background: #0D9488; }
.avatar-c5 { background: #DB2777; }

/* --------------------------------------------------------------------------
   17. Empty / skeleton / loading / spinner
   -------------------------------------------------------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 16px;
  text-align: center;
}

.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
}

.empty-icon .icon {
  width: 27px;
  height: 27px;
}

.empty h3 {
  font-size: 15px;
  font-weight: 800;
  margin-top: 12px;
}

.empty p {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 4px;
  max-width: 320px;
}

.skeleton {
  background: #E8ECF1;
  border-radius: 6px;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.sk-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: none;
}

.sk-line {
  height: 12px;
  flex: 1;
}

.sk-line.w-60 { max-width: 60%; }
.sk-line.w-40 { max-width: 40%; }

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-2);
  border-top-color: var(--primary);
  border-right-color: var(--primary);
  border-radius: 50%;
  flex: none;
  animation: spin .7s linear infinite;
}

/* --------------------------------------------------------------------------
   18. Key/value lists
   -------------------------------------------------------------------------- */
.kv-list {
  padding: 0 2px;
}

.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.kv-row:last-child {
  border-bottom: 0;
}

.kv-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-3);
  flex: none;
}

.kv-label .icon {
  width: 15px;
  height: 15px;
  color: var(--text-3);
  flex: none;
}

.kv-value {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   19. Admin shell (sidebar + topbar + dropdowns + stats)
   -------------------------------------------------------------------------- */
.admin-shell,
.adm-shell,
.adm-body {
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 70;
  width: 248px;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-right: 1px solid var(--border);
  transition: transform .22s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  flex: none;
}

.sidebar-app,
.sb-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.sb-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-2);
  text-decoration: none;
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}

.nav-item .icon {
  width: 17px;
  height: 17px;
  color: var(--text-3);
  flex: none;
  transition: color .15s ease;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active {
  background: var(--primary);
  color: #FFFFFF;
}

.nav-item.active .icon {
  color: #FFFFFF;
}

.nav-section {
  padding: 12px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
}

.sidebar-foot {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}

.sidebar-foot .nav-item {
  color: var(--danger);
}

.sidebar-foot .nav-item .icon {
  color: var(--danger);
}

.sidebar-foot .nav-item:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(15, 23, 42, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.sidebar-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.admin-main {
  min-height: 100vh;
  padding: 20px;
}

/* R1-a layout variant: <div class="adm-body"><header class="topbar">…
   <main class="adm-main"> — the left margin lives on .adm-body, not here. */
.adm-main {
  min-height: calc(100vh - 59px);
  padding: 20px;
}

.admin-topbar,
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, .95);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.admin-topbar h1,
.topbar h1 {
  margin: 0;
}

.topbar-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.hamburger,
#sidebar-toggle {
  display: none;
}

.topbar-right,
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown {
  position: relative;
}

.dd-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 55;
  min-width: 210px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: none;
}

.dd-menu.open,
[data-dropdown].open > .dd-menu {
  display: block;
  animation: fadeUp .16s ease both;
}

.dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-2);
  text-align: left;
  text-decoration: none;
}

.dd-item .icon {
  width: 15px;
  height: 15px;
  color: var(--text-3);
  flex: none;
}

.dd-item:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.dd-item.dd-danger {
  color: var(--danger);
}

.dd-item.dd-danger .icon {
  color: var(--danger);
}

.dd-item.dd-danger:hover {
  background: var(--danger-soft);
}

.dd-header {
  padding: 9px 12px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.dd-header .dd-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.dd-header .dd-role {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
}

.dd-trigger,
.dd-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.dd-trigger:hover,
.dd-toggle:hover {
  background: var(--bg);
}

.dd-trigger .avatar,
.dd-toggle .avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.dd-trigger .icon,
.dd-toggle .icon {
  width: 14px;
  height: 14px;
  color: var(--text-3);
}

.dd-toggle .badge {
  font-size: 10.5px;
  padding: 2px 7px;
}

.dd-toggle-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dd-trigger:focus-visible,
.dd-toggle:focus-visible {
  box-shadow: var(--focus-ring);
}

@media (max-width: 479px) {
  .dd-toggle-name {
    display: none;
  }
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.stat-icon .icon {
  width: 21px;
  height: 21px;
}

.stat-v {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
}

.stat-l {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  margin-top: 1px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

/* Desktop sidebar visible; mobile off-canvas. */
@media (min-width: 1024px) {
  .admin-main {
    margin-left: 248px;
  }

  .adm-body {
    margin-left: 248px;
  }
}

@media (max-width: 1023px) {
  .admin-main,
  .adm-body {
    margin-left: 0;
  }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .hamburger,
  #sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--r);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-2);
  }

  .hamburger:hover,
  #sidebar-toggle:hover {
    background: var(--bg);
  }

  .hamburger:focus-visible,
  #sidebar-toggle:focus-visible {
    box-shadow: var(--focus-ring);
  }
}

/* --------------------------------------------------------------------------
   20. Shared tone colors (modal icons, toast icons, stat icons, quick icons)
   -------------------------------------------------------------------------- */
.tone-success { background: #DCFCE7; color: #166534; }
.tone-danger  { background: #FEE2E2; color: #DC2626; }
.tone-warning { background: #FEF3C7; color: #D97706; }
.tone-info    { background: #DBEAFE; color: #1E40AF; }
.tone-purple  { background: #EDE9FE; color: #7C3AED; }

.tone-blue   { background: #DBEAFE; color: #2563EB; }
.tone-green  { background: var(--primary-soft); color: var(--primary); }
.tone-teal   { background: #CCFBF1; color: #0D9488; }
.tone-orange { background: #FFEDD5; color: #EA580C; }

/* --------------------------------------------------------------------------
   21. Auth pages
   -------------------------------------------------------------------------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, #EEF4FF 0%, #F5F7FA 100%);
}

[data-theme="doctor"] .auth-wrap,
.auth-wrap[data-theme="doctor"] {
  background: linear-gradient(180deg, #E9F8F1 0%, #F5F7FA 100%);
}

.auth-brand {
  text-align: center;
  margin-bottom: 18px;
}

.auth-brand img {
  width: 58px;
  height: 58px;
  border-radius: 15px;
  margin: 0 auto;
  box-shadow: 0 10px 26px rgba(30, 107, 232, .3);
}

[data-theme="doctor"] .auth-brand img {
  box-shadow: 0 10px 26px rgba(15, 163, 107, .3);
}

.auth-brand h1 {
  font-size: 21px;
  font-weight: 800;
  margin-top: 12px;
}

.auth-sub {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-top: 3px;
}

.auth-card {
  width: min(420px, 100%);
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  margin: 12px 0;
}

.auth-foot {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  margin-top: 16px;
}

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #FEE2E2;
  color: #991B1B;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  margin: 12px 0;
}

.auth-error .icon {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 1px;
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   22. Fullscreen image viewer
   -------------------------------------------------------------------------- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, .92);
  animation: fadeIn .15s ease both;
}

.viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, .4);
}

.viewer-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
}

.viewer-title .icon {
  width: 15px;
  height: 15px;
  color: #FFFFFF;
  flex: none;
}

.viewer-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .12);
  color: #FFFFFF;
  flex: none;
  text-decoration: none;
}

.viewer-btn .icon {
  width: 18px;
  height: 18px;
}

.viewer-btn:hover {
  background: rgba(255, 255, 255, .24);
  text-decoration: none;
}

.viewer-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .45);
}

.viewer-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.viewer-stage.dragging {
  cursor: grabbing;
}

.viewer-stage img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  max-width: none;
}

.viewer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.viewer-pct {
  width: auto;
  min-width: 64px;
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 999px;
  pointer-events: none;
}

.viewer-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 0;
  z-index: 2;
  pointer-events: none;
}

.viewer-zoom-indicator {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 70px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, .8);
  pointer-events: none;
}

.viewer-context {
  padding: 0 16px 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, .7);
  text-align: center;
}

/* --------------------------------------------------------------------------
   23. Full-page messages (install / config / 404)
   -------------------------------------------------------------------------- */
.full-page-msg {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.full-page-msg .empty-icon {
  margin-bottom: 14px;
}

.full-page-msg h1 {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 8px;
}

.full-page-msg p {
  font-size: 13.5px;
  color: var(--text-2);
  max-width: 480px;
  line-height: 1.6;
}

.full-page-msg .actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

/* --------------------------------------------------------------------------
   24. Utilities
   -------------------------------------------------------------------------- */
.hidden { display: none !important; }

.flex { display: flex; }
.wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mr-auto { margin-right: auto; }
.ml-auto { margin-left: auto; }

.w-full { width: 100%; }
.text-center { text-align: center; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bold,
.b { font-weight: 700; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  z-index: 999;
  padding: 10px 16px;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--r);
  transition: top .15s ease;
}

.skip-link:focus {
  top: 8px;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   25. Keyframes + motion preferences
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes shimmer {
  0%   { opacity: 1; }
  50%  { opacity: .45; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
