@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

/* Keep HTML hidden state stronger than component display rules. */
[hidden] {
  display: none !important;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  min-width: 320px;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  transition:
    background var(--transition),
    color var(--transition);
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
.app-shell {
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-width);
  height: 100dvh;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 26px 17px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.6px;
  margin: 0 8px 42px;
}
.brand-mark {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--brand-primary);
  border-radius: 11px;
}
.workspace-label {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin: 0 12px 13px;
}
.navigation {
  display: grid;
  gap: 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition:
    background var(--transition),
    color var(--transition);
}
.nav-link span {
  width: 20px;
  text-align: center;
  font-size: 17px;
}
.nav-link:hover,
.nav-link.active {
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
}
.sidebar-bottom {
  margin-top: auto;
}
.profile {
  border-top: 1px solid var(--border);
  margin-top: 17px;
  padding: 18px 5px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 35px;
  height: 35px;
  flex: 0 0 35px;
  display: grid;
  place-items: center;
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
  font-weight: 800;
  font-size: 11px;
  border-radius: 50%;
}
.profile strong,
.profile small {
  display: block;
}
.profile strong {
  font-size: 11px;
}
.profile small {
  color: var(--text-secondary);
  font-size: 10px;
  margin-top: 4px;
}
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: var(--topbar-height);
  flex: 0 0 var(--topbar-height);
  padding: 0 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.breadcrumb {
  color: var(--text-secondary);
  font-size: 12px;
}
.breadcrumb span {
  margin: 0 9px;
}
.breadcrumb strong {
  color: var(--text-primary);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}
.local-label {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-secondary);
  font-weight: 700;
}
.icon-button,
.menu-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 10px;
  width: 37px;
  height: 37px;
}
.menu-button {
  display: none;
}
.dashboard {
  width: 100%;
  max-width: 1440px;
  padding: 35px;
  margin: 0 auto;
  flex: 1;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 27px;
}
.eyebrow,
.ai-label {
  color: var(--brand-primary);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  margin-bottom: 9px;
}
.page-head h1 {
  font-family: var(--font-heading);
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -1.1px;
}
.subtitle {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.6;
}
.primary-button,
.secondary-button,
.outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 15px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
  transition:
    background var(--transition),
    border var(--transition);
  white-space: nowrap;
}
.primary-button {
  background: var(--brand-primary);
  color: #fff;
}
.primary-button:hover {
  background: var(--brand-primary-hover);
}
.secondary-button {
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
  width: 100%;
  margin-top: 17px;
}
.outline-button {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-primary);
}
.danger-outline {
  color: var(--danger);
  border-color: var(--danger);
  margin-top: 14px;
}
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}
.metrics-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.metric-label {
  color: var(--text-secondary);
  font-size: 11px;
}
.metric-card h2 {
  font-family: var(--font-heading);
  font-size: clamp(18px, 2vw, 25px);
  margin: 16px 0 8px;
  overflow-wrap: anywhere;
}
.metric-card small {
  color: var(--text-secondary);
  font-size: 10px;
}
.content-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-heading h3,
.panel h3 {
  font-family: var(--font-heading);
  font-size: 15px;
}
.panel-heading p {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.text-button {
  border: 0;
  background: none;
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 700;
}
.empty-state {
  text-align: center;
  padding: 40px 12px;
  color: var(--text-secondary);
}
.empty-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
  border-radius: 14px;
  font-size: 20px;
}
.empty-state h3 {
  color: var(--text-primary);
  font-size: 13px;
  margin-bottom: 7px;
}
.empty-state p {
  font-size: 11px;
  line-height: 1.7;
  max-width: 330px;
  margin: auto;
}
.ai-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
  border-radius: 11px;
}
.intelligence-panel > p,
.muted {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-top: 10px;
}
.snapshot {
  display: grid;
  gap: 0;
  margin-top: 15px;
}
.snapshot div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
}
.snapshot span {
  color: var(--text-secondary);
}
.snapshot strong {
  font-size: 11px;
}
.activity-list {
  display: grid;
}
.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child {
  border-bottom: 0;
}
.activity-item strong,
.activity-item small {
  display: block;
}
.activity-item strong {
  font-size: 11px;
}
.activity-item small,
.cell-sub {
  font-size: 10px;
  color: var(--text-secondary);
  margin: 5px 0;
  display: block;
}
.activity-amount {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 700;
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
}
.status.paid {
  background: #dcfce7;
  color: #166534;
}
.status.pending {
  background: #fef3c7;
  color: #92400e;
}
[data-theme="dark"] .status.paid {
  background: #123c2a;
  color: #86efac;
}
[data-theme="dark"] .status.pending {
  background: #493719;
  color: #fcd34d;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 610px;
  text-align: left;
}
th {
  font-size: 9px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 700;
  background: var(--bg);
}
th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
}
td strong {
  font-size: 11px;
}
tbody tr:last-child td {
  border-bottom: 0;
}
.small-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 9px;
  font-weight: 700;
  margin: 2px;
}
.danger-text {
  color: var(--danger);
}
.insight-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}
.insight-list p {
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-secondary);
}
.insight-list strong {
  color: var(--text-primary);
}
.notice {
  margin-top: 20px;
  padding: 12px;
  border-radius: 10px;
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
  font-size: 10px;
  line-height: 1.7;
}
.settings-panel h3 {
  margin-bottom: 17px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  max-width: 650px;
}
.form-grid label,
.dialog-form label {
  display: grid;
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
}
input,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text-primary);
  outline: none;
  font-size: 11px;
}
input:focus,
select:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px var(--brand-accent-soft);
}
.form-grid button {
  justify-self: start;
}
.settings-panel hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 25px 0;
}
.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 35px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 9px;
}
.footer span:first-child {
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-primary);
}
.app-dialog {
  width: min(480px, calc(100% - 28px));
  max-height: 90dvh;
  margin: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text-primary);
  padding: 0;
  box-shadow: var(--shadow-md);
}
.app-dialog::backdrop {
  background: rgb(2 6 23 / 58%);
  backdrop-filter: blur(3px);
}
.dialog-form {
  padding: 23px;
  display: grid;
  gap: 13px;
  overflow: auto;
  max-height: 90dvh;
}
.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}
.dialog-heading h2 {
  font-family: var(--font-heading);
  font-size: 20px;
}
.close-button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 20px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 8px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 15px);
  opacity: 0;
  pointer-events: none;
  background: var(--brand-dark);
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 11px;
  box-shadow: var(--shadow-md);
  transition:
    opacity 0.2s,
    transform 0.2s;
  z-index: 50;
  max-width: calc(100% - 30px);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .content-grid {
    grid-template-columns: 1fr;
  }
  .dashboard {
    padding: 27px;
  }
}
@media (max-width: 760px) {
  :root {
    --sidebar-width: 260px;
  }
  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-md);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .topbar {
    padding: 0 17px;
    gap: 12px;
  }
  .menu-button {
    display: block;
    flex: 0 0 37px;
  }
  .breadcrumb {
    margin-right: auto;
    font-size: 11px;
  }
  .topbar-actions {
    gap: 9px;
  }
  .local-label {
    display: none;
  }
  .dashboard {
    padding: 25px 16px;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .page-head > .primary-button {
    width: 100%;
  }
  .metrics-grid {
    gap: 10px;
  }
  .metric-card,
  .panel {
    padding: 15px;
  }
  .metric-card h2 {
    font-size: 19px;
  }
  .footer {
    padding: 16px;
    flex-wrap: wrap;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 390px) {
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }
  .metric-card {
    padding: 12px;
  }
  .metric-card h2 {
    font-size: 17px;
  }
  .dashboard {
    padding-inline: 12px;
  }
  .avatar {
    display: grid;
  }
}

