/*
 * Leny Clinical AI — Stylesheet
 *
 * Sections:
 *   1. Variables & Reset
 *   2. App Shell / Layout
 *   3. Sidebar (header, chat list, rail, search, menu)
 *   4. Chat Area / Home Screen
 *   5. Message Rendering (bubbles, feedback, corrections, citations)
 *   6. Intelligence Panel (blocks, checklist, differential, workup)
 *   7. UI Components (action sheet, correction sheet, profile sheet, modals, buttons)
 *   8. Notes / Workspace
 *   9. Auth Screens (login, signup)
 *  10. Admin Panel
 *  11. Animations / Transitions
 *  12. Media Queries / Responsive
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent
}

:root {
  --bg: #F0EDE8;
  --srf: #FFFFFF;
  --srf2: #F7F4F0;
  --or: #C07040;
  --or-l: rgba(192, 112, 64, .1);
  --or-m: rgba(192, 112, 64, .2);
  --red: #C0392B;
  --red-l: rgba(192, 57, 43, .08);
  --amb: #9A7400;
  --grn: #2A7A4B;
  --grn-l: rgba(42, 122, 75, .1);
  --blu: #2563EB;
  --t1: #1C1917;
  --t2: #44403C;
  --t3: #78716C;
  --t4: #A8A29E;
  --bd: #E4DED6;
  --shadow-xs: 0 1px 2px rgba(28, 25, 23, .04);
  --shadow-sm: 0 2px 8px rgba(28, 25, 23, .06);
  --shadow: 0 4px 20px rgba(28, 25, 23, .08), 0 1px 3px rgba(28, 25, 23, .04);
  --shadow-lg: 0 8px 40px rgba(28, 25, 23, .12), 0 2px 8px rgba(28, 25, 23, .06);
  --r: 14px;
  --r-sm: 10px;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sw: 280px;
  --iw: 360px;
  --cw: 780px;
  /* z-index scale */
  --z-dropdown: 50;
  --z-sheet: 60;
  --z-modal-backdrop: 70;
  --z-modal: 80;
  --z-action-menu: 100;
  --z-toast: 200;
  --z-overlay: 300;
  --z-auth: 9999;
  --ease: cubic-bezier(.32, .72, 0, 1)
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--t1);
  height: 100%;
  height: -webkit-fill-available;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'kern' 1
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
  font-weight: 500;
  transition: all .15s
}

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

::-webkit-scrollbar {
  width: 4px
}

::-webkit-scrollbar-track {
  background: transparent
}

::-webkit-scrollbar-thumb {
  background: var(--bd);
  border-radius: 4px
}

/* ═══ APP SHELL ═══ */
.app {
  height: 100vh;
  height: 100dvh;
  height: -webkit-fill-available;
  min-height: 100%;
  position: relative;
  overflow: hidden;
  background: var(--srf)
}

@media(max-width:1023px) {
  .app {
    margin: 0 auto
  }

  .screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column
  }

  #chatArea {
    z-index: 1;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    height: 100%
  }

  #sidebar {
    z-index: 10;
    background: var(--srf);
    transform: translateX(-100%);
    transition: transform .28s var(--ease);
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column
  }

  #sidebar.mob-open {
    transform: translateX(0);
    pointer-events: auto
  }

  #homeScreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden
  }

  .home-inner {
    width: 100%;
    padding: 24px 4px 32px;
    overflow: visible
  }

  .sb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .25);
    z-index: 9
  }

  .sb-overlay.show {
    display: block
  }

  #intelPanel {
    z-index: 5;
    display: none;
    background: var(--srf);
    position: absolute;
    inset: 0
  }

  #intelPanel.mob-show {
    display: flex;
    flex-direction: column
  }

  #workspace {
    z-index: 3;
    display: none;
    background: var(--srf);
    position: absolute;
    inset: 0
  }

  #workspace.show {
    display: flex;
    flex-direction: column
  }

  .sb-toggle,
  .sb-rail,
  .dsk {
    display: none !important
  }
}

@media(min-width:1024px) {
  .app {
    display: flex
  }

  #sidebar {
    width: var(--sw);
    flex-shrink: 0;
    border-right: 1px solid var(--bd);
    display: flex;
    flex-direction: column;
    height: 100dvh;
    background: var(--srf);
    transition: width .2s;
    overflow: hidden
  }

  #sidebar.collapsed {
    width: 54px;
    background: var(--bg);
    border-right-color: transparent
  }

  #sidebar.collapsed~#chatArea .ch-hdr {
    background: var(--bg);
    border-bottom-color: transparent
  }

  #sidebar.collapsed .sb-full {
    display: none
  }

  #sidebar.collapsed .sb-rail {
    display: flex
  }

  #sidebar:not(.collapsed) .sb-rail {
    display: none
  }

  #chatArea {
    flex: 1;
    display: flex !important;
    flex-direction: column;
    height: 100dvh;
    min-width: 0;
    background: var(--bg);
    transition: flex .3s var(--ease)
  }

  #intelPanel {
    width: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    transition: width .3s var(--ease);
    border-left: 2px solid var(--bd);
    background: var(--srf2)
  }

  #intelPanel.show {
    width: var(--iw)
  }

  #workspace {
    flex: 0;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    transition: flex .3s var(--ease);
    border-left: 1px solid var(--bd);
    background: var(--srf);
    min-width: 0
  }

  #workspace.show {
    flex: 1
  }

  .mob {
    display: none !important
  }
}

/* ═══ SIDEBAR ═══ */
.sb-full {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative
}

.sb-hdr {
  padding: 0 6px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: var(--st);
  background: var(--srf)
}

.sb-hdr-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  height: 56px
}

.sb-logo {
  display: flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
  flex: 1
}

.sb-logo-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--or);
  letter-spacing: -.04em
}

.sb-logo-name span {
  color: var(--t1)
}

.sb-btns {
  display: flex;
  gap: 0;
  align-items: center
}

/* Search state */
.sb-hdr-search {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  height: 56px
}

.sb-hdr-search .sb-search {
  flex: 1;
  margin: 0
}

.sb-hdr.searching .sb-hdr-top {
  display: none
}

.sb-hdr.searching .sb-hdr-search {
  display: flex
}

.sb-cancel {
  background: none;
  border: none;
  color: var(--or);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 4px;
  white-space: nowrap;
  font-family: inherit
}

.sb-cancel:hover {
  opacity: .8
}

.sb-ibtn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t2);
  transition: background .12s
}

.sb-ibtn:hover {
  background: var(--srf2)
}

.sb-ibtn:active {
  background: var(--bd)
}

.sb-ibtn svg {
  width: 20px;
  height: 20px
}

.sb-over {
  position: relative
}

.sb-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 190px;
  background: var(--srf);
  border: 1px solid var(--bd);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  z-index: 50;
  padding: 4px;
  display: none
}

.sb-menu.show {
  display: block
}

.sb-mi {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--t1);
  width: 100%
}

.sb-mi:hover {
  background: var(--srf2)
}

.sb-mi svg {
  width: 14px;
  height: 14px;
  color: var(--t3);
  flex-shrink: 0
}

.sb-search {
  flex: 1;
  position: relative
}

.sb-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: var(--srf2);
  border: none;
  border-radius: 22px;
  font-size: 15px;
  color: var(--t1);
  outline: none;
  transition: background .15s;
  font-family: inherit;
  box-sizing: border-box
}

.sb-search input:focus {
  background: var(--bg)
}

.sb-search input::placeholder {
  color: var(--t4)
}

.sb-search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  pointer-events: none;
  color: var(--t4)
}

/* filter pills removed */
.sb-chats {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 12px
}

/* Patient list items */
.ci {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .12s;
  margin-bottom: 1px;
  position: relative;
  appearance: none;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit
}
.ci:focus-visible {
  outline: 2px solid var(--or);
  outline-offset: -2px;
  border-radius: var(--r-sm)
}

.ci:hover {
  background: var(--srf2)
}

.ci.act {
  background: var(--or-l)
}

.ci-av {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
  position: relative
}

.ci-av.emoji {
  font-size: 20px;
  background: var(--srf2) !important
}

.ci-status {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--srf)
}

.ci-status.red {
  background: var(--red)
}
.ci-status.red::after { content: '!'; font-size: 7px; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; height: 100% }

.ci-status.amb {
  background: var(--amb)
}
.ci-status.amb::after { content: '~'; font-size: 8px; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; height: 100% }

.ci-status.grn {
  background: var(--grn)
}
.ci-status.grn::after { content: '\2713'; font-size: 6px; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; height: 100% }

.ci-body {
  flex: 1;
  min-width: 0
}

.ci-row1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px
}

.ci-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.ci-time {
  font-size: 12.5px;
  color: var(--t4);
  flex-shrink: 0
}

.ci-row2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  margin-top: 3px
}

.ci-sub {
  font-size: 14px;
  color: var(--t3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1
}


.ci-badge {
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0
}

.ci-badge.red {
  background: var(--red)
}

.ci-badge.amb {
  background: var(--amb)
}

.ci-badge.grn {
  background: var(--grn)
}

.ci-badge.grey {
  background: var(--t4)
}

.sb-section-lbl {
  padding: 6px 14px 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--t4)
}

.sb-divider {
  height: 1px;
  background: var(--bd);
  margin: 4px 12px
}

/* Sidebar rail — clean minimal */
.sb-rail {
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  padding-top: calc(12px + var(--st));
  height: 100%;
  gap: 0
}

.sb-rail-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-bottom: 8px
}

.sb-rail-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s;
  color: var(--t3);
  flex-shrink: 0;
  position: relative
}

.sb-rail-btn:hover {
  background: var(--srf2);
  color: var(--t1)
}

.sb-rail-btn svg {
  width: 18px;
  height: 18px
}

.sb-rail-btn.logo {
  color: var(--or)
}

.sb-rail-btn.logo svg {
  width: 22px;
  height: 22px
}

.sb-rail-sep {
  width: 24px;
  height: 1px;
  background: var(--bd);
  margin: 4px 0;
  flex-shrink: 0
}

.sb-rail-patients {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  scrollbar-width: none;
  -ms-overflow-style: none
}

.sb-rail-patients::-webkit-scrollbar {
  display: none
}

.sb-rail-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
  color: #fff;
  position: relative;
  opacity: .7
}

.sb-rail-av:hover {
  opacity: 1;
  transform: scale(1.08)
}

.sb-rail-av.act {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--srf), 0 0 0 3.5px var(--or)
}

.sb-rail-av[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--t1);
  color: #fff;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 999;
  pointer-events: none;
  box-shadow: var(--shadow-sm)
}

.sb-rail-av[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-right-color: var(--t1);
  z-index: 999;
  pointer-events: none
}

.sb-rail-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--bd);
  margin: 0 8px;
  padding-bottom: calc(12px + var(--sb))
}

.sb-rail-btn.expand svg {
  width: 14px;
  height: 14px
}

.sb-rail-profile {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--or);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  margin-top: 4px;
  flex-shrink: 0
}

.sb-rail-profile:hover {
  opacity: .85;
  transform: scale(1.05)
}

/* ═══ CHAT AREA ═══ */
/* Subtle dot pattern wallpaper */
#chatArea {
  position: relative
}

#chatArea::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='1.2' fill='%231C1917'/%3E%3C/svg%3E");
  z-index: 0
}

/* Home screen */
.home {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 32px;
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  justify-content: center;
  position: relative;
  z-index: 1
}

.home-menu {
  position: absolute;
  top: calc(12px + var(--st));
  left: 12px;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3);
  z-index: 5
}

.home-menu:hover {
  background: var(--srf2);
  color: var(--t1)
}

.home-inner {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible
}

.home-greet {
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -.03em;
  text-align: center;
  color: var(--t1);
  margin-bottom: 36px;
  min-height: 1.3em
}

