:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #eef3f6;
  --ink: #182026;
  --muted: #657179;
  --line: #d9e1e5;
  --blue: #1f6feb;
  --blue-dark: #174ea6;
  --green: #18865a;
  --green-soft: #dff3e9;
  --amber: #b8691f;
  --amber-soft: #f7ead9;
  --rose: #b9435c;
  --rose-soft: #f9e4e9;
  --slate: #2f3a42;
  --shadow: 0 16px 36px rgba(25, 35, 42, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 220px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.22);
  outline-offset: 2px;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.icon-sprite {
  display: none;
}

.license-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.license-card {
  width: min(460px, 100%);
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.license-logo {
  display: block;
  width: min(220px, 62vw);
  height: auto;
  margin-bottom: 22px;
  mix-blend-mode: multiply;
}

.license-card h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 8vw, 40px);
  line-height: 1.02;
}

.license-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.license-form {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.license-error {
  min-height: 20px;
  color: var(--rose);
  font-size: 13px;
}

.license-offer-link {
  display: inline-flex;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.license-offer-link:hover {
  color: var(--blue);
  text-decoration: underline;
}

.app-shell {
  width: min(1480px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 16px;
  background: rgba(244, 246, 243, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.brand:focus-visible {
  outline: 3px solid rgba(15, 108, 255, 0.28);
  outline-offset: 4px;
}

.brand-logo {
  display: block;
  width: clamp(180px, 24vw, 290px);
  height: 58px;
  object-fit: contain;
  object-position: left center;
  mix-blend-mode: multiply;
}

.topbar-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.license-banner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.license-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 999px;
  font-weight: 800;
}

.license-banner strong {
  color: var(--ink);
}

.license-change {
  border: 0;
  padding: 0;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.license-change:hover {
  text-decoration: underline;
}

.app-footer {
  display: flex;
  justify-content: center;
  padding: 18px 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.app-footer a {
  color: inherit;
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--blue);
  text-decoration: underline;
}

.print-action {
  display: grid;
  gap: 4px;
  max-width: 360px;
}

.print-action .button {
  justify-content: center;
}

.print-action p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.generation-error {
  width: 100%;
  min-height: 18px;
  margin: 2px 0 0;
  color: var(--rose);
  font-size: 13px;
  line-height: 1.35;
}

.secondary-action {
  max-width: none;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

body[data-view="home"] .detail-only {
  display: none;
}

.home-view {
  display: grid;
  gap: 14px;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.home-summary,
.create-panel,
.folders-panel {
  padding: 16px;
}

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

.metric {
  display: grid;
  gap: 5px;
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.metric span,
.folder-kicker,
.status-filter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.metric strong {
  align-self: end;
  font-size: 30px;
  line-height: 1;
}

.status-filter {
  display: grid;
  gap: 6px;
  min-width: 160px;
}

.folder-list {
  display: grid;
  gap: 8px;
}

.folder-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
  color: var(--ink);
  text-align: left;
}

.folder-card:hover {
  border-color: rgba(31, 111, 235, 0.36);
  background: #f8fbff;
}

.folder-main,
.folder-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.folder-main strong {
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-main small {
  color: var(--muted);
  font-size: 13px;
}

.folder-meta {
  justify-items: end;
  min-width: 126px;
}

.folder-meta strong {
  font-size: 18px;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 160px;
  border: 1px dashed #a9bbc7;
  border-radius: var(--radius);
  background: #f8fbfc;
  color: var(--muted);
}

.empty-state svg {
  width: 32px;
  height: 32px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 14px;
  align-items: start;
}

.main-flow {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.intake-panel,
.photos-panel,
.note-panel,
.report-panel,
.quote-panel,
.actions-panel,
.memory-panel {
  padding: 16px;
}

.side-stack {
  display: grid;
  gap: 14px;
  min-width: 0;
}

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

.panel-header.compact {
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  font-size: 25px;
}

h2 {
  font-size: 20px;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.ready {
  background: var(--green-soft);
  color: #0e6a45;
}

.status-pill.status-draft {
  background: var(--amber-soft);
  color: #7a4212;
}

.status-pill.status-sent {
  background: #e3efff;
  color: #174ea6;
}

.status-pill.status-accepted {
  background: var(--green-soft);
  color: #0e6a45;
}

.status-pill.status-declined {
  background: var(--rose-soft);
  color: #78283b;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.field,
.control-block {
  display: grid;
  gap: 7px;
}

.field span,
.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.field input,
.field select,
.status-filter select,
.totals select,
.voice-box textarea,
.message-text {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

.field input,
.field select,
.status-filter select,
.totals select {
  height: 42px;
  padding: 0 11px;
}

.segmented,
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.segment,
.tab {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.segment {
  height: 36px;
}

.tab {
  height: 34px;
}

.segment.active,
.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(22, 32, 40, 0.1);
}

.media-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #dfe7e0;
}

.photos-panel .media-card,
.note-panel .voice-box {
  margin-top: 0;
}

.media-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-overlay {
  position: absolute;
  inset: auto 10px 10px 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.photo-overlay span {
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(14, 22, 28, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.photo-thumb,
.photo-empty {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.photo-thumb {
  position: relative;
  overflow: hidden;
  margin: 0;
  aspect-ratio: 1;
}

.photo-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb figcaption {
  position: absolute;
  right: 6px;
  bottom: 6px;
  left: 6px;
  overflow: hidden;
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(14, 22, 28, 0.68);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(14, 22, 28, 0.76);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.photo-delete:hover {
  background: rgba(185, 67, 92, 0.92);
}

.photo-empty {
  grid-column: 1 / -1;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin: 10px 0 14px;
  border: 1px dashed #9ab0bd;
  border-radius: var(--radius);
  background: #f8fbfc;
  color: var(--blue-dark);
  font-weight: 800;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.voice-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  overflow: hidden;
  margin-top: 14px;
}

.voice-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.note-help {
  margin: 0;
  padding: 10px 11px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.voice-box textarea {
  min-height: 132px;
  resize: vertical;
  border: 0;
  border-radius: 0;
  padding: 11px;
  line-height: 1.45;
}

.dictation-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 8px;
  padding: 0 11px 11px;
}

.dictation-status {
  grid-column: 1 / -1;
  min-height: 30px;
  border-radius: var(--radius);
  padding: 7px 9px;
  background: #eef6ff;
  color: #16467f;
  font-size: 13px;
  font-weight: 850;
}

.dictation-status[data-state="recording"] {
  background: #fff0e6;
  color: #924b13;
}

.dictation-status[data-state="saved"] {
  background: var(--green-soft);
  color: var(--green);
}

.dictation-status[data-state="unsupported"],
.dictation-status[data-state="error"] {
  background: #fff1f2;
  color: #9f1239;
}

.dictation-status[data-state="stopped"] {
  background: #f1f5f9;
  color: #475569;
}

.audio-note {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
}

.audio-note-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.audio-note h3 {
  margin: 0;
  font-size: 15px;
}

.audio-note p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.audio-status {
  flex: 0 0 auto;
  max-width: 190px;
  border-radius: 999px;
  padding: 5px 8px;
  background: #eef6ff;
  color: #16467f;
  font-size: 12px;
  font-weight: 850;
  text-align: right;
}

.audio-status[data-state="recording"] {
  background: #fff0e6;
  color: #924b13;
}

.audio-status[data-state="denied"],
.audio-status[data-state="unsupported"],
.audio-status[data-state="error"] {
  border-radius: var(--radius);
  background: #fff1f2;
  color: #9f1239;
}

.audio-controls {
  margin: 0;
}

.audio-note audio {
  width: 100%;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 13px;
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
}

.button.danger {
  border-color: #f1b7c2;
  background: #fff1f2;
  color: #9f1239;
}

.button.primary {
  background: var(--blue);
  color: #fff;
}

.button.primary:hover {
  background: var(--blue-dark);
}

.button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--slate);
}

.button.secondary:hover {
  background: var(--surface-2);
}

.button.stretch {
  flex: 1;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--slate);
}

.icon-button:hover,
.icon-button.active {
  border-color: rgba(31, 111, 235, 0.32);
  background: #e9f1ff;
  color: var(--blue-dark);
}

.quote-heading {
  align-items: flex-start;
}

.analysis-card {
  display: grid;
  gap: 10px;
  max-width: 390px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfc;
}

.analysis-card-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.analysis-card-main span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.analysis-card-main strong {
  padding: 4px 8px;
  border: 1px solid #ead5a8;
  border-radius: 999px;
  background: #fff8e8;
  color: #8a5a12;
  font-size: 12px;
}

.analysis-card p {
  margin: 0;
  color: var(--slate);
  font-size: 13px;
  line-height: 1.45;
}

.analysis-card ul {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.analysis-card li {
  position: relative;
  padding-left: 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.analysis-card li::before {
  position: absolute;
  top: 0.55em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #6d7d86;
  content: "";
}

.detected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 31px;
  margin-bottom: 14px;
}

.detected-list span {
  border-radius: 999px;
  padding: 7px 9px;
  background: #eef6ff;
  color: #16467f;
  font-size: 12px;
  font-weight: 800;
}

.detected-list p {
  width: 100%;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #f8fbfc;
  color: var(--slate);
  font-size: 13px;
  line-height: 1.45;
}

.quote-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.quote-tools span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.quote-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.quote-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px 112px;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.quote-row:first-child {
  border-top: 0;
}

.quote-row.quote-head {
  min-height: 38px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.quote-row strong,
.quote-row span {
  min-width: 0;
}

.quote-row strong {
  display: block;
  margin-bottom: 3px;
}

.quote-row small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.quote-row .qty,
.quote-row .line-total {
  font-weight: 850;
  text-align: right;
}

.quote-row-editable input {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f8fbfc;
  color: var(--ink);
  padding: 8px 9px;
}

.quote-row-editable input:focus {
  border-color: rgba(31, 111, 235, 0.4);
  background: #fff;
}

.quote-row-editable .quote-item {
  display: grid;
  gap: 6px;
}

.quote-row-editable .quote-item input:first-child {
  font-weight: 850;
}

.quote-row-editable .quote-item input:last-child {
  color: var(--muted);
  font-size: 13px;
}

.quote-row-editable .qty,
.quote-row-editable .line-total {
  text-align: right;
}

.totals {
  display: grid;
  grid-template-columns: 1fr 110px 1.1fr;
  gap: 10px;
  margin: 12px 0 14px;
}

.totals > div {
  display: grid;
  align-content: center;
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: #fff;
}

.totals span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.totals strong {
  margin-top: 4px;
  font-size: 21px;
}

.totals select {
  height: 34px;
  margin-top: 4px;
}

.grand-total {
  background: var(--slate) !important;
  color: #fff;
}

.grand-total span {
  color: rgba(255, 255, 255, 0.72);
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  background: #fff;
}

.timeline-item svg {
  display: grid;
  place-self: center;
  width: 28px;
  height: 28px;
  padding: 5px;
  border-radius: 50%;
  background: var(--amber-soft);
  color: var(--amber);
}

.timeline-item.done svg {
  background: var(--green-soft);
  color: var(--green);
}

.timeline-item strong,
.timeline-item span {
  display: block;
}

.timeline-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 46px;
  height: 28px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c9d3d9;
  transition: background 0.18s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  transition: transform 0.18s ease;
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.tab-panel {
  display: none;
  margin-top: 12px;
}

.tab-panel.active {
  display: block;
}

.message-text {
  min-height: 174px;
  resize: vertical;
  padding: 11px;
  line-height: 1.45;
  margin-bottom: 10px;
}

.message-text.compact-message {
  min-height: 104px;
  background: #f8fbfc;
}

.handoff-result {
  display: grid;
  gap: 4px;
  margin: 0 0 10px;
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--green-soft);
  color: #14532d;
}

.handoff-result[hidden] {
  display: none;
}

.handoff-result strong {
  font-size: 14px;
}

.handoff-result span {
  font-size: 13px;
  line-height: 1.4;
}

.actions-panel .button {
  min-height: 44px;
  white-space: normal;
}

.report-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px;
  background: #fff;
  line-height: 1.45;
}

.report-card p {
  margin: 0;
}

.client-facts {
  display: grid;
  gap: 8px;
}

.client-facts div {
  display: grid;
  gap: 3px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.client-facts span,
.next-step span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.next-step {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.next-action-value {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
  line-height: 1.35;
  text-align: left;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 36px));
  border-radius: var(--radius);
  padding: 11px 13px;
  background: var(--slate);
  color: #fff;
  font-weight: 800;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

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

.print-dossier {
  display: none;
}

@media (max-width: 1180px) {
  .home-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  }
}

@media (max-width: 780px) {
  .license-screen {
    align-items: start;
    padding: 18px;
  }

  .license-card {
    padding: 20px;
  }

  .app-shell {
    width: min(100vw - 18px, 680px);
    padding-top: 8px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 10px;
  }

  .topbar-actions,
  .button-row {
    width: 100%;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .topbar-actions .button,
  .topbar-actions .icon-button {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  .topbar-actions .button {
    white-space: normal;
  }

  .license-banner {
    align-items: flex-start;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 7px 10px;
    padding: 8px 0 4px;
  }

  .license-banner strong {
    flex: 1 1 100%;
  }

  .print-action {
    flex: 1 1 100%;
    max-width: none;
  }

  .print-action .button {
    width: 100%;
  }

  .app-footer {
    padding: 14px 0 2px;
    font-size: 12px;
  }

  .workspace,
  .side-stack {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .folder-meta {
    grid-template-columns: 1fr auto;
    justify-items: start;
    min-width: 0;
    width: 100%;
  }

  .quote-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .quote-heading {
    flex-direction: column;
  }

  .analysis-card {
    max-width: none;
    width: 100%;
  }

  .field-grid,
  .totals {
    grid-template-columns: 1fr;
  }

  .dictation-controls {
    grid-template-columns: 1fr;
  }

  .dictation-controls .button {
    min-height: 48px;
    width: 100%;
  }

  .quote-row {
    grid-template-columns: minmax(0, 1fr) 54px 86px;
    gap: 7px;
    padding: 10px;
  }

  h1 {
    font-size: 22px;
  }
}

@media (max-width: 430px) {
  .intake-panel,
  .photos-panel,
  .note-panel,
  .report-panel,
  .quote-panel,
  .actions-panel,
  .memory-panel {
    padding: 12px;
  }

  .segment,
  .tab {
    font-size: 12px;
  }

  .button {
    padding: 0 10px;
  }

  .photo-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .home-summary,
  .create-panel,
  .folders-panel {
    padding: 12px;
  }

  .quote-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .quote-row .qty,
  .quote-row .line-total {
    text-align: left;
  }

  .quote-head {
    display: none;
  }
}

@media print {
  @page {
    margin: 14mm;
  }

  html,
  body {
    background: #fff !important;
    color: #111 !important;
    font-family: Arial, sans-serif;
    font-size: 11pt;
  }

  .icon-sprite,
  .app-shell,
  .toast {
    display: none !important;
  }

  .print-dossier {
    display: block !important;
    width: 100%;
  }

  .print-header {
    display: flex;
    justify-content: space-between;
    gap: 18mm;
    padding-bottom: 8mm;
    border-bottom: 1px solid #111;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-brand {
    margin: 0 0 4mm;
    font-size: 10pt;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .print-header h1 {
    margin: 0 0 3mm;
    font-size: 22pt;
    line-height: 1.15;
    break-after: avoid;
    page-break-after: avoid;
  }

  .print-header p,
  .print-date span {
    margin: 0;
    color: #444;
  }

  .print-header .print-subtitle {
    margin: 0 0 2mm;
    color: #111;
    font-size: 11pt;
    font-weight: 700;
  }

  .print-date {
    min-width: 42mm;
    text-align: right;
  }

  .print-date strong {
    display: block;
    margin-top: 2mm;
    color: #111;
    font-size: 10pt;
  }

  .print-block {
    margin-top: 8mm;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-block h2 {
    margin: 0 0 4mm;
    padding-bottom: 2mm;
    border-bottom: 1px solid #ccc;
    font-size: 15pt;
    break-after: avoid;
    page-break-after: avoid;
  }

  .print-section-title {
    break-after: avoid;
    page-break-after: avoid;
  }

  .print-report-block {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-photos-block {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4mm 8mm;
    margin: 0;
  }

  .print-info-grid div {
    break-inside: avoid;
  }

  .print-info-grid dt {
    margin: 0 0 1mm;
    color: #555;
    font-size: 9pt;
    font-weight: 700;
    text-transform: uppercase;
  }

  .print-info-grid dd {
    margin: 0;
    color: #111;
  }

  .print-report-section {
    margin: 0 0 5mm;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-report-section h3 {
    margin: 0 0 2mm;
    font-size: 12pt;
    break-after: avoid;
    page-break-after: avoid;
  }

  .print-report-section p,
  .print-block p {
    margin: 0;
    line-height: 1.45;
  }

  .print-photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6mm;
    break-before: avoid;
    page-break-before: avoid;
  }

  .print-photo-grid figure {
    margin: 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-photo-grid img {
    display: block;
    width: 100%;
    max-height: 72mm;
    border: 1px solid #bbb;
    object-fit: cover;
  }

  .print-photo-grid figcaption {
    margin-top: 2mm;
    color: #555;
    font-size: 9pt;
  }
}