/* Supabase authentication gate */
.auth-gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(
      circle at 15% 10%,
      var(--brand-accent-soft),
      transparent 35%
    ),
    var(--bg);
}
.auth-card {
  width: min(100%, 440px);
  padding: clamp(22px, 5vw, 38px);
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 32px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 18px;
}
.auth-card h1 {
  font-family: var(--font-heading);
  font-size: clamp(24px, 5vw, 30px);
  letter-spacing: -0.8px;
  margin: 8px 0;
}
.auth-intro,
.auth-footnote {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.auth-form {
  display: grid;
  gap: 15px;
  margin-top: 22px;
}
.auth-form label {
  display: grid;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}
.auth-form .primary-button {
  width: 100%;
  min-height: 44px;
}
.auth-form button:disabled {
  opacity: 0.65;
  cursor: wait;
}
.auth-switch {
  display: block;
  margin: 18px auto 0;
  border: 0;
  background: none;
  color: var(--brand-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 8px;
}
.auth-footnote {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 18px;
  font-size: 10px;
}
.auth-message {
  min-height: 0;
  margin-top: 14px;
  font-size: 11px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.auth-message:empty {
  display: none;
}
.auth-message.error {
  color: var(--danger);
}
.auth-message.success {
  color: var(--success);
}
.auth-message.warning {
  color: var(--warning);
}
.signout-button {
  padding: 8px 10px;
  font-size: 10px;
}
@media (max-width: 420px) {
  .auth-gate {
    padding: 14px;
  }
  .auth-card {
    padding: 22px;
    border-radius: 17px;
  }
}

/* Confirmation email resend action */
.auth-resend {
  display: block;
  width: 100%;
  margin: 8px auto 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}
.auth-resend:hover {
  background: var(--brand-accent-soft);
}
.auth-resend:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status.partially_paid {
  background: #e0e7ff;
  color: #3730a3;
}
[data-theme="dark"] .status.partially_paid {
  background: #252b55;
  color: #c7d2fe;
}
.small-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Stage 5: business intelligence cards */
.insight-cards {
  display: grid;
  gap: 12px;
}
.insight-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.insight-item-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.insight-item-heading strong {
  font-size: 12px;
  color: var(--text-primary);
}
.insight-item p {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-secondary);
}
.insight-tag {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 700;
}
.insight-tag.warning {
  background: #fef3c7;
  color: #92400e;
}
.insight-tag.success {
  background: #dcfce7;
  color: #166534;
}
.insight-tag.info {
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
}

/* WELLCOME interaction and accessibility improvements */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.48);
  border: 0;
  z-index: 19;
}
.sidebar-backdrop:not([hidden]) {
  display: block;
}
.sidebar {
  z-index: 20;
}
.sidebar-open {
  overflow: hidden;
}
.ai-composer {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 12px 30px;
  background: var(--bg);
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}
.ai-composer textarea {
  resize: none;
  min-height: 42px;
  max-height: 180px;
  border: 0;
  background: transparent;
  box-shadow: none !important;
  padding: 11px 10px;
  line-height: 1.55;
  font: inherit;
  font-size: 13px;
  align-self: center;
}
.ai-composer textarea:focus {
  outline: none;
}
.ai-composer .primary-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 20px;
  padding: 0;
}
.composer-hint {
  position: absolute;
  bottom: 8px;
  left: 22px;
  font-size: 9px;
  color: var(--text-secondary);
}
#customExpenseWrap[hidden] {
  display: none !important;
}
.settings-panel > label {
  display: grid;
  gap: 8px;
  max-width: 320px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}
@media (max-width: 760px) {
  .sidebar-backdrop {
    display: block;
  }
  .sidebar-backdrop[hidden] {
    display: none;
  }
  .ai-composer {
    padding: 8px 8px 29px;
  }
  .ai-composer textarea {
    font-size: 16px;
  }
  .dashboard {
    min-width: 0;
  }
  .page-head,
  .panel,
  .metric-card {
    min-width: 0;
  }
  .footer {
    font-size: 9px;
  }
}
@media (max-width: 360px) {
  .topbar {
    padding-inline: 10px;
  }
  .dashboard {
    padding-inline: 10px;
  }
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .page-head h1 {
    overflow-wrap: anywhere;
  }
  .dialog-form {
    padding: 16px;
  }
}

.record-menu {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}
.record-menu summary {
  list-style: none;
  cursor: pointer;
  width: 32px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 18px;
  color: var(--text-primary);
}
.record-menu summary::-webkit-details-marker {
  display: none;
}
.record-menu > div {
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  z-index: 30;
  min-width: 145px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.record-menu button {
  display: block;
  width: 100%;
  padding: 9px;
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font-size: 11px;
}
.record-menu button:hover {
  background: var(--bg);
}
.record-menu button[data-action*="delete"] {
  color: var(--danger);
}

/* WELLCOME startup skeleton and polished sign-in controls */
.startup-skeleton {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: clamp(20px, 4vw, 44px);
  background: var(--bg);
  color: var(--text-primary);
}
.skeleton-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 18px;
}
.skeleton-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  flex: 1;
  padding-top: 38px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}
