/* =========================================================
   Kozani — Chat shell (sidebar + conversation + composer)
   Structure from the Claude Design "Kozani Empty State"
   artboard, Variation 1 "Guided and warm".
   Light surfaces; burgundy as the accent.
   ========================================================= */
@import url('brand.css?v=20260825');

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

/* =========================================================
   App shell
   ========================================================= */
.app {
  display: flex;
  height: 100dvh;
  background: linear-gradient(180deg, var(--card), var(--blush-50));
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.side {
  width: 250px;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background: linear-gradient(180deg, var(--blush-50), var(--blush-100));
  border-right: 1px solid var(--border);
}

.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 0;
  margin-bottom: 20px;
}

.side-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  min-width: 0;
}
.side-brand img { height: 34px; width: auto; flex: none; }
.side-brand span {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  color: var(--wine-600);
  letter-spacing: -.02em;
  line-height: 1;
}

.icon-btn {
  width: 32px;
  height: 32px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--wine-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.icon-btn:hover { background: var(--blush-200); color: var(--wine-600); }
.icon-btn svg { width: 18px; height: 18px; }

/* New conversation */
.btn-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 12px 10px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--wine-600), var(--wine-800));
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(109,21,43,.22);
  transition: filter .18s var(--ease), transform .1s var(--ease);
}
.btn-new:hover { filter: brightness(1.08); }
.btn-new:active { transform: translateY(1px); }
.btn-new svg { width: 18px; height: 18px; flex: none; }

/* Conversation list */
.convos {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0 -6px;
  padding: 0 6px;
}
.convos::-webkit-scrollbar { width: 8px; }
.convos::-webkit-scrollbar-button { height: 0; width: 0; }
.convos::-webkit-scrollbar-track { background: transparent; }
.convos::-webkit-scrollbar-thumb {
  background: var(--blush-300);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--radius-pill);
}
.convos { scrollbar-width: thin; scrollbar-color: var(--blush-300) transparent; }

.convo-group {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--wine-300);
  padding: 22px 10px 8px;
}
.convo-group:first-child { padding-top: 16px; }

.convo {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 3px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.convo > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.convo:hover { background: var(--blush-200); color: var(--text); }
.convo.is-active {
  background: var(--card);
  color: var(--text-soft);
  box-shadow: var(--shadow-1);
}

.convos-empty {
  padding: 18px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--faint);
}

/* Sidebar footer actions */
.side-foot {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-soft);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.side-link:hover { background: var(--blush-200); color: var(--text); }
.side-link svg { width: 18px; height: 18px; flex: none; }
.side-link .chev { margin-left: auto; width: 14px; height: 14px; }

.side-link.urgent {
  background: var(--alert-bg);
  border: 1px solid var(--alert-line);
  color: var(--wine-600);
  font-weight: 700;
  margin-top: 4px;
}
.side-link.urgent:hover { background: #FDE8E8; }

/* =========================================================
   MAIN
   ========================================================= */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Top bar. On desktop it exists only to hold the per-conversation
   actions (kebab), so it stays borderless and transparent there; on
   mobile it also carries the drawer toggle + brand and gets a rule. */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 12px 14px;
  background: transparent;
  min-height: 56px;
}
.topbar .side-brand span { font-size: 20px; }

/* Menu button and brand belong to the mobile drawer layout only. */
.topbar #btn-menu,
.topbar .side-brand { display: none; }

/* Push conversation actions to the right. */
.chat-actions {
  position: relative;
  margin-left: auto;
}
.chat-actions[hidden] { display: none; }

/* ---------- Kebab dropdown ---------- */
.chat-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 180px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  animation: menu-in .16s var(--ease) both;
}
.chat-menu[hidden] { display: none; }

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.chat-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  font: 500 .9rem/1.2 var(--font-body);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.chat-menu-item svg { width: 17px; height: 17px; flex: none; }
.chat-menu-item:hover { background: var(--blush-100); }
.chat-menu-item.danger { color: var(--alert); }
.chat-menu-item.danger:hover { background: #FFF1F1; }

/* ---------- Empty state ---------- */
.empty {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 40px;
  text-align: center;
  overflow-y: auto;
}
.empty[hidden] { display: none; }
.empty-inner { max-width: 600px; }

.empty-mark {
  width: 112px;
  height: auto;
  margin-bottom: 2px;
  filter: drop-shadow(0 8px 18px rgba(109,21,43,.12));
}

.empty-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 600;
  line-height: 1.14;
  color: var(--wine-800);
  letter-spacing: -.02em;
  margin: 16px 0 0;
  text-wrap: balance;
}

