/* ============================================================
   ArajanlatPro — bold "neo-brutalist" workspace
   Thick ink borders · hard offset shadows · chunky rounded
   corners · heavy display type · one flat violet accent.
   Sidebar + sortable quote table. Reference vibe:
   profiajanlat.hu — simple, high-contrast, confident.
   ============================================================ */

:root {
  --bg: #F3F2EE;
  --surface: #FFFFFF;
  --surface-alt: #F6F5F1;
  --ink: #14130F;
  --line: #14130F;

  --text: #14130F;
  --text-mute: #56544C;
  --text-faint: #8A887E;

  --accent: #6C5CE7;
  --accent-strong: #5A4AD1;
  --accent-soft: #ECEAFB;
  --accent-ink: #FFFFFF;

  --hair: #E3DFD4;

  --sent: #56544C;
  --sent-soft: #EEEDE8;
  --viewed: #2563EB;
  --viewed-soft: #E4ECFC;
  --accepted: #15803D;
  --accepted-soft: #E1F1E6;
  --expired: #C81E1E;
  --expired-soft: #FBE5E4;
  --warn: #B45309;
  --warn-soft: #FBEEDC;

  --bd: 2px solid var(--line);
  --bd-thick: 2.5px solid var(--line);
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --sh-sm: 3px 3px 0 var(--line);
  --sh: 4px 4px 0 var(--line);
  --sh-lg: 6px 6px 0 var(--line);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Poppins", var(--font);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #16150F;
  --surface: #201E17;
  --surface-alt: #262319;
  --ink: #F4F1E6;
  --line: #F4F1E6;

  --text: #F4F1E6;
  --text-mute: #B4AF9E;
  --text-faint: #837E6C;

  --accent: #8F80F5;
  --accent-strong: #A99DF8;
  --accent-soft: #262244;
  --accent-ink: #14130F;

  --hair: #38352A;

  --sent: #B4AF9E;
  --sent-soft: #2C2A20;
  --viewed: #6FA0F6;
  --viewed-soft: #1E2A44;
  --accepted: #58BE86;
  --accepted-soft: #17301F;
  --expired: #E8756B;
  --expired-soft: #351E1B;
  --warn: #DDA45C;
  --warn-soft: #342816;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
::selection { background: var(--accent); color: #fff; }

/* ============ App shell ============ */
.app {
  display: grid;
  grid-template-columns: 244px 1fr;
  min-height: 100vh;
}

/* ============ Sidebar ============ */
.sidebar {
  background: var(--surface);
  border-right: var(--bd-thick);
  padding: 1.15rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.side-brand { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.5rem 0.9rem; border-bottom: var(--bd); }
.brand-mark {
  width: 32px; height: 32px;
  border: var(--bd);
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--display);
  font-weight: 800; font-size: 1rem;
}
.brand-name { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.brand-name strong { font-weight: 800; }

.side-nav { display: flex; flex-direction: column; gap: 0.2rem; }
.side-section {
  font-size: 0.66rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-faint);
  padding: 0.5rem 0.6rem 0.3rem;
}
.side-section:not(:first-child) { margin-top: 0.5rem; }

.side-link {
  display: flex; align-items: center; gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 2px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--text-mute);
  font-size: 0.9rem; font-weight: 600;
  text-align: left;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.side-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.side-link:hover { background: var(--surface-alt); color: var(--text); }
.side-link.is-active {
  background: var(--accent-soft);
  border-color: var(--line);
  color: var(--text);
  box-shadow: var(--sh-sm);
}
.side-count {
  margin-left: auto;
  font-size: 0.74rem; font-weight: 800;
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
  min-width: 1.4rem; text-align: center;
  padding: 0 0.35rem;
  background: var(--surface);
}

.side-foot {
  margin-top: auto;
  display: flex; align-items: center; gap: 0.4rem;
  padding-top: 0.9rem;
  border-top: var(--bd);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  border: var(--bd);
  border-radius: 11px;
  padding: 0.58rem 1rem;
  font-family: var(--display);
  font-size: 0.9rem; font-weight: 700;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--sh-sm);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.12s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: var(--sh); }
.btn:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--line); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn-quiet { background: var(--surface); color: var(--text); }
.btn-ghost { background: var(--surface-alt); color: var(--text-mute); box-shadow: none; }
.btn-ghost:hover:not(:disabled) { color: var(--text); box-shadow: var(--sh-sm); }
.btn-block { width: 100%; justify-content: center; }