.skeleton-layout aside {
  display: grid;
  align-content: start;
  gap: 15px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  height: fit-content;
}
.skeleton-layout main {
  display: grid;
  align-content: start;
  gap: 18px;
}
.skeleton-line,
.skeleton-layout aside i,
.skeleton-cards i,
.skeleton-panel {
  display: block;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    var(--border) 20%,
    var(--surface) 42%,
    var(--border) 65%
  );
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.25s linear infinite;
}
.skeleton-layout aside i {
  height: 34px;
}
.skeleton-line {
  height: 16px;
  width: 42%;
}
.skeleton-line.wide {
  height: 28px;
  width: 65%;
}
.skeleton-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.skeleton-cards i {
  height: 112px;
}
.skeleton-panel {
  height: 250px;
}
.startup-skeleton > p {
  margin: 0 auto;
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.auth-pending .app-shell {
  visibility: hidden;
}
.password-control {
  display: flex;
  align-items: stretch;
  position: relative;
}
.password-control input {
  padding-right: 70px;
}
.password-toggle {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  height: 30px;
  min-width: 54px;
  border: 0;
  border-radius: 7px;
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
  font-size: 10px;
  font-weight: 800;
}
.auth-form label.password-field {
  gap: 7px;
}
.auth-form input {
  min-height: 46px;
  font-size: 13px;
}
.auth-card {
  backdrop-filter: blur(14px);
}
.auth-card .auth-brand {
  margin-bottom: 25px;
}
.auth-card .eyebrow {
  margin-bottom: 10px;
}
.auth-card .primary-button {
  min-height: 48px;
  font-size: 12px;
}
.topbar-actions {
  gap: 10px;
}
.settings-panel [data-auth-signout] {
  margin-top: 12px;
}
@keyframes skeleton-shimmer {
  to {
    background-position: -220% 0;
  }
}
@media (max-width: 760px) {
  .skeleton-layout {
    grid-template-columns: 1fr;
    padding-top: 24px;
  }
  .skeleton-layout aside {
    display: none;
  }
  .skeleton-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .skeleton-cards i:last-child {
    display: none;
  }
  .skeleton-panel {
    height: 190px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-layout aside i,
  .skeleton-line,
  .skeleton-cards i,
  .skeleton-panel {
    animation: none;
  }
}

/* Transaction evidence workspace */
.evidence-upload-form {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 1.2fr auto;
  align-items: end;
  gap: 13px;
}
.evidence-upload-form label {
  display: grid;
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
}
.evidence-upload-form input,
.evidence-upload-form select {
  min-width: 0;
}
.evidence-hint {
  grid-column: 1/-1;
  margin: 0 !important;
}
.evidence-upload-form button {
  min-height: 42px;
}
@media (max-width: 900px) {
  .evidence-upload-form {
    grid-template-columns: 1fr 1fr;
  }
  .evidence-upload-form button {
    justify-self: start;
  }
}
@media (max-width: 560px) {
  .evidence-upload-form {
    grid-template-columns: 1fr;
  }
  .evidence-upload-form button {
    width: 100%;
  }
}

/* Phase 3 interaction refinements */
.payment-evidence-form {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  align-items: end;
  gap: 12px;
}
.payment-evidence-form label {
  display: grid;
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
}
.payment-evidence-form button {
  min-height: 42px;
}
@media (max-width: 650px) {
  .payment-evidence-form {
    grid-template-columns: 1fr;
  }
  .payment-evidence-form button {
    width: 100%;
  }
}
.sidebar,
.sidebar-backdrop,
.menu-button {
  -webkit-tap-highlight-color: transparent;
}
.sidebar {
  backface-visibility: hidden;
  will-change: transform;
  transition: transform 0.2s cubic-bezier(0.2, 0.75, 0.25, 1);
}
@media (max-width: 760px) {
  .sidebar-backdrop {
    background: rgba(2, 6, 23, 0.38);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
.record-menu[open] > summary {
  background: var(--bg);
  color: var(--brand-primary);
}
.date-filter-bar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin: -10px 0 20px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.date-filter-bar label {
  display: grid;
  gap: 5px;
  min-width: 150px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
}
.date-filter-bar input {
  min-height: 36px;
}
.date-filter-bar .outline-button {
  min-height: 36px;
  padding: 8px 12px;
}
.date-filter-bar .text-button {
  min-height: 36px;
  padding: 8px;
}
.payment-history-list {
  display: grid;
  gap: 12px;
}
.payment-history-list p {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 11px;
}
.payment-history-list small,
.payment-history-list span {
  color: var(--text-secondary);
  font-size: 10px;
}
.month-group-row td {
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.35px;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
}

/* WELLCOME responsive and persistent navigation refinements */
.topbar {
  position: sticky;
  top: 0;
  z-index: 18;
  min-height: var(--topbar-height);
}
.menu-button {
  display: grid;
  place-items: center;
  flex: 0 0 37px;
  font-size: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.sidebar.desktop-collapsed {
  transform: translateX(-105%);
}
.main-content.sidebar-collapsed {
  margin-left: 0;
}
.compact-controls {
  display: flex;
  justify-content: center;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.compact-controls .text-button {
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--brand-accent-soft);
}
.compact-hidden[hidden] {
  display: none !important;
}
.evidence-dialog {
  width: min(980px, calc(100% - 24px));
  max-height: min(94dvh, 1000px);
}
.evidence-dialog .dialog-form {
  max-height: min(94dvh, 1000px);
}
.evidence-preview {
  width: 100%;
  height: clamp(260px, 55vh, 620px);
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 12px;
}
.evidence-preview iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.evidence-preview img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.evidence-file-fallback {
  padding: 24px;
  text-align: center;
  gap: 12px;
  align-content: center;
}
.history-details {
  display: grid;
  gap: 8px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.history-details h3 {
  font-size: 13px;
  margin-bottom: 3px;
}
.history-details p,
.history-summary p {
  font-size: 11px;
  line-height: 1.65;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.history-summary {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
}
.table-wrap {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}
.panel,
.content-grid > *,
.metrics-grid > *,
.page-head > div {
  min-width: 0;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
@media (max-width: 1100px) {
  .main-content {
    margin-left: var(--sidebar-width);
  }
  .dashboard {
    padding: clamp(18px, 3vw, 28px);
  }
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .topbar {
    padding: 0 12px;
    gap: 10px;
  }
  .menu-button {
    display: grid;
    position: relative;
    z-index: 19;
  }
  .sidebar {
    transform: translateX(-105%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar.desktop-collapsed {
    transform: translateX(-105%);
  }
  .main-content,
  .main-content.sidebar-collapsed {
    margin-left: 0;
  }
  .dashboard {
    padding: 20px 14px;
  }
  .page-head {
    align-items: stretch;
  }
  .page-head > .primary-button {
    width: 100%;
  }
  .metrics-grid,
  .metrics-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .evidence-dialog {
    width: calc(100% - 12px);
    max-height: 96dvh;
  }
  .evidence-dialog .dialog-form {
    padding: 14px;
    max-height: 96dvh;
  }
  .evidence-preview {
    height: 48dvh;
    min-height: 220px;
  }
  .dialog-actions {
    flex-wrap: wrap;
  }
  .dialog-actions > * {
    flex: 1 1 130px;
  }
  .footer {
    gap: 8px;
  }
}
@media (max-width: 480px) {
  .topbar {
    height: auto;
    min-height: var(--topbar-height);
    padding: 8px 10px;
  }
  .breadcrumb {
    font-size: 10px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .breadcrumb span {
    margin: 0 4px;
  }
  .topbar-actions .avatar {
    display: grid !important;
  }
  .dashboard {
    padding: 17px 10px;
  }
  .metrics-grid,
  .metrics-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .metric-card,
  .panel {
    padding: 12px;
    border-radius: 12px;
  }
  .metric-card h2 {
    font-size: clamp(15px, 4.5vw, 19px);
  }
  .panel-heading {
    align-items: flex-start;
  }
  .date-filter-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .date-filter-bar label {
    min-width: 0;
  }
  .date-filter-bar button {
    width: 100%;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .table-wrap table {
    min-width: 590px;
  }
  .record-menu > div {
    max-width: min(220px, calc(100vw - 48px));
  }
}
@media (max-width: 350px) {
  .metrics-grid,
  .metrics-grid.two {
    grid-template-columns: 1fr;
  }
  .topbar-actions {
    display: none;
  }
  .page-head h1 {
    font-size: 23px;
  }
  .dialog-form {
    padding: 13px;
  }
}
@media (min-width: 761px) and (max-width: 1050px) {
  .sidebar {
    width: 220px;
    padding: 22px 12px;
  }
  :root {
    --sidebar-width: 220px;
  }
  .topbar {
    padding-inline: 20px;
  }
  .dashboard {
    padding: 24px 20px;
  }
  .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none !important;
  }
}
.preview-fallback-link {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 8px;
}
.preview-fallback-link a {
  color: var(--brand-primary);
  font-weight: 700;
  text-decoration: underline;
}

.pdf-preview-shell {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start !important;
  gap: 10px;
  overflow: auto !important;
  padding: 10px;
}
.pdf-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  width: 100%;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.pdf-toolbar span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 110px;
  text-align: center;
}
.pdf-toolbar button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pdf-page-canvas {
  display: block;
  max-width: 100%;
  height: auto !important;
  background: #fff;
  box-shadow: 0 2px 14px rgb(0 0 0 / 15%);
}
.preview-fallback-link {
  font-size: 11px;
  text-align: center;
  color: var(--text-secondary);
  padding: 8px;
}
.preview-fallback-link a {
  color: var(--brand-primary);
  font-weight: 700;
  text-decoration: underline;
  margin: 0 3px;
}
@media (max-width: 480px) {
  .topbar-actions .avatar {
    display: grid !important;
    width: 31px;
    height: 31px;
    flex-basis: 31px;
  }
  .pdf-preview-shell {
    height: 55dvh;
    min-height: 280px;
    padding: 7px;
  }
  .pdf-toolbar {
    gap: 4px;
  }
  .pdf-toolbar span {
    min-width: 90px;
    font-size: 10px;
  }
  .pdf-toolbar .small-button {
    padding: 7px 8px;
  }
}

/* Phase 5 v0.13 — restore the spacious workspace and refine responsive layouts. */
@media (min-width: 1200px) {
  .dashboard {
    max-width: 1600px;
    padding: 42px 44px;
  }
  .page-head {
    margin-bottom: 32px;
  }
  .page-head h1 {
    font-size: clamp(29px, 2.4vw, 38px);
  }
  .subtitle {
    font-size: 14px;
    max-width: 760px;
  }
  .metrics-grid {
    gap: 18px;
    margin-bottom: 24px;
  }
  .metric-card,
  .panel {
    padding: 24px;
    border-radius: var(--radius-lg);
  }
  .metric-label {
    font-size: 12px;
  }
  .metric-card h2 {
    font-size: clamp(22px, 2vw, 30px);
    margin: 18px 0 10px;
  }
  .content-grid {
    gap: 22px;
  }
  .panel-heading h3,
  .panel h3 {
    font-size: 17px;
  }
  .panel-heading p,
  .intelligence-panel > p,
  .muted {
    font-size: 12px;
  }
}
@media (min-width: 761px) and (max-width: 1199px) {
  .dashboard {
    max-width: none;
    padding: 32px clamp(24px, 3.2vw, 40px);
  }
  .metric-card,
  .panel {
    padding: 21px;
  }
  .page-head h1 {
    font-size: 30px;
  }
  .subtitle {
    font-size: 13px;
  }
}
/* Clearer business intelligence hierarchy */
.intelligence-panel {
  padding: clamp(20px, 2.2vw, 28px);
}
.intelligence-panel .panel-heading {
  margin-bottom: 18px;
}
.intelligence-panel .panel-heading h3 {
  font-size: clamp(17px, 1.5vw, 20px);
  letter-spacing: -0.35px;
}
.intelligence-panel .panel-heading p {
  font-size: 12px;
  line-height: 1.65;
  max-width: 680px;
}
.insight-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.insight-item {
  padding: 18px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.insight-item-heading {
  align-items: flex-start;
}
.insight-item-heading strong {
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.15px;
}
.insight-item p {
  font-size: 13px;
  line-height: 1.75;
  margin-top: 10px;
}
.insight-tag {
  font-size: 10px;
  padding: 5px 9px;
}
.insight-item .small-button {
  font-size: 11px;
  padding: 8px 11px;
  margin: 12px 0 0;
}
.insight-list {
  gap: 14px;
  margin-top: 20px;
}
.insight-list p {
  font-size: 14px;
  line-height: 1.8;
}
/* AI assistant conversation typography and spacing */
.assistant-workspace {
  padding: clamp(18px, 2.4vw, 30px);
}
.assistant-intro {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 20px;
}
.assistant-intro > .ai-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  font-size: 19px;
}
.assistant-intro h3 {
  font-size: clamp(19px, 2vw, 24px);
  letter-spacing: -0.5px;
  margin-top: 3px;
}
.assistant-intro p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-top: 7px;
}
.assistant-messages {
  max-height: min(58vh, 680px);
  min-height: 180px;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 22px 0;
  padding: 4px 3px;
  display: grid;
  align-content: start;
  gap: 14px;
}
.chat-message {
  max-width: min(88%, 820px);
  padding: 17px 19px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}
.chat-message.from-user {
  justify-self: end;
  background: var(--brand-accent-soft);
  border-color: transparent;
}
.chat-message.from-assistant {
  justify-self: start;
  background: var(--surface);
}
.chat-message-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-primary);
}
.chat-avatar {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 800;
}
.from-user .chat-avatar {
  background: var(--surface);
}
.chat-message-content {
  white-space: pre-wrap;
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}
.assistant-workspace > .ai-composer {
  margin-top: 18px;
}
.assistant-workspace > .muted {
  font-size: 12px !important;
  line-height: 1.7;
}
@media (max-width: 760px) {
  /* Phone layout: keep the dashboard spacious and readable, not miniaturised. */
  .dashboard {
    width: 100%;
    max-width: none;
    padding: 24px 18px;
  }
  .page-head {
    gap: 14px;
    margin-bottom: 23px;
  }
  .page-head h1 {
    font-size: clamp(25px, 6vw, 31px);
    line-height: 1.18;
  }
  .subtitle {
    font-size: 13px;
    line-height: 1.7;
  }
  .metrics-grid,
  .metrics-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .metric-card,
  .panel {
    padding: 17px;
    border-radius: 15px;
  }
  .metric-label {
    font-size: 11px;
    line-height: 1.5;
  }
  .metric-card h2 {
    font-size: clamp(18px, 5vw, 22px);
    margin: 13px 0 8px;
  }
  .metric-card small {
    font-size: 11px;
    line-height: 1.5;
  }
  .panel-heading h3,
  .panel h3 {
    font-size: 16px;
    line-height: 1.4;
  }
  .panel-heading p {
    font-size: 11px;
    line-height: 1.6;
  }
  .insight-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .insight-item {
    padding: 16px;
  }
  .insight-item-heading strong {
    font-size: 14px;
  }
  .insight-item p {
    font-size: 13px;
    line-height: 1.75;
  }
  .insight-list p {
    font-size: 13px;
  }
  .assistant-workspace {
    padding: 17px;
  }
  .assistant-messages {
    max-height: 55vh;
    min-height: 160px;
    gap: 11px;
    margin: 17px 0;
  }
  .chat-message {
    max-width: 96%;
    padding: 14px;
    border-radius: 14px;
  }
  .chat-message-content {
    font-size: 14px;
    line-height: 1.8;
  }
  .assistant-intro h3 {
    font-size: 19px;
  }
  .assistant-intro p {
    font-size: 12px;
  }
}
@media (max-width: 480px) {
  .dashboard {
    padding: 22px 15px;
  }
  .topbar {
    min-height: 58px;
    padding: 8px 12px;
  }
  .menu-button {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }
  .breadcrumb {
    font-size: 11px;
  }
  .metrics-grid,
  .metrics-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .metric-card,
  .panel {
    padding: 15px;
  }
  .metric-card h2 {
    font-size: 18px;
    overflow-wrap: anywhere;
  }
  .panel-heading {
    gap: 9px;
  }
  .insight-item-heading {
    flex-wrap: wrap;
  }
  .insight-tag {
    margin-left: 0;
  }
  .assistant-intro {
    gap: 11px;
  }
  .assistant-intro > .ai-icon {
    width: 39px;
    height: 39px;
    flex-basis: 39px;
  }
  .chat-message {
    max-width: 100%;
  }
  .chat-message-content {
    font-size: 14px;
  }
  .ai-composer {
    grid-template-columns: minmax(0, 1fr) 40px;
  }
  .ai-composer .primary-button {
    width: 40px;
    height: 40px;
  }
}
@media (max-width: 360px) {
  .dashboard {
    padding: 19px 12px;
  }
  .metrics-grid,
  .metrics-grid.two {
    grid-template-columns: 1fr;
  }
  .metric-card,
  .panel {
    padding: 14px;
  }
  .page-head h1 {
    font-size: 25px;
  }
  .topbar-actions {
    display: flex;
  }
  .topbar-actions .avatar {
    width: 29px;
    height: 29px;
    flex-basis: 29px;
  }
  .chat-message-content {
    font-size: 13px;
  }
}

/* WELLCOME database audit timeline */
.audit-event-list {
  display: grid;
  gap: 0;
  margin-top: 8px;
}
.audit-event {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.audit-event:last-child {
  border-bottom: 0;
}
.audit-event-marker {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent, #16a34a);
  margin: 6px auto 0;
  box-shadow: 0 0 0 4px
    color-mix(in srgb, var(--accent, #16a34a) 12%, transparent);
}
.audit-event-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.audit-event-top time,
.audit-event-main small,
.audit-footnote {
  color: var(--muted, #6b7280);
  font-size: 0.82rem;
}
.audit-event-main p {
  margin: 7px 0;
  color: var(--text, #1f2937);
  overflow-wrap: anywhere;
}
.audit-change-details {
  margin-top: 10px;
  font-size: 0.88rem;
}
.audit-change-details summary {
  cursor: pointer;
  color: var(--accent, #15803d);
}
.audit-change-details pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface-soft, #f5f7f5);
  padding: 10px;
  border-radius: 8px;
  max-height: 220px;
  overflow: auto;
  font-size: 0.78rem;
}
.audit-footnote {
  margin-top: 16px;
}
@media (max-width: 600px) {
  .audit-event-top {
    display: grid;
    gap: 4px;
  }
  .audit-event {
    gap: 8px;
  }
}

/* Audience-friendly business activity timeline */
.audit-event-title {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.audit-event-title strong {
  font-size: 0.98rem;
  text-transform: capitalize;
}
.audit-event-type {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-soft, #f3f4f6);
  color: var(--muted, #64748b);
}
.audit-event-main > p {
  font-size: 0.94rem;
  line-height: 1.55;
  margin: 9px 0 7px;
}
.audit-event-meta {
  font-size: 0.8rem;
  color: var(--muted, #64748b);
}
.audit-friendly-changes {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.audit-friendly-change {
  display: grid;
  grid-template-columns: minmax(90px, 0.7fr) minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
}
.audit-friendly-change strong {
  font-size: 0.82rem;
}
.audit-old-value,
.audit-new-value {
  overflow-wrap: anywhere;
  font-size: 0.85rem;
}
.audit-old-value {
  color: var(--muted, #64748b);
}
.audit-new-value {
  font-weight: 650;
  color: var(--text, #1f2937);
}
.audit-change-arrow {
  color: var(--muted, #64748b);
}
.audit-change-details summary {
  font-weight: 600;
  font-size: 0.83rem;
  margin-top: 10px;
}
@media (max-width: 600px) {
  .audit-friendly-change {
    grid-template-columns: 1fr auto 1fr;
    gap: 7px;
  }
  .audit-friendly-change strong {
    grid-column: 1/-1;
  }
  .audit-event-top {
    gap: 7px;
  }
}

/* Accessible dark-mode-safe activity and assistant copy controls */
.audit-event-top time,
.audit-event-main small,
.audit-footnote,
.audit-event-meta,
.audit-old-value,
.audit-change-arrow {
  color: var(--text-secondary);
}
.audit-event-main p,
.audit-new-value {
  color: var(--text-primary);
}
.audit-event-type {
  background: var(--surface-raised);
  color: var(--text-secondary);
}
.audit-friendly-change {
  background: var(--surface);
}
.chat-message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.chat-message-actions .text-button {
  color: var(--brand-primary);
  font-size: 12px;
  font-weight: 700;
}
[data-theme="dark"] .chat-message-actions .text-button {
  color: #93c5fd;
}

/* v0.25 — compact, readable document intelligence and cancellable analysis */
.wellcome-analysis-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(10, 15, 25, 0.68);
  display: grid;
  place-items: center;
  padding: 18px;
}
.wellcome-analysis-card {
  width: min(390px, 100%);
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-md);
}
.wellcome-analysis-title {
  font-size: 16px;
  font-weight: 750;
  color: var(--text-primary);
}
.wellcome-analysis-card > p {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 9px 0 13px;
}
.wellcome-analysis-track {
  height: 7px;
  border-radius: 99px;
  background: var(--surface-raised);
  overflow: hidden;
}
.wellcome-analysis-track > div {
  height: 100%;
  width: 8%;
  background: var(--brand-primary);
  border-radius: 99px;
  transition: width 0.2s ease;
}
.wellcome-analysis-card .wellcome-analysis-footnote {
  font-size: 10px;
  margin: 10px 0 14px;
}
.wellcome-analysis-cancel {
  width: 100%;
  min-height: 40px;
}
.extraction-result {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.extraction-status {
  font-size: 10px;
  color: var(--text-secondary);
  padding: 8px 10px;
  background: var(--surface-raised);
  border-radius: 8px;
  margin: 0;
}
.extraction-section {
  display: grid;
  gap: 9px;
  min-width: 0;
}
.extraction-section h3 {
  font-size: 13px;
  color: var(--text-primary);
}
.extraction-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.extracted-document-text {
  margin: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg);
  color: var(--text-primary);
  font:
    12px/1.8 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 48dvh;
  overflow: auto;
}
.extraction-meta,
.extraction-review {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 12px;
}
.extraction-meta > summary,
.extraction-review > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}
.extraction-meta > summary::-webkit-details-marker,
.extraction-review > summary::-webkit-details-marker {
  display: none;
}
.extraction-meta > summary span,
.extraction-review > summary span {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}
.extraction-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}
.extraction-field {
  display: grid;
  gap: 4px;
  padding: 9px;
  border-radius: 8px;
  background: var(--bg);
  min-width: 0;
}
.extraction-field span {
  font-size: 9px;
  color: var(--text-secondary);
}
.extraction-field strong {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.extraction-review ul {
  margin: 10px 0 2px;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.65;
}
.extraction-line-items {
  display: grid;
  gap: 7px;
}
.extraction-line-items > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.extraction-line-items strong {
  font-size: 11px;
  color: var(--text-primary);
}
.extraction-line-items span {
  font-size: 10px;
  color: var(--text-secondary);
}
@media (max-width: 480px) {
  .extraction-field-grid {
    grid-template-columns: 1fr 1fr;
  }
  .extracted-document-text {
    font-size: 11px;
    padding: 11px;
    max-height: 44dvh;
  }
  .wellcome-analysis-card {
    padding: 17px;
  }
}

/* v0.26 — business evidence graph and reviewed record matching */
.evidence-graph-list {
  display: grid;
  gap: 12px;
}
.evidence-graph-node {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.evidence-graph-record {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.evidence-node-type {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 750;
}
.evidence-graph-record strong,
.evidence-graph-doc strong {
  font-size: 12px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.evidence-graph-record b {
  font-size: 13px;
  color: var(--text-primary);
}
.evidence-graph-record small,
.evidence-graph-edge small,
.evidence-graph-doc span {
  font-size: 10px;
  color: var(--text-secondary);
}
.evidence-graph-edge {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.evidence-graph-edge span {
  height: 1px;
  flex: 1;
  background: var(--border);
}
.evidence-graph-docs {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.evidence-graph-doc {
  display: grid;
  gap: 3px;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised);
  min-width: 0;
}
.evidence-no-doc {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.evidence-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.evidence-suggestion:last-child {
  border-bottom: 0;
}
.evidence-suggestion > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.evidence-suggestion strong {
  font-size: 12px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.evidence-suggestion small,
.evidence-suggestion p,
.evidence-match-hint {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}
.evidence-match-hint {
  padding: 10px;
  border-radius: 9px;
  background: var(--surface-raised);
  margin-bottom: 12px;
}
@media (max-width: 760px) {
  .evidence-graph-node {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .evidence-graph-edge {
    padding: 0 2px;
  }
  .evidence-graph-edge span {
    max-width: 50px;
  }
  .evidence-suggestion {
    align-items: flex-start;
    flex-direction: column;
  }
}

.evidence-amount-check {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(
      2,
      minmax(100px, 0.7fr)
    ) minmax(150px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.evidence-amount-check > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.evidence-amount-check strong {
  font-size: 11px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.evidence-amount-check small,
.evidence-amount-check span {
  font-size: 10px;
  color: var(--text-secondary);
}
.evidence-amount-status.is-match strong {
  color: #15803d;
}
.evidence-amount-status.is-mismatch strong {
  color: #b45309;
}
@media (max-width: 760px) {
  .evidence-amount-check {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .evidence-amount-check > div:first-child {
    grid-column: 1/-1;
  }
  .evidence-amount-status {
    grid-column: 1/-1;
  }
}

/* WELLCOME v0.27 — monthly intelligence and evidence network */
.analytics-chart-panel {
  overflow: hidden;
}
.analytics-chart-panel .panel-heading {
  align-items: flex-start;
}
.analytics-period {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.eyebrow {
  display: block;
  color: var(--brand-primary);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.14em;
  margin-bottom: 7px;
}
.chart-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 8px 0 0 4px;
}
.chart-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 11px;
}
.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.legend-dot.received {
  background: #16a36a;
}
.legend-dot.spent {
  background: #8b5cf6;
}
.cashflow-chart {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
  overflow: visible;
  margin-top: 8px;
}
.cashflow-chart line {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}
.cashflow-chart text {
  fill: var(--text-secondary);
  font-size: 10px;
}
.chart-line {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.received-line {
  stroke: #16a36a;
}
.spent-line {
  stroke: #8b5cf6;
}
.chart-point {
  stroke: var(--surface);
  stroke-width: 2;
}
.chart-point.received {
  fill: #16a36a;
}
.chart-point.spent {
  fill: #8b5cf6;
}
.chart-footnote {
  font-size: 10px;
  line-height: 1.65;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 3px;
}
.analytics-two-col {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  margin-bottom: 18px;
}
.analytics-two-col .panel {
  margin: 0;
}
.category-bar-row {
  display: grid;
  gap: 8px;
  margin: 17px 0;
}
.category-bar-row > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
}
.category-bar-row > div strong {
  font-weight: 650;
}
.category-bar-row > div b {
  font-variant-numeric: tabular-nums;
}
.category-bar-row > span {
  height: 8px;
  border-radius: 20px;
  background: var(--bg);
  overflow: hidden;
}
.category-bar-row > span i {
  display: block;
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, #16a36a, #22c7a0);
}
.pulse-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-secondary);
}
.pulse-stat:last-child {
  border: 0;
}
.pulse-stat strong {
  font-size: 17px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.network-summary {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}
.network-summary span {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}
.evidence-network-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  padding: 12px;
  margin-bottom: 18px;
  -webkit-overflow-scrolling: touch;
}
.evidence-network-svg {
  display: block;
  width: 100%;
  min-width: 520px;
  height: auto;
  overflow: visible;
}
.network-record {
  fill: var(--surface);
  stroke: var(--brand-primary);
  stroke-width: 1.3;
}
.network-document {
  fill: var(--surface-raised);
  stroke: var(--brand-accent);
  stroke-width: 1.2;
}
.network-kind {
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.1em;
  fill: var(--brand-primary);
}
.network-title {
  font-size: 10px;
  font-weight: 700;
  fill: var(--text-primary);
}
.network-value {
  font-size: 9px;
  font-weight: 700;
  fill: var(--text-secondary);
}
.network-doc-label {
  font-size: 9px;
  fill: var(--text-primary);
}
.network-edge {
  fill: none;
  stroke: var(--brand-accent);
  stroke-width: 1.8;
  opacity: 0.8;
}
.network-missing {
  stroke: var(--warning);
  stroke-dasharray: 5 5;
}
.network-missing-label {
  font-size: 9px;
  fill: var(--text-secondary);
}
@media (max-width: 760px) {
  .analytics-two-col {
    grid-template-columns: 1fr;
  }
  .analytics-chart-panel {
    padding: 15px;
  }
  .cashflow-chart {
    min-width: 430px;
  }
  .analytics-chart-panel {
    overflow-x: auto;
  }
  .analytics-chart-panel .panel-heading,
  .chart-legend,
  .chart-footnote {
    min-width: 0;
  }
}

/* v0.28 — clearer analytics hierarchy, evidence map controls and file actions */
.analytics-chart-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.78fr);
  gap: 22px;
  align-items: start;
}
.analytics-chart-intro h3 {
  font-size: clamp(17px, 2vw, 22px);
  margin: 3px 0 7px;
  color: var(--text-primary);
}
.analytics-chart-intro p {
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}
.analytics-chart-intro .chart-legend {
  margin: 16px 0 0;
}
.analytics-side-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.analytics-side-stats > div {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg);
}
.analytics-side-stats span {
  font-size: 9px;
  line-height: 1.35;
  color: var(--text-secondary);
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.analytics-side-stats strong {
  font-size: clamp(13px, 1.5vw, 17px);
  line-height: 1.3;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.analytics-chart-panel .cashflow-chart {
  margin-top: 16px;
  max-height: 300px;
}
.network-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}
.network-toolbar .network-summary {
  margin: 0;
}
.network-legend {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
}
.network-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 650;
}
.network-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
}
.network-legend-record {
  background: var(--brand-primary);
}
.network-legend-document {
  background: var(--brand-accent);
}
.network-legend-missing {
  border: 1px dashed var(--warning);
  background: transparent;
}
.evidence-network-scroll {
  background: linear-gradient(145deg, var(--surface), var(--bg));
  border-color: var(--border);
  padding: 16px;
}
.evidence-network-svg {
  min-width: 570px;
}
.evidence-graph-list {
  gap: 10px;
}
.evidence-graph-node {
  grid-template-columns: minmax(0, 1fr) 105px minmax(0, 1fr);
  gap: 14px;
  padding: 15px;
  background: var(--surface);
  border-radius: 13px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.035);
}
.evidence-graph-record {
  padding: 4px 0;
}
.evidence-graph-record strong {
  font-size: 13px;
  line-height: 1.45;
}
.evidence-graph-record b {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.evidence-graph-edge {
  position: relative;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}
.evidence-graph-edge span {
  width: 100%;
  height: 2px;
  flex: none;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  border-radius: 3px;
}
.evidence-graph-edge span:after {
  content: "›";
  position: absolute;
  right: 0;
  top: -13px;
  color: var(--brand-accent);
  font-size: 22px;
  font-weight: 800;
}
.evidence-graph-edge small {
  font-size: 9px;
  line-height: 1.35;
}
.evidence-graph-doc {
  width: 100%;
  min-height: 68px;
  padding: 12px;
  border-radius: 10px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  text-align: center;
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.evidence-graph-doc span,
.evidence-graph-doc strong {
  width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
}
.evidence-graph-doc span {
  line-height: 1.35;
}
.evidence-graph-doc strong {
  line-height: 1.45;
}
.evidence-graph-doc:active {
  transform: scale(0.99);
}
.evidence-graph-doc:hover {
  border-color: var(--brand-accent);
}
.evidence-graph-doc strong {
  font-size: 11px;
  line-height: 1.4;
}
.evidence-no-doc {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 68px;
  padding: 11px 12px;
  background: color-mix(in srgb, var(--warning) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
  line-height: 1.5;
}
.evidence-overflow-menu {
  position: relative;
  margin-left: auto;
}
.evidence-overflow-menu > summary {
  list-style: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-raised);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
}
.evidence-overflow-menu > summary::-webkit-details-marker {
  display: none;
}
.evidence-overflow-menu[open] > summary {
  border-color: var(--brand-primary);
  background: var(--brand-accent-soft);
}
.evidence-overflow-options {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  width: min(235px, calc(100vw - 54px));
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 3px;
}
.evidence-overflow-options button {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.evidence-overflow-options button:hover {
  background: var(--surface-raised);
}
.evidence-overflow-options button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.dialog-actions {
  align-items: center;
  justify-content: space-between;
}
@media (max-width: 760px) {
  .analytics-chart-top {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .analytics-side-stats {
    grid-template-columns: 1fr 1fr;
  }
  .evidence-graph-node {
    grid-template-columns: 1fr;
    gap: 9px;
  }
  .evidence-graph-edge {
    padding: 0;
    align-items: flex-start;
    text-align: left;
  }
  .evidence-graph-edge span {
    width: 48px;
  }
  .evidence-graph-edge span:after {
    left: 37px;
    right: auto;
    top: -13px;
  }
  .evidence-graph-docs {
    padding-left: 12px;
    border-left: 2px solid var(--brand-accent);
  }
  .network-toolbar {
    align-items: flex-start;
  }
  .network-legend {
    gap: 9px;
  }
}
@media (max-width: 380px) {
  .analytics-side-stats > div {
    padding: 10px;
  }
  .analytics-side-stats strong {
    font-size: 12px;
  }
  .network-summary span {
    font-size: 9px;
    padding: 6px 8px;
  }
}

/* v0.31 — evidence map hierarchy and readable connected-record layout */
.evidence-map-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 16px;
}
.evidence-map-stat {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}
.evidence-map-stat strong {
  font-size: 21px;
  line-height: 1;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.evidence-map-stat span {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-secondary);
  font-weight: 650;
}
.evidence-map-stat.is-warning strong {
  color: var(--warning);
}
.evidence-map-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 2px 14px;
}
.evidence-map-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 650;
}
.map-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 3px;
}
.map-record-dot {
  background: var(--brand-primary);
}
.map-document-dot {
  background: var(--brand-accent);
}
.map-missing-dot {
  border: 1.5px dashed var(--warning);
  background: transparent;
}
.evidence-map-list {
  display: grid;
  gap: 10px;
}
.evidence-map-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.evidence-map-record {
  box-sizing: border-box;
  min-width: 0;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  padding: 12px 15px 14px;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 48%, var(--border));
  border-left: 4px solid var(--brand-primary);
  border-radius: 11px;
  background: var(--surface-soft);
}
.evidence-map-record .evidence-node-type {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-accent);
  font-weight: 800;
}
.evidence-map-record strong {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.evidence-map-record b {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.evidence-map-record small {
  font-size: 10px;
  line-height: 1.45;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.evidence-map-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
}
.evidence-map-connector > span {
  width: 100%;
  height: 2px;
  background: var(--brand-accent);
  position: relative;
  opacity: 0.8;
}
.evidence-map-connector > span:before,
.evidence-map-connector > span:after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border: 2px solid var(--brand-accent);
  border-radius: 50%;
  background: var(--surface);
  transform: translateY(-50%);
}
.evidence-map-connector > span:before {
  left: -1px;
}
.evidence-map-connector > span:after {
  right: -1px;
}
.evidence-map-connector small {
  font-size: 9px;
  font-weight: 750;
  color: var(--text-secondary);
  text-align: center;
}
.missing-evidence .evidence-map-connector > span {
  background: repeating-linear-gradient(
    90deg,
    var(--warning) 0 5px,
    transparent 5px 9px
  );
}
.missing-evidence .evidence-map-connector > span:before,
.missing-evidence .evidence-map-connector > span:after {
  border-color: var(--warning);
}
.missing-evidence .evidence-map-connector small {
  color: var(--warning);
}
.evidence-map-documents {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
}
.evidence-map-document {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--brand-accent) 45%, var(--border));
  border-radius: 10px;
  background: var(--surface-soft);
  text-align: left;
  cursor: pointer;
}
.evidence-map-document:hover {
  border-color: var(--brand-accent);
  background: var(--surface-raised);
}
.evidence-map-document > span {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-accent);
}
.evidence-map-document strong {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.evidence-map-document small {
  font-size: 9px;
  color: var(--text-secondary);
}
.evidence-map-missing {
  display: grid;
  gap: 5px;
  padding: 12px 13px;
  border: 1px dashed var(--warning);
  border-radius: 10px;
  background: color-mix(in srgb, var(--warning) 7%, var(--surface));
}
.evidence-map-missing strong {
  font-size: 11px;
  color: var(--text-primary);
}
.evidence-map-missing small {
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-secondary);
}
@media (max-width: 760px) {
  .evidence-map-overview {
    gap: 7px;
  }
  .evidence-map-stat {
    display: grid;
    gap: 5px;
    padding: 10px;
  }
  .evidence-map-stat strong {
    font-size: 19px;
  }
  .evidence-map-stat span {
    font-size: 9px;
  }
  .evidence-map-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 11px;
  }
  .evidence-map-record {
    min-height: 0;
    padding: 12px 14px 14px;
  }
  .evidence-map-connector {
    align-items: flex-start;
    gap: 4px;
    padding: 0 5px;
  }
  .evidence-map-connector > span {
    width: 42px;
  }
  .evidence-map-connector > span:after {
    left: 35px;
    right: auto;
  }
  .evidence-map-connector small {
    text-align: left;
  }
  .evidence-map-documents {
    padding-left: 12px;
    border-left: 2px solid var(--brand-accent);
  }
}
@media (max-width: 380px) {
  .evidence-map-overview {
    grid-template-columns: 1fr 1fr;
  }
  .evidence-map-stat:last-child {
    grid-column: 1/-1;
  }
}

/* WELLCOME responsive and interaction refinements */
.assistant-intro {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.assistant-intro > div {
  flex: 1;
  min-width: 220px;
}
.assistant-new-chat {
  flex: 0 0 auto;
  white-space: nowrap;
}
.chat-message-actions .text-button {
  color: var(--text-secondary);
}
.chat-message-actions .text-button:hover {
  color: var(--text-primary);
  background: var(--surface-soft);
}
.evidence-dialog {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: var(--surface);
}
.evidence-dialog .dialog-form {
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  overflow: auto;
  border-radius: 0;
  padding: clamp(14px, 2vw, 28px);
}
.evidence-dialog .evidence-preview {
  height: calc(100dvh - 260px);
  min-height: 260px;
  max-height: none;
}
.evidence-dialog .close-button {
  position: sticky;
  top: 0;
  z-index: 3;
}
.download-choice-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.profile-settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 0 22px;
}
.profile-avatar-preview,
.avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--text-primary);
  font-weight: 800;
}
.profile-avatar-preview {
  width: 76px;
  height: 76px;
  font-size: 23px;
  border: 1px solid var(--border);
}
.profile-avatar-preview img,
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-upload-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.settings-form-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
}
.profile-settings-row .muted {
  margin: 4px 0 10px;
}
@media (max-width: 760px) {
  .assistant-intro {
    align-items: flex-start;
  }
  .assistant-new-chat {
    width: 100%;
    margin-left: 0;
  }
  .assistant-messages {
    max-height: none;
    min-height: 260px;
  }
  .ai-composer {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
    z-index: 2;
  }
  .evidence-dialog .dialog-form {
    padding: 14px;
  }
  .evidence-dialog .evidence-preview {
    height: calc(100dvh - 245px);
    min-height: 220px;
  }
  .dialog-actions {
    flex-wrap: wrap;
  }
  .evidence-overflow-options {
    right: 0;
    left: auto;
    max-width: min(88vw, 300px);
  }
  .profile-settings-row {
    align-items: flex-start;
  }
}
@media (max-width: 480px) {
  .chat-message {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .chat-message-content {
    overflow-wrap: anywhere;
  }
  .chat-message-actions {
    justify-content: flex-start;
  }
  .settings-form-actions > * {
    flex: 1 1 100%;
  }
  .download-choice-actions > * {
    flex: 1 1 100%;
  }
  .evidence-dialog .dialog-heading {
    gap: 8px;
  }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .dashboard {
    padding-left: clamp(16px, 2vw, 28px);
    padding-right: clamp(16px, 2vw, 28px);
  }
}

@media (max-width: 760px) {
  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }
  .app-shell,
  .main-content,
  .dashboard,
  .panel,
  .content-grid,
  .metrics-grid {
    min-width: 0;
    max-width: 100%;
  }
  .main-content {
    width: 100%;
  }
  .dashboard {
    padding-left: clamp(12px, 3vw, 20px);
    padding-right: clamp(12px, 3vw, 20px);
  }
  .panel {
    overflow-wrap: anywhere;
  }
  .table-wrap,
  .table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
@media (min-width: 1440px) {
  .dashboard {
    max-width: 1680px;
    margin-inline: auto;
  }
}
@media (max-width: 360px) {
  .dashboard {
    padding-left: 10px;
    padding-right: 10px;
  }
  .assistant-messages {
    padding: 10px;
  }
  .chat-message {
    padding: 10px;
  }
}

/* WELLCOME AI: comfortable composer, saved chat archive and reliable scrolling */
.assistant-history {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  margin: 0 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  max-height: 190px;
  overflow: auto;
  overscroll-behavior: contain;
}
.assistant-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text-primary);
}
.assistant-history-heading span,
.assistant-history-item small {
  font-size: 10px;
  color: var(--text-secondary);
}
.assistant-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
}
.assistant-history-item.active {
  border-color: var(--brand-primary);
  background: var(--brand-accent-soft);
}
.assistant-history-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.assistant-message-region {
  position: relative;
  min-width: 0;
}
.assistant-messages {
  height: min(58vh, 650px);
  max-height: none;
  min-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-gutter: stable;
  margin: 14px 0;
  padding: 10px 12px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
}
.assistant-messages::-webkit-scrollbar,
.assistant-history::-webkit-scrollbar {
  width: 8px;
}
.assistant-messages::-webkit-scrollbar-thumb,
.assistant-history::-webkit-scrollbar-thumb {
  background: var(--border-strong, var(--text-secondary));
  border-radius: 20px;
}
.assistant-scroll-controls {
  position: absolute;
  right: 12px;
  bottom: 14px;
  z-index: 2;
  display: grid;
  gap: 6px;
}
.assistant-scroll-controls button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  font-size: 17px;
  cursor: pointer;
}
.ai-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: end;
  gap: 9px;
  position: sticky;
  bottom: 0;
  z-index: 4;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
}
.ai-composer textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  max-height: 122px;
  resize: none;
  overflow-y: hidden;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text-primary);
  font: inherit;
  line-height: 1.5;
  overscroll-behavior: contain;
}
.ai-composer textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--brand-primary) 35%, transparent);
  outline-offset: 1px;
}
.ai-composer > .primary-button {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 14px;
}
.ai-composer .composer-hint {
  grid-column: 1/-1;
  margin: 0 3px;
  font-size: 10px;
  color: var(--text-secondary);
}
.assistant-thinking {
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text-primary);
}
.assistant-thinking > span:last-child {
  display: grid;
  gap: 3px;
}
.assistant-thinking strong {
  font-size: 11px;
}
.assistant-thinking small {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.thinking-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.thinking-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-primary);
  animation: wellcomeThinking 1.1s infinite ease-in-out;
}
.thinking-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.thinking-dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes wellcomeThinking {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-4px);
  }
}
.assistant-disclaimer {
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.6;
}
@media (max-width: 760px) {
  .assistant-messages {
    height: min(54dvh, 560px);
    min-height: 220px;
    max-height: none;
    margin: 12px 0;
    touch-action: pan-y;
  }
  .assistant-history {
    max-height: 150px;
  }
  .assistant-scroll-controls {
    right: 8px;
    bottom: 12px;
  }
  .assistant-scroll-controls button {
    width: 32px;
    height: 32px;
  }
  .ai-composer {
    position: sticky;
    bottom: 0;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 7px;
    padding: 9px 0 calc(10px + env(safe-area-inset-bottom));
  }
  .ai-composer textarea {
    min-height: 46px;
    max-height: 122px;
    font-size: 16px;
  }
  .ai-composer > .primary-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }
}
@media (max-width: 380px) {
  .assistant-history-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
  .assistant-thinking {
    padding: 10px;
  }
  .assistant-thinking small {
    max-width: 230px;
  }
}

