:root {
  --bg: #f4f7fb;
  --bg-accent: radial-gradient(circle at top left, rgba(98, 90, 255, 0.14), transparent 28%),
    linear-gradient(180deg, #f8faff 0%, #f4f7fb 42%, #eef3f9 100%);
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --surface-muted: #f6f8fc;
  --line: #e4e9f4;
  --line-strong: #d5ddec;
  --text: #162033;
  --muted: #6d7792;
  --muted-soft: #8f98b2;
  --primary: #6658ff;
  --primary-strong: #5142f4;
  --primary-soft: #efedff;
  --success: #17a267;
  --success-soft: #e8fbf2;
  --warning: #f2a23c;
  --warning-soft: #fff5e7;
  --danger: #de5757;
  --danger-soft: #fff0f0;
  --info: #3792ff;
  --info-soft: #ecf5ff;
  --shadow-sm: 0 10px 24px rgba(22, 32, 51, 0.06);
  --shadow-md: 0 18px 44px rgba(35, 48, 86, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --content-width: 1480px;
}

* {
  box-sizing: border-box;
}

html {
  direction: rtl;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Rubik", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-accent);
}

body.public-route .sidebar,
body.public-route .topbar {
  display: none;
}

body.public-route .app-shell {
  grid-template-columns: 1fr;
}

body.public-route .content-shell {
  padding: 0;
}

body.public-route .content {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px 18px;
  background: rgba(12, 18, 34, 0.94);
  color: #f7f9ff;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 24px 0 50px rgba(7, 11, 23, 0.24);
  backdrop-filter: blur(18px);
}

.brand-block {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(113, 101, 255, 0.24), rgba(113, 101, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #7f74ff, #5fdbff);
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.brand-logo-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.brand-subtitle,
.workspace-switch label,
.profile-meta span,
.side-section-title {
  color: rgba(233, 238, 255, 0.66);
}

.workspace-switch {
  display: grid;
  gap: 8px;
}

.workspace-switch select,
.top-search input {
  width: 100%;
}

.sidebar select,
.sidebar input {
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.08);
  color: #f7f9ff;
}

.sidebar select:focus,
.sidebar input:focus {
  border-color: rgba(144, 133, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(120, 110, 255, 0.16);
}

.side-section-title {
  margin: 8px 10px 0;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: rgba(247, 249, 255, 0.78);
  border-radius: 16px;
  border: 1px solid transparent;
  transition: 0.18s ease;
}

.side-link::before {
  content: attr(data-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.95rem;
}

.side-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.side-link.active,
.side-link.highlight {
  color: #fff;
  background: linear-gradient(90deg, rgba(102, 88, 255, 0.3), rgba(99, 187, 255, 0.18));
  border-color: rgba(163, 176, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.side-reset {
  margin-top: auto;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #7d74ff, #6fd4ff);
  color: white;
  font-weight: 700;
}

.content-shell {
  min-width: 0;
  padding: 24px;
}

.topbar {
  max-width: var(--content-width);
  margin: 0 auto 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: stretch;
}

.topbar-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}

.topbar-title {
  display: grid;
  gap: 5px;
}

.topbar-kicker {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.topbar-title h1 {
  margin: 0;
  font-size: 1.88rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge,
.plan-chip,
.status-pill,
.metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.plan-chip,
.badge.primary {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.badge.success,
.status-pill.Approved {
  background: var(--success-soft);
  color: var(--success);
}

.badge.warning,
.status-pill.Negotiating,
.status-pill.Expired {
  background: var(--warning-soft);
  color: #a76500;
}

.badge.danger,
.status-pill.Lost {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-pill.Draft,
.status-pill.Sent,
.status-pill.Viewed {
  background: var(--info-soft);
  color: var(--info);
}

.top-search {
  position: relative;
  display: flex;
  align-items: center;
}

.top-search::before {
  content: "⌕";
  position: absolute;
  right: 14px;
  color: var(--muted-soft);
}

.top-search input {
  padding-right: 38px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.page-section {
  display: grid;
  gap: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-head h2,
.section-head h3 {
  margin: 0;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.page-grid {
  display: grid;
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.8fr) 360px;
  align-items: start;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.dual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 18px;
}

.three-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.panel,
.card,
.metric-card,
.widget-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-title {
  display: grid;
  gap: 6px;
}

.panel-title h2,
.panel-title h3 {
  margin: 0;
  font-size: 1.2rem;
}

.panel-title p {
  margin: 0;
  color: var(--muted);
}

.metric-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.metric-value,
.big {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.metric-subtext,
.small {
  color: var(--muted);
  font-size: 0.92rem;
}

.hero-widget {
  padding: 22px;
  display: grid;
  gap: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 246, 255, 0.92));
}

.hero-widget .panel-title h2 {
  font-size: 1.34rem;
}

.voice-hero {
  display: grid;
  gap: 16px;
}

.voice-widget-layout {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.voice-circle {
  width: 116px;
  height: 116px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  color: #fff;
  font-size: 2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 18px 30px rgba(102, 88, 255, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.voice-circle:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 34px rgba(102, 88, 255, 0.32);
}

.voice-circle.recording {
  background: linear-gradient(180deg, #ff6c6c, #de5757);
  box-shadow: 0 18px 32px rgba(222, 87, 87, 0.28);
}

.voice-status-stack {
  display: grid;
  gap: 8px;
}

.voice-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.metric-pill {
  background: #f2f5fa;
  color: var(--muted);
}

.transcript-box {
  display: grid;
  gap: 10px;
}

textarea,
input,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(102, 88, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(102, 88, 255, 0.12);
}

.btn-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  min-height: 46px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  box-shadow: 0 14px 26px rgba(102, 88, 255, 0.25);
}

.btn.secondary {
  background: #eef2ff;
  color: var(--primary-strong);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.warn {
  background: var(--warning-soft);
  color: #a76500;
}

.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn.success {
  background: var(--success-soft);
  color: var(--success);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.form-grid.compact {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field label {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--muted);
}

.editor-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 360px;
  gap: 18px;
  align-items: start;
}

.editor-main {
  display: grid;
  gap: 18px;
}

.editor-sidebar {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 24px;
}

.section-card {
  padding: 22px;
}

.section-card + .section-card {
  margin-top: 0;
}

.section-card .panel-title h3 {
  font-size: 1.08rem;
}

.stack {
  display: grid;
  gap: 16px;
}

.editor-items {
  display: grid;
  gap: 14px;
}

.item-editor {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  display: grid;
  gap: 12px;
}

.item-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 13px 14px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table th {
  background: #f8faff;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: #fafcff;
}

.totals-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.summary-list {
  display: grid;
  gap: 10px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-row strong:last-child {
  font-size: 1.05rem;
}

.chat-box {
  display: grid;
  gap: 10px;
  min-height: 72px;
}

.chat-line {
  max-width: 86%;
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.5;
}

.chat-line.assistant {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.chat-line.user {
  margin-right: auto;
  background: #eff5fb;
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.debug-card {
  padding: 16px;
  border-radius: 18px;
  background: #fbfcff;
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.debug-card pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #24304f;
}

.debug-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.debug-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.debug-tags span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 30px 18px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.35rem;
}

.trend-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  min-height: 230px;
}

.trend-col {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.trend-bar-wrap {
  width: 100%;
  min-height: 170px;
  display: flex;
  align-items: end;
  justify-content: center;
}

.trend-bar {
  width: 58px;
  border-radius: 18px 18px 10px 10px;
  background: linear-gradient(180deg, #7e73ff 0%, #6658ff 52%, #4a93ff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.funnel-list {
  display: grid;
  gap: 12px;
}

.funnel-row {
  display: grid;
  gap: 8px;
}

.funnel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.funnel-track {
  height: 10px;
  border-radius: 999px;
  background: #eff3f9;
  overflow: hidden;
}

.funnel-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7d72ff, #4da3ff);
}

.quick-create-card {
  padding: 22px;
  display: grid;
  gap: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f6ff 100%);
}

.quick-actions {
  display: grid;
  gap: 10px;
}

.widget-list {
  display: grid;
  gap: 12px;
}

.widget-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quote-document {
  background: #fff;
  border: 1px solid #e7ebf4;
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 22px 50px rgba(18, 26, 51, 0.08);
  display: grid;
  gap: 18px;
  max-width: 980px;
  margin: 0 auto;
}

.document-accent-bar {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #6f62ff 0%, #488dff 52%, #53c192 100%);
}

.quote-doc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e9edf5;
}

.quote-brand-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.quote-brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, #6f62ff, #57b8ff);
  color: white;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  font-weight: 700;
  overflow: hidden;
  flex: 0 0 58px;
}

.quote-logo-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quote-brand-copy {
  display: grid;
  gap: 2px;
}

.quote-brand-copy h2 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}

.quote-brand-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.quote-eyebrow {
  display: inline-flex;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef1ff;
  color: #5448f6;
  font-size: 0.72rem;
  font-weight: 700;
}

.quote-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.quote-action-stack {
  display: grid;
  gap: 10px;
  width: 100%;
}

.quote-number-box {
  min-width: 152px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f8faff;
  border: 1px solid #e7ecf8;
  display: grid;
  gap: 4px;
  text-align: right;
}

.quote-number-box span {
  font-size: 0.82rem;
  color: var(--muted);
}

.quote-number-box strong {
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.quote-number-box p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.quote-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.quote-summary-pill {
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfcff 0%, #f4f7ff 100%);
  border: 1px solid #e5ebfb;
  display: grid;
  gap: 6px;
}

.quote-summary-pill span {
  color: var(--muted);
  font-size: 0.8rem;
}

.quote-summary-pill strong {
  font-size: 1.12rem;
}

.quote-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quote-meta-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: #f8faff;
  border: 1px solid #e8edf7;
  display: grid;
  gap: 5px;
}

.quote-meta-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.quote-meta-card strong {
  font-size: 1.12rem;
}

.quote-meta-card p {
  margin: 0;
  color: var(--muted);
}

.quote-section-head {
  display: grid;
  gap: 8px;
}

.quote-section-head strong {
  font-size: 1.08rem;
}

.quote-table-wrap {
  border: 1px solid #e7ebf4;
  border-radius: 18px;
  overflow: hidden;
}

.quote-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.quote-table th,
.quote-table td {
  padding: 15px 16px;
  text-align: right;
  border-bottom: 1px solid #edf1f7;
  vertical-align: top;
}

.quote-table th {
  background: #f8faff;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.quote-lines-table td:first-child,
.quote-lines-table th:first-child {
  width: 42px;
}

.quote-lines-table th:nth-child(2),
.quote-lines-table td:nth-child(2) {
  width: 18%;
}

.quote-lines-table th:nth-child(3),
.quote-lines-table td:nth-child(3) {
  width: 28%;
}

.quote-lines-table th:nth-child(4),
.quote-lines-table td:nth-child(4) {
  width: 12%;
}

.quote-lines-table th:nth-child(5),
.quote-lines-table td:nth-child(5) {
  width: 12%;
}

.quote-lines-table th:nth-child(6),
.quote-lines-table td:nth-child(6),
.quote-lines-table th:nth-child(7),
.quote-lines-table td:nth-child(7) {
  width: 14%;
}

.line-title-cell {
  display: grid;
  gap: 8px;
}

.line-title-cell strong {
  font-size: 1rem;
}

.line-type-badge {
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef1ff;
  color: #5146f4;
  font-size: 0.76rem;
  font-weight: 700;
}

.muted-inline {
  color: var(--muted);
}

.quote-table tr:last-child td {
  border-bottom: 0;
}

.quote-footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 340px;
  gap: 18px;
  align-items: start;
}

.quote-terms-card,
.quote-totals-card {
  padding: 20px;
  border-radius: 22px;
  border: 1px solid #e7ecf8;
}

.quote-terms-card {
  background: #fbfcff;
}

.quote-terms-card p {
  margin: 10px 0 0;
  line-height: 1.7;
}

.quote-totals-card {
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fe 100%);
  display: grid;
  gap: 8px;
}

.quote-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #ecf0f7;
}

.quote-total-row.grand {
  border-bottom: 0;
  padding-top: 14px;
}

.quote-total-row.grand span,
.quote-total-row.grand strong {
  font-size: 1.18rem;
  font-weight: 700;
}

.quote-doc-footnote {
  padding-top: 14px;
  border-top: 1px dashed #dde5f3;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.82rem;
  flex-wrap: wrap;
}

.quote-document {
  font-family: "Heebo", "Assistant", "Rubik", sans-serif;
  max-width: 920px;
  padding: 32px;
  gap: 22px;
}

.quote-pro-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eceff5;
}

.quote-pro-header-side {
  display: grid;
  gap: 8px;
}

.quote-pro-header-meta {
  min-width: 220px;
  justify-items: start;
}

.quote-pro-header-brand {
  justify-items: end;
}

.quote-pro-quote-id {
  font-size: 1.85rem;
  font-weight: 800;
  color: #4f46e5;
  letter-spacing: -0.04em;
}

.quote-pro-header-lines {
  display: grid;
  gap: 4px;
}

.quote-pro-header-lines div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #6f7890;
  font-size: 1rem;
}

.quote-pro-header-lines strong {
  color: #1f2940;
}

.quote-pro-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.quote-pro-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6f62ff, #57b8ff);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 700;
  overflow: hidden;
  flex: 0 0 48px;
}

.quote-pro-brand-copy {
  display: grid;
  gap: 3px;
}

.quote-pro-brand-copy h1 {
  margin: 0;
  font-size: 1.42rem;
  letter-spacing: -0.03em;
}

.quote-pro-brand-copy p {
  margin: 0;
  color: #69738b;
  font-size: 0.98rem;
}

.quote-mini-kicker {
  display: inline-flex;
  width: fit-content;
  color: #6159f6;
  font-size: 0.92rem;
  font-weight: 700;
}

.quote-pro-title-block {
  display: grid;
  gap: 4px;
  text-align: right;
}

.quote-pro-title-block h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.05em;
}

.quote-pro-meta {
  min-width: 190px;
  display: grid;
  gap: 8px;
}

.quote-pro-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f2f7;
  font-size: 0.92rem;
}

.quote-pro-meta-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.quote-pro-meta-row span {
  color: #7d859b;
}

.quote-pro-meta-row strong {
  font-size: 1rem;
}

.quote-pro-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.quote-pro-intro {
  display: grid;
  gap: 6px;
}

.quote-pro-intro h2 {
  margin: 0;
  font-size: 2.1rem;
  letter-spacing: -0.04em;
}

.quote-pro-intro p {
  margin: 0;
  color: #69738b;
  font-size: 1rem;
}

.quote-public-actions,
.quote-action-stack {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.quote-pro-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.quote-client-card-full {
  grid-column: 1 / -1;
}

.quote-pro-card {
  padding: 20px;
  border-radius: 18px;
  background: #fbfcff;
  border: 1px solid #eceff5;
  display: grid;
  gap: 6px;
}

.quote-card-label {
  color: #7a8398;
  font-size: 0.92rem;
  font-weight: 700;
}

.quote-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eceff5;
}

.quote-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ecebff;
  color: #564cf5;
  font-size: 0.95rem;
}

.quote-pro-card strong {
  font-size: 1.18rem;
}

.quote-pro-card p {
  margin: 0;
  color: #69738b;
  font-size: 1rem;
}

.quote-client-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.quote-client-side {
  text-align: left;
}

.quote-pro-table-block {
  display: grid;
  gap: 12px;
}

.quote-pro-table-head {
  display: grid;
  gap: 4px;
}

.quote-pro-table-head strong {
  font-size: 1.15rem;
}

.quote-pro-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.quote-pro-table th,
.quote-pro-table td {
  padding: 15px 8px;
  text-align: right;
  border-bottom: 1px solid #edf0f6;
  vertical-align: top;
  font-size: 1rem;
}

.quote-pro-table th {
  color: #7b8499;
  font-size: 0.9rem;
  font-weight: 700;
}

.quote-pro-table th:nth-child(1),
.quote-pro-table td:nth-child(1) {
  width: 28%;
}

.quote-pro-table th:nth-child(2),
.quote-pro-table td:nth-child(2) {
  width: 12%;
}

.quote-pro-table th:nth-child(3),
.quote-pro-table td:nth-child(3) {
  width: 12%;
}

.quote-pro-table th:nth-child(4),
.quote-pro-table td:nth-child(4) {
  width: 16%;
}

.quote-pro-table th:nth-child(5),
.quote-pro-table td:nth-child(5) {
  width: 14%;
}

.quote-pro-table th:nth-child(6),
.quote-pro-table td:nth-child(6) {
  width: 18%;
}

.quote-pro-table tr:last-child td {
  border-bottom: 0;
}

.quote-line-primary {
  display: grid;
  gap: 5px;
}

.quote-line-primary strong {
  font-size: 0.98rem;
}

.quote-line-primary span {
  color: #7b8499;
  font-size: 0.92rem;
}

.quote-pro-finance {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.quote-pro-totals {
  padding: 20px;
  border-radius: 18px;
  border: 1px solid #eceff5;
  background: #fff;
  display: grid;
  gap: 8px;
}

.quote-pro-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f6;
  font-size: 1rem;
}

.quote-pro-total-row.grand {
  padding-top: 14px;
  border-bottom: 0;
}

.quote-pro-total-row.grand span,
.quote-pro-total-row.grand strong {
  font-size: 1.56rem;
  font-weight: 800;
  color: #4338ca;
}

.quote-pro-footer {
  padding-top: 16px;
  border-top: 1px solid #edf0f6;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.quote-pro-footer-contact,
.quote-pro-footer-approval {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quote-pro-footer strong {
  font-size: 1.15rem;
}

.no-print {
  display: initial;
}

.logo-upload-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfcff 0%, #f4f7ff 100%);
  border: 1px solid #e5ebfb;
}

.logo-upload-preview {
  width: 132px;
  height: 132px;
  border-radius: 24px;
  background: linear-gradient(135deg, #6f62ff, #56b8ff);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.logo-upload-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-upload-fallback {
  color: white;
  font-size: 2rem;
  font-weight: 800;
}

.logo-upload-meta {
  display: grid;
  gap: 10px;
  align-content: center;
}

.logo-upload-meta strong {
  font-size: 1rem;
}

.logo-upload-meta p {
  margin: 0;
  color: var(--muted);
}

.logo-upload-trigger {
  cursor: pointer;
}

.tabs-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tab {
  padding: 10px 14px;
  border-radius: 999px;
  background: #f1f4fb;
  color: var(--muted);
  font-weight: 600;
}

.tab.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.toast {
  position: fixed;
  left: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(14, 19, 34, 0.94);
  color: #fff;
  box-shadow: 0 16px 34px rgba(14, 19, 34, 0.28);
  opacity: 0;
  transform: translateY(14px);
  transition: 0.2s ease;
  pointer-events: none;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.loading-skeleton {
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f1f4fb, #e7ecf7, #f1f4fb);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (max-width: 1320px) {
  .dashboard-grid,
  .editor-shell,
  .dual-grid,
  .topbar {
    grid-template-columns: 1fr;
  }

  .editor-sidebar {
    position: static;
  }

  .stats-grid,
  .three-grid,
  .totals-grid,
  .quote-meta-grid,
  .debug-grid,
  .form-grid,
  .form-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quote-footer-grid {
    grid-template-columns: 1fr;
  }

  .quote-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .logo-upload-card {
    grid-template-columns: 1fr;
  }

  .logo-upload-preview {
    margin-inline: auto;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-left: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px 14px;
    gap: 14px;
  }

  .brand-block {
    grid-template-columns: 46px 1fr;
    align-items: center;
  }

  .side-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .side-link {
    min-height: 56px;
    justify-content: center;
    text-align: center;
    padding: 10px;
    font-size: 0.88rem;
  }

  .side-link::before {
    display: none;
  }

  .profile-card {
    display: none;
  }

  .content-shell {
    padding: 14px;
  }

  .topbar {
    margin-bottom: 16px;
  }

  .topbar-panel {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-title h1 {
    font-size: 1.46rem;
  }

  .topbar-actions,
  .topbar-meta {
    justify-content: space-between;
  }

  .voice-widget-layout,
  .stats-grid,
  .three-grid,
  .totals-grid,
  .quote-meta-grid,
  .debug-grid,
  .form-grid,
  .form-grid.compact,
  .trend-chart {
    grid-template-columns: 1fr;
  }

  .voice-circle {
    margin-inline: auto;
  }

  .table {
    min-width: 640px;
  }

  .quote-doc-header,
  .quote-brand-card {
    flex-direction: column;
    align-items: stretch;
  }

  .quote-pro-header,
  .quote-pro-brand,
  .quote-pro-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .quote-pro-header-brand {
    justify-items: stretch;
  }

  .quote-summary-strip {
    grid-template-columns: 1fr;
  }

  .quote-actions {
    justify-items: stretch;
  }

  .quote-table {
    min-width: 640px;
  }

  .quote-pro-table {
    min-width: 640px;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .btn-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .quote-pro-grid,
  .quote-pro-finance,
  .quote-pro-footer {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar {
    border-radius: 0 0 22px 22px;
  }

  .workspace-switch,
  .top-search {
    width: 100%;
  }

  .metric-card,
  .panel,
  .quick-create-card,
  .public-box,
  .quote-document {
    padding: 16px;
    border-radius: 18px;
  }

  .voice-circle {
    width: 88px;
    height: 88px;
    font-size: 1.6rem;
  }

  .table {
    min-width: 560px;
  }

  .quote-table {
    min-width: 560px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  html,
  body {
    width: auto;
    min-height: auto;
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sidebar,
  .topbar,
  .btn-row,
  .toast,
  .no-print {
    display: none !important;
  }

  body,
  .content-shell,
  .content,
  .printable-quote {
    background: white !important;
    box-shadow: none;
    padding: 0;
  }

  body.public-route .app-shell,
  body.public-route .page-section,
  .app-shell,
  .page-section {
    display: block;
    min-height: auto;
    padding: 0;
    margin: 0;
  }

  body.public-route .content-shell,
  body.public-route .content,
  .quote-document {
    max-width: none;
    width: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  .printable-quote,
  .quote-document {
    display: block;
    width: 100%;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    overflow: visible !important;
  }

  .quote-table-wrap,
  .table-wrap,
  .quote-pro-table-block {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  .quote-table,
  .quote-pro-table,
  .table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  .quote-table th,
  .quote-table td,
  .quote-pro-table th,
  .quote-pro-table td,
  .table th,
  .table td {
    white-space: normal !important;
    word-break: break-word !important;
  }

  .content-shell,
  .content,
  .page-section,
  .public-box {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  .quote-pro-header,
  .quote-pro-grid,
  .quote-pro-finance,
  .quote-pro-footer {
    break-inside: avoid;
  }

  .quote-pro-header {
    display: grid;
    grid-template-columns: 1fr 52mm;
    gap: 2.6mm;
    padding-bottom: 2mm;
    margin-bottom: 1mm;
    border-bottom: 1px solid #d9dfeb;
  }

  .quote-pro-header-meta {
    min-width: 0;
  }

  .quote-pro-brand {
    gap: 1.8mm;
    align-items: center;
  }

  .quote-pro-logo {
    width: 8mm;
    height: 8mm;
    border-radius: 2.2mm;
    flex: 0 0 8mm;
  }

  .quote-pro-brand-copy h1 {
    font-size: 11pt;
  }

  .quote-pro-title-block h2 {
    font-size: 15pt;
  }

  .quote-pro-brand-copy p,
  .quote-pro-meta-row span,
  .quote-pro-card p,
  .quote-card-label,
  .quote-pro-intro p {
    font-size: 8.4pt;
    color: #5f6b84 !important;
  }

  .quote-mini-kicker {
    font-size: 8pt;
  }

  .quote-pro-meta {
    min-width: auto;
    gap: 4px;
  }

  .quote-pro-meta-row {
    gap: 8px;
    padding-bottom: 4px;
    font-size: 7.4pt;
  }

  .quote-pro-quote-id {
    font-size: 15pt;
  }

  .quote-pro-intro {
    gap: 2px;
  }

  .quote-pro-intro h2 {
    font-size: 14pt;
  }

  .quote-public-actions,
  .quote-action-stack {
    display: none !important;
  }

  .quote-pro-card,
  .quote-pro-totals {
    padding: 2.8mm;
    border-radius: 3mm;
    box-shadow: none !important;
  }

  .quote-card-head {
    padding-bottom: 1.6mm;
    gap: 1.8mm;
  }

  .quote-card-icon {
    width: 7mm;
    height: 7mm;
    font-size: 6pt;
  }

  .quote-client-grid {
    gap: 3mm;
  }

  .quote-pro-table {
    table-layout: fixed;
  }

  .quote-pro-table th,
  .quote-pro-table td {
    padding: 1.6mm 1.5mm;
    font-size: 9.6pt;
    line-height: 1.15;
    word-break: break-word;
  }

  .quote-line-primary strong {
    font-size: 10pt;
  }

  .quote-line-primary span {
    font-size: 8.2pt;
  }

  .quote-pro-finance {
    grid-template-columns: minmax(0, 1fr) 46mm;
    gap: 3mm;
  }

  .quote-pro-total-row {
    padding: 1.5mm 0;
    border-bottom: 1px solid #e6ebf3;
    font-size: 10pt;
  }

  .quote-pro-total-row.grand {
    padding-top: 2mm;
  }

  .quote-pro-total-row.grand span,
  .quote-pro-total-row.grand strong {
    font-size: 12pt;
  }

  .quote-pro-footer {
    padding-top: 2mm;
    gap: 3mm;
  }

  .quote-pro-footer strong {
    font-size: 8.2pt;
  }

  .document-accent-bar {
    height: 2.5mm;
    margin-bottom: 3mm;
    border-radius: 999px;
  }

  .quote-doc-header,
  .quote-footer-grid,
  .quote-meta-grid,
  .quote-summary-strip {
    break-inside: avoid;
  }

  .quote-doc-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40mm;
    gap: 2.4mm;
    align-items: start;
    padding-bottom: 2mm;
    margin-bottom: 2mm;
    border-bottom: 1px solid #d9dfeb;
  }

  .quote-brand-card {
    gap: 2mm;
    align-items: center;
  }

  .quote-brand-mark {
    width: 10mm;
    height: 10mm;
    border-radius: 3mm;
    flex: 0 0 10mm;
  }

  .quote-brand-copy {
    gap: 1mm;
  }

  .quote-table th,
  .quote-table td {
    padding: 1.6mm 1.5mm;
    font-size: 7.9pt;
    line-height: 1.15;
    word-break: break-word;
  }

  .quote-brand-copy h2 {
    font-size: 11pt;
  }

  .quote-brand-copy p,
  .quote-number-box p,
  .quote-summary-pill span,
  .quote-meta-card span,
  .quote-meta-card p,
  .quote-doc-footnote {
    color: #5f6b84 !important;
  }

  .quote-eyebrow {
    padding: 0.8mm 2.2mm;
    font-size: 7pt;
    background: #eef1ff !important;
  }

  .quote-number-box {
    min-width: auto;
    width: 100%;
    padding: 1.8mm 2.2mm;
    border-radius: 3mm;
    background: #f8faff !important;
    border: 1px solid #d9e2f2;
  }

  .quote-number-box strong {
    font-size: 10pt;
  }

  .quote-number-box span,
  .quote-number-box p {
    font-size: 7pt;
  }

  .quote-summary-strip {
    display: none !important;
  }

  .quote-summary-pill,
  .quote-meta-card,
  .quote-terms-card,
  .quote-totals-card {
    padding: 2.8mm;
    border-radius: 3mm;
    border-color: #d9dfeb;
    background: #fff !important;
    box-shadow: none !important;
  }

  .quote-summary-pill strong,
  .quote-meta-card strong {
    font-size: 10.5pt;
  }

  .quote-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5mm;
    margin-bottom: 3mm;
  }

  .quote-section-head {
    margin-bottom: 1.5mm;
  }

  .quote-section-head strong {
    font-size: 9.4pt;
  }

  .quote-table-wrap {
    border: 1px solid #d9dfeb;
    border-radius: 0;
    margin-bottom: 3mm;
  }

  .quote-table th {
    background: #f4f7fb !important;
    color: #55627d;
    font-size: 7.8pt;
  }

  .line-title-cell {
    gap: 1.5mm;
  }

  .line-title-cell strong {
    font-size: 8pt;
  }

  .line-type-badge {
    padding: 0.6mm 1.6mm;
    font-size: 6.8pt;
    background: #eef1ff !important;
    color: #4b44d7;
  }

  .quote-footer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48mm;
    gap: 3mm;
    align-items: start;
    margin-top: 1mm;
  }

  .quote-terms-card p {
    margin-top: 1.4mm;
    font-size: 8.1pt;
    line-height: 1.35;
  }

  .quote-total-row {
    padding: 1.5mm 0;
    border-bottom: 1px solid #e6ebf3;
    font-size: 8.1pt;
  }

  .quote-total-row.grand {
    padding-top: 2mm;
  }

  .quote-total-row.grand span,
  .quote-total-row.grand strong {
    font-size: 9.3pt;
  }

  .quote-doc-footnote {
    margin-top: 2mm;
    padding-top: 2mm;
    border-top: 1px dashed #d9dfeb;
    font-size: 7pt;
    display: flex;
    justify-content: space-between;
    gap: 4mm;
  }

  .status-pill {
    padding: 1.2mm 2.8mm;
    font-size: 7.8pt;
    background: #eef4ff !important;
  }

  .quote-lines-table td:first-child,
  .quote-lines-table th:first-child {
    width: 8mm;
  }

  .quote-lines-table th:nth-child(2),
  .quote-lines-table td:nth-child(2) {
    width: 17%;
  }

  .quote-lines-table th:nth-child(3),
  .quote-lines-table td:nth-child(3) {
    width: 27%;
  }

  .quote-lines-table th:nth-child(4),
  .quote-lines-table td:nth-child(4) {
    width: 11%;
  }

  .quote-lines-table th:nth-child(5),
  .quote-lines-table td:nth-child(5) {
    width: 12%;
  }

  .quote-lines-table th:nth-child(6),
  .quote-lines-table td:nth-child(6),
  .quote-lines-table th:nth-child(7),
  .quote-lines-table td:nth-child(7) {
    width: 12.5%;
  }
}