/* ── Home input: two-zone card ── */
.home-input-wrap {
  width: 100%;
  background: var(--srf);
  border: 1.5px solid var(--bd);
  border-radius: 22px;
  box-shadow: var(--shadow-xs);
  transition: border-color .2s, box-shadow .2s;
  display: flex;
  flex-direction: column
}

.home-input-wrap:focus-within {
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--or-l), var(--shadow-xs)
}

.home-field {
  width: 100%;
  padding: 18px 20px 12px;
  background: transparent;
  border: none;
  border-radius: 22px 22px 0 0;
  font-size: 16px;
  color: var(--t1);
  outline: none;
  resize: none;
  min-height: 84px;
  max-height: 160px;
  line-height: 1.5;
  font-family: inherit
}

.home-field::placeholder {
  color: var(--t4)
}

.home-toolbar {
  display: flex;
  align-items: center;
  padding: 8px 12px 10px;
  gap: 4px;
}

.home-left {}

.home-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto
}

.ha-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3)
}

.ha-btn:hover {
  background: var(--srf2);
  color: var(--t1)
}

.ha-btn svg {
  width: 19px;
  height: 19px
}

.ha-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s
}

.ha-send.off {
  color: var(--t3);
  background: none;
  pointer-events: auto;
  opacity: .5
}

.ha-send.on {
  background: var(--or);
  color: #fff
}

.ha-send.on:hover {
  filter: brightness(.9)
}

.ha-send svg {
  width: 16px;
  height: 16px
}


.sug-cat {
  background: var(--srf);
  border: 1.5px solid var(--bd);
  border-radius: 20px;
  overflow: visible;
  transition: all .15s;
  cursor: pointer;
  position: relative
}

.sug-cat:hover {
  border-color: var(--or-m)
}

.sug-cat-hdr {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  user-select: none;
  white-space: nowrap
}

.sug-cat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--t2)
}

.sug-cat-arrow {
  width: 12px;
  height: 12px;
  color: var(--t3);
  transition: transform .2s;
  flex-shrink: 0
}

.sug-cat.open .sug-cat-arrow {
  transform: rotate(180deg)
}

.sug-cat.open {
  border-color: var(--or);
  background: var(--or-l)
}

.sug-cat-body {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 210px;
  background: var(--srf);
  border: 1.5px solid var(--bd);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  z-index: 20;
  display: none
}

.sug-cat.open .sug-cat-body {
  display: block
}

.sug-item {
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--t2);
  transition: all .12s;
  white-space: nowrap
}

.sug-item+.sug-item {
  border-top: 1px solid rgba(228, 222, 214, .5)
}

.sug-item:first-child {
  border-radius: var(--r) var(--r) 0 0
}

.sug-item:last-child {
  border-radius: 0 0 var(--r) var(--r)
}

.sug-item:only-child {
  border-radius: var(--r)
}

.sug-item:hover {
  background: var(--or-l);
  color: var(--or)
}

/* ═══ CHAT VIEW ═══ */
.ch-hdr {
  padding: 6px 14px;
  padding-top: calc(6px + var(--st));
  background: var(--srf);
  border-bottom: 1px solid var(--bd);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  z-index: 2;
  position: relative;
  min-height: 0
}

.ch-back {
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--or);
  padding: 0 4px 0 0;
  font-weight: 500
}

.ch-back:hover {
  background: var(--srf2)
}

@media(min-width:1024px) {
  .ch-back {
    display: none
  }
}

.ch-av-wrap {
  display: none
}

.ch-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px
}

.ch-info h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--t2);
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.ch-info p {
  display: none
}

.ch-btns {
  display: flex;
  gap: 2px;
  flex-shrink: 0
}

.ch-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3);
  position: relative
}

.ch-btn:hover {
  background: var(--srf2);
  color: var(--t1)
}

.ch-btn-share {
  width: auto;
  min-width: fit-content;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg);
  color: var(--t2);
  border-radius: 8px;
  flex-shrink: 0
}

.ch-btn-share:hover {
  background: var(--or-l) !important;
  color: var(--or) !important
}

.ch-btn svg {
  width: 14px;
  height: 14px
}

.ch-new-conv {
  height: 28px;
  padding: 0 10px 0 6px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--or);
  background: color-mix(in srgb, var(--or) 10%, transparent);
  transition: background .15s
}

.ch-new-conv:hover {
  background: color-mix(in srgb, var(--or) 20%, transparent)
}

.ch-new-conv svg {
  width: 14px;
  height: 14px
}

.ch-btn .notif-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--red);
  border: 1.5px solid var(--bg)
}

/* Messages */
.mo {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  position: relative;
  z-index: 1
}

.mo::before {
  content: '';
  position: sticky;
  top: 0;
  display: block;
  height: 16px;
  background: linear-gradient(var(--bg), transparent);
  z-index: 1;
  pointer-events: none;
  margin-bottom: -16px
}

.msgs {
  max-width: var(--cw);
  margin: 0 auto;
  padding: 24px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px
}

/* System / date msg */
.mr.s {
  align-self: center;
  max-width: 100%;
  justify-content: center
}

.mr.s .mb {
  background: rgba(255, 255, 255, .75);
  backdrop-filter: blur(4px);
  color: var(--t3);
  font-size: 11.5px;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 500
}

/* AI message — bubble with tail */
.mr.ai {
  display: flex;
  gap: 0;
  width: 100%;
  align-self: flex-start;
  margin-top: 2px
}

.mr.ai.gap,
.mr.u.gap {
  margin-top: 16px
}

.ai-avt {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--or);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  margin-top: 3px
}

.ai-body {
  width: 100%;
  max-width: 100%;
  min-width: 0
}

.mr.ai .mb {
  background: var(--srf);
  color: var(--t1);
  border: 1px solid var(--bd);
  padding: 14px 18px;
  border-radius: 20px;
  border-bottom-left-radius: 4px;
  font-size: 15px;
  line-height: 1.6;
  position: relative;
  word-break: break-word
}

.mr.ai .mb b,
.mr.ai .mb strong {
  font-weight: 600
}

.mr.ai .mb h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 16px 0 8px;
  line-height: 1.3
}

.mr.ai .mb h2:first-child {
  margin-top: 0
}

.mr.ai .mb h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 14px 0 6px;
  line-height: 1.3
}

.mr.ai .mb h3:first-child {
  margin-top: 0
}

.mr.ai .mb h4 {
  font-size: 14.5px;
  font-weight: 600;
  margin: 12px 0 4px;
  line-height: 1.3
}

.mr.ai .mb h4:first-child {
  margin-top: 0
}

.mr.ai .mb p {
  margin: 6px 0
}

.mr.ai .mb p:first-child {
  margin-top: 0
}

.mr.ai .mb p:last-child {
  margin-bottom: 0
}

.mr.ai .mb ul,
.mr.ai .mb ol {
  margin: 6px 0;
  padding-left: 22px
}

.mr.ai .mb li {
  margin: 3px 0;
  line-height: 1.5
}

.mr.ai .mb li::marker {
  color: var(--t3)
}

.mr.ai .mb code {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  background: var(--srf2);
  border: 1px solid var(--bd);
  padding: 1px 5px;
  border-radius: 4px
}

.mr.ai .mb pre {
  margin: 8px 0;
  background: var(--srf2);
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 10px 14px;
  overflow-x: auto
}

.mr.ai .mb pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5
}

.mr.ai .mb a {
  color: var(--or);
  text-decoration: none;
  border-bottom: 1px solid var(--or-m)
}

.mr.ai .mb a:hover {
  border-bottom-color: var(--or)
}

.mr.ai .mb em {
  font-style: italic;
  color: var(--t2)
}

.mr.ai .mb hr {
  border: none;
  border-top: 1px solid var(--bd);
  margin: 10px 0
}

.mr.ai .mb blockquote {
  margin: 8px 0;
  padding: 6px 14px;
  border-left: 3px solid var(--or);
  background: var(--srf2);
  border-radius: 0 6px 6px 0;
  color: var(--t2)
}

.mr.ai .mb blockquote p {
  margin: 4px 0
}

.mr.ai .mb del {
  color: var(--t3);
  text-decoration: line-through
}

.mr.ai .mb ul.contains-task-list {
  list-style: none;
  padding-left: 4px
}

.mr.ai .mb .task-list-item {
  display: flex;
  align-items: baseline;
  gap: 6px
}

.mr.ai .mb .task-list-item input[type="checkbox"] {
  accent-color: var(--or);
  margin: 0;
  flex-shrink: 0
}

.mr.ai .mb table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 13.5px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--bd)
}

.mr.ai .mb th {
  background: var(--srf2);
  font-weight: 600;
  text-align: left;
  padding: 7px 12px;
  border-bottom: 2px solid var(--bd);
  color: var(--t1);
  font-size: 12.5px
}

.mr.ai .mb td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--bd);
  color: var(--t2)
}

.mr.ai .mb tr:last-child td {
  border-bottom: none
}

@keyframes blink {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0
  }
}

.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 14px;
  background: var(--or);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink .6s step-end infinite
}

.stream-wait {
  display: inline-flex;
  align-items: baseline;
  color: var(--t3);
  font-size: 13.5px;
  font-weight: 500;
  animation: swPulse 1.8s ease-in-out infinite
}

.sw-dots span {
  animation: swDot 1.4s steps(1) infinite;
  opacity: 0
}

.sw-dots span:nth-child(1) { animation-delay: 0s }
.sw-dots span:nth-child(2) { animation-delay: .3s }
.sw-dots span:nth-child(3) { animation-delay: .6s }

@keyframes swPulse {
  0%, 100% { opacity: .4 }
  50% { opacity: 1 }
}

@keyframes swDot {
  0% { opacity: 0 }
  25% { opacity: 1 }
  100% { opacity: 1 }
}

/* Bubble tail */
.mr.ai .mb::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -6px;
  width: 12px;
  height: 12px;
  background: var(--srf);
  clip-path: polygon(100% 0, 100% 100%, 0 100%)
}

/* User message */
.mr.u {
  display: flex;
  gap: 6px;
  max-width: 72%;
  align-self: flex-end;
  flex-direction: row-reverse;
  margin-top: 2px
}

.mr.u .mb {
  background: var(--or-l);
  color: var(--t1);
  border: 1.5px solid var(--or-m);
  padding: 12px 18px;
  border-radius: 20px;
  border-bottom-right-radius: 4px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  font-weight: 500
}

.mr.u .mb::before {
  display: none
}

/* Feedback bar on AI messages */
.fb-bar {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 8px 0 4px;
  animation: fadeIn .15s ease
}

.fb-icn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  color: var(--t3);
  cursor: pointer;
  transition: color .15s;
  background: none;
  border: none
}

.fb-lbl {
  display: none
}

.fb-icn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.5
}

.fb-icn:hover {
  color: var(--t1)
}

.fb-icn:active {
  opacity: .6
}

.fb-icn.fb-up.active {
  color: var(--grn)
}

.fb-icn.correct:hover {
  color: var(--or)
}

.fb-bar.voted .fb-icn.fb-up:not(.active) {
  opacity: .25;
  pointer-events: none
}

.fb-bar.voted .fb-btn:not(.active, .fb-up, .fb-dn, .fb-correct-btn) {
  opacity: .35;
  pointer-events: none
}

.fb-div {
  width: 1px;
  height: 14px;
  background: var(--bd);
  margin: 0 2px;
  align-self: center;
  flex-shrink: 0
}

.fb-btn.fb-up.active {
  color: var(--grn)
}

.fb-btn.fb-dn.active {
  color: var(--red)
}

.fb-bar.voted .fb-btn.active {
  color: var(--grn);
  font-weight: 600
}

.fb-bar.show {
  display: flex
}

.msg-ts-bar {
  font-size: 11px;
  color: var(--t3);
  margin-left: auto;
  align-self: center;
  padding-left: 4px;
  font-family: inherit
}