/* WELLCOME AI: comfortable composer, saved chat archive and reliable scrolling */
.assistant-history {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  margin: 0 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  max-height: 190px;
  overflow: auto;
  overscroll-behavior: contain;
}
.assistant-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text-primary);
}
.assistant-history-heading span,
.assistant-history-item small {
  font-size: 10px;
  color: var(--text-secondary);
}
.assistant-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
}
.assistant-history-item.active {
  border-color: var(--brand-primary);
  background: var(--brand-accent-soft);
}
.assistant-history-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.assistant-message-region {
  position: relative;
  min-width: 0;
}
.assistant-messages {
  height: min(58vh, 650px);
  max-height: none;
  min-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-gutter: stable;
  margin: 14px 0;
  padding: 10px 12px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
}
.assistant-messages::-webkit-scrollbar,
.assistant-history::-webkit-scrollbar {
  width: 8px;
}
.assistant-messages::-webkit-scrollbar-thumb,
.assistant-history::-webkit-scrollbar-thumb {
  background: var(--border-strong, var(--text-secondary));
  border-radius: 20px;
}
.assistant-scroll-controls {
  position: absolute;
  right: 12px;
  bottom: 14px;
  z-index: 2;
  display: grid;
  gap: 6px;
}
.assistant-scroll-controls button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  font-size: 17px;
  cursor: pointer;
}
.ai-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: end;
  gap: 9px;
  position: sticky;
  bottom: 0;
  z-index: 4;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
}
.ai-composer textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  max-height: 122px;
  resize: none;
  overflow-y: hidden;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text-primary);
  font: inherit;
  line-height: 1.5;
  overscroll-behavior: contain;
}
.ai-composer textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--brand-primary) 35%, transparent);
  outline-offset: 1px;
}
.ai-composer > .primary-button {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 14px;
}
.ai-composer .composer-hint {
  grid-column: 1/-1;
  margin: 0 3px;
  font-size: 10px;
  color: var(--text-secondary);
}
.assistant-thinking {
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text-primary);
}
.assistant-thinking > span:last-child {
  display: grid;
  gap: 3px;
}
.assistant-thinking strong {
  font-size: 11px;
}
.assistant-thinking small {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.thinking-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.thinking-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-primary);
  animation: wellcomeThinking 1.1s infinite ease-in-out;
}
.thinking-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.thinking-dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes wellcomeThinking {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-4px);
  }
}
.assistant-disclaimer {
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.6;
}
@media (max-width: 760px) {
  .assistant-messages {
    height: min(54dvh, 560px);
    min-height: 220px;
    max-height: none;
    margin: 12px 0;
    touch-action: pan-y;
  }
  .assistant-history {
    max-height: 150px;
  }
  .assistant-scroll-controls {
    right: 8px;
    bottom: 12px;
  }
  .assistant-scroll-controls button {
    width: 32px;
    height: 32px;
  }
  .ai-composer {
    position: sticky;
    bottom: 0;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 7px;
    padding: 9px 0 calc(10px + env(safe-area-inset-bottom));
  }
  .ai-composer textarea {
    min-height: 46px;
    max-height: 122px;
    font-size: 16px;
  }
  .ai-composer > .primary-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }
}
@media (max-width: 380px) {
  .assistant-history-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
  .assistant-thinking {
    padding: 10px;
  }
  .assistant-thinking small {
    max-width: 230px;
  }
}
.auth-code-button {
  display: block;
  width: 100%;
  margin: 10px auto 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
}
.auth-code-button:hover {
  background: var(--brand-accent-soft);
}
.auth-code-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* WELLCOME auth and mobile AI refinements */
.password-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 7px;
}
.password-control input {
  min-width: 0;
  padding-right: 12px;
}
.password-toggle {
  position: static;
  transform: none;
  align-self: stretch;
  height: auto;
  min-width: 58px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--brand-primary);
}
.assistant-history-dropdown {
  margin: 0 0 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--bg);
  overflow: visible;
}
.assistant-history-dropdown > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-primary);
}
.assistant-history-dropdown > summary::-webkit-details-marker {
  display: none;
}
.assistant-history-dropdown > summary:after {
  content: "⌄";
  font-size: 16px;
  color: var(--brand-primary);
}
.assistant-history-dropdown[open] > summary:after {
  content: "⌃";
}
.assistant-history-dropdown > summary small {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
}
.assistant-history-dropdown .assistant-history {
  max-height: 220px;
  margin: 0;
  padding: 8px;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 13px 13px;
}
.assistant-history-item {
  padding: 5px 7px;
}
.assistant-history-open {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.assistant-history-rename {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
}
.assistant-swipe-hint {
  position: absolute;
  z-index: 2;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 9px 5px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text-secondary);
  pointer-events: none;
  opacity: 0.82;
}
.assistant-swipe-hint span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.assistant-swipe-hint b {
  font-size: 15px;
  line-height: 1;
}
@media (max-width: 760px) {
  .assistant-swipe-hint {
    right: 4px;
  }
  .assistant-messages {
    padding-right: 30px;
    touch-action: pan-y pinch-zoom;
  }
}