.empty-sub {
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--muted);
  margin: 14px 0 0;
  text-wrap: balance;
}

/* ---------- Conversation transcript ---------- */
.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 40px 20px;
  scroll-behavior: smooth;
}
.thread[hidden] { display: none; }
.thread::-webkit-scrollbar { width: 10px; }
.thread::-webkit-scrollbar-button { height: 0; width: 0; }
.thread::-webkit-scrollbar-track { background: transparent; }
.thread::-webkit-scrollbar-thumb {
  background: var(--blush-300);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--radius-pill);
}
.thread { scrollbar-width: thin; scrollbar-color: var(--blush-300) transparent; }

.thread-inner {
  width: 100%;
  max-width: 720px;
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;   /* newest content sits by the composer */
  gap: 14px;
}

.msg {
  max-width: 78%;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.68;
  border-radius: var(--radius-lg);
  overflow-wrap: anywhere;
  animation: msg-in .3s var(--ease) both;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.msg.bot {
  align-self: flex-start;
  background: var(--blush-100);
  border: 1px solid var(--blush-200);
  border-bottom-left-radius: 6px;
  color: var(--text);
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(160deg, var(--wine-600), var(--wine-800));
  border: 1px solid var(--wine-800);
  border-bottom-right-radius: 6px;
  color: #fff;
  box-shadow: var(--shadow-1);
}
.msg.error {
  align-self: center;
  background: var(--alert-bg);
  border: 1px solid var(--alert-line);
  color: var(--alert);
}

.msg > :first-child { margin-top: 0; }
.msg > :last-child { margin-bottom: 0; }
.msg p { margin: 0 0 10px; }
.msg ul, .msg ol { margin: 0 0 10px; padding-left: 1.3em; }
.msg li { margin: 4px 0; }
.msg a { color: var(--wine-600); text-decoration: underline; text-underline-offset: 2px; }
.msg.user a { color: #fff; }
.msg.bot strong { font-weight: 700; color: var(--wine-700); }
.msg.user strong { color: #fff; }
.msg code {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--wine-07);
  border-radius: 5px;
  padding: 1px 5px;
}
.msg pre {
  background: var(--wine-07);
  border: 1px solid var(--blush-200);
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
}
.msg pre code { background: none; padding: 0; }

/* Typing indicator */
.msg.typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 15px 18px;
}
.msg.typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--wine-400);
  animation: blink 1.3s infinite ease-in-out both;
}
.msg.typing span:nth-child(2) { animation-delay: .18s; }
.msg.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes blink {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40%           { opacity: 1;  transform: translateY(-3px); }
}

/* =========================================================
   COMPOSER
   ========================================================= */
.composer-wrap {
  flex: none;
  padding: 8px 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Suggestion chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  max-width: 720px;
}
.chips:empty { display: none; }
.chips[hidden] { display: none; }

.chip {
  padding: 9px 16px;
  border: 1px solid var(--blush-300);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--wine-600);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease),
              border-color .18s var(--ease), transform .1s var(--ease);
}
.chip:hover {
  background: var(--wine-600);
  border-color: var(--wine-600);
  color: #fff;
}
.chip:active { transform: translateY(1px); }

/* The input card */
.composer {
  width: 100%;
  max-width: 720px;
  background: var(--card);
  border: 1px solid var(--blush-200);
  border-radius: 18px;
  box-shadow: var(--shadow-2);
  padding: 14px 14px 10px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.composer:focus-within {
  border-color: var(--wine-400);
  box-shadow: var(--shadow-2), var(--ring);
}

#msg {
  display: block;
  width: 100%;
  height: 24px;              /* exactly one line; JS grows it as she types */
  min-height: 24px;
  max-height: 160px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  line-height: 24px;         /* match height so an empty box never overflows */
  color: var(--text);
  padding: 0 4px;            /* no vertical padding — it would force a scrollbar */
  margin-bottom: 10px;       /* breathing room above the action row instead */
  /* hidden until JS adds .is-tall, so an empty box shows no scrollbar */
  overflow-y: hidden;
}
#msg.is-tall { overflow-y: auto; }