.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: var(--bd); border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--sh-sm);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.icon-btn:hover { transform: translate(-1px, -1px); box-shadow: var(--sh); }
.icon-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--line); }
.icon-btn svg { width: 17px; height: 17px; }

.lang-btn {
  font-family: var(--display);
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.03em;
  width: auto; padding: 0 0.6rem; height: 36px;
}

.avatar {
  width: 34px; height: 34px;
  border: var(--bd); border-radius: 50%;
  background: var(--accent-soft);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display);
  font-size: 0.78rem; font-weight: 800;
  margin-left: auto;
  box-shadow: var(--sh-sm);
}

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

/* ============ Main ============ */
.main { min-width: 0; padding: 1.9rem 2.1rem 3.5rem; max-width: 1180px; }

.main-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.main-head h1 { font-size: 1.8rem; font-weight: 800; }

.automation-note {
  margin-top: 0.6rem;
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.86rem; font-weight: 600; color: var(--text);
  background: var(--accent-soft);
  border: var(--bd);
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.8rem 0.3rem 0.62rem;
  box-shadow: var(--sh-sm);
}
.automation-note svg { width: 14px; height: 14px; color: var(--accent); flex-shrink: 0; }

/* ============ Pipeline summary + funnel ============ */
.pipeline-summary {
  margin: 1.8rem 0 1.6rem;
  padding-bottom: 1.6rem;
  border-bottom: var(--bd);
}
.ps-label {
  font-family: var(--display);
  font-size: 0.75rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-mute);
}
.ps-value {
  font-family: var(--display);
  font-size: 2.5rem; font-weight: 800;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  margin-top: 0.1rem;
  line-height: 1.05;
}
.ps-sub { font-size: 0.92rem; color: var(--text-mute); margin-top: 0.35rem; }
.ps-sub span:first-child, #summaryWin { font-weight: 800; color: var(--text); }
.ps-dot { margin: 0 0.5rem; color: var(--text-faint); }

.funnel {
  display: flex;
  gap: 4px;
  height: 16px;
  margin-top: 1.2rem;
  max-width: 620px;
}
.funnel-seg {
  height: 100%;
  border: 2px solid var(--line);
  border-radius: 5px;
  min-width: 10px;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.funnel-seg:hover { transform: translateY(-2px); box-shadow: 0 3px 0 var(--line); }
.funnel-seg.is-active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--line); }
.fseg-sent { background: var(--sent); }
.fseg-viewed { background: var(--viewed); }
.fseg-accepted { background: var(--accepted); }
.fseg-expired { background: var(--expired); }

/* ============ Toolbar ============ */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filter-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--display);
  font-size: 0.83rem; font-weight: 700;
  padding: 0.38rem 0.65rem 0.38rem 0.85rem;
  border: var(--bd);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-mute);
  box-shadow: var(--sh-sm);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.12s ease, color 0.12s ease;
}
.chip:hover { transform: translate(-1px, -1px); box-shadow: var(--sh); color: var(--text); }
.chip.is-active { background: var(--accent); color: #fff; }
.chip-count {
  font-size: 0.72rem; font-weight: 800;
  border: 2px solid currentColor;
  border-radius: var(--radius-pill);
  min-width: 1.3rem; text-align: center;
  padding: 0 0.3rem;
}

.search {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface);
  border: var(--bd);
  border-radius: 11px;
  padding: 0.42rem 0.7rem;
  width: 250px; max-width: 100%;
  color: var(--text-faint);
  box-shadow: var(--sh-sm);
}
.search:focus-within { box-shadow: var(--sh); }
.search svg { width: 16px; height: 16px; flex-shrink: 0; }
.search input {
  border: none; background: transparent; outline: none;
  font-size: 0.88rem; font-weight: 500; color: var(--text); width: 100%;
}
.search input::placeholder { color: var(--text-faint); font-weight: 400; }