/* Desktop navigation scrolls independently from the workspace content. */
.sidebar {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
.sidebar .navigation {
  flex: 1 0 auto;
  min-height: 0;
}
.sidebar .sidebar-bottom {
  flex: 0 0 auto;
}
.sidebar::-webkit-scrollbar {
  width: 7px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-strong, var(--text-secondary));
  border-radius: 20px;
}
.auth-business-dialog {
  width: min(460px, calc(100% - 28px));
}
.choice-option {
  display: flex !important;
  grid-template-columns: auto 1fr !important;
  align-items: center;
  gap: 10px !important;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 12px !important;
  color: var(--text-primary) !important;
}
.choice-option input {
  width: 17px;
  min-height: 17px;
}
@media (max-width: 760px) {
  .assistant-swipe-hint {
    position: fixed;
    right: max(4px, env(safe-area-inset-right));
    top: 56dvh;
    z-index: 35;
    transform: translateY(-50%);
  }
}

/* v6: AI chat dates/times and delete, welcome intro */
.assistant-history-delete {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--danger);
  cursor: pointer;
  font-size: 13px;
}
.assistant-history-delete:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: var(--danger);
}
.assistant-history-open small {
  white-space: nowrap;
  flex: 0 0 auto;
}
.chat-message-time {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}
.chat-day-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 8px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.chat-day-divider:before,
.chat-day-divider:after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.welcome-intro {
  max-width: min(460px, calc(100vw - 28px));
  width: 100%;
}
.welcome-intro-card {
  text-align: center;
  padding: 8px 4px 4px;
}
.welcome-intro-icon {
  width: 60px;
  height: 60px;
  margin: 6px auto 14px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--brand-primary);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
}
.welcome-intro-body {
  margin: 8px 0 18px;
  line-height: 1.6;
  color: var(--text-secondary);
  font-size: 14px;
}
.welcome-intro-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-bottom: 18px;
}
.welcome-intro-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.welcome-intro-dots i.on {
  width: 22px;
  border-radius: 8px;
  background: var(--brand-primary);
}
.welcome-intro .dialog-actions {
  justify-content: space-between;
}