.error-msg {
  background: rgba(192,57,43,.08);
  border: 1px solid rgba(192,57,43,.2);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  color: var(--red);
  font-size: 13px
}

.msg-sent-ck {
  font-size: 10px;
  color: var(--t4);
  text-align: right;
  padding: 2px 2px 0;
  margin-top: -2px
}

.fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  border: 1.5px solid var(--bd);
  background: var(--srf2);
  color: var(--t2);
  cursor: pointer;
  white-space: nowrap;
  transition: all .12s
}

.fb-btn:hover {
  background: var(--srf);
  border-color: var(--or-m);
  color: var(--t1)
}

.fb-btn:active {
  transform: scale(.93)
}

.fb-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0
}

.fb-btn:hover {
  border-color: var(--or);
  color: var(--or);
  background: var(--or-l)
}

.fb-btn.active {
  border-color: var(--or);
  color: var(--or);
  background: var(--or-l)
}

.fb-btn.flag:hover,
.fb-btn.flag.active {
  border-color: var(--amb);
  color: var(--amb);
  background: rgba(154, 116, 0, .1)
}

.fb-btn.correct:hover,
.fb-btn.correct.active {
  border-color: var(--blu);
  color: var(--blu);
  background: rgba(37, 99, 235, .08)
}

.fb-btn svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0
}

/* Citations — inline superscript + reference footer */
.cite {
  font-size: 10px;
  font-weight: 700;
  color: var(--blu);
  cursor: pointer;
  vertical-align: super;
  line-height: 0;
  padding: 0 1px;
  border-radius: 3px;
  transition: background .12s
}

.cite:hover {
  background: rgba(37, 99, 235, .1)
}

.ref-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--bd)
}

.ref-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--t3);
  cursor: pointer;
  transition: color .12s;
  background: none;
  border: none;
  padding: 2px 0;
  font-family: inherit;
  width: 100%;
  text-align: left
}

.ref-toggle:hover {
  color: var(--t1)
}

.ref-toggle svg {
  width: 10px;
  height: 10px;
  transition: transform .15s;
  flex-shrink: 0
}

.ref-toggle.open svg {
  transform: rotate(90deg)
}

.ref-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height .2s ease
}

.ref-toggle.open+.ref-list {
  max-height: 500px
}

.ref-item {
  display: flex;
  gap: 6px;
  padding: 4px 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--t2)
}

.ref-num {
  font-weight: 700;
  color: var(--blu);
  flex-shrink: 0;
  min-width: 14px
}

.ref-text {
  flex: 1
}

.ref-text .ref-src {
  font-weight: 600
}

.ref-text .ref-yr {
  color: var(--t3)
}

.ref-text .ref-detail {
  color: var(--t3);
  font-style: italic
}

/* Confidence badge */
.conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  margin-top: 5px;
  margin-bottom: 2px
}

.conf-badge.high {
  background: var(--grn-l);
  color: var(--grn)
}

.conf-badge.med {
  background: rgba(154, 116, 0, .1);
  color: var(--amb)
}

.conf-badge.low {
  background: var(--red-l);
  color: var(--red)
}

/* Inline correction — appears below the message */
.corr-select-hint {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--or);
  margin-bottom: 8px;
  letter-spacing: .01em
}

.corr-sentences {
  line-height: 1.65;
  font-size: 14.5px
}

.corr-sent {
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 2px;
  transition: all .12s;
  -webkit-user-select: none;
  user-select: none
}

.corr-sent:hover {
  background: rgba(192, 112, 64, .08)
}

.corr-sent.sel {
  background: rgba(192, 57, 43, .12);
  color: var(--red);
  text-decoration: underline;
  text-decoration-color: rgba(192, 57, 43, .3);
  text-underline-offset: 2px
}

.corr-cards-note {
  font-size: 11px;
  color: var(--t4);
  margin-top: 8px;
  font-style: italic
}

.corr-cancel-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px
}

.mb.corr-mode {
  border-color: var(--or-m);
  background: var(--srf)
}

.corr-selected-text {
  font-size: 12px;
  color: var(--red);
  font-style: italic;
  padding: 6px 10px;
  background: var(--red-l);
  border-radius: 8px;
  margin-bottom: 8px;
  line-height: 1.4;
  border-left: 3px solid var(--red)
}

.inline-corr {
  margin: 6px 0 8px;
  background: var(--srf);
  border: 1.5px solid var(--bd);
  border-radius: 14px;
  padding: 10px 12px;
  animation: fadeIn .15s ease;
  max-width: 90%
}

.inline-corr-cats {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px
}

.inline-corr-cat {
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1.5px solid var(--bd);
  background: var(--srf);
  color: var(--t2);
  cursor: pointer;
  transition: all .12s;
  white-space: nowrap
}

.inline-corr-cat:hover {
  border-color: var(--or-m);
  color: var(--or)
}

.inline-corr-cat.sel {
  border-color: var(--or);
  background: var(--or-l);
  color: var(--or)
}

.inline-corr-input {
  width: 100%;
  border: 1.5px solid var(--bd);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  background: var(--srf2);
  color: var(--t1);
  transition: border-color .15s;
  line-height: 1.4
}

.inline-corr-input:focus {
  border-color: var(--or);
  background: var(--srf)
}

.inline-corr-input::placeholder {
  color: var(--t4)
}

.inline-corr-foot {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px
}

.inline-corr-btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
  font-family: inherit
}

.inline-corr-btn.cancel {
  background: none;
  color: var(--t3);
  border: none
}

.inline-corr-btn.cancel:hover {
  color: var(--t1)
}

.inline-corr-btn.submit {
  background: var(--or);
  color: #fff;
  border: none
}

.inline-corr-btn.submit:hover {
  filter: brightness(.92)
}

.inline-corr-btn.submit:active {
  transform: scale(.96)
}

.inline-corr-done {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--grn);
  padding: 4px 0;
  animation: fadeIn .2s ease
}

.inline-corr-done svg {
  width: 13px;
  height: 13px
}

.pts-pop {
  position: absolute;
  font-size: 11px;
  font-weight: 700;
  color: var(--or);
  pointer-events: none;
  animation: ptsFly .9s ease-out forwards;
  white-space: nowrap;
  z-index: 50
}

@keyframes ptsFly {
  0% {
    opacity: 1;
    transform: translateY(0)
  }

  100% {
    opacity: 0;
    transform: translateY(-28px)
  }
}

/* Thinking dots */
.thinking {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 2px
}

.td {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--or);
  opacity: .25;
  animation: pulse 1.4s ease-in-out infinite
}

.td:nth-child(2) {
  animation-delay: .2s
}

.td:nth-child(3) {
  animation-delay: .4s
}

@keyframes pulse {

  0%,
  80%,
  100% {
    opacity: .25;
    transform: scale(1)
  }

  40% {
    opacity: .7;
    transform: scale(1.15)
  }
}

/* Action cards */
.act-card {
  border-radius: var(--r-sm);
  overflow: hidden;
  margin-top: 8px;
  background: var(--srf);
  box-shadow: var(--shadow-xs)
}

.act-card-h {
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--t2);
  border-bottom: 1px solid var(--bd)
}

.act-card-h svg {
  width: 13px;
  height: 13px;
  color: var(--t3);
  flex-shrink: 0
}

.act-card-b {
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--t1);
  font-family: 'DM Mono', ui-monospace, monospace;
  white-space: pre-wrap
}

.act-card-f {
  display: flex;
  gap: 6px;
  padding: 9px 12px;
  border-top: 1px solid var(--bd);
  flex-wrap: wrap
}

.abtn {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--bd);
  background: var(--srf);
  white-space: nowrap;
  color: var(--t2);
  display: inline-flex;
  align-items: center;
  gap: 4px
}

.abtn:hover {
  background: var(--srf2);
  color: var(--t1)
}

.abtn:active {
  transform: scale(.97)
}

.abtn.pr {
  background: var(--or);
  color: #fff;
  border: none
}

.abtn.pr:hover {
  filter: brightness(.9)
}

.abtn svg {
  width: 12px;
  height: 12px
}

.wrn-c {
  margin: 6px 0;
  font-size: 13px;
  color: var(--red);
  line-height: 1.45;
  padding: 8px 12px;
  font-weight: 500;
  background: var(--red-l);
  border-radius: 8px;
  border-left: 3px solid var(--red)
}

.wrn-c b {
  font-weight: 600
}

.src {
  font-size: 11.5px;
  color: var(--or);
  padding: 3px 2px;
  margin-top: 4px;
  font-weight: 600
}

/* Follow-up chips */
.fups {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px
}

.fup {
  padding: 9px 15px;
  background: var(--srf);
  border: 1.5px solid var(--bd);
  border-radius: 22px;
  font-size: 13.5px;
  color: var(--t1);
  cursor: pointer;
  white-space: nowrap;
  transition: all .12s;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 400;
  box-shadow: var(--shadow-xs)
}

.fup:hover {
  background: var(--srf2);
  border-color: var(--or-m)
}

.fup:active {
  transform: scale(.96)
}

.fup svg {
  width: 14px;
  height: 14px;
  color: var(--t3);
  flex-shrink: 0
}

.fup.do {
  border-color: var(--or-m);
  color: var(--or)
}

.fup.do:hover {
  background: var(--or-l)
}

.fup.do svg {
  color: var(--or)
}

.pt-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--t3);
  padding: 2px 8px;
  background: var(--srf2);
  border-radius: 6px;
  margin-bottom: 5px
}

.pt-tag .pt-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--grn)
}

.pt-tag.new .pt-dot {
  background: var(--t3)
}

/* Chat input */
/* ── Chat input: two-zone card ── */
.input-area {
  background: var(--bg);
  padding: 0 20px 12px;
  padding-bottom: calc(12px + var(--sb));
  flex-shrink: 0;
  position: relative;
  z-index: 2
}

.input-area::before {
  content: '';
  position: absolute;
  top: -32px;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none
}

.input-inner {
  max-width: var(--cw);
  margin: 0 auto
}

.input-wrap {
  background: var(--srf);
  border: 1.5px solid var(--bd);
  border-radius: 22px;
  box-shadow: var(--shadow-xs);
  transition: border-color .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
  cursor: text
}

.input-wrap:focus-within {
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--or-l), var(--shadow-xs)
}

.input-field {
  width: 100%;
  padding: 10px 16px 2px;
  background: transparent;
  border: none;
  font-size: 15px;
  color: var(--t1);
  outline: none;
  resize: none;
  min-height: 28px;
  max-height: 100px;
  line-height: 1.4;
  font-family: inherit
}

.input-field::placeholder {
  color: var(--t4)
}

.input-toolbar {
  display: flex;
  align-items: center;
  padding: 2px 8px 6px;
  gap: 4px
}

.i-left {
  margin-right: auto
}

.i-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px
}

.i-left {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3);
  flex-shrink: 0
}

.i-left:hover {
  background: var(--srf2);
  color: var(--t1)
}

.i-left svg {
  width: 19px;
  height: 19px
}

.i-right {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  margin-left: auto
}

.i-mic {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3)
}

.i-mic:hover {
  background: var(--srf2);
  color: var(--t1)
}

.i-mic svg {
  width: 19px;
  height: 19px
}

.i-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s
}

.i-send.off {
  color: var(--t3);
  pointer-events: auto;
  opacity: .5
}

.i-send.on {
  background: var(--or);
  color: #fff
}

.i-send.on:hover {
  filter: brightness(.9)
}

.i-send svg {
  width: 16px;
  height: 16px
}

/* ═══ INTELLIGENCE PANEL ═══ */
.pnl-x {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3);
  flex-shrink: 0
}

.pnl-x:hover {
  background: var(--srf2)
}

.pnl-x svg {
  width: 14px;
  height: 14px
}