/* ============ Quote table ============ */
.table-wrap {
  background: var(--surface);
  border: var(--bd);
  border-radius: var(--radius);
  box-shadow: var(--sh);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.quote-table { width: 100%; border-collapse: collapse; }

.quote-table thead th {
  text-align: left;
  font-family: var(--display);
  font-size: 0.72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute);
  padding: 0.8rem 1.15rem;
  background: var(--surface-alt);
  border-bottom: var(--bd);
  cursor: pointer; -webkit-user-select: none; user-select: none; white-space: nowrap;
}
.quote-table thead th.num { text-align: right; }
.quote-table thead th:hover { color: var(--text); }
.quote-table thead th span { position: relative; padding-right: 14px; }
.quote-table thead th span::after {
  content: "";
  position: absolute; right: 0; top: 50%; margin-top: -2px;
  width: 0; height: 0; opacity: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.quote-table thead th.sort-asc span::after { opacity: 1; border-bottom: 5px solid var(--accent); }
.quote-table thead th.sort-desc span::after { opacity: 1; border-top: 5px solid var(--accent); }

.qrow { transition: background 0.1s ease; cursor: pointer; }
.qrow td {
  padding: 0.85rem 1.15rem;
  border-bottom: 1.5px solid var(--hair);
  font-size: 0.9rem;
  vertical-align: middle;
}
.qrow:last-child td { border-bottom: none; }
.qrow:hover td { background: var(--accent-soft); }
.qrow:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }

.qrow .c-client { font-weight: 700; white-space: nowrap; }
.qdot {
  display: inline-block;
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid var(--line);
  margin-right: 0.6rem; vertical-align: middle;
}
.qdot-sent { background: var(--sent); }
.qdot-viewed { background: var(--viewed); }
.qdot-accepted { background: var(--accepted); }
.qdot-expired { background: var(--expired); }

.qrow .c-amount { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qrow .c-date { color: var(--text-mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
.c-fu .fu { font-size: 0.85rem; font-weight: 600; color: var(--text-mute); display: inline-flex; align-items: center; gap: 0.4rem; }
.c-fu .fu::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.c-fu .fu.plain::before, .c-fu .fu.muted::before { display: none; }
.c-fu .fu.muted { color: var(--text-faint); font-weight: 500; }
.c-fu .fu.soon { color: var(--warn); }
.c-fu .fu.due { color: var(--expired); font-weight: 800; }
.c-fu .fu.due::before { animation: fuPulse 1.3s ease-in-out infinite; }

.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--display);
  font-size: 0.75rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.03em;
  padding: 0.22rem 0.6rem;
  border: 2px solid currentColor;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-sent { color: var(--sent); background: var(--sent-soft); }
.pill-viewed { color: var(--viewed); background: var(--viewed-soft); }
.pill-accepted { color: var(--accepted); background: var(--accepted-soft); }
.pill-expired { color: var(--expired); background: var(--expired-soft); }

.table-empty { padding: 2.75rem 1rem; text-align: center; font-size: 0.92rem; font-weight: 600; color: var(--text-faint); }
.table-empty[hidden] { display: none; }

/* ============ Footer ============ */
.page-footer {
  margin-top: 2.5rem;
  padding-top: 1.4rem;
  border-top: var(--bd);
  font-size: 0.84rem; color: var(--text-faint);
}
.page-footer-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }

/* ---------- Amethyst Nexalune credit badge ---------- */
.page-footer-credit {
  margin-top: 1.1rem;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
}
.an-credit-label { font-size: 0.8rem; color: var(--text-faint); }
.an-credit {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit;
  padding: 0.6rem 1.1rem 0.6rem 0.8rem;
  background: #1c1433;
  border: var(--bd);
  border-radius: var(--radius);
  box-shadow: var(--sh-sm);
  transition: transform 0.2s ease, filter 0.2s ease;
}
.an-credit:hover { transform: translateY(-1px); filter: brightness(1.14); }
.an-credit-logo {
  width: 34px; height: 34px; flex: 0 0 34px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(140, 84, 214, 0.4));
}
.an-credit-text { display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.an-credit-name {
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; white-space: nowrap;
  color: #146fd1;
  padding-bottom: 3px;
  border-bottom: 2px solid #d8b765;
}
.an-credit-tagline {
  align-self: center; width: fit-content; margin-top: 5px;
  font-size: 0.68rem; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; text-align: center;
  color: #f5f3fb;
  text-decoration-line: underline;
  text-decoration-color: #146fd1;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* ============ Badge (drawer) ============ */
.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--display);
  font-size: 0.76rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.28rem 0.7rem;
  border: 2px solid currentColor;
  border-radius: var(--radius-pill);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.status-sent { color: var(--sent); background: var(--sent-soft); }
.badge.status-viewed { color: var(--viewed); background: var(--viewed-soft); }
.badge.status-accepted { color: var(--accepted); background: var(--accepted-soft); }
.badge.status-expired { color: var(--expired); background: var(--expired-soft); }

/* ============ Drawer ============ */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 19, 15, 0.4);
  z-index: 40;
  visibility: hidden; opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}