/* ===== Interaction polish (v0.32) ===== */
.nav-signout {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
}
.nav-signout:hover {
  background: rgb(220 38 38 / 10%);
  color: var(--danger);
}
.primary-button,
.outline-button,
.secondary-button,
.small-button,
.text-button,
.nav-link,
.close-button,
.evidence-overflow-options button {
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}
.primary-button:hover,
.outline-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.primary-button:active,
.outline-button:active,
.secondary-button:active,
.small-button:active,
.nav-link:active {
  transform: scale(0.97);
  box-shadow: none;
}
.primary-button:disabled,
.outline-button:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}
.nav-link:hover {
  transform: translateX(3px);
}
.metric-card,
.panel {
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}
.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-accent);
}
tbody tr {
  transition: background 0.15s ease;
}
tbody tr:hover {
  background: var(--brand-accent-soft);
}
.avatar[role="button"] {
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease;
}
.avatar[role="button"]:hover {
  transform: scale(1.08);
  box-shadow: 0 0 0 3px var(--brand-accent-soft);
}
:where(button, a, summary, [role="button"], input, select):focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}
.dashboard > * {
  animation: viewIn 0.28s ease both;
}
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
dialog.app-dialog[open] {
  animation: dialogIn 0.22s ease both;
}
dialog.app-dialog[open]::backdrop {
  animation: fadeIn 0.22s ease both;
}
@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.toast {
  border-left: 4px solid var(--brand-accent);
}
.busy-chip {
  position: fixed;
  left: 50%;
  bottom: 78px;
  transform: translate(-50%, 12px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--brand-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  z-index: 60;
  max-width: calc(100% - 30px);
}
.busy-chip.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.busy-spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgb(255 255 255 / 35%);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
  flex: 0 0 15px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.signout-dialog {
  width: min(400px, calc(100% - 28px));
}
.signout-form {
  text-align: center;
  justify-items: center;
}
.signout-form h2 {
  font-family: var(--font-heading);
  font-size: 20px;
}
.signout-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgb(220 38 38 / 12%);
  color: var(--danger);
  font-size: 24px;
}
.signout-actions {
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}
.signout-actions > * {
  flex: 1 1 140px;
}
.danger-solid {
  background: var(--danger) !important;
  color: #fff;
}
.danger-solid:hover {
  filter: brightness(0.92);
}
.ready-actions {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}
.ready-actions > * {
  width: 100%;
  text-decoration: none;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.guide-card {
  display: grid;
  gap: 5px;
  text-align: left;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  transition:
    transform 0.15s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.guide-card strong {
  font-size: 12px;
}
.guide-card small {
  font-size: 10px;
  color: var(--text-secondary);
}
.guide-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-accent);
  box-shadow: var(--shadow-sm);
}