.ip-hdr {
  padding: 8px 12px;
  padding-top: calc(8px + var(--st));
  background: var(--srf);
  border-bottom: 1px solid var(--bd);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0
}

@media(min-width:1024px) {
  .ip-hdr {
    padding-top: 8px
  }
}

.ip-back {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3)
}

.ip-back:hover {
  background: var(--srf2)
}

@media(min-width:1024px) {
  .ip-back {
    display: none
  }
}

.ip-hdr-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--t2);
  flex: 1
}

.ip-hdr-sub {
  font-size: 11px;
  color: var(--t4);
  font-weight: 400;
  margin-top: 1px
}

.ip-body {
  flex: 1;
  overflow-y: auto;
  padding: 0
}

.ip-disclaim {
  padding: 16px;
  font-size: 10.5px;
  color: var(--t3);
  text-align: center;
  font-style: italic
}

.ip-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center
}

.ip-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--bd)
}

.ip-section-lbl {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--t4);
  margin-bottom: 10px
}

.ip-qa-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px
}

.ip-qa {
  padding: 10px 9px;
  background: var(--srf2);
  border: 1px solid var(--bd);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--t1);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all .15s;
  line-height: 1.35
}

.ip-qa:hover {
  border-color: var(--or-m);
  background: var(--or-l);
  color: var(--or)
}

.ip-ctx-card {
  padding: 10px 12px;
  background: var(--srf2);
  border-radius: 10px;
  font-size: 12px;
  color: var(--t2);
  line-height: 1.5;
  margin-bottom: 6px
}

.ip-ask-Leny {
  padding: 10px 16px;
  background: var(--or-l);
  border-bottom: 1px solid var(--or-m);
  display: flex;
  gap: 8px;
  align-items: center;
  cursor: pointer
}

.ip-ask-Leny:hover {
  background: var(--or-m)
}

.ip-ask-Leny svg {
  width: 14px;
  height: 14px;
  color: var(--or);
  flex-shrink: 0
}

.ip-ask-Leny span {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--or)
}

/* Critical */
.ip-crit {
  padding: 12px 16px;
  background: var(--red-l);
  border-bottom: 1px solid rgba(192, 57, 43, .12);
  display: flex;
  gap: 10px;
  align-items: flex-start
}

.ip-crit-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  color: #fff;
  font-weight: 800
}

.ip-crit-body {
  flex: 1
}

.ip-crit-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--red)
}

.ip-crit-title em {
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  background: var(--red);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 5px;
  vertical-align: 1px
}

.ip-crit-sub {
  font-size: 12px;
  color: var(--t2);
  margin-top: 2px
}

.ip-crit-x {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3);
  flex-shrink: 0;
  cursor: pointer;
  font-size: 14px;
  line-height: 1
}

.ip-crit-x:hover {
  background: rgba(0, 0, 0, .06)
}

/* Did You Notice? */
.ip-notices {
  padding: 0;
  border-bottom: 1px solid var(--bd)
}

.ip-notices-hdr {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(154, 116, 0, .07)
}

.ip-notices-hdr span {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--amb)
}

.ip-ntc {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(228, 222, 214, .4);
  display: flex;
  gap: 10px;
  cursor: pointer
}

.ip-ntc:last-child {
  border-bottom: none
}

.ip-ntc:hover {
  background: rgba(0, 0, 0, .015)
}

.ip-ntc-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--amb);
  flex-shrink: 0;
  margin-top: 6px
}

.ip-ntc-body {
  flex: 1
}

.ip-ntc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 5px
}

.ip-ntc-title .ip-expand-hint {
  width: 12px;
  height: 12px;
  color: var(--t3);
  flex-shrink: 0;
  transition: transform .2s
}

.ip-ntc.open .ip-ntc-title .ip-expand-hint {
  transform: rotate(90deg)
}

.ip-ntc-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height .2s ease, opacity .2s;
  opacity: 0
}

.ip-ntc.open .ip-ntc-detail {
  max-height: 150px;
  opacity: 1
}

.ip-ntc-text {
  font-size: 12px;
  color: var(--t3);
  margin-top: 3px;
  line-height: 1.4
}

/* Checklist */
.ip-cl-hdr {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--bd);
  background: var(--srf2)
}

.ip-cl-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--t2);
  flex: 1
}

.ip-cl-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--t3)
}

.ip-cl-count b {
  color: var(--grn)
}

.ip-cl-list {
  padding: 0
}

.ip-cli {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(228, 222, 214, .5);
  cursor: default;
  overflow: hidden
}

.ip-cli:last-child {
  border-bottom: none
}

.ip-cli:hover {
  background: rgba(0, 0, 0, .015)
}

.ip-cb {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--bd);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  margin-top: 1px
}

.ip-cb:hover {
  border-color: var(--t3)
}

.ip-cb.checked {
  background: var(--grn);
  border-color: var(--grn)
}

.ip-cb.checked svg {
  display: block
}

.ip-cb svg {
  display: none;
  width: 12px;
  height: 12px;
  color: #fff
}

.ip-cli-body {
  flex: 1;
  min-width: 0;
  cursor: pointer
}

.ip-cli-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 5px
}

.ip-cli-title .ip-expand-hint {
  width: 14px;
  height: 14px;
  color: var(--t3);
  flex-shrink: 0;
  transition: transform .2s
}

.ip-cli.open .ip-cli-title .ip-expand-hint {
  transform: rotate(90deg)
}

.ip-cli-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height .2s ease, opacity .2s;
  opacity: 0
}

.ip-cli.open .ip-cli-detail {
  max-height: 120px;
  opacity: 1
}

.ip-cli-text {
  font-size: 12px;
  color: var(--t3);
  margin-top: 3px;
  line-height: 1.4
}

.ip-cli-urg {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  padding-top: 3px
}

.urg-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px
}

.urg-dot.red {
  background: var(--red)
}

.urg-dot.amb {
  background: var(--amb)
}

.urg-dot.blu {
  background: var(--t4)
}

/* Batch actions */
.ip-batch {
  display: none;
  padding: 8px 16px;
  background: var(--grn-l);
  border-bottom: 1px solid rgba(42, 122, 75, .15);
  align-items: center;
  gap: 8px
}

.ip-batch-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--grn);
  flex: 1
}

.ip-batch-btn {
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--bd);
  background: var(--srf);
  color: var(--t2);
  display: flex;
  align-items: center;
  gap: 4px
}

.ip-batch-btn:hover {
  background: var(--srf2)
}

.ip-batch-btn.pri {
  background: var(--grn);
  color: #fff;
  border-color: var(--grn)
}

.ip-batch-btn.pri:hover {
  opacity: .9
}

.ip-batch-btn svg {
  width: 12px;
  height: 12px
}

/* Differential */
.ip-ddx-sec {
  border-bottom: 1px solid var(--bd)
}

.ip-ddx-hdr {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none
}

.ip-ddx-hdr:hover {
  background: var(--srf2)
}

.ip-ddx-bar {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--t2);
  flex-shrink: 0
}

.ip-ddx-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--t2);
  flex: 1
}

.ip-ddx-chev {
  width: 14px;
  height: 14px;
  color: var(--t3);
  transition: transform .2s;
  flex-shrink: 0
}

.ip-ddx-sec.open .ip-ddx-chev {
  transform: rotate(180deg)
}

.ip-ddx-body {
  display: none;
  padding: 0 16px 12px
}

.ip-ddx-sec.open .ip-ddx-body {
  display: block
}

.ip-dx-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--bd)
}

.ip-dx-item:last-child {
  border-bottom: none
}

.ip-dx-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px
}

.ip-dx-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--t1)
}

.ip-dx-pct {
  font-weight: 600;
  font-size: 13px;
  color: var(--t3)
}

.ip-dx-bar {
  height: 3px;
  background: var(--bg);
  border-radius: 2px;
  margin-bottom: 3px;
  overflow: hidden
}

.ip-dx-fill {
  height: 100%;
  background: var(--or);
  border-radius: 2px;
  transition: width .6s
}

.ip-dx-reason {
  font-size: 12px;
  color: var(--t3)
}

/* Watch strip */
.ip-watch {
  padding: 10px 16px;
  background: var(--srf2);
  border-bottom: 1px solid var(--bd);
  display: flex;
  align-items: flex-start;
  gap: 8px
}

.ip-watch-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--t3);
  flex-shrink: 0;
  margin-top: 1px
}

.ip-watch-items {
  font-size: 12.5px;
  color: var(--t2);
  line-height: 1.5;
  flex: 1
}

.ip-watch-items b {
  font-weight: 600;
  color: var(--t1)
}

/* Workup */
.ip-workup {
  border-bottom: 1px solid var(--bd)
}

.ip-workup-hdr {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--srf2)
}

.ip-workup-hdr span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--t2)
}

.ip-wu-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(228, 222, 214, .4);
  cursor: pointer
}

.ip-wu-item:last-child {
  border-bottom: none
}

.ip-wu-item:hover {
  background: rgba(0, 0, 0, .015)
}

.ip-wu-num {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--srf2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--t2);
  flex-shrink: 0;
  margin-top: 1px
}

.ip-wu-item[data-pri="red"] .ip-wu-num {
  background: var(--red-l);
  color: var(--red)
}

.ip-wu-item[data-pri="amb"] .ip-wu-num {
  background: rgba(154, 116, 0, .08);
  color: var(--amb)
}

.ip-wu-body {
  flex: 1;
  font-size: 13px;
  color: var(--t1);
  line-height: 1.4
}

.ip-wu-body .wu-sub {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height .2s ease, opacity .2s, margin .2s;
  font-size: 12px;
  color: var(--t3);
  margin-top: 0
}

.ip-wu-item.open .wu-sub {
  max-height: 60px;
  opacity: 1;
  margin-top: 3px
}

.ip-wu-urg {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  padding-top: 5px
}

/* Red flags */
.ip-rf {
  border-bottom: 1px solid var(--bd)
}

.ip-rf-hdr {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--red-l)
}

.ip-rf-hdr em {
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  background: var(--red);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px
}

.ip-rf-hdr span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--red)
}

.ip-rf-item {
  padding: 8px 16px;
  border-bottom: 1px solid rgba(228, 222, 214, .4);
  font-size: 13px;
  color: var(--t1);
  line-height: 1.4;
  display: flex;
  gap: 8px
}

.ip-rf-item:last-child {
  border-bottom: none
}

.ip-rf-icon {
  color: var(--red);
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 2px
}

/* Key points */
.ip-kp {
  border-bottom: 1px solid var(--bd)
}

.ip-kp-hdr {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--srf2)
}

.ip-kp-hdr span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--t2)
}

.ip-kp-item {
  padding: 8px 16px;
  border-bottom: 1px solid rgba(228, 222, 214, .4);
  font-size: 13px;
  color: var(--t2);
  line-height: 1.45;
  display: flex;
  gap: 8px
}

.ip-kp-item:last-child {
  border-bottom: none
}

.ip-kp-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--t3);
  flex-shrink: 0;
  margin-top: 7px
}

.ip-kp-item b {
  font-weight: 600;
  color: var(--t1)
}

/* Dosing */
.ip-dose {
  border-bottom: 1px solid var(--bd)
}

.ip-dose-hdr {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--srf2)
}

.ip-dose-hdr span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--t2);
  flex: 1
}

.ip-dose-copy {
  font-size: 11.5px;
  color: var(--or);
  font-weight: 600;
  cursor: pointer
}

.ip-dose-copy:hover {
  text-decoration: underline
}

.ip-dose-body {
  padding: 14px 16px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--t1);
  white-space: pre-wrap
}

.ip-src {
  padding: 8px 16px;
  font-size: 11.5px;
  color: var(--or);
  font-weight: 600;
  border-bottom: 1px solid var(--bd)
}

/* ═══ INTEL BLOCK SLOTS (incremental rendering) ═══ */
.ib-slot {
  overflow: hidden
}