.drawer-backdrop.show { visibility: visible; opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 400px; max-width: 100%;
  background: var(--surface);
  border-left: var(--bd-thick);
  padding: 1.75rem;
  box-shadow: -8px 0 0 rgba(20, 19, 15, 0.06);
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
}
.drawer-backdrop.show .drawer { transform: translateX(0); }

.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.drawer-client { font-family: var(--display); font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.drawer-amount { font-size: 1rem; font-weight: 700; color: var(--text-mute); margin-top: 0.2rem; font-variant-numeric: tabular-nums; }

.drawer-section { margin-top: 1.8rem; }
.drawer-section h3 {
  font-family: var(--display);
  font-size: 0.72rem; font-weight: 800;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 0.9rem;
}

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.timeline li { display: flex; gap: 0.7rem; font-size: 0.9rem; position: relative; }
.timeline li:not(:last-child)::after {
  content: "";
  position: absolute; left: 3.5px; top: 1.1rem; bottom: -0.9rem;
  width: 2px; background: var(--line);
}
.timeline .tl-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--line);
  margin-top: 0.35rem; flex-shrink: 0;
  z-index: 1;
}
.timeline .tl-label { color: var(--text-mute); font-weight: 600; }

.drawer-note { font-size: 0.92rem; color: var(--text-mute); }

.drawer-actions { margin-top: 2rem; display: flex; flex-direction: column; gap: 0.65rem; }
.drawer-actions .btn { justify-content: center; padding: 0.72rem 1rem; }

/* ============ Modals ============ */
.modal-backdrop {
  display: flex;
  position: fixed; inset: 0;
  background: rgba(20, 19, 15, 0.44);
  z-index: 50;
  padding: 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  visibility: hidden; opacity: 0; pointer-events: none;
  transition: opacity 0.16s ease, visibility 0.16s ease;
}
.modal-backdrop.show { visibility: visible; opacity: 1; pointer-events: auto; }

.modal {
  position: relative;
  margin: auto;
  background: var(--surface);
  border: var(--bd-thick);
  border-radius: var(--radius-lg);
  padding: 1.7rem;
  width: 100%; max-width: 430px;
  box-shadow: var(--sh-lg);
  transform: translateY(14px);
  transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.modal-backdrop.show .modal { transform: none; }
.modal-x { position: absolute; top: 0.85rem; right: 0.85rem; z-index: 2; font-size: 1.3rem; line-height: 1; }

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.15rem; }
.modal-head h3 { font-size: 1.2rem; font-weight: 800; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.5rem; }

.intro-modal { max-width: 470px; text-align: center; }
.intro-lang-btn { position: absolute; top: 0.85rem; left: 0.85rem; }
.intro-tag {
  display: inline-block;
  font-family: var(--display);
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em;
  color: #fff; background: var(--accent);
  border: var(--bd);
  padding: 0.22rem 0.7rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--sh-sm);
  margin-bottom: 0.95rem;
}
.intro-brand {
  font-family: var(--display);
  font-size: 1.7rem; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.1;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.intro-brand strong { font-weight: 800; }
.intro-tagline { font-size: 0.95rem; font-weight: 600; color: var(--text-mute); line-height: 1.35; margin-bottom: 1.1rem; }
.intro-purpose {
  font-size: 0.9rem; color: var(--text);
  line-height: 1.6; text-align: left;
  margin-bottom: 1rem;
}
.intro-body {
  font-size: 0.82rem; color: var(--text-mute);
  line-height: 1.55; text-align: left;
  background: var(--surface-alt);
  border: var(--bd);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  margin-bottom: 1.4rem;
}

.form-grid { display: grid; gap: 1rem; }
.form-row label { display: block; font-family: var(--display); font-size: 0.82rem; font-weight: 700; color: var(--text-mute); margin-bottom: 0.4rem; }
.form-row input, .form-row textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: var(--bd);
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  background: var(--surface);
  color: var(--text);
  transition: box-shadow 0.12s ease;
}
.form-row input:focus, .form-row textarea:focus { outline: none; box-shadow: var(--sh-sm); }
.form-row textarea { resize: vertical; min-height: 4rem; }