/* Thin scrollbar for the rare long message, with no arrow buttons */
#msg::-webkit-scrollbar { width: 8px; }
#msg::-webkit-scrollbar-button { height: 0; width: 0; }
#msg::-webkit-scrollbar-track { background: transparent; }
#msg::-webkit-scrollbar-thumb {
  background: var(--blush-300);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--radius-pill);
}
#msg { scrollbar-width: thin; scrollbar-color: var(--blush-300) transparent; }
#msg::placeholder { color: var(--faint); }

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-mic {
  width: 42px;
  height: 42px;
  flex: none;
  border: 0;
  border-radius: 13px;
  background: var(--blush-100);
  color: var(--wine-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.btn-mic:hover { background: var(--blush-200); color: var(--wine-600); }
.btn-mic svg { width: 20px; height: 20px; }

#send {
  height: 42px;
  padding: 0 20px;
  flex: none;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--wine-600), var(--wine-800));
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(109,21,43,.2);
  transition: filter .18s var(--ease), transform .1s var(--ease), opacity .18s;
}
#send:hover { filter: brightness(1.08); }
#send:active { transform: translateY(1px); }
#send:disabled { opacity: .5; cursor: not-allowed; filter: none; }
#send svg { width: 17px; height: 17px; flex: none; }

.status {
  margin: 10px 0 0;
  min-height: 1.1em;
  font-size: 13px;
  color: var(--wine-400);
  font-style: italic;
  text-align: center;
}
.status:empty { min-height: 0; margin: 0; }

/* =========================================================
   Language flyout
   ========================================================= */
.lang-pop {
  /* Anchored to the viewport, not to <main>. This element lives inside
     <main> in the markup, so `position: absolute; left: 250px` measured
     from main's left edge -- which already starts after the sidebar --
     and the popup floated out in the middle of the conversation. Fixed
     positioning puts it beside the Language button in the sidebar. */
  position: fixed;
  left: 258px;
  bottom: 86px;
  width: 240px;
  /* Only English plus a short note, so no scrolling needed. */
  overflow: visible;
  background: var(--card);
  border: 1px solid var(--blush-200);
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(45,14,28,.16);
  padding: 6px;
  z-index: 100;
}
.lang-pop[hidden] { display: none; }
.lang-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: 400 14px/1.4 var(--font-body);
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
}
.lang-opt:hover { background: var(--blush-50); }
.lang-opt[aria-selected="true"] {
  background: var(--blush-100);
  color: var(--wine-600);
  font-weight: 700;
}
.lang-opt svg { width: 15px; height: 15px; flex: none; }

/* Only English is offered, so explain the limitation rather than
   listing languages that cannot be selected yet. */
.lang-note {
  margin: 6px 6px 2px;
  padding: 0 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

/* Backdrop for the mobile drawer */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(45,14,28,.42);
  z-index: 40;
  border: 0;
  padding: 0;
}
.scrim[hidden] { display: none; }

/* =========================================================
   Responsive — sidebar becomes a drawer
   ========================================================= */
@media (max-width: 860px) {
  .topbar {
    display: flex;
    background: var(--card);
    border-bottom: 1px solid var(--border);
  }
  .topbar #btn-menu,
  .topbar .side-brand { display: flex; }

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: 274px;
    transform: translateX(-100%);
    transition: transform .28s var(--ease);
    box-shadow: 0 0 40px rgba(45,14,28,.2);
  }
  .side.is-open { transform: none; }

  .empty { padding: 20px; }
  .empty-mark { width: 88px; }
  .empty-sub { font-size: 15px; }
  .thread { padding: 20px 16px 16px; }
  .msg { max-width: 88%; }
  .composer-wrap { padding: 0 16px 20px; }
  .chips { margin-bottom: 14px; }
  .lang-pop { left: 12px; right: 12px; width: auto; bottom: 76px; }
}

@media (min-width: 861px) {
  .side { transform: none !important; }
  .scrim { display: none !important; }
}

@media print {
  .side, .composer-wrap, .topbar { display: none; }
  .thread { overflow: visible; }
}

/* =========================================================
   Loading + busy states
   ========================================================= */

/* Shown while a conversation's history is being fetched, so the
   thread is never just blank during the round-trip. */
.thread-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  align-self: flex-start;
}
.thread-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blush-300);
  animation: thread-pulse 1.3s infinite ease-in-out both;
}
.thread-loading span:nth-child(2) { animation-delay: .18s; }
.thread-loading span:nth-child(3) { animation-delay: .36s; }