.ib-slot:empty {
  display: none
}

/* ═══ INTEL PANEL: NOTES PANE ═══ */

.ip-hdr-info {
  flex: 1;
  min-width: 0
}

.ip-hdr-tabs {
  display: flex;
  gap: 0;
  flex: 1
}

.ip-tab {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--t3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all .15s
}

.ip-tab.act {
  color: var(--or);
  border-bottom-color: var(--or);
  font-weight: 600
}

.ip-notes-toggle {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--t2);
  border: 1.5px solid var(--bd);
  border-radius: 8px;
  background: var(--srf2);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap
}

@media(min-width:1024px) {
  .ip-notes-toggle { display: flex }
  .ip-notes-toggle:hover {
    border-color: var(--or-m);
    background: var(--or-l);
    color: var(--or)
  }
  .ip-notes-toggle.active {
    color: var(--or);
    border-color: var(--or);
    background: var(--or-l)
  }
}

.ip-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0
}

@media(min-width:1024px) {
  .ip-content { flex-direction: row }
}

.ip-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  min-width: 0
}

.ip-pane-intel { flex: 1 }
.ip-pane-notes { flex: 1 }

@media(min-width:1024px) {
  .ip-pane-notes { border-left: 1px solid var(--bd) }
  #intelPanel.notes-open {
    width: calc(var(--iw) * 1.85);
    max-width: 680px
  }
  #intelPanel.notes-open .ip-pane-intel { flex: 1.1 }
  #intelPanel.notes-open .ip-pane-notes { flex: 1 }
}

.ip-notes-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden
}

.ip-notes-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--bd);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none
}

.ip-notes-tabs::-webkit-scrollbar { display: none }

.ip-notes-tab {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--t3);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: all .15s
}

.ip-notes-tab.act {
  color: var(--or);
  border-bottom-color: var(--or);
  font-weight: 600
}

.ip-notes-editor {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--t1);
  background: var(--srf);
  outline: none
}

.ip-notes-editor:empty::before {
  content: 'Click Generate or start typing…';
  color: var(--t4);
  font-style: italic
}

.ip-notes-foot {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  padding-bottom: calc(10px + var(--sb));
  border-top: 1px solid var(--bd);
  flex-shrink: 0
}

.ip-notes-gen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px;
  background: var(--or);
  color: #fff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer
}

.ip-notes-gen:hover { filter: brightness(.9) }

.ip-notes-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--srf2);
  color: var(--t2);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--bd);
  cursor: pointer
}

.ip-notes-copy:hover { background: var(--bd) }

/* ═══ NOTES WORKSPACE ═══ */
.ws-hdr {
  padding: 8px 12px;
  padding-top: calc(8px + var(--st));
  background: var(--srf);
  border-bottom: 1px solid var(--bd);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0
}

@media(min-width:1024px) {
  .ws-hdr {
    padding-top: 8px
  }
}

.ws-back {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3);
  flex-shrink: 0
}

.ws-back:hover {
  background: var(--srf2)
}

@media(min-width:1024px) {
  .ws-back {
    display: none
  }
}

.ws-hdr-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--t2);
  flex-shrink: 0;
  padding-left: 4px
}

.ws-tabs {
  display: flex;
  gap: 1px;
  flex: 1;
  overflow-x: auto;
  min-width: 0;
  justify-content: flex-end
}

.ws-tabs::-webkit-scrollbar {
  display: none
}

.ws-tab {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--t3);
  white-space: nowrap;
  position: relative
}

.ws-tab:hover {
  background: var(--srf2)
}

.ws-tab.act {
  background: var(--srf2);
  color: var(--t1);
  font-weight: 600
}

.ws-tab.act::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 8px;
  right: 8px;
  height: 2px;
  background: var(--or);
  border-radius: 2px
}

.ws-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg)
}

.ws-note {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.75;
  color: var(--t1);
  white-space: pre-wrap;
  outline: none;
  min-height: 100%;
  padding: 14px;
  background: var(--srf);
  border-radius: var(--r-sm);
  border: 1.5px solid var(--bd)
}

.ws-note .sh {
  font-weight: 700;
  display: block;
  margin-top: 12px
}

.ws-note .sh:first-child {
  margin-top: 0
}

.ws-foot {
  padding: 6px 12px;
  padding-bottom: calc(6px + var(--sb));
  background: var(--srf);
  border-top: 1px solid var(--bd);
  display: flex;
  flex-shrink: 0
}

.ws-btn {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--or);
  color: #fff;
  border: none
}

.ws-btn:hover {
  filter: brightness(.9)
}

.ws-btn svg {
  width: 13px;
  height: 13px
}

.note-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--bd);
  border-top-color: var(--or);
  border-radius: 50%;
  animation: noteSpin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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

/* ═══ CORRECTION DRAWER ═══ (from V5) */
.corr-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--srf);
  border-radius: 20px 20px 0 0;
  z-index: 62;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  box-shadow: 0 -8px 40px rgba(28, 25, 23, .14)
}

.corr-sheet.open {
  transform: translateY(0)
}

.corr-drag {
  width: 36px;
  height: 4px;
  background: var(--bd);
  border-radius: 4px;
  margin: 10px auto 0
}

.corr-hdr {
  padding: 14px 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bd)
}

.corr-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--t1)
}

.corr-close-x {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--srf2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--t3)
}

.corr-hint {
  font-size: 11px;
  color: var(--t4);
  font-weight: 400;
  margin-left: 4px
}

.corr-chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 16px
}

.corr-chip {
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--bd);
  background: var(--srf2);
  color: var(--t2);
  cursor: pointer;
  transition: all .12s
}

.corr-chip.sel {
  border-color: var(--or);
  color: var(--or);
  background: var(--or-l)
}

.corr-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--t2);
  margin-bottom: 6px
}

.corr-body {
  padding: 12px 18px 0
}

.corr-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 7px
}

.corr-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px
}

.corr-cat {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1.5px solid var(--bd);
  background: var(--srf2);
  color: var(--t2);
  cursor: pointer
}

.corr-cat.sel {
  border-color: var(--or);
  color: var(--or);
  background: var(--or-l)
}

.corr-ta {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  background: var(--srf2);
  border: 1.5px solid var(--bd);
  border-radius: 12px;
  font-size: 14px;
  color: var(--t1);
  resize: none;
  outline: none;
  font-family: inherit;
  line-height: 1.5
}

.corr-ta:focus {
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--or-l)
}

.corr-conf {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 0
}

.corr-conf-lbl {
  font-size: 12.5px;
  color: var(--t2);
  font-weight: 500;
  flex-shrink: 0
}

.conf-toggle {
  display: flex;
  background: var(--srf2);
  border-radius: 20px;
  border: 1.5px solid var(--bd);
  overflow: hidden
}

.conf-opt {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--t3);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit
}

.conf-opt.sel {
  background: var(--or);
  color: #fff
}

.corr-footer {
  padding: 12px 18px;
  padding-bottom: calc(12px + var(--sb));
  border-top: 1px solid var(--bd);
  margin-top: 12px;
  display: flex;
  gap: 8px
}

.corr-submit {
  flex: 1;
  padding: 12px;
  background: var(--or);
  color: #fff;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit
}

.corr-submit:hover {
  filter: brightness(.9)
}

.corr-cancel {
  padding: 12px 16px;
  background: var(--srf2);
  color: var(--t2);
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--bd);
  font-family: inherit
}

.corr-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, .35);
  z-index: 61;
  display: none
}

.corr-backdrop.show {
  display: block
}

/* ═══ ACCURACY SCORE CHIP ═══ (from V5) */
.score-chip {
  position: fixed;
  bottom: calc(72px + var(--sb));
  right: 16px;
  background: var(--or);
  color: #fff;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  z-index: 40;
  display: none;
  align-items: center;
  gap: 7px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: none;
  font-family: inherit
}

.score-chip.show {
  display: flex
}

@keyframes chipPulse {

  0%,
  100% {
    transform: scale(1)
  }

  50% {
    transform: scale(1.08)
  }
}

.score-chip.pulse {
  animation: chipPulse .4s ease
}

.score-chip svg {
  width: 14px;
  height: 14px
}

/* ═══ PROVIDER PROFILE SHEET ═══ (from V5) */
.prof-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none
}

.prof-sheet.open {
  display: block
}

.prof-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, .45);
  backdrop-filter: blur(3px)
}

.prof-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 92dvh;
  background: var(--srf);
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32, 0, .2, 1)
}

.prof-sheet.open .prof-panel {
  transform: translateY(0)
}

.prof-scroll {
  overflow-y: auto;
  flex: 1;
  padding-bottom: calc(20px + var(--sb))
}

.prof-drag {
  width: 36px;
  height: 4px;
  background: var(--bd);
  border-radius: 4px;
  margin: 10px auto 4px
}

.prof-hero {
  padding: 16px 20px 0;
  display: flex;
  align-items: flex-start;
  gap: 14px
}

.prof-av {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--or);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0
}

.prof-info {
  flex: 1;
  min-width: 0
}

.prof-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--t1);
  line-height: 1.2
}

.prof-role {
  font-size: 12.5px;
  color: var(--t3);
  margin-top: 2px
}

.prof-level {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 10px;
  background: var(--or-l);
  border: 1.5px solid var(--or-m);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--or)
}

.prof-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--srf2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--t3);
  flex-shrink: 0
}

.prof-score-card {
  margin: 14px 20px 0;
  background: linear-gradient(135deg, #C07040 0%, #8A4820 100%);
  border-radius: 16px;
  padding: 16px;
  color: #fff
}

.prof-score-num {
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px
}

.prof-score-lbl {
  font-size: 11.5px;
  opacity: .8;
  font-weight: 500;
  margin-top: 1px
}

.prof-progress-wrap {
  margin-top: 11px
}

.prof-progress-bar {
  height: 5px;
  background: rgba(255, 255, 255, .22);
  border-radius: 3px;
  margin-top: 5px;
  overflow: hidden
}

.prof-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 3px;
  transition: width .7s cubic-bezier(.4, 0, .2, 1)
}

.prof-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  opacity: .72;
  margin-top: 4px
}

.prof-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 12px 20px 0
}

.prof-stat {
  background: var(--srf2);
  border-radius: 12px;
  padding: 11px 8px;
  text-align: center;
  border: 1px solid var(--bd)
}

.prof-stat-n {
  font-size: 20px;
  font-weight: 800;
  color: var(--t1)
}

.prof-stat-l {
  font-size: 10px;
  color: var(--t3);
  margin-top: 1px;
  font-weight: 500
}

.prof-section {
  padding: 14px 20px 0
}

.prof-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--t3);
  margin-bottom: 10px
}

.prof-recent {
  padding: 8px 0;
  border-bottom: 1px solid var(--bd);
  display: flex;
  align-items: center;
  gap: 10px
}

.prof-recent:last-child {
  border-bottom: none
}

.prof-recent-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0
}

.prof-recent-text {
  flex: 1;
  min-width: 0
}

.prof-recent-q {
  font-size: 13px;
  color: var(--t1);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.prof-recent-meta {
  font-size: 11.5px;
  color: var(--t3);
  margin-top: 1px
}

.prof-impact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 20px 0;
  padding: 12px 14px;
  background: var(--srf2);
  border: 1px solid var(--bd);
  border-radius: 12px
}

.prof-impact-icon {
  font-size: 22px;
  flex-shrink: 0
}

.prof-impact-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--t1)
}

.prof-impact-sub {
  font-size: 11.5px;
  color: var(--t3);
  margin-top: 1px
}

.prof-cta {
  margin: 12px 20px 0;
  background: var(--srf2);
  border-radius: 14px;
  padding: 13px;
  text-align: center;
  border: 1px solid var(--bd)
}