.customer-modal { max-width: 460px; }
.customer-eyebrow {
  font-family: var(--display);
  font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.14em; color: var(--accent);
  margin-bottom: 0.5rem;
}
.customer-modal h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.55rem; }
.customer-sub { font-size: 0.9rem; color: var(--text-mute); margin-bottom: 1.3rem; }

.customer-summary {
  background: var(--surface-alt);
  border: var(--bd);
  border-radius: var(--radius);
  padding: 0.3rem 1rem;
}
.customer-summary > div {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 0;
  font-size: 0.92rem;
}
.customer-summary > div + div { border-top: 2px solid var(--line); }
.customer-summary span { color: var(--text-mute); font-weight: 600; }
.customer-summary strong { font-weight: 800; font-variant-numeric: tabular-nums; }
.customer-actions { margin-top: 1.4rem; }

/* ============ Toasts ============ */
.toast-stack { position: fixed; bottom: 1.5rem; right: 1.5rem; display: flex; flex-direction: column; gap: 0.7rem; z-index: 60; }
.toast {
  background: var(--surface);
  border: var(--bd);
  border-left: 6px solid var(--accent);
  border-radius: 11px;
  padding: 0.8rem 1.05rem;
  box-shadow: var(--sh);
  font-size: 0.88rem;
  min-width: 260px; max-width: 340px;
  color: var(--text-mute);
  animation: toastIn 0.26s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.toast strong { display: block; margin-bottom: 0.1rem; color: var(--text); font-family: var(--display); font-weight: 800; }

/* ============ Motion ============ */
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rowFlash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
@keyframes rowAccept { 0%, 40% { background: var(--accepted-soft); } 100% { background: transparent; } }
@keyframes fuPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.8); } }
@keyframes toastIn { from { opacity: 0; transform: translate(16px, 0); } to { opacity: 1; transform: none; } }
@keyframes valueBump { 0% { transform: scale(1); } 35% { transform: scale(1.04); } 100% { transform: scale(1); } }

.qrow.row-in td { animation: rowIn 0.28s ease both; }
.qrow.just-moved td { animation: rowFlash 1.1s ease; }
.qrow.just-accepted td { animation: rowAccept 1.5s ease; }
.ps-value.bump { animation: valueBump 0.5s ease; transform-origin: left center; display: inline-block; }

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

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto;
    flex-direction: row; align-items: center; gap: 0.6rem;
    padding: 0.6rem 1rem;
    border-right: none; border-bottom: var(--bd-thick);
    overflow-x: auto;
  }
  .side-brand { border: none; padding: 0 0.5rem 0 0; flex-shrink: 0; }
  .side-nav { flex-direction: row; gap: 0.3rem; }
  .side-section { display: none; }
  .side-link span:not(.side-count) { display: none; }
  .side-link.is-active span:not(.side-count) { display: inline; }
  .side-link { width: auto; padding: 0.5rem; flex-shrink: 0; }
  .side-count { display: none; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: none; flex-shrink: 0; }
  .main { padding: 1.5rem 1.25rem 3rem; }
}

@media (max-width: 620px) {
  .sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand foot" "nav nav";
    row-gap: 0.55rem;
    overflow: visible;
    padding: 0.6rem 1rem 0.7rem;
  }
  .side-brand { grid-area: brand; }
  .side-foot { grid-area: foot; margin: 0; }
  .side-nav { grid-area: nav; min-width: 0; overflow-x: auto; padding: 0 5px 5px 0; }
  .toast-stack { left: 1rem; right: 1rem; bottom: 1rem; }
  .toast { min-width: 0; max-width: none; }
  .modal { padding: 1.4rem 1.25rem; }
  .modal-actions { flex-wrap: wrap-reverse; }
  .modal-actions .btn { flex: 1 1 auto; justify-content: center; }
  .main-head { flex-direction: column; }
  .main-head h1 { font-size: 1.5rem; }
  .toolbar { align-items: stretch; }
  .search { width: 100%; }
  .quote-table thead th:nth-child(3), .qrow .c-date { display: none; }
  .ps-value { font-size: 2rem; }
  .drawer { width: 100%; border-left: none; }
  .page-footer-row { flex-direction: column; }
}

@media (max-width: 400px) {
  .avatar { display: none; }
}