/* Keep the top bar (and its ☰ menu button) pinned while scrolling.
   overflow-x:hidden on html+body stops position:sticky from working, so clip is used instead. */
@supports not (overflow-x: clip) {
  html {
    overflow-x: hidden;
  }
  body {
    overflow-x: visible;
  }
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 18;
  background: var(--surface);
}
@media (max-width: 760px) {
  .topbar {
    box-shadow: 0 2px 10px rgb(15 23 42 / 8%);
  }
}

/* Gentle staggered entrance for dashboard cards and list rows */
.metrics-grid > .metric-card,
.content-grid > * {
  animation: viewIn 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.metrics-grid > :nth-child(2),
.content-grid > :nth-child(2) {
  animation-delay: 0.06s;
}
.metrics-grid > :nth-child(3) {
  animation-delay: 0.12s;
}
.metrics-grid > :nth-child(4) {
  animation-delay: 0.18s;
}
.activity-item {
  animation: viewIn 0.3s ease both;
}
.activity-item:nth-child(2) {
  animation-delay: 0.04s;
}
.activity-item:nth-child(3) {
  animation-delay: 0.08s;
}
.activity-item:nth-child(4) {
  animation-delay: 0.12s;
}
.activity-item:nth-child(5) {
  animation-delay: 0.16s;
}
.status {
  transition:
    background 0.25s ease,
    color 0.25s ease;
}