.prof-cta-text {
  font-size: 13px;
  color: var(--t2);
  line-height: 1.5
}

.prof-cta-text b {
  color: var(--t1)
}

/* ═══ ADMIN LOGIN MODAL ═══ */
.adm-login {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center
}

.adm-login.open {
  display: flex
}

.adm-login-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, .45);
  backdrop-filter: blur(3px)
}

.adm-login-card {
  position: relative;
  width: 340px;
  background: var(--srf);
  border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-lg);
  z-index: 1
}

.adm-login-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 4px
}

.adm-login-sub {
  font-size: 13px;
  color: var(--t3);
  margin-bottom: 18px
}

.adm-login-field {
  width: 100%;
  padding: 10px 14px;
  background: var(--srf2);
  border: 1.5px solid var(--bd);
  border-radius: 10px;
  font-size: 14px;
  color: var(--t1);
  outline: none;
  margin-bottom: 10px;
  transition: border-color .2s;
  font-family: inherit
}

.adm-login-field:focus {
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--or-l)
}

.adm-login-err {
  font-size: 12px;
  color: var(--red);
  margin-bottom: 8px;
  display: none
}

.adm-login-btn {
  width: 100%;
  padding: 11px;
  background: var(--or);
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: filter .15s
}

.adm-login-btn:hover {
  filter: brightness(.9)
}

.adm-login-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--srf2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--t3);
  border: none
}

/* ═══ ADMIN PANEL OVERLAY ═══ */
.adm-panel {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: none
}

.adm-panel.open {
  display: block
}

.adm-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, .45);
  backdrop-filter: blur(3px)
}

.adm-panel-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 94dvh;
  background: var(--srf);
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32, 0, .2, 1)
}

.adm-panel.open .adm-panel-sheet {
  transform: translateY(0)
}

.adm-panel-scroll {
  overflow-y: auto;
  flex: 1;
  padding: 0 20px 24px
}

.adm-panel-drag {
  width: 36px;
  height: 4px;
  background: var(--bd);
  border-radius: 4px;
  margin: 10px auto 4px
}

.adm-panel-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 8px
}

.adm-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--t1)
}

.adm-panel-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--srf2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--t3);
  border: none
}

.adm-section {
  margin-top: 16px
}

.adm-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--t3);
  margin-bottom: 10px
}

.adm-field {
  margin-bottom: 12px
}

.adm-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--t2);
  margin-bottom: 4px
}

.adm-field input[type="text"],
.adm-field input[type="number"] {
  width: 100%;
  padding: 9px 12px;
  background: var(--srf2);
  border: 1.5px solid var(--bd);
  border-radius: 8px;
  font-size: 14px;
  color: var(--t1);
  outline: none;
  font-family: inherit;
  transition: border-color .2s
}

.adm-field input:focus {
  border-color: var(--or)
}

.adm-range-wrap {
  display: flex;
  align-items: center;
  gap: 10px
}

.adm-range-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--or)
}

.adm-range-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--or);
  min-width: 36px;
  text-align: right;
  font-family: 'DM Mono', monospace
}

.adm-collapse {
  border: 1.5px solid var(--bd);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden
}

.adm-collapse-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--srf2);
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit
}

.adm-collapse-hdr svg {
  width: 14px;
  height: 14px;
  color: var(--t3);
  transition: transform .2s;
  flex-shrink: 0
}

.adm-collapse.open .adm-collapse-hdr svg {
  transform: rotate(180deg)
}

.adm-collapse-body {
  display: none;
  padding: 10px 14px 14px
}

.adm-collapse.open .adm-collapse-body {
  display: block
}

.adm-collapse textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px;
  background: var(--srf2);
  border: 1.5px solid var(--bd);
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--t1);
  outline: none;
  resize: vertical;
  transition: border-color .2s
}

.adm-collapse textarea:focus {
  border-color: var(--or)
}

.adm-footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--bd);
  background: var(--srf)
}

.adm-footer button {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all .15s
}

.adm-btn-save {
  background: var(--or);
  color: #fff
}

.adm-btn-save:hover {
  filter: brightness(.9)
}

.adm-btn-reset {
  background: var(--srf2);
  color: var(--t2);
  border: 1.5px solid var(--bd)
}

.adm-btn-reset:hover {
  background: var(--bd)
}

@media(min-width:768px) {
  .adm-panel-sheet {
    max-width: 640px;
    left: 50%;
    transform: translateX(-50%) translateY(100%)
  }

  .adm-panel.open .adm-panel-sheet {
    transform: translateX(-50%) translateY(0)
  }

  .adm-login-card {
    width: 380px
  }
}

/* ═══ SPECIALTY SELECTOR ═══ */
.spec-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity .3s
}

.spec-overlay.hide {
  opacity: 0;
  pointer-events: none
}

.spec-inner {
  width: 100%;
  max-width: 400px;
  padding: 0 24px;
  text-align: center
}

.spec-name-wrap {
  margin: 16px 0 4px;
  text-align: left
}

.spec-name-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--t3);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .04em
}

.spec-name-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--srf);
  border: 1.5px solid var(--bd);
  border-radius: 10px;
  font-size: 15px;
  color: var(--t1);
  outline: none;
  transition: all .2s
}

.spec-name-input:focus {
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--or-l)
}

.spec-name-input::placeholder {
  color: var(--t4)
}

.spec-logo {
  width: 46px;
  height: 46px;
  background: var(--or);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  color: #fff;
  font-weight: 800;
  margin: 0 auto 14px
}

.spec-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 3px;
  letter-spacing: -.02em
}

.spec-sub {
  font-size: 14px;
  color: var(--t3);
  margin-bottom: 22px
}

.lang-toggle {
  display: flex;
  gap: 6px;
  flex-wrap: wrap
}

.lang-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1.5px solid var(--bd);
  background: var(--srf2);
  color: var(--t2);
  cursor: pointer;
  font-family: inherit;
  transition: all .12s
}

.lang-btn.act {
  border-color: var(--or);
  color: var(--or);
  background: var(--or-l)
}

.spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  text-align: left
}

.spec-btn {
  padding: 11px 14px;
  background: var(--srf);
  border: 1.5px solid var(--bd);
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 10px
}

.spec-btn:hover {
  border-color: var(--or);
  background: var(--or-l)
}

.spec-btn:active {
  transform: scale(.97)
}

.spec-btn.su-active {
  border-color: var(--or);
  background: var(--or-l)
}

.spec-btn .spec-emoji {
  font-size: 18px;
  flex-shrink: 0;
  width: 26px;
  text-align: center
}

.spec-btn .spec-label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--t1);
  line-height: 1.3
}

.spec-btn .spec-detail {
  font-size: 11px;
  color: var(--t3)
}

/* Voice overlay */
.vo {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, .88);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s
}

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

.vr {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--or);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: vp 1.5s infinite
}

@keyframes vp {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(192, 112, 64, .4)
  }

  50% {
    box-shadow: 0 0 0 22px rgba(192, 112, 64, 0)
  }
}

.vr svg {
  width: 32px;
  height: 32px;
  color: #fff
}

.vt {
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  margin-top: 18px
}

.vs {
  color: rgba(255, 255, 255, .4);
  font-size: 13px;
  margin-top: 5px;
  max-height: 80px;
  overflow-y: auto;
  padding: 0 24px;
  text-align: center;
  word-break: break-word
}

.vtm {
  color: rgba(255, 255, 255, .8);
  font-size: 26px;
  font-weight: 700;
  margin-top: 14px;
  font-variant-numeric: tabular-nums
}

.vo-btns {
  display: flex;
  gap: 12px;
  margin-top: 24px
}

.vc {
  color: rgba(255, 255, 255, .4);
  font-size: 13px;
  cursor: pointer;
  padding: 9px 18px;
  border: 1.5px solid rgba(255, 255, 255, .15);
  border-radius: 18px
}

.vd {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 9px 24px;
  background: var(--or);
  border: none;
  border-radius: 18px
}

.i-mic.recording,
.ha-btn.recording {
  color: var(--red, #ef4444);
  animation: vp 1.5s infinite
}

/* Action sheet — see ═══ ACTION SHEET ═══ section below */

/* Toast */
.toast {
  position: fixed;
  bottom: calc(80px + var(--sb));
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #2A2A2A;
  color: #fff;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all .3s;
  z-index: 300;
  white-space: nowrap;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 6px
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0)
}

.toast .tcheck {
  width: 13px;
  height: 13px;
  color: #4ADE80
}

.toast .undo-btn {
  background: none;
  border: 1px solid rgba(255,255,255,.4);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-left: 6px
}
.toast .undo-btn:active { background: rgba(255,255,255,.15) }
.toast.show { pointer-events: auto }

.fade-in {
  animation: fi .2s ease
}

@keyframes fi {
  from {
    opacity: 0;
    transform: translateY(3px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

/* Reasoning */
.reasoning {
  padding: 12px;
  background: var(--srf2);
  border-radius: 10px;
  margin-top: 6px
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--bd);
  border-top-color: var(--or);
  border-radius: 50%;
  animation: spin .8s linear infinite
}

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

.rs {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 0;
  font-size: 12px;
  color: var(--t3)
}

.rs.done {
  color: var(--t2)
}

.rs.act {
  color: var(--t1)
}

.rs .dot {
  width: 14px;
  height: 14px;
  border-radius: 7px;
  border: 2px solid var(--bd);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0
}

.rs.done .dot {
  background: var(--grn);
  border-color: var(--grn)
}

.rs.done .dot svg {
  display: block
}

.rs .dot svg {
  display: none;
  width: 8px;
  height: 8px;
  color: #fff
}

.rs.act .dot {
  border-color: var(--or)
}

/* ═══ RICH CHAT CONTENT COMPONENTS (V5) ═══ */
.r-answer-text {
  line-height: 1.6;
  font-size: 14px
}

.r-answer-text b {
  font-weight: 600;
  color: var(--t1)
}

/* DDx table */
.r-ddx {
  margin-top: 10px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--bd);
  font-size: 12.5px
}

.r-ddx-hdr {
  padding: 8px 12px;
  background: var(--srf2);
  border-bottom: 1px solid var(--bd);
  display: flex;
  align-items: baseline;
  gap: 8px
}

.r-ddx-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--t2)
}

.r-ddx-sub {
  font-size: 11px;
  color: var(--t4)
}

.r-ddx-row {
  display: grid;
  grid-template-columns: 1.6fr 90px 1.8fr;
  border-bottom: 1px solid rgba(228, 222, 214, .5);
  align-items: stretch
}

.r-ddx-row:last-child {
  border-bottom: none
}

.r-ddx-cell {
  padding: 8px 10px;
  line-height: 1.4
}

.r-ddx-name {
  background: var(--srf)
}

.r-ddx-cond {
  display: block;
  font-weight: 600;
  color: var(--t1);
  font-size: 12px
}

.r-ddx-type {
  display: block;
  font-size: 10.5px;
  color: var(--t3);
  margin-top: 1px
}

.r-ddx-like {
  background: var(--srf2);
  display: flex;
  align-items: center;
  justify-content: center
}

.r-ddx-pill {
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap
}

.r-ddx-pill.common {
  background: rgba(42, 122, 75, .12);
  color: var(--grn)
}

.r-ddx-pill.less {
  background: rgba(154, 116, 0, .1);
  color: var(--amb)
}

.r-ddx-pill.rare {
  background: rgba(228, 222, 214, .6);
  color: var(--t3)
}

.r-ddx-feat {
  font-size: 11.5px;
  color: var(--t2);
  line-height: 1.45;
  background: var(--srf)
}

/* Workup steps */
.r-workup {
  margin-top: 10px
}

.r-urg {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 7px
}

.r-urg.red {
  background: var(--red)
}

.r-urg.amb {
  background: var(--amb)
}

.r-urg.blu {
  background: var(--t4)
}

