:root {
  --red: #e30613;
  --red-dark: #c9000b;
  --red-soft: #fff1f2;
  --green: #16a34a;
  --green-soft: #eaf8ee;
  --orange: #f97316;
  --orange-soft: #fff3e8;
  --blue: #1d72d2;
  --blue-soft: #eaf3ff;
  --text: #111827;
  --muted: #667085;
  --line: #e5e7eb;
  --line-strong: #d0d5dd;
  --surface: #ffffff;
  --bg: #f8f9fb;
  --shadow: 0 8px 24px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
body { margin: 0; font-size: 15px; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell { display: flex; min-height: 100vh; background: var(--bg); }
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(248, 249, 251, .82);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
  backdrop-filter: blur(8px);
}
.is-page-loading .page-loader {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.page-loader-card {
  min-width: 260px;
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 24px 70px rgba(16,24,40,.12);
}
.page-loader-mark { width: 34px; height: 34px; object-fit: contain; flex: 0 0 34px; }
.page-loader-copy { display: grid; gap: 2px; min-width: 0; }
.page-loader-copy strong { font-size: 17px; line-height: 1.1; }
.page-loader-copy small { color: var(--muted); font-weight: 650; }
.page-loader-spinner, .btn-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(227,6,19,.18);
  border-top-color: var(--red);
  animation: spin .72s linear infinite;
}
.page-loader-spinner { margin-left: auto; }
.btn-spinner {
  width: 16px;
  height: 16px;
  border-color: rgba(255,255,255,.38);
  border-top-color: #fff;
  flex: 0 0 16px;
}
.btn-secondary .btn-spinner, .btn-muted .btn-spinner, .quick-item .btn-spinner, .icon-button .btn-spinner {
  border-color: rgba(227,6,19,.18);
  border-top-color: var(--red);
}
form.is-submitting { cursor: wait; }
button.is-loading, .btn.is-loading, .quick-item.is-loading {
  cursor: wait;
  pointer-events: none;
  opacity: .94;
}
button.is-loading .icon, .btn.is-loading .icon, .quick-item.is-loading .icon {
  display: none;
}
.sidebar { width: 264px; flex: 0 0 264px; background: #fff; border-right: 1px solid var(--line); min-height: 100vh; position: fixed; left: 0; top: 0; bottom: 0; padding: 28px 10px 24px; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 14px 34px; font-size: 28px; font-weight: 800; min-width: 0; }
.brand-logo { display: block; width: 152px; max-width: 100%; height: auto; }
.brand-icon { display: inline-block; width: 29px; height: 29px; object-fit: contain; flex: 0 0 auto; }
.brand-icon.small { width: 22px; height: 22px; flex-basis: 22px; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 29px; height: 29px; border-radius: 4px; background: var(--red); color: #fff; font-size: 24px; line-height: 1; font-weight: 800; box-shadow: inset 0 -1px 0 rgba(0,0,0,.12); }
.brand-mark.small { width: 22px; height: 22px; font-size: 18px; border-radius: 4px; flex: 0 0 22px; }
.side-nav { display: grid; gap: 8px; }
.side-nav a { display: flex; align-items: center; gap: 14px; height: 44px; border-radius: 4px; padding: 0 18px; color: #1f2937; border-left: 2px solid transparent; font-weight: 560; }
.side-nav a:hover { background: #fbfbfc; }
.side-nav a.is-active { color: var(--red); background: linear-gradient(90deg, rgba(227,6,19,.12), rgba(227,6,19,.04)); border-left-color: var(--red); font-weight: 750; }
.nav-count-badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
}
.side-nav a.is-active .nav-count-badge { background: var(--red); color: #fff; }
.side-nav a.ai-nav-focus {
  color: var(--red);
  background: linear-gradient(90deg, rgba(227,6,19,.16), rgba(227,6,19,.06));
  border-left-color: var(--red);
  box-shadow: 0 0 0 3px rgba(227,6,19,.08);
  animation: aiNavFocus .9s ease-in-out infinite;
}
.side-nav a.has-attention .nav-attention { margin-left: auto; width: 20px; height: 20px; color: var(--red); position: relative; display: inline-flex; align-items: center; justify-content: center; }
.side-nav a.has-attention .nav-attention .icon { width: 18px; height: 18px; }
.side-nav a.has-attention .nav-attention::before,
.side-nav a.has-attention .nav-attention::after {
  position: absolute;
  top: 50%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
  z-index: 80;
}
.side-nav a.has-attention .nav-attention::before {
  content: "";
  left: calc(100% + 6px);
  width: 9px;
  height: 9px;
  background: #111827;
  border-left: 1px solid rgba(255,255,255,.08);
  border-bottom: 1px solid rgba(255,255,255,.08);
  transform: translateY(-50%) rotate(45deg) translateX(-4px);
}
.side-nav a.has-attention .nav-attention::after {
  content: attr(data-tooltip);
  left: calc(100% + 11px);
  transform: translateY(-50%) translateX(-4px);
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  background: #111827;
  color: #fff;
  box-shadow: 0 14px 34px rgba(16,24,40,.22);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1;
  font-weight: 760;
}
.side-nav a.has-attention .nav-attention:hover::before,
.side-nav a.has-attention .nav-attention:hover::after,
.side-nav a.has-attention:focus-visible .nav-attention::before,
.side-nav a.has-attention:focus-visible .nav-attention::after {
  opacity: 1;
  visibility: visible;
}
.side-nav a.has-attention .nav-attention:hover::before,
.side-nav a.has-attention:focus-visible .nav-attention::before {
  transform: translateY(-50%) rotate(45deg) translateX(0);
}
.side-nav a.has-attention .nav-attention:hover::after,
.side-nav a.has-attention:focus-visible .nav-attention::after {
  transform: translateY(-50%) translateX(0);
}
.icon { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; flex: 0 0 auto; }
.icon svg { width: 100%; height: 100%; }
.swiss-note { margin-top: auto; border-top: 1px solid var(--line); padding: 18px 14px 6px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.swiss-note strong { color: var(--text); font-size: 13px; }

.main { margin-left: 264px; width: calc(100% - 264px); min-height: 100vh; }
.topbar { height: 78px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 24px; padding: 0 32px; position: sticky; top: 0; z-index: 10; }
.org-switcher { position: relative; flex: 0 0 auto; }
.org-switcher summary { list-style: none; cursor: pointer; }
.org-switcher summary::-webkit-details-marker { display: none; }
.org-switch { display: flex; align-items: center; gap: 10px; height: 44px; min-width: 246px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; font-weight: 560; }
.org-switch:hover, .org-switcher[open] .org-switch { border-color: #b9c2cf; box-shadow: 0 8px 20px rgba(16,24,40,.06); }
.org-switch > span:not(.icon) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-switch .icon:last-child { margin-left: auto; width: 16px; height: 16px; color: var(--muted); }
.org-switcher[open] .org-switch .icon:last-child { transform: rotate(90deg); }
.org-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(16,24,40,.16);
  padding: 10px;
  z-index: 80;
}
.org-menu-title {
  padding: 5px 6px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.org-menu-list { display: grid; gap: 4px; max-height: 260px; overflow: auto; padding-bottom: 8px; }
.org-menu-list form { margin: 0; }
.org-menu-item {
  width: 100%;
  min-height: 52px;
  border: 1px solid transparent;
  border-radius: 6px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}
button.org-menu-item { cursor: pointer; }
button.org-menu-item:hover, button.org-menu-item:focus-visible { border-color: #edf0f4; background: #fbfbfc; outline: none; }
.org-menu-item.is-active { border-color: #fecdd3; background: var(--red-soft); }
.org-menu-item.is-active .icon { width: 18px; height: 18px; color: var(--red); }
.org-menu-avatar {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #111827;
  color: #fff;
  font-size: 12px;
  font-weight: 850;
}
.org-menu-copy { display: grid; gap: 2px; min-width: 0; }
.org-menu-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
.org-menu-copy small { color: var(--muted); font-size: 12px; font-weight: 650; }
.org-create-form {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding: 12px 2px 0;
  display: grid;
  gap: 8px;
}
.org-create-form label { color: #344054; font-size: 13px; font-weight: 750; padding: 0 4px; }
.org-create-row { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 8px; }
.org-create-row input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 11px;
  outline: none;
}
.org-create-row input:focus { border-color: rgba(227,6,19,.45); box-shadow: 0 0 0 3px rgba(227,6,19,.06); }
.org-create-row button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--red);
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.org-create-row button:hover { background: var(--red-dark); }
.org-create-row button .icon { width: 19px; height: 19px; }
.global-search { position: relative; flex: 1; max-width: 470px; margin: 0 auto; }
.global-search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #475467; width: 19px; height: 19px; }
.global-search input { width: 100%; height: 44px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 0 14px 0 42px; color: var(--text); outline: none; background: #fff; }
.top-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.bell, .icon-button { border: 0; background: transparent; color: #1f2937; cursor: pointer; padding: 4px; position: relative; }
.icon-button:hover { color: var(--red); }
.icon-button.danger { color: var(--red); }
.icon-button.danger:hover { background: var(--red-soft); border-radius: 5px; }
.bell span { position: absolute; right: 3px; top: 3px; width: 8px; height: 8px; border-radius: 999px; background: var(--red); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #0f4c81; color: #fff; font-weight: 800; }
.user-chip strong { display: block; font-size: 14px; }
.user-chip small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.profile-menu { position: relative; }
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-summary {
  min-height: 44px;
  cursor: pointer;
  list-style: none;
}
.profile-summary .icon { width: 17px; height: 17px; color: var(--muted); transform: rotate(90deg); transition: transform .16s ease; }
.profile-menu[open] .profile-summary .icon { transform: rotate(-90deg); }
.profile-avatar { position: relative; }
.notification-dot {
  position: absolute;
  right: -4px;
  top: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 850;
}
.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(320px, calc(100vw - 28px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(16,24,40,.14);
  z-index: 90;
}
.profile-dropdown-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.profile-dropdown-head div { min-width: 0; display: grid; gap: 2px; }
.profile-dropdown-head strong, .profile-dropdown-head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-dropdown-head small { color: var(--muted); }
.profile-dropdown form { margin: 0; }
.profile-dropdown-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-weight: 700;
}
.profile-dropdown-item:hover { background: #fbfbfc; color: var(--red); }
.profile-dropdown-item .icon { width: 18px; height: 18px; color: currentColor; }
.profile-dropdown-item.danger { color: var(--red); }
.profile-menu-count {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  font-size: 12px;
}
.content { padding: 30px 32px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.page-title h1 { font-size: 30px; line-height: 1.1; margin: 0 0 8px; letter-spacing: 0; }
.page-title p { margin: 0; color: var(--muted); font-size: 16px; }
.page-actions { display: flex; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.page-actions form { display: inline-flex; }
.page-back-link { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 12px; color: var(--muted); font-weight: 750; }
.page-back-link:hover { color: var(--red); }
.page-back-link .back-icon { width: 17px; height: 17px; transform: rotate(180deg); }

.btn { min-height: 46px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--line-strong); padding: 0 18px; font-weight: 760; background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:disabled { cursor: not-allowed; opacity: .58; box-shadow: none; }
.btn .icon { width: 20px; height: 20px; }
.btn-primary { background: linear-gradient(180deg, #e30613, #cc000b); border-color: var(--red); color: #fff; box-shadow: 0 8px 18px rgba(227,6,19,.18); }
.btn-secondary { color: var(--red); border-color: var(--red); background: #fff; }
.btn-muted { color: var(--text); background: #fff; }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.floating-save-button {
  position: fixed;
  right: max(96px, calc(env(safe-area-inset-right) + 96px));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 900;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--red);
  border-radius: 6px;
  padding: 0 24px;
  background: linear-gradient(180deg, #e30613, #cc000b);
  color: #fff;
  box-shadow: 0 14px 34px rgba(227,6,19,.24);
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.floating-save-button:hover { background: linear-gradient(180deg, #f00716, #c9000b); }
.floating-save-button.is-loading { cursor: wait; }
.ai-assistant {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 930;
  display: grid;
  justify-items: end;
  gap: 12px;
  pointer-events: none;
}
.ai-mic-button {
  position: relative;
  width: 58px;
  height: 58px;
  border: 1px solid var(--red);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #e30613, #c9000b);
  color: #fff;
  box-shadow: 0 18px 38px rgba(227, 6, 19, .28);
  cursor: pointer;
  pointer-events: auto;
}
.ai-mic-button:hover { background: linear-gradient(180deg, #f00716, #b7000a); }
.ai-mic-button:focus-visible { outline: 3px solid rgba(227, 6, 19, .22); outline-offset: 3px; }
.ai-mic-button .icon {
  width: 26px;
  height: 26px;
  transition: opacity .14s ease, transform .14s ease;
}
.ai-mic-button.is-recording {
  background: linear-gradient(180deg, #f00716, #b7000a);
  box-shadow: 0 0 0 8px rgba(227, 6, 19, .12), 0 18px 38px rgba(227, 6, 19, .3);
}
.ai-mic-button.is-recording.has-voice {
  animation: aiMicPulse 1.2s ease-in-out infinite;
}
.ai-mic-button.is-recording .ai-mic-icon {
  opacity: 0;
  transform: scale(.72);
}
.ai-mic-button.is-busy { cursor: wait; opacity: .95; }
.ai-mic-button.is-busy .icon { opacity: 0; }
.ai-mic-button.is-busy .ai-voice-meter { opacity: 0; }
.ai-mic-button.is-busy::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .78s linear infinite;
}
.ai-voice-meter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  opacity: 0;
  pointer-events: none;
  transform: scale(.94);
  transition: opacity .14s ease, transform .14s ease;
}
.ai-mic-button.is-recording .ai-voice-meter {
  opacity: 1;
  transform: scale(1);
}
.ai-voice-meter span {
  width: 3px;
  height: 25px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 12px rgba(255,255,255,.24);
  opacity: .62;
  transform: scaleY(.18);
  transform-origin: center;
  transition: transform .07s linear, opacity .1s ease;
}
.ai-assistant-panel {
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 22px 60px rgba(16,24,40,.18);
  padding: 14px;
  pointer-events: auto;
}
.ai-assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}
.ai-assistant-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ai-assistant-head strong { font-size: 14px; line-height: 1.1; }
.ai-assistant-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ai-assistant-head-actions span {
  color: var(--red);
  font-size: 12px;
  font-weight: 820;
  white-space: nowrap;
}
.ai-assistant-voice {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f2f4f7;
  color: #344054;
  cursor: pointer;
}
.ai-assistant-voice:hover { background: var(--red-soft); color: var(--red); }
.ai-assistant-voice:focus-visible { outline: 3px solid rgba(227, 6, 19, .18); outline-offset: 2px; }
.ai-assistant-voice .icon { width: 17px; height: 17px; }
.ai-assistant-voice .voice-off { display: none; }
.ai-assistant-voice.is-muted .voice-on { display: none; }
.ai-assistant-voice.is-muted .voice-off { display: inline-flex; }
.ai-assistant-close {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f2f4f7;
  color: var(--muted);
  font-size: 16px;
  font-weight: 820;
  line-height: 1;
  cursor: pointer;
}
.ai-assistant-close:hover { background: var(--red-soft); color: var(--red); }
.ai-assistant-close:focus-visible { outline: 3px solid rgba(227, 6, 19, .18); outline-offset: 2px; }
.ai-assistant-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.ai-assistant-panel p + p { margin-top: 8px; }
.ai-assistant-panel [data-ai-assistant-transcript] {
  color: var(--text);
  font-weight: 650;
}
.ai-assistant-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.ai-assistant-actions[hidden] { display: none; }
.ai-assistant-confirmation-card {
  display: grid;
  gap: 8px;
}
.ai-assistant-edit {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fafb;
}
.ai-assistant-edit label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}
.ai-assistant-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ai-assistant-edit-control {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.ai-assistant-edit-control:focus {
  border-color: rgba(227, 6, 19, .55);
  outline: 3px solid rgba(227, 6, 19, .12);
}
.ai-assistant-action {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--red);
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 780;
  text-align: left;
  cursor: pointer;
}
.ai-assistant-action:hover { background: #c9000b; }
.ai-assistant-action:disabled { cursor: wait; opacity: .72; }

@keyframes aiMicPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes aiNavFocus {
  0%, 100% { transform: translateX(0); box-shadow: 0 0 0 3px rgba(227,6,19,.08); }
  50% { transform: translateX(4px); box-shadow: 0 0 0 5px rgba(227,6,19,.12); }
}

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; min-height: 112px; padding: 22px; display: flex; align-items: center; gap: 20px; box-shadow: var(--shadow); }
.stat-icon { width: 60px; height: 60px; border-radius: 7px; background: var(--red-soft); color: var(--red); display: flex; align-items: center; justify-content: center; flex: 0 0 60px; }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.orange { background: var(--orange-soft); color: var(--orange); }
.stat-card label { color: #374151; display: block; margin-bottom: 6px; }
.stat-card strong { font-size: 24px; line-height: 1; display: block; }
.stat-card small { color: var(--muted); display: block; margin-top: 14px; }
.trend-up { color: var(--green); }
.trend-warn { color: var(--red); }

.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 22px; }
.clients-table-section { display: grid; gap: 22px; }
.clients-table {
  table-layout: fixed;
  min-width: 1040px;
}
.clients-table th:nth-child(1), .clients-table td:nth-child(1) { width: 24%; }
.clients-table th:nth-child(2), .clients-table td:nth-child(2) { width: 13%; }
.clients-table th:nth-child(3), .clients-table td:nth-child(3) { width: 10%; }
.clients-table th:nth-child(4), .clients-table td:nth-child(4) { width: 22%; }
.clients-table th:nth-child(5), .clients-table td:nth-child(5) { width: 12%; }
.clients-table th:nth-child(6), .clients-table td:nth-child(6) { width: 7%; }
.clients-table th:nth-child(7), .clients-table td:nth-child(7) { width: 9%; }
.clients-table th:nth-child(8), .clients-table td:nth-child(8) { width: 110px; }
.clients-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.clients-table .client-mini {
  min-width: 0;
}
.clients-table .client-mini strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.documents-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); overflow: hidden; }
.panel.pad { padding: 20px; }
.panel-head { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.panel-title { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 760; margin: 0; }
.panel-link { color: var(--red); font-weight: 650; font-size: 14px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.toolbar .form-control { max-width: 320px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { color: #4b5563; font-size: 13px; text-align: left; font-weight: 650; background: #fafafa; }
.table th, .table td { padding: 14px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { font-size: 14px; }
.table tr:hover td { background: #fcfcfd; }
.table tr[data-row-href] { cursor: pointer; }
.table tr[data-row-href]:focus-visible td { outline: 2px solid rgba(227,6,19,.35); outline-offset: -2px; background: #fff8f8; }
.documents-table {
  table-layout: fixed;
  min-width: 1080px;
}
.documents-table th,
.documents-table td {
  padding-left: 12px;
  padding-right: 12px;
  vertical-align: middle;
}
.documents-table .document-preview-col { width: 62px; }
.documents-table .document-number-col { width: 150px; }
.documents-table .document-client-col { width: 230px; }
.documents-table .document-date-col,
.documents-table .document-due-col { width: 112px; }
.documents-table .document-amount-col { width: 124px; }
.documents-table .document-status-col { width: 140px; }
.documents-table .document-actions-col { width: 150px; }
.document-preview-cell {
  padding-left: 8px !important;
  padding-right: 8px !important;
  padding-top: 9px !important;
  padding-bottom: 9px !important;
}
.document-preview-thumb {
  width: 46px;
  height: 60px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  color: #344054;
  display: inline-grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: 0 5px 12px rgba(16,24,40,.08);
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
.document-preview-thumb:hover,
.document-preview-thumb:focus-visible {
  border-color: rgba(227,6,19,.46);
  box-shadow: 0 10px 22px rgba(16,24,40,.13);
  outline: none;
  transform: translateY(-1px);
}
.document-preview-thumb.is-loading { cursor: progress; }
.document-preview-thumb.is-ready { background: #f8fafc; }
.document-preview-placeholder {
  display: grid;
  justify-items: center;
  gap: 3px;
  color: #667085;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
}
.document-preview-placeholder .icon {
  width: 19px;
  height: 19px;
  color: var(--red);
}
.document-preview-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}
.document-preview-empty {
  color: var(--muted);
  font-weight: 750;
}
.document-client-cell {
  min-width: 0;
  overflow: visible;
}
.document-client-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.document-pdf-popover {
  position: fixed;
  z-index: 130;
  width: 300px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(16,24,40,.2);
  padding: 10px;
  pointer-events: auto;
}
.document-pdf-popover[hidden] { display: none; }
.document-pdf-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 1px 8px;
}
.document-pdf-popover-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.document-pdf-popover-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.document-pdf-popover-body,
.document-pdf-modal-page-viewport {
  display: grid;
  place-items: center;
  background: #eef2f7;
}
.document-pdf-popover-body {
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.document-pdf-popover canvas,
.document-pdf-modal-page canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 10px 22px rgba(16,24,40,.12);
}
.document-pdf-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 12px;
  text-align: center;
}
.document-pdf-status.is-error {
  color: #b42318;
}
.document-pdf-modal-panel {
  width: min(1120px, 100%);
}
.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.document-pdf-modal-scroll {
  height: min(76vh, 780px);
  min-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eef2f7;
  padding: 16px;
}
.document-pdf-modal-pages {
  display: grid;
  gap: 16px;
  min-width: fit-content;
  justify-items: center;
}
.document-pdf-modal-page {
  display: grid;
  gap: 8px;
  width: max-content;
}
.document-pdf-modal-page-number {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.document-pdf-modal-page-viewport {
  min-width: 280px;
  min-height: 360px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 12px 26px rgba(16,24,40,.16);
}
.status-with-warning { display: inline-flex; align-items: center; gap: 7px; }
.row-warning {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #b42318;
  background: #fff1f2;
  cursor: help;
  position: relative;
  outline: none;
}
.row-warning .icon { width: 16px; height: 16px; }
.row-warning::before,
.row-warning::after {
  position: absolute;
  left: 50%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
  z-index: 90;
}
.row-warning::before {
  content: "";
  bottom: calc(100% + 5px);
  width: 9px;
  height: 9px;
  background: #111827;
  transform: translateX(-50%) translateY(4px) rotate(45deg);
}
.row-warning::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 9px);
  width: max-content;
  max-width: 310px;
  white-space: normal;
  border-radius: 6px;
  background: #111827;
  color: #fff;
  box-shadow: 0 14px 34px rgba(16,24,40,.22);
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 760;
  transform: translateX(-50%) translateY(4px);
}
.row-warning:hover::before,
.row-warning:hover::after,
.row-warning:focus-visible::before,
.row-warning:focus-visible::after {
  opacity: 1;
  visibility: visible;
}
.row-warning:hover::before,
.row-warning:focus-visible::before {
  transform: translateX(-50%) translateY(0) rotate(45deg);
}
.row-warning:hover::after,
.row-warning:focus-visible::after {
  transform: translateX(-50%) translateY(0);
}
.row-actions { display: flex; align-items: center; gap: 12px; color: #344054; }
.row-actions form { display: inline-flex; }
.documents-table .row-actions { gap: 7px; }
.invoice-action {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.invoice-action .icon { width: 20px; height: 20px; }
.invoice-action.has-state { color: var(--blue); background: var(--blue-soft); border-color: #bfdbfe; }
.invoice-action.reminder-action { color: var(--orange); }
.invoice-action.reminder-action.has-state { color: var(--orange); background: var(--orange-soft); border-color: #fed7aa; }
.action-state-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 15px;
  height: 15px;
  border: 2px solid #fff;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: #fff;
}
.action-state-badge .icon { width: 9px; height: 9px; }
.access-table .form-control,
.access-table .form-select {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 14px;
}
.access-user-name { min-width: 150px; }
.access-user-role { min-width: 150px; }
.resend-pill {
  min-height: 34px;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  background: var(--blue-soft);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}
.resend-pill .icon { width: 17px; height: 17px; }
.resend-pill:hover { border-color: var(--blue); background: #e0efff; }
.badge { display: inline-flex; align-items: center; gap: 7px; border-radius: 5px; padding: 5px 9px; font-size: 13px; font-weight: 650; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.badge-paid { color: var(--green); background: var(--green-soft); }
.badge-late { color: var(--red); background: var(--red-soft); }
.badge-pending { color: var(--orange); background: var(--orange-soft); }
.badge-draft { color: #667085; background: #f2f4f7; }
.badge-sent { color: var(--blue); background: var(--blue-soft); }

.automation-section-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}
.automation-section-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}
/* Connected mailbox status chip (page header) */
.automation-mailbox {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 8px;
  min-width: 0;
  max-width: 340px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.automation-mailbox-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}
.automation-mailbox.is-connected { color: #344054; }
.automation-mailbox.is-connected .automation-mailbox-dot { background: #16a34a; }
.automation-mailbox-label { white-space: nowrap; }
.automation-mailbox-email {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.automation-mailbox-email::before { content: "·"; margin-right: 6px; color: var(--line-strong); }
/* Automation rules — compact disclosure list */
.automation-rules {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}
.automation-rule-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.automation-rule-summary::-webkit-details-marker { display: none; }
.automation-rule-summary:hover { background: #fcfcfd; }
.automation-rule-summary:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.automation-rule-icon {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red-soft);
  color: var(--red);
}
.automation-rule-icon .icon { width: 20px; height: 20px; }
.automation-rule-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 16px;
  font-weight: 760;
  color: var(--text);
}
.automation-rule-chevron {
  flex: 0 0 auto;
  display: inline-flex;
  color: var(--muted);
}
.automation-rule-chevron .icon { width: 18px; height: 18px; transition: transform .18s ease; }
.automation-rule[open] .automation-rule-chevron .icon { transform: rotate(90deg); }
.automation-rule[open] .automation-rule-summary { border-bottom: 1px solid var(--line); }
.automation-rule-body {
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
}
.automation-rule-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.automation-rule-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.automation-rule-footer form { margin: 0; }
.automation-rule-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 7px;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 800;
}
.automation-steps {
  margin: 0;
  padding-left: 20px;
  color: #344054;
  display: grid;
  gap: 8px;
}
.automation-test {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.automation-test summary {
  cursor: pointer;
  color: var(--red);
  font-weight: 800;
}
.automation-test .stack-form { margin-top: 14px; }
.automation-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.automation-notification-list { display: grid; gap: 12px; }
.automation-notification {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.automation-notification.is-unread {
  border-color: #fecdd3;
  background: #fffafa;
}
.automation-notification-main { min-width: 0; }
.automation-notification h3 {
  margin: 10px 0 6px;
  font-size: 18px;
}
.automation-notification p {
  margin: 0;
  color: #344054;
  line-height: 1.45;
}
.automation-notification dl {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 12px 0 0;
}
.automation-notification dl div { min-width: 140px; }
.automation-notification dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.automation-notification dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}
.automation-notification-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.automation-notification-actions form { margin: 0; }
.empty-state.compact {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
  text-align: center;
}
.empty-state.compact .icon { width: 28px; height: 28px; color: var(--red); }
.empty-state.compact strong { color: var(--text); }
.email-preview-card { display: grid; gap: 12px; }
.email-preview-meta {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 13px;
}
.email-preview-meta div { display: grid; gap: 2px; }
.email-preview-meta span { color: var(--muted); font-weight: 800; }
.email-preview-body {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fbfbfc;
  color: #344054;
  line-height: 1.5;
}

.quick-list { display: grid; padding: 10px 18px 18px; gap: 11px; }
.quick-item { min-height: 64px; width: 100%; border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: #fff; color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.quick-item:hover { border-color: var(--line-strong); background: #fcfcfd; }
.quick-item.is-resend { border-color: #bfdbfe; background: #f8fbff; }
.quick-item.is-resend:hover { border-color: var(--blue); background: var(--blue-soft); }
.quick-item.danger-item { border-color: #fecdd3; background: #fffafa; }
.quick-item.danger-item:hover { border-color: var(--red); background: var(--red-soft); }
.quick-item .icon { color: var(--red); width: 28px; height: 28px; }
.quick-item.is-resend .icon { color: var(--blue); }
.quick-item span:nth-child(2) { font-size: 16px; font-weight: 560; }
.quick-item-label { display: grid; gap: 2px; }
.quick-item-label strong { font-size: 16px; font-weight: 650; }
.quick-item-label small { color: var(--blue); font-size: 12px; font-weight: 760; }
.quick-item .chev { margin-left: auto; color: var(--muted); width: 18px; height: 18px; }

.form-control, .form-select, textarea.form-control { width: 100%; min-height: 42px; border: 1px solid var(--line-strong); border-radius: 5px; padding: 9px 12px; background: #fff; color: var(--text); outline: none; }
textarea.form-control { min-height: 90px; resize: vertical; }
.form-control:focus, .form-select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(227,6,19,.08); }
.password-field { position: relative; display: block; }
.password-field .form-control { padding-right: 48px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.password-toggle:hover { color: var(--red); background: var(--red-soft); }
.password-toggle .icon { width: 19px; height: 19px; }
.filter-pill { min-height: 38px; border: 1px solid var(--line); border-radius: 5px; padding: 0 14px; display: inline-flex; align-items: center; background: #fff; color: #344054; font-weight: 560; }
.filter-pill.active { border-color: var(--red); color: var(--red); }

.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: 1.5fr .6fr .8fr 1.2fr; }
.stack-form { display: grid; gap: 15px; }
.stack-form label, .form-grid label { color: #344054; font-size: 13px; font-weight: 650; display: grid; gap: 7px; }
.address-autocomplete-field { position: relative; display: grid; gap: 7px; min-width: 0; }
.form-grid .address-autocomplete-field { grid-column: 1 / -1; }
.address-suggestions {
  position: absolute;
  z-index: 1300;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow-strong);
}
.address-suggestion-option {
  appearance: none;
  width: 100%;
  display: block;
  border: 0;
  border-radius: 5px;
  padding: 9px 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.address-suggestion-option:hover,
.address-suggestion-option:focus-visible {
  background: var(--red-soft);
  outline: none;
}
.address-suggestion-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 750;
}
.client-import-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fcfcfd;
  padding: 14px;
}
.client-import-title { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.client-import-title .icon { width: 19px; height: 19px; color: var(--red); }
.client-import-copy small { display: block; margin-top: 4px; color: var(--muted); font-weight: 600; line-height: 1.4; }
.client-import-picker {
  min-height: 56px;
  position: relative;
  display: grid !important;
  grid-template-columns: 38px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px !important;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  padding: 9px 12px !important;
  color: var(--text) !important;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.client-import-picker:hover { border-color: #98a2b3; background: #f9fafb; }
.client-import-picker:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(227,6,19,.08); }
.client-import-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.client-import-picker-icon {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f2f4f7;
  color: var(--red);
}
.client-import-picker-icon .icon { width: 19px; height: 19px; }
.client-import-picker-copy { min-width: 0; display: grid; gap: 2px; }
.client-import-picker-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
}
.client-import-picker-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.client-import-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e4e7ec;
  border-top-color: var(--red);
  border-radius: 50%;
  opacity: 0;
}
.client-import-box.is-loading .client-import-spinner {
  opacity: 1;
  animation: spin .7s linear infinite;
}
.client-import-box.is-loading .client-import-picker { pointer-events: none; opacity: .78; }
.client-import-status {
  grid-column: 1 / -1;
  margin: 0;
  border-radius: 5px;
  padding: 9px 11px;
  background: #ecfdf3;
  color: #067647;
  font-size: 13px;
  font-weight: 700;
}
.client-import-status.is-error { background: var(--red-soft); color: #b91c1c; }
.client-import-box.is-compact { grid-template-columns: 1fr; }
.price-mode-field { display: grid; gap: 7px; color: #344054; font-size: 13px; font-weight: 650; }
.quick-product-grid { align-items: start; }
.quick-product-grid > label,
.quick-product-grid > .price-mode-field { align-self: start; }
.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f9fafb;
}
.segmented-control label { display: inline-flex; gap: 0; color: inherit; font-size: 12px; font-weight: 760; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-control span {
  min-width: 42px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
}
.segmented-control input:checked + span {
  background: #fff;
  color: var(--red);
  box-shadow: 0 1px 4px rgba(16,24,40,.08);
}
.client-type-company [data-client-field="private"], .client-type-private [data-client-field="company"] { display: none !important; }
.field-with-action { color: #344054; font-size: 13px; font-weight: 650; display: grid; gap: 7px; }
.input-action-row { display: flex; align-items: stretch; gap: 8px; min-width: 0; }
.input-action-row .form-select { flex: 1 1 auto; min-width: 0; }
.input-action-row .searchable-select { flex: 1 1 auto; min-width: 0; }
.searchable-select { position: relative; display: block; min-width: 0; }
.searchable-select__source { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
.searchable-select__input { width: 100%; }
.form-control.is-invalid, .form-select.is-invalid, .searchable-select__input.is-invalid, .field-with-action.has-error .searchable-select__input { border-color: #dc2626; box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.25); }
.field-error { margin: 0; color: #b91c1c; font-weight: 650; font-size: 12.5px; }
.searchable-select__hint { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--green, #16a34a); font-size: 12px; font-weight: 700; }
.searchable-select__hint[hidden] { display: none; }
.searchable-options { position: absolute; z-index: 1300; top: calc(100% + 4px); left: 0; right: 0; display: grid; gap: 2px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; box-shadow: var(--shadow-strong); max-height: 280px; overflow-y: auto; }
.searchable-options[hidden] { display: none; }
.searchable-option { appearance: none; width: 100%; display: grid; gap: 2px; border: 0; border-radius: 5px; padding: 8px 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.searchable-option:hover, .searchable-option:focus-visible, .searchable-option.is-active { background: var(--red-soft); outline: none; }
.searchable-option__title { font-size: 13.5px; font-weight: 750; color: var(--ink, #101828); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.searchable-option__subtitle { font-size: 12px; color: var(--muted, #667085); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.searchable-option--empty { padding: 9px 10px; color: var(--muted, #667085); font-size: 12.5px; cursor: default; }
.searchable-option--empty:hover { background: transparent; }
.inline-add-button { width: 42px; min-width: 42px; height: 42px; border: 1px solid rgba(227,6,19,.28); border-radius: 5px; background: var(--red-soft); color: var(--red); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.inline-add-button:hover { border-color: var(--red); background: #fff; }
.inline-add-button .icon { width: 20px; height: 20px; }
.line-editor { display: grid; gap: 12px; }
.document-table-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 2px; }
.document-table-head h2 { margin: 0; font-size: 17px; line-height: 1.2; }
.line-list { display: grid; gap: 12px; }
.invoice-line {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 12px;
}
.invoice-line:focus-within { border-color: rgba(227,6,19,.45); box-shadow: 0 0 0 3px rgba(227,6,19,.06); }
.line-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 650; }
.line-title strong { color: var(--text); }
.line-choice { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.line-fields { display: grid; gap: 12px; }
.line-main-fields { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr); gap: 12px; align-items: start; }
.line-detail-fields { display: grid; grid-template-columns: .65fr .85fr 1fr .85fr .85fr minmax(120px, .95fr); gap: 10px; align-items: end; }
.invoice-line label { color: #344054; font-size: 13px; font-weight: 650; display: grid; gap: 7px; min-width: 0; }
.invoice-line .description-field { min-height: 58px; }
.line-total-box {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 7px 10px;
  background: #fafafa;
}
.line-total-box span { color: var(--muted); font-size: 11px; font-weight: 650; }
.line-total-box strong { font-size: 14px; line-height: 1.1; }
.form-section-title { font-size: 17px; font-weight: 760; margin-top: 10px; color: var(--text); }
.check-row { display: flex !important; align-items: center; gap: 10px; }
.invoice-email-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: grid;
  gap: 14px;
}
.invoice-email-section .document-table-head { padding-top: 0; }
.email-message-field { min-height: 175px; }
.email-signature-field { min-height: 150px; }
.document-form-stack {
  display: grid;
  gap: 24px;
  align-content: start;
}
.invoice-email-panel { display: block; }
.invoice-email-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  color: var(--text);
}
.invoice-email-summary::-webkit-details-marker { display: none; }
.invoice-email-summary .icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform .16s ease;
}
.invoice-email-panel[open] .invoice-email-summary .icon { transform: rotate(90deg); }
.invoice-email-summary strong { font-size: 18px; line-height: 1.2; }
.invoice-email-content {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.email-template-group {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.email-template-group + .email-template-group {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.email-template-group h3,
.email-template-group summary {
  margin: 0;
  color: #344054;
  font-size: 14px;
  font-weight: 800;
}
.email-template-group summary {
  cursor: pointer;
  list-style-position: inside;
}
.email-template-group[open] {
  gap: 12px;
}

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.detail-grid > aside { align-self: start; }
.client-detail-stack {
  display: grid;
  gap: 22px;
}
.client-profile-panel {
  display: grid;
  grid-template-columns: minmax(260px, .72fr) minmax(420px, 1fr);
  gap: 22px 28px;
  align-items: start;
}
.client-profile-main {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}
.client-profile-avatar {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  font-size: 17px;
}
.client-profile-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--red);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.client-profile-main h2 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.12;
}
.client-profile-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.client-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 22px;
}
.client-profile-grid div,
.client-profile-metrics div {
  min-width: 0;
  display: grid;
  gap: 5px;
}
.client-profile-grid span,
.client-profile-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}
.client-profile-grid strong,
.client-profile-metrics strong {
  min-width: 0;
  color: #1f2937;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.client-profile-grid a:hover { color: var(--red); }
.client-profile-metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
}
.client-profile-metrics div {
  min-height: 72px;
  justify-content: center;
  padding: 14px 16px;
  background: #fcfcfd;
}
.client-profile-metrics strong {
  font-size: 20px;
  line-height: 1.1;
}
.document-detail-stack { display: grid; gap: 14px; align-content: start; }
.document-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.document-title-line h1 { margin: 0; }
.document-top-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: stretch; }
.document-overview-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.document-overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.document-party-card, .document-meta-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 16px;
  background: #fcfcfd;
}
.document-party-card span, .document-meta-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 750; margin-bottom: 6px; }
.document-party-card strong { display: block; font-size: 16px; margin-bottom: 10px; }
.document-party-card p { margin: 0; color: #344054; line-height: 1.55; }
.document-party-card small { display: block; margin-top: 10px; color: var(--muted); }
.document-meta-card { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.document-meta-card div { min-width: 0; }
.document-meta-card strong { display: block; overflow-wrap: anywhere; }
.document-overview-panel { height: 100%; }
.pdf-preview-panel { overflow: hidden; }
.pdf-preview-frame { width: 100%; height: min(78vh, 860px); min-height: 620px; border: 0; background: #f2f4f7; display: block; }
.pdf-preview-panel.compact { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.pdf-preview-panel.compact .panel-head { min-height: 56px; padding: 0 14px; }
.pdf-preview-panel.compact .panel-title { font-size: 15px; }
.pdf-preview-panel.compact .panel-link { font-size: 13px; }
.pdf-preview-panel.compact .pdf-preview-frame { height: 330px; min-height: 330px; }
.inline-alert {
  margin-top: 14px;
  border: 1px solid #fecdd3;
  border-radius: 6px;
  background: var(--red-soft);
  color: #9f1239;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 650;
  line-height: 1.4;
}
.inline-alert .icon { width: 20px; height: 20px; flex: 0 0 20px; }
.inline-alert a { text-decoration: underline; }
.inline-alert.success-alert {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}
.summary-box { display: grid; gap: 12px; }
.summary-line { display: flex; justify-content: space-between; gap: 20px; color: #344054; }
.summary-line.total { border-top: 1px solid var(--line); padding-top: 12px; font-size: 18px; font-weight: 800; color: var(--text); }
.delivery-timeline-card h3 { display: flex; align-items: center; gap: 8px; }
.delivery-timeline-card h3 .icon { width: 19px; height: 19px; color: var(--red); }
.delivery-timeline { display: grid; gap: 10px; }
.delivery-event {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fcfcfd;
  padding: 11px 12px;
  display: grid;
  gap: 3px;
}
.delivery-event span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}
.delivery-event strong {
  color: var(--text);
  font-size: 14px;
}
.delivery-event small {
  color: var(--muted);
  font-weight: 650;
  overflow-wrap: anywhere;
}
.form-summary-panel {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 4px;
}
.form-summary-panel h3 { margin: 0; font-size: 20px; }
.form-summary-panel .btn { justify-self: start; min-width: 220px; }
.invoice-live-preview-card {
  position: sticky;
  top: 0;
  align-self: start;
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 20px);
  overflow: auto;
}
.invoice-live-preview-card h3 { margin-bottom: 0; }
.invoice-pdf-preview-card {
  align-content: start;
  background: #f8fafc;
}
.pdf-enlargeable {
  position: relative;
  cursor: zoom-in;
  outline: none;
}
.pdf-enlargeable::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: rgba(17, 24, 39, .08);
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease;
}
.pdf-enlargeable:hover::after,
.pdf-enlargeable:focus-visible::after {
  opacity: 1;
}
.pdf-enlargeable:focus-visible {
  box-shadow: 0 0 0 3px rgba(227, 6, 19, .12), 0 12px 28px rgba(16,24,40,.12);
}
.pdf-enlarge-hint {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  background: rgba(17,24,39,.86);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(-4px) scale(.94);
  transition: opacity .14s ease, transform .14s ease;
  pointer-events: none;
  box-shadow: 0 14px 32px rgba(16,24,40,.24);
}
.pdf-enlarge-hint .icon {
  width: 19px;
  height: 19px;
}
.pdf-enlargeable:hover .pdf-enlarge-hint,
.pdf-enlargeable:focus-visible .pdf-enlarge-hint {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.pdf-preview-click-zone {
  display: grid;
  gap: 14px;
  min-height: 120px;
  border-radius: 6px;
}
.document-pdf-preview-card {
  height: 100%;
  max-height: 560px;
  overflow: auto;
}
.invoice-pdf-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.invoice-pdf-preview-head h3 { margin: 0; }
.invoice-pdf-preview-status {
  margin: 0;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
.invoice-pdf-preview-status[hidden] { display: none; }
.invoice-pdf-preview-status.is-error {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #9f1239;
}
.invoice-pdf-page-stack {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-height: 120px;
}
.invoice-pdf-page {
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 100%;
}
.invoice-pdf-page-label {
  justify-self: start;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.invoice-pdf-page-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid #d9dde5;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(16, 24, 40, .16);
}
.invoice-preview-sheet {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 18px;
  display: grid;
  gap: 14px;
  color: #111827;
  box-shadow: inset 0 3px 0 var(--red);
}
.invoice-preview-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.invoice-preview-client,
.invoice-preview-issuer {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: #475467;
  font-size: 11px;
  line-height: 1.35;
}
.invoice-preview-issuer { text-align: right; }
.invoice-preview-client strong,
.invoice-preview-issuer strong {
  color: #111827;
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.invoice-preview-client span,
.invoice-preview-issuer span { overflow-wrap: anywhere; }
.invoice-preview-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.invoice-preview-title-row h4 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}
.invoice-preview-title-row span { color: var(--muted); font-size: 12px; font-weight: 700; }
.invoice-preview-stamp {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 8px;
  background: #f8fafc;
  color: #344054 !important;
  white-space: nowrap;
}
.invoice-preview-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fcfcfd;
}
.invoice-preview-meta div {
  padding: 8px 9px;
  display: grid;
  gap: 2px;
  min-width: 0;
  border-right: 1px solid var(--line);
}
.invoice-preview-meta div:last-child { border-right: 0; }
.invoice-preview-meta span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.invoice-preview-meta strong { font-size: 12px; overflow-wrap: anywhere; }
.invoice-preview-items {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}
.invoice-preview-items th {
  background: #111827;
  color: #fff;
  text-align: left;
  font-size: 9px;
  text-transform: uppercase;
}
.invoice-preview-items th,
.invoice-preview-items td {
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
}
.invoice-preview-items th:nth-child(2),
.invoice-preview-items td:nth-child(2),
.invoice-preview-items th:nth-child(3),
.invoice-preview-items td:nth-child(3) {
  text-align: right;
  width: 24%;
}
.invoice-preview-empty {
  margin: 0;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  padding: 14px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}
.invoice-preview-empty[hidden] { display: none; }
.invoice-preview-totals {
  margin-left: auto;
  width: min(240px, 100%);
  display: grid;
  gap: 7px;
  font-size: 12px;
}
.invoice-preview-totals div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #344054;
}
.invoice-preview-totals .total {
  border-top: 1px solid #111827;
  padding-top: 8px;
  color: #111827;
  font-size: 15px;
  font-weight: 850;
}
.invoice-preview-notes {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: grid;
  gap: 5px;
}
.invoice-preview-notes[hidden] { display: none; }
.invoice-preview-notes span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.invoice-preview-notes p {
  margin: 0;
  color: #344054;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pdf-mini-stack {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 2px 0 4px;
}
.pdf-mini-page {
  position: relative;
  width: min(100%, 292px);
  aspect-ratio: 210 / 297;
  overflow: hidden;
  border: 1px solid #d9dde5;
  border-radius: 2px;
  background: #fff;
  color: #111827;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .14);
  padding: 20px;
  font-family: Arial, sans-serif;
  font-size: 5.7px;
  line-height: 1.38;
}
.pdf-mini-redline {
  height: 4px;
  margin: -20px -20px 14px;
  background: var(--red);
}
.pdf-mini-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid #d9dde5;
}
.pdf-mini-address {
  display: grid;
  gap: 1px;
  min-width: 0;
  color: #263042;
}
.pdf-mini-issuer { text-align: right; }
.pdf-mini-address strong {
  display: block;
  margin-bottom: 2px;
  color: #111827;
  font-size: 6.6px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.pdf-mini-address span { overflow-wrap: anywhere; }
.pdf-mini-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 15px 0 10px;
}
.pdf-mini-title-row h4 {
  margin: 0;
  font-size: 15.5px;
  line-height: 1;
  letter-spacing: 0;
}
.pdf-mini-title-row span {
  color: #667085;
  font-size: 6.3px;
  font-weight: 700;
}
.pdf-mini-stamp {
  flex: 0 0 auto;
  border: 1px solid #d0d5dd;
  border-radius: 5px;
  padding: 4px 6px;
  background: #f8f9fb;
  color: #344054 !important;
}
.pdf-mini-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #e5e7eb;
  background: #fafafa;
  margin-bottom: 10px;
}
.pdf-mini-meta div {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 4px;
  padding: 4px 6px;
  border-right: 1px solid #eef0f3;
  border-bottom: 1px solid #eef0f3;
  min-width: 0;
}
.pdf-mini-meta div:nth-child(2n) { border-right: 0; }
.pdf-mini-meta div:nth-last-child(-n+2) { border-bottom: 0; }
.pdf-mini-meta span {
  color: #667085;
  font-weight: 800;
}
.pdf-mini-meta strong { overflow-wrap: anywhere; }
.pdf-mini-intro {
  margin: 0 0 10px;
  color: #344054;
}
.pdf-mini-items {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.pdf-mini-items th {
  background: #111827;
  color: #fff;
  text-align: left;
  font-size: 5.1px;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.pdf-mini-items th,
.pdf-mini-items td {
  padding: 4.2px;
  border-bottom: 1px solid #e4e7ec;
  vertical-align: top;
  overflow-wrap: anywhere;
}
.pdf-mini-items th:first-child,
.pdf-mini-items td:first-child { width: 38%; }
.pdf-mini-items th:not(:first-child),
.pdf-mini-items td:not(:first-child) { text-align: right; }
.pdf-mini-empty {
  margin: 8px 0 0;
  border: 1px dashed #d0d5dd;
  border-radius: 4px;
  padding: 11px;
  color: #667085;
  text-align: center;
  font-size: 6.2px;
  font-weight: 800;
}
.pdf-mini-empty[hidden] { display: none; }
.pdf-mini-totals {
  width: 134px;
  margin: 12px 0 0 auto;
  display: grid;
  gap: 4px;
}
.pdf-mini-totals div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #344054;
}
.pdf-mini-totals .total {
  margin-top: 3px;
  padding-top: 6px;
  border-top: 1px solid #111827;
  color: #111827;
  font-size: 7.6px;
  font-weight: 850;
}
.pdf-mini-notes {
  margin-top: 14px;
  padding-top: 9px;
  border-top: 1px solid #e4e7ec;
}
.pdf-mini-notes[hidden] { display: none; }
.pdf-mini-notes span {
  display: block;
  margin-bottom: 3px;
  color: #111827;
  font-size: 6px;
  font-weight: 800;
}
.pdf-mini-notes p {
  margin: 0;
  color: #344054;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pdf-mini-footer {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 13px;
  border-top: 1px solid #d9dde5;
  padding-top: 4px;
  color: #667085;
  font-size: 4.9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-mini-payment-page {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0;
}
.pdf-mini-cut-note {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 145px;
  border-top: 1px dashed #b7bcc5;
  color: #667085;
  font-size: 5.1px;
  padding-top: 4px;
  text-align: center;
}
.pdf-mini-slip {
  height: 145px;
  border-top: 1px solid #111827;
  display: grid;
  grid-template-columns: 82px 1fr;
  background: #fff;
}
.pdf-mini-receipt,
.pdf-mini-payment {
  padding: 10px;
  min-width: 0;
}
.pdf-mini-receipt {
  border-right: 1px solid #111827;
  display: grid;
  align-content: start;
  gap: 5px;
}
.pdf-mini-receipt h4,
.pdf-mini-payment h4 {
  margin: 0 0 4px;
  font-size: 7.6px;
  line-height: 1.1;
}
.pdf-mini-receipt div,
.pdf-mini-payment-info div {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.pdf-mini-receipt strong,
.pdf-mini-payment-info strong {
  font-size: 4.9px;
  line-height: 1.1;
}
.pdf-mini-receipt span,
.pdf-mini-payment-info span {
  font-size: 4.8px;
  color: #111827;
  overflow-wrap: anywhere;
}
.pdf-mini-receipt em {
  align-self: end;
  justify-self: end;
  font-style: normal;
  font-size: 4.6px;
  font-weight: 800;
}
.pdf-mini-payment-grid {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 8px;
  align-items: start;
}
.pdf-mini-qr {
  width: 60px;
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, #111 10%, transparent 10% 20%, #111 20% 30%, transparent 30% 45%, #111 45% 55%, transparent 55% 70%, #111 70% 80%, transparent 80%),
    linear-gradient(#111 10%, transparent 10% 20%, #111 20% 30%, transparent 30% 45%, #111 45% 55%, transparent 55% 70%, #111 70% 80%, transparent 80%);
  background-size: 11px 11px;
  border: 5px solid #fff;
  outline: 1px solid #e5e7eb;
}
.pdf-mini-qr::before,
.pdf-mini-qr::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 4px solid #111;
  background: #fff;
}
.pdf-mini-qr::before { left: 0; top: 0; }
.pdf-mini-qr::after { right: 0; top: 0; }
.pdf-mini-qr span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 1px solid #111;
}
.pdf-mini-qr span::before,
.pdf-mini-qr span::after {
  content: "";
  position: absolute;
  background: #ef4444;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.pdf-mini-qr span::before { width: 8px; height: 2px; }
.pdf-mini-qr span::after { width: 2px; height: 8px; }
.pdf-mini-slip-amount {
  display: flex !important;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
.pdf-mini-slip-amount span { font-size: 4.8px; }
.pdf-mini-slip-amount strong { font-size: 5.4px; }
.pdf-mini-payment-info {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.payment-progress { display: grid; gap: 7px; padding-top: 2px; }
.payment-progress-bar { height: 8px; border-radius: 999px; overflow: hidden; background: #eef0f3; }
.payment-progress-bar span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.payment-progress small { color: var(--muted); font-weight: 700; }
.payment-proof-panel { display: grid; gap: 14px; }
.payment-proof-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.payment-proof-list { display: grid; gap: 10px; }
.payment-proof-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 13px;
  background: #fcfcfd;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.payment-proof-item.manual { grid-template-columns: minmax(170px, .75fr) minmax(0, 1fr); }
.payment-proof-main { display: grid; gap: 4px; min-width: 0; }
.payment-proof-main strong { font-size: 18px; line-height: 1.1; }
.payment-proof-main span { color: #344054; font-weight: 700; overflow-wrap: anywhere; }
.payment-proof-main small, .payment-proof-main span { color: var(--muted); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.payment-proof-item > .btn { justify-self: end; white-space: nowrap; }
.statement-line {
  grid-column: 1 / -1;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: #fff;
  padding: 10px 11px;
  display: grid;
  gap: 4px;
}
.statement-line span { color: var(--muted); font-size: 12px; font-weight: 800; }
.statement-line p { margin: 0; color: #344054; line-height: 1.45; overflow-wrap: anywhere; }
.proof-modal-panel { width: min(1180px, 100%); }
.proof-text-preview span {
  color: #9a3412;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.proof-text-preview mark {
  display: block;
  border-radius: 5px;
  background: rgba(253, 230, 138, .78);
  color: #111827;
  padding: 6px 8px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.proof-pdf-status {
  border: 1px solid rgba(37, 99, 235, .16);
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 750;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.proof-pdf-status.is-error {
  border-color: rgba(227, 6, 19, .24);
  background: var(--red-soft);
  color: #b42318;
}
.proof-pdf-scroll {
  height: min(76vh, 780px);
  min-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eef2f7;
  padding: 14px;
}
.proof-pdf-pages {
  display: grid;
  gap: 16px;
  min-width: fit-content;
  justify-items: center;
}
.proof-pdf-page {
  display: grid;
  gap: 8px;
  width: max-content;
}
.proof-pdf-page-number {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.proof-pdf-page-viewport {
  position: relative;
  margin: 0 auto;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 26px rgba(16, 24, 40, .16);
}
.proof-pdf-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f8fafc 0%, #edf2f7 100%);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
.proof-pdf-placeholder[hidden],
.proof-pdf-scroll[hidden],
.proof-text-preview[hidden] { display: none !important; }
.proof-pdf-canvas { display: block; }
.proof-pdf-text-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  line-height: 1;
  pointer-events: none;
  text-align: initial;
  text-size-adjust: none;
  forced-color-adjust: none;
}
.proof-pdf-text-layer span,
.proof-pdf-text-layer br {
  position: absolute;
  color: transparent;
  white-space: pre;
  transform-origin: 0 0;
}
.proof-pdf-highlight {
  position: absolute;
  border: 2px solid rgba(215, 156, 0, .95);
  background: rgba(255, 227, 77, .38);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .58) inset;
  pointer-events: none;
}
.proof-text-preview {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
  background: #fff;
}
.proof-text-preview small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.document-items input, .document-items select { min-width: 95px; }
.document-items [data-product-select] { min-width: 145px; }
.document-items .description-field { min-width: 260px; }
.item-remove { color: var(--red); border: 0; background: transparent; cursor: pointer; }
.invoice-line .item-remove { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 5px; }
.invoice-line .item-remove:hover { border-color: rgba(227,6,19,.28); background: var(--red-soft); }

.client-mini { display: flex; align-items: center; gap: 12px; }
.client-mini .avatar { width: 34px; height: 34px; }
.client-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 18px; }
.mini-card { border: 1px solid var(--line); border-radius: 7px; padding: 14px; display: flex; align-items: center; gap: 14px; background: #fff; }
.side-card { background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.side-card h3 { margin: 0 0 16px; font-size: 17px; }
.quote-guide-list { display: grid; gap: 10px; color: #344054; font-weight: 650; }
.quote-guide-list span { display: flex; align-items: center; gap: 9px; }
.quote-guide-list span::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: var(--green); flex: 0 0 7px; }
.info-list { display: grid; gap: 13px; }
.info-list div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; color: #344054; }
.info-list span:first-child { color: var(--muted); }
.documents-layout .info-list div { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.documents-layout .info-list strong { white-space: nowrap; }
.reminder-side-list { display: grid; gap: 9px; }
.table-show-more-cell {
  padding: 16px !important;
  text-align: center !important;
  background: #fff;
}
.table-show-more {
  min-width: 210px;
}

.chart-card { padding: 20px; }
.bars { display: grid; gap: 14px; margin-top: 14px; }
.bar-row { display: grid; grid-template-columns: 80px 1fr 44px; gap: 14px; align-items: center; }
.bar-track { height: 9px; border-radius: 999px; background: #eef0f3; overflow: hidden; }
.bar-fill { height: 100%; background: var(--red); border-radius: inherit; }
.line-chart { height: 220px; position: relative; margin-top: 18px; background: repeating-linear-gradient(to bottom, transparent 0, transparent 42px, #eef0f3 43px); }
.line-chart svg { width: 100%; height: 100%; overflow: visible; }

.trend-neutral { color: var(--muted); }
.report-head { align-items: stretch; }
.report-actions { align-items: flex-start; }
.report-period-form {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 5px;
  box-shadow: var(--shadow);
}
.report-period-form label {
  padding-left: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.report-period-form select {
  height: 34px;
  min-width: 168px;
  border: 0;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
  outline: none;
}
.report-period-strip {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(130px, .45fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
  box-shadow: var(--shadow);
}
.report-period-strip > div {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 5px;
  background: #fff;
  padding: 12px 16px;
}
.report-period-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.report-period-strip strong { font-size: 17px; line-height: 1.15; }
.report-kpi-grid { gap: 18px; }
.report-kpi-card { min-height: 126px; align-items: flex-start; }
.report-kpi-card .stat-icon { width: 52px; height: 52px; flex-basis: 52px; }
.report-kpi-card strong { font-size: 25px; }
.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
  align-items: start;
}
.report-main-stack, .report-side-stack { display: grid; gap: 22px; align-content: start; }
.report-panel-head { gap: 16px; }
.report-legend { display: inline-flex; align-items: center; gap: 14px; color: #344054; font-size: 13px; font-weight: 760; }
.report-legend span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}
.legend-dot.is-revenue { background: var(--red); }
.legend-dot.is-collected { background: var(--blue); }
.report-line-chart {
  height: 340px;
  padding: 12px 14px 8px;
  background: linear-gradient(180deg, #fff, #fbfcfd);
}
.report-line-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart-grid-line { stroke: #e8ecf1; stroke-width: 1; }
.chart-axis-label, .chart-month-label {
  fill: #667085;
  font-size: 12px;
  font-weight: 750;
}
.chart-month-label { text-anchor: middle; }
.chart-area { fill: rgba(227, 6, 19, .08); }
.chart-line {
  fill: none;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-line.is-revenue { stroke: var(--red); }
.chart-line.is-collected { stroke: var(--blue); stroke-dasharray: 7 7; }
.chart-point { stroke: #fff; stroke-width: 2; }
.chart-point.is-revenue { fill: var(--red); }
.chart-point.is-collected { fill: var(--blue); }
.chart-hover-month { outline: none; }
.chart-hit-area {
  fill: transparent;
  pointer-events: all;
  cursor: crosshair;
}
.chart-hover-line,
.chart-hover-ring,
.chart-tooltip {
  opacity: 0;
  transition: opacity .14s ease;
  pointer-events: none;
}
.chart-hover-line {
  stroke: #98a2b3;
  stroke-width: 1;
  stroke-dasharray: 4 5;
}
.chart-hover-ring {
  fill: #fff;
  stroke-width: 2.5;
}
.chart-hover-ring.is-revenue { stroke: var(--red); }
.chart-hover-ring.is-collected { stroke: var(--blue); }
.chart-tooltip rect {
  fill: #111827;
  stroke: rgba(255,255,255,.18);
  stroke-width: 1;
  filter: drop-shadow(0 12px 20px rgba(16,24,40,.2));
}
.chart-tooltip text {
  fill: #fff;
  font-size: 12px;
}
.chart-tooltip-title {
  font-weight: 850;
}
.chart-tooltip-label {
  fill: rgba(255,255,255,.72) !important;
  font-weight: 720;
}
.chart-tooltip-value {
  text-anchor: end;
  font-weight: 850;
}
.chart-hover-month:hover .chart-hover-line,
.chart-hover-month:hover .chart-hover-ring,
.chart-hover-month:hover .chart-tooltip,
.chart-hover-month:focus .chart-hover-line,
.chart-hover-month:focus .chart-hover-ring,
.chart-hover-month:focus .chart-tooltip {
  opacity: 1;
}
.report-grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
  gap: 22px;
}
.report-donut-body {
  display: grid;
  grid-template-columns: minmax(156px, .72fr) minmax(292px, 1fr);
  gap: 22px;
  align-items: center;
  padding: 20px;
}
.report-donut {
  width: min(178px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(16,24,40,.05);
}
.report-donut > div {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16,24,40,.11);
}
.report-donut strong { font-size: 28px; line-height: 1; }
.report-donut span { color: var(--muted); font-size: 12px; font-weight: 800; }
.report-status-list { display: grid; gap: 11px; }
.report-status-row {
  display: grid;
  grid-template-columns: minmax(118px, 1fr) minmax(28px, max-content) minmax(138px, max-content);
  gap: 14px;
  align-items: center;
  color: #344054;
}
.report-status-row span {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 760;
  white-space: nowrap;
}
.report-status-row span i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex: 0 0 9px;
}
.report-status-row strong { text-align: right; }
.report-status-row small {
  min-width: 138px;
  color: var(--muted);
  text-align: right;
  font-weight: 760;
  white-space: nowrap;
}
.report-quality-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}
.report-quality-grid > div {
  min-height: 116px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 18px;
  background: #fff;
}
.report-quality-grid span { color: var(--muted); font-size: 13px; font-weight: 800; }
.report-quality-grid strong { font-size: 25px; line-height: 1; }
.report-quality-grid small { color: #667085; font-weight: 650; }
.report-vat-list { display: grid; gap: 14px; padding: 18px 20px; }
.report-vat-row {
  display: grid;
  grid-template-columns: minmax(160px, .75fr) minmax(150px, 1fr) minmax(116px, auto);
  gap: 16px;
  align-items: center;
}
.report-vat-row div:first-child { display: grid; gap: 3px; min-width: 0; }
.report-vat-row div:first-child span { color: var(--muted); font-size: 13px; font-weight: 650; }
.report-vat-row > strong { text-align: right; }
.report-progress {
  height: 9px;
  border-radius: 999px;
  background: #eef0f3;
  overflow: hidden;
  display: block;
}
.report-progress span, .report-progress b {
  height: 100%;
  min-width: 4px;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), #ff6b74);
}
.report-progress span.is-danger { background: linear-gradient(90deg, #c9000b, var(--red)); }
.report-table { min-width: 780px; }
.report-side-card { padding: 18px; margin: 0; }
.report-side-card h3 { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.report-side-card h3 .icon { width: 20px; height: 20px; color: var(--red); }
.report-bars { display: grid; gap: 14px; }
.report-bar-row {
  display: grid;
  grid-template-columns: minmax(110px, .9fr) minmax(86px, 1fr) minmax(54px, auto);
  gap: 12px;
  align-items: center;
}
.report-bar-row div:first-child { display: grid; gap: 2px; min-width: 0; }
.report-bar-row div:first-child strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-bar-row div:first-child span { color: var(--muted); font-size: 12px; font-weight: 700; }
.report-bar-row > strong { text-align: right; font-size: 13px; }
.report-ranking { display: grid; gap: 12px; }
.report-ranking-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.report-ranking-row:hover { border-color: var(--line-strong); background: #fcfcfd; }
.report-ranking-row span { min-width: 0; display: grid; gap: 4px; }
.report-ranking-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-ranking-row small { color: var(--muted); font-weight: 650; line-height: 1.35; }
.report-ranking-row em { color: var(--text); font-style: normal; font-weight: 830; white-space: nowrap; }
.report-ranking-row .report-progress { grid-column: 1 / -1; }
.report-export-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--red);
  font-size: 14px;
  font-weight: 800;
}
.report-export-link .icon { width: 18px; height: 18px; }
.report-quick-list { padding: 0; }
.report-quick-list .quick-item { min-height: 56px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; }
.access-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.access-panel-head .btn { flex: 0 0 auto; }
.invite-user-form {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fcfcfd;
  padding: 14px;
}
.setting-row { display: grid; grid-template-columns: 220px 1fr; gap: 12px; align-items: center; padding: 6px 0; }
.logo-upload-box { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo-upload-preview {
  width: 72px;
  height: 72px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background-color: #fff;
  flex: 0 0 72px;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.logo-upload-preview.has-image {
  background-image: linear-gradient(45deg, #f3f4f6 25%, transparent 25%), linear-gradient(-45deg, #f3f4f6 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f3f4f6 75%), linear-gradient(-45deg, transparent 75%, #f3f4f6 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.logo-upload-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-remove-button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(220, 38, 38, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  color: #dc2626;
  display: inline-grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.14);
}
.logo-remove-button:hover { background: #fef2f2; }
.logo-remove-button .icon { width: 15px; height: 15px; }
.logo-upload-box small { display: block; margin-top: 6px; color: var(--muted); }
.email-settings-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.email-settings-head .btn { flex: 0 0 auto; }
.email-settings-help {
  margin: 0;
  color: #344054;
  font-size: 14px;
  line-height: 1.5;
}
.email-settings-help.is-muted { color: var(--muted); }
.email-provider-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.email-provider-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fcfcfd;
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: space-between;
}
.email-provider-card.is-connected { border-color: #bbf7d0; background: #f8fffa; }
.email-provider-head { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.email-provider-head > div { min-width: 0; flex: 1; }
.email-provider-head strong { display: block; font-size: 16px; line-height: 1.2; }
.email-provider-head div > span:not(.badge) { display: block; color: var(--muted); margin-top: 4px; font-size: 13px; overflow-wrap: anywhere; }
.email-provider-head .badge { margin-left: auto; flex: 0 0 auto; }
.email-provider-logo {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 7px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  padding: 6px;
}
.email-provider-logo.is-generic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--red);
}
.email-provider-logo.is-generic .icon { width: 20px; height: 20px; }
.email-provider-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.email-provider-actions form { display: inline-flex; }
.email-provider-error { color: #b91c1c; font-weight: 650; overflow-wrap: anywhere; }
.email-provider-form {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fcfcfd;
  padding: 16px;
}
.email-provider-form h3 { margin: 0; font-size: 17px; }
.field-stack { display: grid; gap: 7px; align-content: start; }
.field-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: #344054; font-size: 13px; font-weight: 650; }
.field-label-row a { color: var(--red); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.toggle { width: 38px; height: 22px; border-radius: 999px; background: #d0d5dd; display: inline-flex; padding: 2px; justify-content: flex-start; }
.toggle.on { background: var(--red); justify-content: flex-end; }
.toggle span { width: 18px; height: 18px; background: #fff; border-radius: 50%; }

.empty-state { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty-state .icon { width: 42px; height: 42px; color: var(--red); margin-bottom: 12px; }
.page-empty { margin-top: 80px; }
.toast-stack {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 120;
  width: min(460px, calc(100vw - 28px));
  display: grid;
  gap: 10px;
  pointer-events: none;
  transform: translateX(-50%);
}
.toast {
  --toast-accent: var(--green);
  --toast-border: rgba(22, 163, 74, .22);
  --toast-bg: rgba(240, 253, 244, .96);
  --toast-text: #14532d;
  position: relative;
  min-height: 48px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--toast-border);
  border-radius: 8px;
  padding: 13px 16px 16px;
  background: var(--toast-bg);
  color: var(--toast-text);
  box-shadow: 0 18px 55px rgba(16, 24, 40, .16), 0 2px 8px rgba(16, 24, 40, .05);
  font-size: 14px;
  font-weight: 760;
  line-height: 1.35;
  pointer-events: auto;
  backdrop-filter: blur(14px);
  animation: toast-in .18s ease-out both, toast-out .22s ease-in 2.78s forwards;
}
.toast::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--toast-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--toast-accent) 13%, transparent);
}
.toast::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--toast-accent);
  transform-origin: left center;
  animation: toast-progress 3s linear forwards;
}
.toast > span { min-width: 0; overflow-wrap: anywhere; }
.toast.success {
  --toast-accent: var(--green);
  --toast-border: rgba(22, 163, 74, .24);
  --toast-bg: rgba(240, 253, 244, .96);
  --toast-text: #14532d;
}
.toast.error {
  --toast-accent: var(--red);
  --toast-border: rgba(227, 6, 19, .2);
  --toast-bg: rgba(255, 241, 242, .97);
  --toast-text: #9f1239;
}
.toast-action { display: inline-flex; margin-left: 8px; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.985); }
}
@keyframes toast-progress {
  to { transform: scaleX(0); }
}
#email-settings { scroll-margin-top: 24px; }
#email-settings:target {
  outline: 2px solid rgba(227, 6, 19, .35);
  box-shadow: 0 0 0 6px rgba(227, 6, 19, .08), var(--shadow);
}
.import-panel { display: none; padding: 16px 18px; border-bottom: 1px solid var(--line); background: #fffafa; }
.import-panel.is-open, .import-panel:target { display: block; }
.statement-import-panel { background: #f8fbff; }
.payments-main-stack { display: grid; align-content: start; gap: 22px; }
.payments-action-panel {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.manual-payment-panel { background: #fff; }
.import-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.import-panel-head h2 { margin: 0 0 6px; display: flex; align-items: center; gap: 10px; font-size: 18px; }
.import-panel-head p { margin: 0; color: var(--muted); line-height: 1.45; }
.statement-import-submit { align-content: end; }
.statement-help { display: block; margin-top: 12px; color: var(--muted); font-weight: 650; }
.panel-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.statement-alert { align-items: center; justify-content: space-between; margin: 0 0 18px; }
.statement-alert span { flex: 1; }
.statement-review-form { display: grid; gap: 6px; min-width: 280px; }
.statement-review-form small { color: var(--muted); white-space: normal; max-width: 420px; }
.statement-import-list small { color: var(--muted); font-weight: 500; }
.side-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.side-card-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.statement-side-card { padding: 16px; }
.statement-side-list, .statement-side-section { display: grid; gap: 9px; }
.statement-side-section { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.statement-side-section > strong { font-size: 14px; color: #344054; }
.statement-side-item {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-align: left;
}
.statement-side-item.is-clickable { cursor: pointer; transition: border-color .14s ease, background .14s ease, color .14s ease; }
.statement-side-item.is-clickable:hover,
.statement-side-item.is-clickable:focus-visible {
  border-color: rgba(227,6,19,.34);
  background: #fffafa;
  color: var(--red);
  outline: none;
}
.statement-side-item > div:first-child,
.statement-side-match span,
.statement-side-missing span { min-width: 0; display: grid; gap: 3px; }
.statement-side-item strong, .statement-side-match strong, .statement-side-missing strong { line-height: 1.2; }
.statement-side-item small, .statement-side-match small, .statement-side-missing small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.statement-side-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.statement-side-actions a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--red);
}
.statement-side-actions .icon { width: 16px; height: 16px; }
.statement-side-match,
.statement-side-missing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
}
.statement-side-match:hover { color: var(--red); }
.reminder-side-item { padding: 4px 0; }
.statement-preview-panel {
  width: min(1040px, 100%);
}
.statement-preview-body {
  min-height: 260px;
  max-height: min(68vh, 680px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.statement-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.statement-preview-table th,
.statement-preview-table td {
  max-width: 260px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.statement-preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafafa;
  color: #344054;
  font-weight: 800;
}
.statement-preview-text {
  margin: 0;
  padding: 14px;
  color: #344054;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}
.muted-text { color: var(--muted); margin: 0; line-height: 1.45; }
.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(17, 24, 39, .42);
}
.modal-backdrop[hidden] { display: none; }
.modal-panel {
  width: min(720px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(16, 24, 40, .22);
  padding: 22px;
}
.guest-auth-panel { width: min(520px, 100%); }
.guest-auth-panel .modal-head p { margin: 6px 0 0; color: var(--muted); line-height: 1.45; }
.guest-auth-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.guest-auth-actions .btn { flex: 1 1 180px; }
.catalog-modal-panel { width: min(860px, 100%); }
.catalog-modal-head h2 { display: flex; align-items: center; gap: 10px; }
.catalog-modal-head h2 .icon { color: var(--red); width: 24px; height: 24px; }
.catalog-search {
  margin: 0 0 14px;
  position: relative;
  display: block;
}
.catalog-search .icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: #98a2b3;
  pointer-events: none;
}
.catalog-search .form-control {
  height: 46px;
  padding-left: 46px;
  border-color: var(--line-strong);
}
.catalog-search .form-control:focus { border-color: rgba(227,6,19,.55); box-shadow: 0 0 0 3px rgba(227,6,19,.08); }
.catalog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 0 14px;
  color: var(--muted);
  font-weight: 700;
}
.catalog-meta span:last-child { display: inline-flex; align-items: center; gap: 10px; }
.catalog-meta button {
  border: 0;
  background: transparent;
  color: var(--red);
  padding: 0;
  cursor: pointer;
  font-weight: 760;
}
.catalog-product-list {
  display: grid;
  gap: 12px;
  max-height: min(430px, 48vh);
  overflow: auto;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.catalog-product-card {
  min-height: 92px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}
.catalog-product-card:hover { border-color: var(--line-strong); background: #fcfcfd; }
.catalog-product-card.is-selected { border-color: rgba(227,6,19,.38); background: var(--red-soft); box-shadow: 0 0 0 2px rgba(227,6,19,.06); }
.catalog-product-card input {
  width: 24px;
  height: 24px;
  accent-color: var(--red);
}
.catalog-product-copy { min-width: 0; display: grid; gap: 5px; }
.catalog-product-copy strong { font-size: 16px; line-height: 1.2; }
.catalog-product-copy small { color: var(--muted); font-size: 13px; font-weight: 650; }
.catalog-product-price { font-size: 16px; white-space: nowrap; }
.catalog-actions { padding-top: 18px; }
.catalog-actions .btn-primary:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-head h2 { margin: 0 0 6px; font-size: 22px; line-height: 1.15; }
.modal-head p { margin: 0; color: var(--muted); }
.modal-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 5px; font-size: 24px; line-height: 1; background: #fff; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 2px; }
.unsaved-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(17, 24, 39, .45);
  backdrop-filter: blur(5px);
}
.unsaved-dialog-backdrop[hidden] { display: none; }
.unsaved-dialog {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(16,24,40,.24);
  padding: 22px;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
}
.unsaved-dialog-icon {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  border: 1px solid #fecdd3;
  background: var(--red-soft);
  color: var(--red);
  display: grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
  font-weight: 850;
}
.unsaved-dialog-copy h2 { margin: 0 0 7px; font-size: 21px; line-height: 1.15; }
.unsaved-dialog-copy p { margin: 0; color: var(--muted); line-height: 1.5; }
.unsaved-dialog-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
  flex-wrap: wrap;
}
.form-error { margin: 0; border: 1px solid #fecdd3; border-radius: 5px; background: var(--red-soft); color: #b91c1c; padding: 10px 12px; font-weight: 650; }

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

.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #fff, #f7f8fa); padding: 30px; }
.auth-card { position: relative; width: min(760px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 34px; }
.auth-guest-form { position: absolute; top: 24px; right: 24px; margin: 0; }
.auth-brand { padding: 0 0 26px; }
.auth-brand .brand-logo { width: 150px; }
.auth-card h1 { margin: 0 0 8px; font-size: 30px; }
.auth-subtitle { margin: 0 0 24px; color: var(--muted); }
.onboarding-form { max-height: none; overflow: visible; padding-right: 0; }
.auth-alt-action { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 10px; text-align: center; color: var(--muted); font-weight: 650; }
.auth-legal-links { display: flex; justify-content: center; gap: 8px; margin-top: 18px; color: var(--muted); font-size: 13px; font-weight: 650; }
.auth-legal-links a:hover { color: var(--red); }

.public-shell { min-height: 100vh; background: #fff; color: var(--text); display: flex; flex-direction: column; }
.public-topbar { min-height: 76px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 0 max(24px, calc((100vw - 1040px) / 2)); background: rgba(255,255,255,.94); position: sticky; top: 0; z-index: 10; }
.public-brand { padding: 0; font-size: 25px; }
.public-brand .brand-logo { width: 142px; }
.public-nav { display: flex; align-items: center; gap: 18px; color: #344054; font-size: 14px; font-weight: 700; }
.public-nav a:not(.btn):hover { color: var(--red); }
.public-main { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 70px; flex: 1; }
.public-footer { border-top: 1px solid var(--line); color: var(--muted); display: flex; justify-content: space-between; gap: 16px; padding: 22px max(24px, calc((100vw - 1040px) / 2)); font-size: 13px; font-weight: 650; }
.public-footer a:hover { color: var(--red); }
.legal-page { max-width: 860px; }
.legal-kicker { margin: 0 0 12px; color: var(--red); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.legal-page h1 { margin: 0 0 14px; font-size: clamp(34px, 5vw, 54px); line-height: 1.02; letter-spacing: 0; }
.legal-lead { margin: 0 0 34px; color: #475467; font-size: 18px; line-height: 1.62; }
.legal-page section { border-top: 1px solid var(--line); padding: 24px 0; }
.legal-page h2 { margin: 0 0 12px; font-size: 22px; line-height: 1.2; }
.legal-page p, .legal-page li { color: #344054; line-height: 1.66; }
.legal-page p { margin: 0; }
.legal-page ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.legal-page a { color: var(--red); font-weight: 750; }
.legal-page code { border: 1px solid var(--line); border-radius: 5px; background: var(--bg); padding: 2px 5px; color: #111827; font-size: .92em; }

.mobile-only { display: none; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .detail-grid, .settings-grid, .document-top-grid, .report-layout { grid-template-columns: 1fr; }
  .client-profile-panel { grid-template-columns: 1fr; }
  .invoice-live-preview-card { position: static; max-height: none; }
  .topbar { gap: 14px; }
  .org-switch { min-width: 200px; }
  .report-period-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; width: 100%; }
  .mobile-only { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .org-switcher .org-switch { min-width: 44px; width: 44px; padding: 0 10px; }
  .org-switcher .org-switch > span:not(.icon) { display: none; }
  .org-switcher .org-switch .icon:last-child { display: none; }
  .org-menu { left: -58px; width: min(330px, calc(100vw - 24px)); }
  .top-actions .user-chip > span:not(.avatar) { display: none; }
  .content { padding: 22px 16px; }
  .page-head { display: grid; }
  .page-actions { justify-content: stretch; }
  .page-actions .btn { flex: 1; }
  .profile-dropdown { right: -6px; }
  .stats-grid, .form-grid.two, .form-grid.three, .form-grid.four, .client-cards, .email-provider-list, .client-import-box { grid-template-columns: 1fr; }
  .automation-section-head { display: grid; }
  .automation-notification { grid-template-columns: 1fr; }
  .automation-mailbox { align-self: stretch; justify-content: center; max-width: none; }
  .automation-mailbox-email { display: none; }
  .automation-notification-actions { justify-content: stretch; }
  .automation-notification-actions form, .automation-notification-actions .btn { width: 100%; }
  .report-actions { display: grid; }
  .report-period-form { width: 100%; display: grid; grid-template-columns: 1fr; padding: 10px; }
  .report-period-form label { padding-left: 0; }
  .report-period-form select { width: 100%; min-width: 0; }
  .report-period-strip, .report-grid-two, .report-side-stack, .report-donut-body, .report-quality-grid { grid-template-columns: 1fr; }
  .report-period-strip > div { min-height: 64px; }
  .report-panel-head { align-items: flex-start; display: grid; }
  .report-legend { flex-wrap: wrap; }
  .report-line-chart { height: 300px; padding: 8px; }
  .report-donut { width: 178px; justify-self: center; }
  .report-status-row { grid-template-columns: minmax(0, 1fr) 34px minmax(128px, max-content); }
  .report-status-row small { min-width: 128px; }
  .report-vat-row, .report-bar-row { grid-template-columns: 1fr; align-items: stretch; }
  .report-vat-row > strong, .report-bar-row > strong { text-align: left; }
  .client-profile-grid, .client-profile-metrics { grid-template-columns: 1fr; }
  .stat-card { min-height: 96px; }
  .setting-row { grid-template-columns: 1fr; }
  .document-overview-grid, .document-meta-card { grid-template-columns: 1fr; }
  .payment-proof-item, .payment-proof-item.manual { grid-template-columns: 1fr; }
  .payment-proof-item > .btn { justify-self: stretch; }
  .proof-pdf-scroll { min-height: 360px; height: 62vh; padding: 10px; }
  .pdf-preview-frame, .pdf-preview-panel.compact .pdf-preview-frame { min-height: 520px; height: 70vh; }
  .logo-upload-box { align-items: flex-start; }
  .access-panel-head, .email-settings-head { align-items: stretch; display: grid; }
  .document-table-head, .line-main-fields, .line-detail-fields { grid-template-columns: 1fr; }
  .document-table-head { display: grid; }
  .line-detail-fields { gap: 12px; }
  .form-summary-panel .btn { justify-self: stretch; min-width: 0; }
  .invoice-preview-header, .invoice-preview-meta { grid-template-columns: 1fr; }
  .invoice-preview-issuer { text-align: left; }
  .invoice-preview-meta div { border-right: 0; border-bottom: 1px solid var(--line); }
  .invoice-preview-meta div:last-child { border-bottom: 0; }
  .catalog-meta { align-items: flex-start; display: grid; }
  .catalog-product-card { grid-template-columns: 30px minmax(0, 1fr); }
  .catalog-product-price { grid-column: 2; justify-self: start; }
  .modal-backdrop { align-items: start; padding: 14px; }
  .modal-panel { max-height: calc(100vh - 28px); padding: 18px; }
  .auth-guest-form { position: static; display: flex; justify-content: flex-end; margin-bottom: 18px; }
  .modal-actions, .unsaved-dialog-actions { display: grid; grid-template-columns: 1fr; }
  .unsaved-dialog { grid-template-columns: 1fr; padding: 18px; }
  .public-topbar, .public-footer { display: grid; justify-content: stretch; padding-left: 16px; padding-right: 16px; }
  .public-topbar { gap: 12px; padding-top: 14px; padding-bottom: 14px; }
  .public-nav { flex-wrap: wrap; gap: 12px; }
  .public-main { width: calc(100% - 32px); padding: 36px 0 54px; }
  .legal-page h1 { font-size: 36px; }
  .floating-save-button {
    right: 84px;
    bottom: 16px;
    min-height: 48px;
    padding: 0 18px;
  }
  .ai-assistant { right: 16px; bottom: 16px; }
  .ai-mic-button { width: 54px; height: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .page-loader,
  .page-loader-spinner,
  .btn-spinner,
  .ai-mic-button.is-recording.has-voice,
  .ai-mic-button.is-busy::after,
  .side-nav a.ai-nav-focus {
    animation: none;
    transition: none;
  }
  .ai-voice-meter span {
    transition: none;
  }
}

/* ---- Banner d'essai / abonnement ---- */
.trial-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 11px 14px 11px 16px;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font-size: 13.5px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
}
.trial-banner .icon { width: 17px; height: 17px; flex-shrink: 0; opacity: .95; }
.trial-banner-icon { display: inline-flex; }
.trial-banner-text { flex: 1; min-width: 0; }
.trial-banner-text strong { font-weight: 700; }
.trial-banner-cta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  padding: 7px 8px 7px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: background .2s ease, transform .2s ease;
}
.trial-banner-cta:hover { background: rgba(255, 255, 255, 0.26); transform: translateY(-1px); }
.trial-banner-arrow { width: 15px; height: 15px; }
.trial-banner.is-urgent { background: linear-gradient(90deg, #9a3412, #c2410c); }
.trial-banner.is-expired {
  background: linear-gradient(90deg, var(--red-dark), var(--red));
  box-shadow: 0 10px 26px rgba(227, 6, 19, 0.28);
}
.trial-banner.is-expired .trial-banner-cta { background: #fff; color: var(--red-dark); }
.trial-banner.is-expired .trial-banner-cta:hover { background: #fff; transform: translateY(-1px); }
@media (max-width: 640px) {
  .trial-banner { flex-wrap: wrap; }
  .trial-banner-text { flex-basis: 100%; order: 2; }
  .trial-banner-cta { margin-left: auto; order: 3; }
  .trial-banner-icon { order: 1; }
}

/* ---- Carte abonnement (page profil) ---- */
.sub-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sub-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}
.sub-card.is-active::before { background: var(--green); }
.sub-card.is-expired::before { background: var(--red); }
.sub-card.is-trial::before { background: var(--orange); }
.sub-card-body { flex: 1 1 320px; min-width: 0; }
.sub-card-aside { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex: 0 0 auto; }
.sub-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
}
.sub-card-badge .icon { width: 14px; height: 14px; }
.sub-card.is-active .sub-card-badge { background: var(--green-soft); color: #166534; }
.sub-card.is-expired .sub-card-badge { background: var(--red-soft); color: #9f1239; }
.sub-card.is-trial .sub-card-badge { background: var(--orange-soft); color: #9a3412; }
.sub-card-title { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.sub-card-title strong { color: var(--red); }
.sub-card.is-active .sub-card-title strong { color: var(--green); }
.sub-card-text { margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.sub-progress { max-width: 460px; margin-top: 14px; height: 7px; border-radius: 999px; background: #eef0f3; overflow: hidden; }
.sub-progress span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--orange), var(--red)); }
.sub-price { text-align: right; line-height: 1.1; }
.sub-price-amount { font-size: 22px; font-weight: 800; color: var(--text); }
.sub-price-period { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.sub-card-aside .btn { white-space: nowrap; }
@media (max-width: 640px) {
  .sub-card { flex-direction: column; align-items: stretch; }
  .sub-card-aside { align-items: stretch; }
  .sub-price { text-align: left; }
  .sub-card-aside .btn { width: 100%; }
}

/* ===================== Design du document (studio) ===================== */
.design-studio { display: grid; grid-template-columns: minmax(320px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.design-editor { padding: 18px; }
.design-tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 8px; padding: 4px; margin-bottom: 16px; }
.design-tab { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 6px; font-weight: 600; color: var(--muted); cursor: pointer; font-size: 13px; }
.design-tab.is-active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.design-panel { display: none; }
.design-panel.is-active { display: block; animation: design-fade .18s ease; }
@keyframes design-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.design-field { margin-bottom: 18px; }
.design-field:last-child { margin-bottom: 0; }
.design-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 8px; color: var(--text); }
.design-label small { color: var(--muted); font-weight: 400; }
.design-inline-check { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }

.design-theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.design-theme-option { position: relative; border: 1px solid var(--line); border-radius: 8px; padding: 10px 6px; text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: border-color .15s, box-shadow .15s; }
.design-theme-option.is-selected { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.design-theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.design-theme-option strong { font-size: 12.5px; }
.design-theme-option small { font-size: 10px; color: var(--muted); line-height: 1.2; }
.design-theme-thumb { width: 44px; height: 56px; border-radius: 4px; border: 1px solid var(--line); background: #fff; position: relative; overflow: hidden; }
.design-theme-thumb::before { content: ''; position: absolute; left: 6px; right: 6px; top: 16px; height: 3px; background: #d0d5dd; box-shadow: 0 7px 0 #e4e7ec, 0 14px 0 #e4e7ec; }
.design-theme-thumb-standard::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--red); }
.design-theme-thumb-compact::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--red); }
.design-theme-thumb-compact::before { top: 10px; box-shadow: 0 5px 0 #e4e7ec, 0 10px 0 #e4e7ec, 0 15px 0 #e4e7ec; }
.design-theme-thumb-lateral::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--red); }
.design-theme-thumb-lateral::before { left: 12px; }

.design-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.design-swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; position: relative; }
.design-swatch.is-selected { box-shadow: 0 0 0 2px var(--text); }
.design-swatch-custom { display: flex; align-items: center; justify-content: center; background: #fff; color: var(--muted); font-size: 20px; font-weight: 600; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.design-swatch-custom input[type="color"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; border: 0; padding: 0; }

.design-apply-list { border: 1px solid var(--line); border-radius: 8px; padding: 2px 12px; }
.design-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; font-size: 13.5px; color: var(--text); cursor: pointer; }
.design-toggle + .design-toggle { border-top: 1px solid var(--line); }
.design-toggle span small { color: var(--muted); }
.design-toggle input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 999px; background: #d0d5dd; position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.design-toggle input[type="checkbox"]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .25); transition: left .15s; }
.design-toggle input[type="checkbox"]:checked { background: var(--green); }
.design-toggle input[type="checkbox"]:checked::after { left: 20px; }
.design-toggle.is-locked { cursor: default; }
.design-toggle.is-locked input[type="checkbox"], .design-toggle input[type="checkbox"]:disabled { opacity: .55; cursor: default; }

.design-banner-preview { width: 120px; height: 46px; border: 1px dashed var(--line); border-radius: 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--bg); flex: none; }
.design-banner-preview img { width: 100%; height: 100%; object-fit: cover; }
.design-banner-preview span { font-size: 10px; color: var(--muted); }

.design-editor-footer { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 18px; }
.design-editor-footer .btn { width: 100%; }

.design-preview-wrap { padding: 16px; position: sticky; top: 16px; }
.design-preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.design-preview-head .panel-title { margin: 0; }
.design-preview-status { font-size: 12px; color: var(--muted); }
.design-preview-stage { background: #eef1f5; border-radius: 8px; overflow: hidden; min-height: 320px; }
.design-preview-frame { border: 0; display: block; background: #fff; width: 794px; }

@media (max-width: 980px) {
  .design-studio { grid-template-columns: 1fr; }
  .design-preview-wrap { position: static; }
}

.settings-link-card { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.settings-link-card:hover { border-color: var(--text); box-shadow: var(--shadow); }
.settings-link-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 8px; background: var(--bg); color: var(--text); flex: none; }
.settings-link-icon .icon { width: 18px; height: 18px; }
.settings-link-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-link-copy strong { font-size: 14px; }
.settings-link-copy small { color: var(--muted); font-size: 12px; }
.settings-link-chev { margin-left: auto; color: var(--muted); flex: none; }

/* ===================== Design : modal sur le formulaire facture/devis ===================== */
button.panel-link { background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 4px; }
button.panel-link .icon { width: 15px; height: 15px; }

.design-modal-panel { width: min(1120px, 96vw); max-width: 96vw; max-height: 94vh; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.design-modal-panel .modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.design-modal-panel .modal-head h2 { margin: 0; font-size: 18px; }
.design-modal-panel .modal-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.design-modal-body { flex: 1; min-height: 0; overflow: hidden; background: var(--bg); }
.design-modal-frame { width: 100%; height: 74vh; border: 0; display: block; background: var(--bg); }
.design-modal-foot { display: flex; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); }
body.is-design-modal-open { overflow: hidden; }

.embed-shell { margin: 0; background: var(--bg); }
.embed-content { padding: 18px; }
.design-embed-head { margin-bottom: 14px; }
.design-embed-head h1 { margin: 0; font-size: 20px; }
.design-embed-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

@media (max-width: 720px) { .design-modal-frame { height: 82vh; } }