@keyframes thread-pulse {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40%           { opacity: 1;  transform: translateY(-3px); }
}

/* While Kozani is generating, the whole composer reads as inert. */
.composer.is-busy {
  opacity: .72;
}
.composer.is-busy #msg {
  cursor: not-allowed;
}

/* Chips are outside the form, so they get their own disabled styling. */
.chip:disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* =========================================================
   Modal (delete confirmation)
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none; }

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(45, 14, 28, .38);
  animation: fade-in .18s var(--ease) both;
}

.modal-card {
  position: relative;
  width: min(400px, 100%);
  padding: 28px 26px 22px;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  text-align: center;
  animation: modal-in .22s var(--ease) both;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.modal-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #FFF1F1;
  color: var(--alert);
}
.modal-icon svg { width: 22px; height: 22px; }

.modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}

.modal-body {
  font-size: .93rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 22px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-ghost,
.btn-danger {
  height: 46px;
  border-radius: 12px;
  font: 600 .95rem/1 var(--font-body);
  cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease),
              filter .16s var(--ease);
}

.btn-ghost {
  background: var(--card);
  border: 1px solid var(--blush-300);
  color: var(--text);
}
.btn-ghost:hover { background: var(--blush-50); }

.btn-danger {
  background: var(--alert);
  border: 1px solid var(--alert);
  color: #fff;
}
.btn-danger:hover { filter: brightness(1.08); }
.btn-danger:disabled { opacity: .6; cursor: not-allowed; filter: none; }

/* Stack the buttons on very narrow screens so neither is cramped. */
@media (max-width: 380px) {
  .modal-actions { grid-template-columns: 1fr; }
  .modal-actions .btn-danger { order: -1; }   /* primary action first */
}

/* =========================================================
   Settings modal
   Two-pane layout from the Claude Design "Kozani Settings"
   artboard. Only the Profile pane is built for now.
   ========================================================= */
.set-card {
  position: relative;
  display: flex;
  width: min(820px, 100%);
  /* Tall enough that Profile fits without scrolling on a normal
     laptop -- the account actions were below the fold at 560px, which
     made "Delete account" easy to miss. Still capped to the viewport,
     and .set-body scrolls if a shorter screen needs it. */
  height: min(640px, calc(100dvh - 40px));
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: modal-in .22s var(--ease) both;
}

/* ---------- Left nav ---------- */
.set-side {
  width: 232px;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  background: linear-gradient(180deg, var(--blush-50), var(--blush-100));
  border-right: 1px solid var(--border);
}

.set-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--wine-600);
}
.set-brand img { width: 26px; height: auto; }

.set-eyebrow {
  margin: 18px 8px 10px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--wine-400);
}

.set-nav { display: flex; flex-direction: column; gap: 2px; }

.set-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: 500 .92rem/1.2 var(--font-body);
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.set-nav-item svg { width: 17px; height: 17px; flex: none; }
.set-nav-item:hover { background: rgba(255,255,255,.6); }
.set-nav-item.is-active {
  background: var(--card);
  color: var(--wine-600);
  font-weight: 600;
  box-shadow: var(--shadow-1);
}

/* Signed-in identity, pinned bottom */
.set-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow-1);
}
.set-avatar {
  width: 32px; height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(165deg, var(--wine-500), var(--wine-700));
  color: #fff;
  font: 700 .85rem/1 var(--font-body);
}
.set-user-text { display: flex; flex-direction: column; min-width: 0; }
.set-user-text strong {
  font-size: .88rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.set-user-text small { font-size: .74rem; color: var(--muted); }

/* ---------- Right pane ---------- */
.set-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.set-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 26px 18px;
  border-bottom: 1px solid var(--border);
}
.set-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 3px;
}
.set-sub { font-size: .88rem; color: var(--muted); margin: 0; }

.set-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 26px 26px;
}

.set-msg {
  display: none;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .87rem;
  line-height: 1.5;
}
.set-msg.show { display: block; }
.set-msg.ok {
  background: #F1F8F4;
  border: 1px solid #C9E4D5;
  color: var(--success);
}
.set-msg.err {
  background: var(--alert-bg);
  border: 1px solid var(--alert-line);
  color: var(--alert);
}

.set-field { margin-bottom: 18px; }
.set-field label {
  display: block;
  margin-bottom: 6px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}