.r-section-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--t3);
  margin-bottom: 6px
}

.r-workup-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(228, 222, 214, .4);
  cursor: pointer;
  transition: all .1s
}

.r-workup-row:last-child {
  border-bottom: none
}

.r-workup-row:hover {
  opacity: .85
}

.r-workup-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--srf2);
  color: var(--t2);
  border: 1.5px solid var(--bd)
}

.r-workup-num.red {
  background: var(--red-l);
  color: var(--red);
  border-color: rgba(192, 57, 43, .3)
}

.r-workup-num.amb {
  background: rgba(154, 116, 0, .1);
  color: var(--amb);
  border-color: rgba(154, 116, 0, .3)
}

.r-workup-body {
  flex: 1
}

.r-workup-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  line-height: 1.3
}

.r-workup-sub {
  font-size: 11.5px;
  color: var(--t3);
  margin-top: 2px;
  line-height: 1.4
}

/* Red flags */
.r-redflags {
  margin-top: 10px;
  background: var(--red-l);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(192, 57, 43, .18)
}

.r-rf-hdr {
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid rgba(192, 57, 43, .15)
}

.r-rf-badge {
  width: 16px;
  height: 16px;
  background: var(--red);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0
}

.r-rf-item {
  padding: 6px 11px;
  font-size: 12px;
  color: var(--red);
  border-bottom: 1px solid rgba(192, 57, 43, .1);
  line-height: 1.4
}

.r-rf-item:last-child {
  border-bottom: none
}

/* Visual / image card */
.r-img-card {
  margin-top: 10px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--bd)
}

.r-img-svg {
  width: 100%;
  display: block
}

.r-img-caption {
  padding: 7px 10px;
  font-size: 11px;
  font-style: italic;
  color: var(--t3);
  background: var(--srf2);
  border-top: 1px solid var(--bd);
  line-height: 1.4
}

/* Evidence badges */
.r-evidence-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px
}

.r-evidence {
  padding: 3px 8px;
  background: rgba(37, 99, 235, .07);
  border: 1px solid rgba(37, 99, 235, .15);
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 500;
  color: #2563EB;
  white-space: nowrap
}

/* Data table */
.r-table {
  margin-top: 10px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--bd);
  font-size: 12px
}

.r-table-title {
  padding: 8px 12px;
  background: var(--srf2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--t2);
  border-bottom: 1px solid var(--bd)
}

.r-table-header {
  display: grid;
  grid-template-columns: 1fr 2fr 1.5fr;
  padding: 5px 10px;
  background: var(--srf2);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--t3);
  border-bottom: 1px solid var(--bd)
}

.r-table-row {
  display: grid;
  grid-template-columns: 1fr 2fr 1.5fr;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(228, 222, 214, .4);
  line-height: 1.4;
  align-items: start
}

.r-table-row:last-child {
  border-bottom: none
}

.r-table-cat {
  font-weight: 600;
  color: var(--t1)
}

.r-table-less {
  color: var(--t3)
}

/* Action cards (v5 style) */
.action-card {
  background: var(--srf);
  border-radius: var(--r-sm);
  overflow: hidden;
  margin-top: 10px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--bd)
}

.ac-header {
  padding: 11px 16px;
  border-bottom: 1px solid var(--bd);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--t2);
  background: var(--srf2)
}

.ac-header svg {
  width: 13px;
  height: 13px;
  color: var(--t3)
}

.ac-body {
  padding: 14px 16px;
  font-family: 'DM Mono', monospace;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--t1);
  white-space: pre-wrap
}

.ac-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--bd);
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

.ac-btn {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--bd);
  background: var(--srf);
  color: var(--t2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
  transition: all .12s
}

.ac-btn:hover {
  background: var(--srf2);
  color: var(--t1)
}

.ac-btn:active {
  transform: scale(.97)
}

.ac-btn svg {
  width: 12px;
  height: 12px
}

.ac-btn.primary {
  background: var(--or);
  color: #fff;
  border-color: var(--or)
}

.ac-btn.primary:hover {
  filter: brightness(.9)
}

.ac-btn.green {
  background: var(--grn);
  color: #fff;
  border-color: var(--grn)
}

/* Warn block */
.warn-block {
  padding: 9px 13px;
  background: var(--red-l);
  border-left: 3px solid var(--red);
  border-radius: 0 8px 8px 0;
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--red);
  font-weight: 500;
  line-height: 1.45
}

/* Inline quick actions */
.inline-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--bd)
}

.ia-btn {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--bd);
  background: var(--srf);
  color: var(--t2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all .12s;
  white-space: nowrap
}

.ia-btn:hover {
  background: var(--srf2)
}

.ia-btn svg {
  width: 11px;
  height: 11px
}

.ia-btn.red {
  border-color: rgba(192, 57, 43, .25);
  color: var(--red)
}

.ia-btn.red:hover {
  background: var(--red-l)
}

.ia-btn.green {
  border-color: rgba(42, 122, 75, .25);
  color: var(--grn)
}

.ia-btn.green:hover {
  background: var(--grn-l)
}

/* ═══ MOBILE RESPONSIVE FIXES ═══ */
html {
  height: 100%;
  height: -webkit-fill-available
}

/* patch body for fill-available */

@media(max-width:600px) {
  .home {
    justify-content: center;
    padding: 20px 12px
  }

  .home-inner {
    margin-top: 0;
    padding-bottom: 16px
  }

  .home-greet {
    font-size: 30px;
    margin-bottom: 20px
  }

  .home-field {
    min-height: 76px;
    font-size: 16px
  }


  .ha-btn,
  .ha-send {
    width: 34px;
    height: 34px;
    border-radius: 10px
  }

  .ha-btn svg {
    width: 18px;
    height: 18px
  }


  .input-area {
    padding: 0 14px 10px;
    padding-bottom: calc(10px + var(--sb))
  }

  .msgs {
    padding: 18px 14px 14px
  }

  .fup {
    padding: 9px 14px;
    font-size: 13px;
    white-space: normal;
    max-width: calc(100vw - 60px);
    line-height: 1.4
  }

  .fb-bar {
    gap: 4px;
    padding: 8px 0 4px
  }

  .fb-icn {
    padding: 7px
  }

  .fb-icn svg {
    width: 15px;
    height: 15px;
    stroke-width: 1.5
  }

  .fb-btn {
    padding: 4px 8px;
    font-size: 11px;
    gap: 3px
  }

  .fb-btn svg {
    width: 11px;
    height: 11px
  }

  .act-card-b {
    font-size: 12.5px;
    line-height: 1.6;
    padding: 12px 14px;
    overflow-x: auto;
    word-break: break-word
  }

  .r-ddx-row {
    grid-template-columns: 1fr 72px;
    grid-template-rows: auto auto
  }

  .r-ddx-cell.r-ddx-feat {
    grid-column: 1 / -1;
    padding-top: 2px;
    padding-bottom: 8px;
    border-top: 1px solid rgba(228, 222, 214, .3);
    font-size: 11.5px;
    color: var(--t3)
  }

  .r-ddx-cell.r-ddx-name {
    padding-bottom: 4px
  }

  .r-workup-title {
    font-size: 13px
  }

  .r-workup-sub {
    font-size: 11.5px
  }

  .ac-body {
    font-size: 13px;
    padding: 12px 14px;
    overflow-x: auto;
    word-break: break-word
  }

  .ac-footer {
    padding: 9px 12px;
    gap: 6px
  }

  .ac-btn {
    padding: 7px 12px;
    font-size: 12.5px
  }

  .score-chip {
    bottom: calc(80px + var(--sb));
    right: 12px;
    padding: 6px 11px;
    font-size: 12px
  }

  .ch-info h3 {
    font-size: 13.5px
  }

  .ch-info p {
    font-size: 11.5px
  }

  .ch-btns {
    gap: 2px
  }

  .ch-btn {
    width: 32px;
    height: 32px
  }

  .corr-body {
    padding: 10px 16px 0
  }

  .corr-footer {
    padding: 10px 16px;
    padding-bottom: calc(10px + var(--sb))
  }

  .prof-panel {
    max-height: 88dvh
  }

  .ws-tabs {
    gap: 0
  }

  .ws-tab {
    padding: 5px 7px;
    font-size: 12px
  }

  .spec-inner {
    padding: 0 20px
  }

  .spec-grid {
    gap: 6px
  }

  .spec-btn {
    padding: 10px 12px
  }

  .r-ddx {
    font-size: 12.5px
  }

  .r-evidence {
    font-size: 10.5px;
    padding: 3px 7px
  }

  .inline-actions {
    gap: 5px
  }

  .ia-btn {
    font-size: 11.5px;
    padding: 5px 10px
  }

  .mr.ai .mb {
    padding: 13px 16px;
    font-size: 15px;
    border-radius: 18px;
    border-bottom-left-radius: 4px
  }

  .mr.u .mb {
    padding: 11px 16px;
    font-size: 15px;
    border-radius: 18px;
    border-bottom-right-radius: 4px
  }

  .mr.ai.gap,
  .mr.u.gap {
    margin-top: 14px
  }

  input,
  textarea,
  .spec-name-input {
    font-size: 16px !important
  }
}

@media(max-width:380px) {
  .home-greet {
    font-size: 26px
  }

  .home-field {
    min-height: 68px;
    font-size: 15px
  }


  .r-ddx-row {
    grid-template-columns: 1fr 64px
  }

  .fb-btn {
    padding: 4px 7px;
    font-size: 10.5px
  }

  .spec-grid {
    grid-template-columns: 1fr 1fr;
    gap: 5px
  }

  .mr.ai .mb {
    padding: 12px 14px;
    font-size: 14.5px
  }

  .mr.u .mb {
    padding: 10px 14px;
    font-size: 14.5px
  }
}

/* ── CLINICAL CARDS ── */
.cl-card {
  background: var(--srf);
  border: 1px solid var(--bd);
  border-radius: 14px;
  overflow: hidden;
  margin-top: 8px
}

.cl-card-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--srf2);
  border-bottom: 1px solid var(--bd)
}

.cl-card-ico {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0
}

.cl-card-lbl {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--t2);
  letter-spacing: .04em;
  text-transform: uppercase
}

.cl-card-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9px
}

.cl-card-body {
  padding: 10px 12px
}

.cl-ck {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  font-size: 12.5px;
  border-bottom: 1px solid var(--bd)
}

.cl-ck:last-child {
  border-bottom: none
}

.cl-ck-box {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  margin-top: 1px
}

.cl-ck-box.r {
  background: var(--red-l);
  color: var(--red)
}

.cl-ck-box.a {
  background: var(--amb-l);
  color: var(--amb)
}

.cl-ck-box.g {
  background: var(--grn-l);
  color: var(--grn)
}

.cl-ck-box.b {
  background: var(--blu-l);
  color: var(--blu)
}

.cl-ck-main {
  flex: 1
}

.cl-ck-title {
  font-weight: 600;
  color: var(--t1);
  line-height: 1.3
}

.cl-ck-sub {
  font-size: 11px;
  color: var(--t3);
  margin-top: 1px;
  line-height: 1.4
}

.cl-ck-tag {
  font-size: 9.5px;
  font-weight: 600;
  margin-left: auto;
  flex-shrink: 0;
  padding-top: 2px
}

.cl-ck-tag.r {
  color: var(--red)
}

.cl-ck-tag.a {
  color: var(--amb)
}

.cl-ck-tag.g {
  color: var(--grn)
}

.cl-ck-tag.b {
  color: var(--blu)
}

.cl-alrt {
  border-radius: 10px;
  padding: 9px 11px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-bottom: 7px
}

.cl-alrt:last-child {
  margin-bottom: 0
}

.cl-alrt.danger {
  background: rgba(192, 57, 43, .07);
  border: 1.5px solid rgba(192, 57, 43, .2)
}

.cl-alrt.warn {
  background: rgba(154, 116, 0, .07);
  border: 1.5px solid rgba(154, 116, 0, .2)
}

.cl-alrt.info {
  background: rgba(37, 99, 235, .06);
  border: 1.5px solid rgba(37, 99, 235, .18)
}

.cl-alrt.ok {
  background: rgba(42, 122, 75, .07);
  border: 1.5px solid rgba(42, 122, 75, .2)
}

.cl-alrt-ico {
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px
}

.cl-alrt-body {
  flex: 1
}

.cl-alrt-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 2px
}

.cl-alrt.danger .cl-alrt-title {
  color: var(--red)
}

.cl-alrt.warn .cl-alrt-title {
  color: var(--amb)
}

.cl-alrt.info .cl-alrt-title {
  color: var(--blu)
}

.cl-alrt.ok .cl-alrt-title {
  color: var(--grn)
}

.cl-alrt-txt {
  font-size: 11.5px;
  color: var(--t2);
  line-height: 1.5
}

/* ═══ ACTION SHEET ═══ */
.as-overlay { position:fixed; inset:0; z-index:100; opacity:0; pointer-events:none }
.as-overlay.show { opacity:1; pointer-events:auto }
.as-menu { position:fixed; z-index:101; background:var(--srf); border:1.5px solid var(--bd); border-radius:var(--r); box-shadow:var(--shadow-lg); padding:0; min-width:280px; opacity:0; pointer-events:none; transform:translateY(6px); transition:all .15s; overflow:hidden }
.as-menu.show { opacity:1; pointer-events:auto; transform:translateY(0) }
.as-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; padding:14px 12px 12px }
.as-tile { display:flex; flex-direction:column; align-items:center; gap:7px; padding:14px 8px 12px; border-radius:var(--r-sm); background:var(--srf2); cursor:pointer; border:1px solid var(--bd); transition:background .12s }
.as-tile:hover { background:var(--or-l) }
.as-tile svg { width:22px; height:22px; color:var(--t2) }
.as-tile span { font-size:12px; font-weight:500; color:var(--t2) }
.as-sep { height:1px; background:var(--bd); margin:2px 14px; opacity:.5 }
.as-toggle-row { display:flex; align-items:center; gap:12px; padding:11px 14px; cursor:pointer; transition:background .1s }
.as-toggle-row:hover { background:var(--srf2) }
.as-toggle-icon { width:32px; height:32px; border-radius:8px; background:var(--srf2); display:flex; align-items:center; justify-content:center; flex-shrink:0; color:var(--t3) }
.as-toggle-info { flex:1; display:flex; flex-direction:column; gap:1px }
.as-toggle-label { font-size:14px; font-weight:500; color:var(--t1) }
.as-toggle-sw { width:40px; height:24px; border-radius:12px; background:var(--bd); position:relative; flex-shrink:0; transition:background .2s }
.as-toggle-sw.on { background:var(--or) }
.as-toggle-knob { position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.2); transition:transform .2s }
.as-toggle-sw.on .as-toggle-knob { transform:translateX(16px) }
.as-style-sub { font-size:11px; color:var(--or); font-weight:500 }
/* ═══ STYLE SUBMENU ═══ */
.as-submenu { position:fixed; z-index:102; background:var(--srf); border:1.5px solid var(--bd); border-radius:var(--r-sm); box-shadow:var(--shadow-lg); min-width:160px; opacity:0; pointer-events:none; transform:translateX(6px); transition:all .15s; overflow:hidden }
.as-submenu.show { opacity:1; pointer-events:auto; transform:translateX(0) }
.as-sub-item { display:flex; align-items:center; justify-content:space-between; padding:11px 14px; cursor:pointer; font-size:14px; color:var(--t1); transition:background .1s }
.as-sub-item:hover { background:var(--srf2) }
.as-sub-check { color:var(--or); flex-shrink:0 }
/* ═══ MODE CHIPS ═══ */
.mode-chips { display:flex; flex-wrap:nowrap; gap:5px; align-items:center; overflow:hidden; flex:1; min-width:0 }
.mode-chips:empty { display:none }
.mode-chip { display:inline-flex; align-items:center; gap:5px; padding:3px 8px 3px 10px; border-radius:20px; background:var(--or-l); border:1px solid var(--or-m); font-size:12px; font-weight:500; color:var(--or); white-space:nowrap; animation:chipIn .15s ease both }
@keyframes chipIn { from{opacity:0;transform:scale(.9)} to{opacity:1;transform:scale(1)} }
.mode-chip-x { width:14px; height:14px; border-radius:50%; background:var(--or-m); display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0; transition:background .1s }
.mode-chip-x:hover { background:var(--or) }
.mode-chip-x svg { color:var(--or) }
.mode-chip-x:hover svg { color:#fff }
/* ═══ SIDEBAR FAB ═══ */
.sb-fab { position:absolute; bottom:calc(16px + var(--sb)); right:12px; width:calc(50% - 12px); display:flex; align-items:center; justify-content:center; gap:8px; padding:11px 16px; background:var(--or); color:#fff; border:none; border-radius:var(--r-sm); font-size:14px; font-weight:600; cursor:pointer; box-shadow:0 4px 20px rgba(192,112,64,.4),0 2px 8px rgba(28,25,23,.12); transition:background .15s,box-shadow .15s,transform .1s; z-index:5 }
.sb-fab:hover { background:#B06030; box-shadow:0 6px 24px rgba(192,112,64,.45),0 2px 8px rgba(28,25,23,.14) }
.sb-fab:active { transform:scale(.96) }

/* ═══ PATIENT SELECTOR ═══ */
.ha-pt-wrap { position:relative; flex-shrink:0 }
.ha-pt-pill { display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border-radius:20px; font-size:12px; font-weight:500; color:var(--t3); border:1.5px solid var(--bd); background:var(--srf2); cursor:pointer; transition:all .15s }
.ha-pt-pill:hover { border-color:var(--or-m); color:var(--or) }
.ha-pt-pill.has-pt { background:var(--or-l); border-color:var(--or-m); color:var(--or) }
.ha-pt-pill.open .ha-pt-chev { transform:rotate(180deg) }
.ha-pt-chev { transition:transform .2s }
.ha-pt-drop { position:absolute; bottom:calc(100% + 6px); left:0; min-width:200px; max-height:260px; overflow-y:auto; background:var(--srf); border:1px solid var(--bd); border-radius:var(--r-sm); box-shadow:var(--shadow); opacity:0; pointer-events:none; transform:translateY(4px); transition:opacity .15s,transform .15s; z-index:50 }
.ha-pt-drop.show { opacity:1; pointer-events:auto; transform:translateY(0) }
.ha-pt-item { display:flex; align-items:center; gap:8px; width:100%; padding:8px 14px; font-size:13px; color:var(--t2); text-align:left; cursor:pointer; border:none; background:none; transition:background .1s }
.ha-pt-item:hover { background:var(--srf2) }
.ha-pt-new { color:var(--or); font-weight:600 }
.ha-pt-divider { height:1px; background:var(--bd); margin:4px 0 }

/* ═══ PROFILE SETTINGS ═══ */
.prof-settings-list { display:flex; flex-direction:column; gap:0 }
.prof-setting-row { display:flex; align-items:center; justify-content:space-between; padding:10px 0; border-bottom:1px solid var(--bd) }
.prof-setting-row:last-child { border-bottom:none }
.prof-setting-info { display:flex; flex-direction:column; gap:1px }
.prof-setting-name { font-size:13.5px; font-weight:500; color:var(--t1) }
.prof-setting-sub { font-size:12px; color:var(--t3) }
.prof-setting-btn { padding:4px 12px; border-radius:16px; font-size:12px; font-weight:600; color:var(--or); background:var(--or-l); border:none; cursor:pointer; transition:background .15s }
.prof-setting-btn:hover { background:var(--or-m) }
.prof-setting-btn.danger { border-color:var(--red); color:var(--red); background:transparent }
.prof-setting-btn.danger:hover { background:var(--red-l) }
.prof-conn-list { display:flex; flex-direction:column; gap:2px }
.prof-conn-item { display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--bd) }
.prof-conn-item:last-child { border-bottom:none }
.prof-conn-icon { width:32px; height:32px; border-radius:8px; display:flex; align-items:center; justify-content:center; flex-shrink:0 }
.prof-conn-info { flex:1; min-width:0 }
.prof-conn-name { font-size:13px; font-weight:500; color:var(--t1) }
.prof-conn-sub { font-size:11px; color:var(--t4); margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.prof-conn-sub.connected { color:var(--grn) }
.prof-conn-btn { font-size:12px; font-weight:500; padding:5px 12px; border-radius:8px; border:1.5px solid var(--bd); background:var(--srf2); color:var(--t2); cursor:pointer; flex-shrink:0; transition:all .15s }
.prof-conn-btn:hover { background:var(--bd) }
.prof-conn-btn.connected { background:var(--grn-l); border-color:var(--grn); color:var(--grn) }

/* ═══ SUMMARY INDICATOR ═══ */
.summary-card { display:flex; gap:10px; align-items:flex-start; padding:10px 14px; background:var(--srf2); border:1px solid var(--bd); border-radius:var(--r-sm); margin:8px auto 16px; max-width:600px }
.summary-icon { width:24px; height:24px; border-radius:50%; background:var(--or-l); display:flex; align-items:center; justify-content:center; flex-shrink:0; color:var(--or); font-size:12px }
.summary-label { font-size:11px; font-weight:600; color:var(--t3); text-transform:uppercase; letter-spacing:.03em }
.summary-body { font-size:12.5px; color:var(--t2); line-height:1.4; margin-top:3px; display:none }
.summary-card.expanded .summary-body { display:block }

/* ═══ SOURCES SECTION ═══ */
.src-wrap { margin-top:16px; padding-top:8px }
.src-toggle { display:inline-flex; align-items:center; gap:5px; cursor:pointer; color:var(--or); font-size:14px; font-weight:500; background:none; border:none; padding:4px 0; transition:opacity .15s }
.src-toggle:hover { opacity:.8 }
.src-toggle .src-chev { transition:transform .2s; font-size:10px }
.src-toggle.open .src-chev { transform:rotate(180deg) }
.src-list { display:none; margin-top:10px; padding:0; list-style:none }
.src-toggle.open+.src-list { display:block }
.src-item { display:flex; gap:10px; align-items:flex-start; padding:8px 0; font-size:13px; line-height:1.45; color:var(--t2) }
.src-item+.src-item { border-top:1px solid var(--bd) }
.src-num { width:22px; height:22px; border-radius:50%; background:var(--or); color:#fff; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; flex-shrink:0; margin-top:1px }
.src-text { flex:1; word-break:break-word }
.src-doi { display:inline-flex; align-items:center; gap:2px; color:var(--or); font-size:12px; font-weight:500; text-decoration:none; margin-left:6px; white-space:nowrap }
.src-doi:hover { text-decoration:underline }
.src-loading { display:flex; align-items:center; gap:8px; margin-top:14px; padding-top:8px; color:var(--or); font-size:13.5px; font-weight:500 }
.src-loading-dots { display:inline-flex; gap:3px }
.src-loading-dots span { width:5px; height:5px; border-radius:50%; background:var(--or); opacity:.3; animation:srcPulse .9s ease-in-out infinite }
.src-loading-dots span:nth-child(2) { animation-delay:.15s }
.src-loading-dots span:nth-child(3) { animation-delay:.3s }
@keyframes srcPulse { 0%,100%{opacity:.3} 50%{opacity:1} }

/* ── Accessibility ── */

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

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

@media (hover: none) {
  .ci:active { background: var(--srf2) }
  .fb-icn:active { background: var(--srf2) }
  .spec-btn:active { border-color: var(--or) }
  .ip-qa:active { background: var(--or-m) }
  .ws-tab:active { background: var(--srf2) }
}