.set-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--blush-300);
  border-radius: 12px;
  font: inherit;
  font-size: .95rem;
  color: var(--text);
  background: var(--blush-50);
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease),
              background .18s var(--ease);
}
.set-field input::placeholder { color: var(--faint); }
.set-field input:focus {
  border-color: var(--wine-500);
  background: var(--card);
  box-shadow: var(--ring);
}
.set-hint { margin: 6px 0 0; font-size: .8rem; color: var(--muted); }

.set-save {
  height: 46px;
  padding: 0 22px;
  background: linear-gradient(135deg, var(--wine-600), var(--wine-800));
  color: #fff;
  border: 0;
  border-radius: 12px;
  font: 600 .95rem/1 var(--font-body);
  cursor: pointer;
  transition: filter .18s var(--ease), transform .1s var(--ease);
}
.set-save:hover { filter: brightness(1.08); }
.set-save:active { transform: translateY(1px); }
.set-save:disabled { opacity: .6; cursor: not-allowed; filter: none; }

/* ---------- Account actions ---------- */
.set-danger {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.set-danger h3 {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
.set-danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.set-danger-row:last-child { border-bottom: 0; }
.set-danger-row strong {
  display: block;
  font-size: .92rem;
  color: var(--text);
  margin-bottom: 2px;
}
.set-danger-row p {
  margin: 0;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 46ch;
}
.set-danger-btn { flex: none; padding: 0 18px; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .set-card {
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }
  .modal:has(.set-card) { padding: 0; }

  /* The sidebar becomes a stacked header: brand row, then the nav as
     horizontal tabs. The nav must stay visible -- hiding it (as an
     earlier version did) left the Account pane unreachable in
     portrait, since there is no other way to switch panes. */
  .set-side {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .set-eyebrow, .set-user { display: none; }

  .set-brand { padding: 0; }

  /* Tabs sit on the bottom edge of the header, underline style. */
  .set-nav {
    flex-direction: row;
    gap: 4px;
    margin: 0 -16px;
    padding: 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .set-nav::-webkit-scrollbar { display: none; }

  .set-nav-item {
    flex: none;
    padding: 10px 4px;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    box-shadow: none;
    white-space: nowrap;
  }
  .set-nav-item + .set-nav-item { margin-left: 18px; }
  .set-nav-item:hover { background: transparent; }
  .set-nav-item.is-active {
    background: transparent;
    box-shadow: none;
    border-bottom-color: var(--wine-600);
    color: var(--wine-600);
  }

  .set-head { padding: 18px 18px 14px; }
  .set-body { padding: 18px 18px 28px; }

  .set-danger-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .set-danger-btn { width: 100%; height: 46px; }
}

/* Settings panes: one visible at a time, driven by the left nav. */
.set-pane { display: none; }
.set-pane.is-active { display: block; animation: wc-fade .2s var(--ease) both; }
.set-pane[hidden] { display: none; }

@keyframes wc-fade {
  from { opacity: 0; transform: translateX(6px); }
  to   { opacity: 1; transform: none; }
}

/* The account rows are now their own pane, so the old .set-danger
   wrapper spacing moves onto the first row instead. */
#pane-account .set-danger-row:first-child { padding-top: 0; }

/* Settings pane scrollbar: same blush treatment as the login modal's
   .wc-scroll, so the two modals feel like one system. The transparent
   3px border + background-clip keeps the visible thumb thin and clear
   of the card's rounded corner; the zero-sized button rule removes the
   native up/down arrows. */
.set-body::-webkit-scrollbar { width: 8px; }
.set-body::-webkit-scrollbar-button {
  height: 0;
  width: 0;
  display: block;
  background: transparent;
}
.set-body::-webkit-scrollbar-track { background: transparent; }
.set-body::-webkit-scrollbar-track-piece { background: transparent; }
.set-body::-webkit-scrollbar-thumb {
  background: var(--blush-300);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--radius-pill);
}
.set-body::-webkit-scrollbar-thumb:hover {
  background: var(--wine-200);
  background-clip: content-box;
}
.set-body::-webkit-scrollbar-corner { background: transparent; }
.set-body {
  scrollbar-width: thin;
  scrollbar-color: var(--blush-300) transparent;
  /* Deliberately no overflow-x here. Setting one axis to `hidden`
     forces the computed value of the other, which is what broke touch
     scrolling on the login card. .set-body is genuinely meant to
     scroll vertically, so leave the x-axis alone. */
}
