:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-soft: #f0f3f1;
  --ink: #24282c;
  --muted: #737b82;
  --line: #e1e4e0;
  --green: #47735a;
  --blue: #4d6f8b;
  --amber: #9a763c;
  --red: #9a5048;
  --shadow: 0 6px 18px rgba(31, 41, 55, .045);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

[hidden] {
  display: none !important;
}

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

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

.login-screen {
  min-height: 100vh;
  padding: 22px;
  background:
    linear-gradient(180deg, #fbfaf6 0%, #f5f7f3 46%, #eef3f1 100%);
}

.front-nav {
  width: min(1180px, 100%);
  margin: 0 auto;
  min-height: 62px;
  padding: 6px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  z-index: 5;
}

.login-area {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.front-price-button {
  border: 0;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.front-price-button:hover {
  color: var(--green);
}

.login-card {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(360px, calc(100vw - 44px));
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 18px 42px rgba(31, 41, 55, .10);
}

.login-card form {
  display: grid;
  gap: 16px;
}

.login-verification-copy {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8f5;
}

.login-verification-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.verification-code-input {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 6px;
}

.bookkeeper-access-settings {
  border-color: #cfd9e0;
  background: #f6f9fa;
}

body.bookkeeper-session #contextActions,
body.bookkeeper-session #mobileInstallAppButton {
  display: none !important;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 210px;
  max-width: 100%;
  height: auto;
}

.login-brand .brand-logo {
  width: 250px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #17212b;
}

.brand-symbol {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  object-fit: cover;
}

.login-brand > div:last-child,
.brand > div:last-child {
  min-width: 0;
}

.login-brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.front-site-links {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}

.front-site-links a {
  color: #47545a;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.front-site-links a:hover {
  color: var(--green);
}

.form-error {
  min-height: 20px;
  margin: -8px 0 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.frontpage {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.front-hero {
  min-height: calc(100vh - 210px);
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  margin-top: 18px;
  padding: 68px;
  border-radius: 8px;
  background-image:
    linear-gradient(90deg, rgba(32, 39, 43, .86) 0%, rgba(32, 39, 43, .68) 42%, rgba(32, 39, 43, .08) 78%),
    linear-gradient(180deg, rgba(217, 194, 123, .16), rgba(32, 39, 43, .08)),
    image-set(url("assets/frontpage-hero.webp") type("image/webp"), url("assets/frontpage-hero.png") type("image/png"));
  background-size: cover;
  background-position: center;
  color: #fff;
}

.hero-copy {
  display: grid;
  gap: 22px;
  max-width: 680px;
  position: relative;
  z-index: 1;
}

.hero-copy .eyebrow {
  width: fit-content;
  padding: 7px 10px;
  border: 1px solid rgba(217, 194, 123, .36);
  border-radius: 8px;
  background: rgba(32, 39, 43, .28);
  color: #f0dda0;
  font-weight: 800;
}

.hero-copy h1 {
  max-width: 700px;
  font-size: clamp(40px, 5.5vw, 66px);
  line-height: 1.06;
  margin: 0;
  letter-spacing: 0;
}

.hero-copy p:not(.eyebrow) {
  max-width: 625px;
  color: #edf1ee;
  font-size: 20px;
  line-height: 1.58;
}

.front-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.front-actions .primary-button {
  padding: 11px 15px;
  font-size: 15px;
}

.demo-request-button {
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 6px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.demo-request-button:hover {
  background: rgba(255, 255, 255, .2);
}

.purchase-now-button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid #17212b;
  border-radius: 6px;
  background: #17212b;
  color: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.purchase-now-button:hover {
  background: #263541;
}

.front-link {
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  border-bottom: 2px solid rgba(217, 194, 123, .75);
}

.hero-login-button {
  background: #d9c27b;
  color: #20272b;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .16);
}

.front-proof {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.front-proof span {
  display: grid;
  gap: 2px;
  min-width: 178px;
  padding: 14px 15px;
  border: 1px solid rgba(255, 255, 255, .20);
  border-radius: 8px;
  background: rgba(255, 255, 255, .11);
  color: #e9efec;
  font-size: 13px;
  line-height: 1.35;
}

.front-proof strong {
  color: #fff;
  font-size: 15px;
}

.front-route {
  position: relative;
  margin-top: 34px;
  padding: 32px 24px 22px;
  border-radius: 8px;
  background: #eef2ef;
  overflow: hidden;
}

.route-intro {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.remember-login {
  color: var(--muted);
  font-size: 12px;
}

.login-role-pill {
  justify-self: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.login-role-pill:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.route-intro .eyebrow {
  margin-bottom: 7px;
  color: var(--green);
}

.route-intro h2 {
  margin-bottom: 8px;
  font-size: 28px;
}

.route-intro > p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.route-canvas {
  position: relative;
  min-height: 360px;
  margin-top: 20px;
}

.route-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.route-line path {
  fill: none;
  stroke: #c1ad70;
  stroke-width: 3;
  stroke-linecap: round;
}

.route-node {
  position: absolute;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 3px;
  width: 156px;
  text-align: center;
  transform: translateX(-50%);
}

.route-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 4px solid #eef2ef;
  background: #20272b;
  color: #d9c27b;
  box-shadow: 0 0 0 1px rgba(32, 39, 43, .14);
}

.route-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route-node strong {
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.2;
}

.route-node small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.route-1 { left: 9%; top: 19px; }
.route-2 { left: 50%; top: 19px; }
.route-3 { left: 91%; top: 19px; }
.route-4 { left: 91%; top: 144px; }
.route-5 { left: 50%; top: 144px; }
.route-6 { left: 9%; top: 144px; }
.route-7 { left: 9%; top: 269px; }
.route-8 { left: 50%; top: 269px; }
.route-9 { left: 91%; top: 269px; }

.front-preview {
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid #dedbcf;
  border-radius: 8px;
  background: #fffdfa;
  box-shadow: 0 12px 34px rgba(31, 41, 55, .065);
}

.front-showcase {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(360px, 520px);
  align-items: center;
  gap: 46px;
  padding: 66px 0 26px;
}

.front-showcase .eyebrow {
  color: var(--green);
  font-weight: 800;
}

.front-showcase h2 {
  max-width: 610px;
  font-size: clamp(28px, 3.8vw, 44px);
  line-height: 1.12;
  margin-bottom: 14px;
}

.showcase-copy {
  max-width: 560px;
  color: #59646a;
  font-size: 17px;
  line-height: 1.58;
}

.preview-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.preview-top span,
.preview-flow span,
.preview-table span {
  color: var(--muted);
  font-size: 13px;
}

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

.preview-flow div,
.preview-table div,
.front-features article {
  border: 1px solid #e4e0d2;
  border-radius: 8px;
  background: #fbfaf5;
}

.front-audience {
  display: grid;
  gap: 28px;
  margin-top: 42px;
  padding: 48px 0 28px;
  border-top: 1px solid #d9ded8;
}

.front-section-intro {
  max-width: 780px;
}

.front-section-intro .eyebrow {
  margin-bottom: 7px;
  color: var(--green);
  font-weight: 800;
}

.front-section-intro h2 {
  max-width: 740px;
  margin: 0 0 12px;
  font-size: clamp(28px, 3.8vw, 42px);
  line-height: 1.14;
}

.front-section-intro > p:last-child {
  max-width: 720px;
  margin: 0;
  color: #59646a;
  font-size: 17px;
  line-height: 1.62;
}

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

.trade-grid a {
  display: grid;
  gap: 7px;
  min-height: 122px;
  padding: 18px;
  border: 1px solid #dce1db;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.trade-grid a:hover {
  border-color: #9cac9f;
  box-shadow: 0 10px 24px rgba(31, 41, 55, .07);
  transform: translateY(-2px);
}

.trade-grid strong {
  color: #24343a;
  font-size: 17px;
}

.trade-grid span {
  color: #657177;
  font-size: 14px;
  line-height: 1.5;
}

.preview-flow div {
  display: grid;
  gap: 4px;
  padding: 14px;
}

.preview-table {
  display: grid;
  gap: 8px;
}

.preview-table div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
}

.front-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 42px;
}

.front-faq {
  display: grid;
  grid-template-columns: minmax(260px, .75fr) minmax(420px, 1.25fr);
  gap: 54px;
  padding: 48px 0 58px;
  border-top: 1px solid #d9ded8;
}

.faq-list {
  display: grid;
  align-content: start;
  border-top: 1px solid #cfd6d1;
}

.faq-list details {
  border-bottom: 1px solid #cfd6d1;
}

.faq-list summary {
  padding: 18px 34px 18px 0;
  color: #26343a;
  font-weight: 800;
  line-height: 1.4;
  cursor: pointer;
}

.faq-list p {
  margin: -4px 0 20px;
  color: #5c686d;
  line-height: 1.6;
}

.front-final-cta {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  align-items: center;
  gap: 48px;
  margin-bottom: 44px;
  padding: 38px;
  border-radius: 8px;
  background: #20272b;
  color: #fff;
}

.front-final-cta .eyebrow {
  margin-bottom: 8px;
  color: #dfc976;
  font-weight: 800;
}

.front-final-cta h2 {
  max-width: 650px;
  margin: 0 0 10px;
  font-size: clamp(26px, 3vw, 36px);
}

.front-final-cta p:last-child {
  max-width: 650px;
  margin: 0;
  color: #d7dfdb;
  line-height: 1.6;
}

.front-final-actions {
  display: grid;
  gap: 9px;
}

.front-final-actions .primary-button,
.front-final-actions .ghost-button {
  width: 100%;
  justify-content: center;
}

.front-final-actions .ghost-button {
  border-color: #566369;
  background: #313a3f;
  color: #fff;
}

.front-final-actions span {
  color: #b9c3bf;
  font-size: 12px;
  text-align: center;
}

.back-to-top {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 45;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #4a565b;
  border-radius: 50%;
  background: #20272b;
  color: #f0dda0;
  box-shadow: 0 10px 26px rgba(31, 41, 55, .2);
  font: inherit;
  cursor: pointer;
  transition: opacity .16s ease, transform .16s ease, background .16s ease;
}

.back-to-top:hover {
  background: #344046;
  transform: translateY(-2px);
}

.back-to-top:focus-visible {
  outline: 3px solid rgba(217, 194, 123, .55);
  outline-offset: 3px;
}

.back-to-top[hidden] {
  display: none;
}

.back-to-top span {
  font-size: 24px;
  line-height: 1;
}

.front-features article {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.front-features strong {
  font-size: 17px;
}

.sidebar {
  background: #20272b;
  color: #fff;
  padding: 24px 18px;
}

.mobile-sidebar-head,
.mobile-nav-panel {
  display: contents;
}

.mobile-menu-button,
.mobile-nav-title,
.mobile-nav-actions,
.mobile-nav-backdrop,
.mobile-planning-toggle {
  display: none;
}

.brand {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  text-indent: 2px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  aspect-ratio: 1 / 1;
  flex: 0 0 44px;
  border-radius: 8px;
  background: #d9c27b;
  color: #20272b;
  font-weight: 800;
}

.eyebrow {
  display: block;
  color: #aeb8bc;
  font-size: 13px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: #dce4e7;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: #313a3f;
  color: #fff;
}

.main {
  padding: 22px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.top-actions,
.topbar-actions,
.card-actions,
menu {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-actions {
  justify-content: flex-end;
  align-items: center;
}

.sync-status {
  position: fixed;
  top: 10px;
  right: 10px;
  top: calc(8px + env(safe-area-inset-top));
  right: calc(8px + env(safe-area-inset-right));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 12px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.sync-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .86);
}

.sync-status strong {
  display: none;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}

.sync-status.online {
  color: var(--green);
}

.sync-status.pending {
  color: var(--amber);
}

.sync-status.syncing {
  color: var(--blue);
}

.sync-status.offline {
  color: var(--red);
}

.sync-status.config {
  color: var(--amber);
}

.sync-status.offline strong,
.sync-status.config strong {
  display: inline;
}

.calendar-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-button {
  width: 40px;
  padding-left: 0;
  padding-right: 0;
  font-size: 18px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.segment {
  border: 0;
  border-right: 1px solid var(--line);
  padding: 9px 10px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}

.segment:last-child {
  border-right: 0;
}

.segment.active {
  background: var(--blue);
  color: #fff;
}

.primary-button,
.ghost-button,
.danger-button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}

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

.ghost-button {
  background: #eef1ee;
  border-color: #dce2dd;
  color: var(--ink);
}

.danger-button {
  background: #f2dedb;
  color: var(--red);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel,
.item-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 12px;
}

.metric-button,
.dashboard-action {
  width: 100%;
  border: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.metric-button:hover,
.dashboard-action:hover {
  border-color: rgba(77, 111, 139, .35);
  box-shadow: 0 10px 24px rgba(31, 41, 55, .10);
}

.metric strong {
  display: block;
  font-size: 21px;
}

.metric span,
.muted {
  color: var(--muted);
}

.dashboard-result-list {
  display: grid;
  gap: 6px;
  max-height: min(58vh, 520px);
  overflow-y: auto;
}

.dashboard-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dashboard-result-row > div,
.dashboard-result-empty {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.dashboard-result-row strong {
  font-size: 13px;
}

.dashboard-result-row span,
.dashboard-result-row small,
.dashboard-result-empty span {
  color: var(--muted);
  line-height: 1.35;
}

.dashboard-result-row span {
  font-size: 12px;
}

.dashboard-result-row small {
  font-size: 11px;
}

.dashboard-result-empty {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafbf9;
}

.content-grid {
  display: grid;
  gap: 14px;
}

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

.content-grid.form-and-list {
  grid-template-columns: minmax(330px, 420px) minmax(0, 1fr);
}

.content-grid.planning-layout {
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: start;
}

.panel {
  padding: 14px;
}

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

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

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

.form-grid.single {
  grid-template-columns: 1fr;
}

.form-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.form-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
}

.settings-group {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.settings-group h3,
.quote-form-section h3,
.day-route-panel h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.settings-group-heading,
.section-heading,
.day-route-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-group-heading .muted,
.section-heading .muted,
.settings-help {
  margin: 3px 0 0;
  font-size: 12px;
}

.route-key-form {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbf9;
}

.setting-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbf9;
}

.setting-toggle span {
  display: grid;
  gap: 2px;
}

.setting-toggle small {
  color: var(--muted);
  font-size: 11px;
}

.setting-toggle input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.dialog-title-row,
.receipt-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-title-row h2,
.dialog-title-row p {
  margin: 0;
}

.receipt-state {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbf9;
}

.receipt-state div {
  display: grid;
  gap: 2px;
  margin-right: auto;
}

.receipt-state small {
  color: var(--muted);
  font-size: 11px;
}

.purchase-review-section {
  padding: 0;
  border: 0;
  background: transparent;
}

.purchase-review-layout {
  display: grid;
  grid-template-columns: minmax(260px, .82fr) minmax(420px, 1.35fr);
  gap: 14px;
  align-items: start;
}

.purchase-receipt-pane,
.purchase-recognized-fields {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.purchase-receipt-heading h3,
.purchase-receipt-heading p,
.purchase-section-heading h3 {
  margin: 0;
}

.purchase-receipt-heading {
  margin-bottom: 10px;
}

.purchase-receipt-preview {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 330px;
  max-height: 520px;
  overflow: auto;
  padding: 10px;
  border: 1px dashed #aeb7ac;
  border-radius: 6px;
  background: #f5f7f4;
  color: var(--muted);
}

.purchase-receipt-preview img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 2px 10px rgba(25, 35, 28, .1);
}

.purchase-receipt-preview img[hidden] {
  display: none;
}

.purchase-receipt-stage {
  position: relative;
  width: 100%;
  line-height: 0;
}

.purchase-receipt-overlay {
  position: absolute;
  inset: 0;
}

.receipt-line-marker {
  position: absolute;
  min-width: 12px;
  min-height: 12px;
  padding: 0;
  border: 2px dashed rgba(92, 101, 96, .72);
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.receipt-line-marker:hover,
.receipt-line-marker:focus-visible {
  border-color: #d09d2f;
  box-shadow: 0 0 0 2px rgba(208, 157, 47, .2);
}

.receipt-line-marker.business {
  border: 3px solid #34865a;
  background: rgba(52, 134, 90, .14);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .72);
}

.purchase-receipt-stage.drawing {
  cursor: crosshair;
  touch-action: none;
}

.purchase-receipt-stage.drawing .receipt-line-marker {
  pointer-events: none;
}

.purchase-selection-draft {
  position: absolute;
  z-index: 4;
  border: 2px solid #d09d2f;
  border-radius: 999px;
  background: rgba(208, 157, 47, .14);
  pointer-events: none;
}

.purchase-lines-section {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.purchase-lines-section .purchase-section-heading {
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.purchase-lines-section p {
  margin: 2px 0 0;
}

.purchase-line-head,
.purchase-line-row {
  display: grid;
  grid-template-columns: 62px minmax(150px, 1.8fr) 70px 90px 72px 90px 34px;
  gap: 7px;
  align-items: end;
}

.purchase-line-head {
  padding: 0 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.purchase-line-rows {
  display: grid;
  gap: 7px;
}

.purchase-line-row {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbf9;
}

.purchase-line-row.business {
  border-color: #7aaa86;
  background: #f2f8f3;
}

.purchase-line-row label {
  gap: 3px;
  font-size: 10px;
}

.purchase-line-row input,
.purchase-line-row select {
  min-width: 0;
  padding: 7px 8px;
  font-size: 12px;
}

.purchase-line-business {
  display: grid;
  place-items: center;
  min-height: 34px;
}

.purchase-line-business input {
  width: 20px;
  height: 20px;
}

.purchase-line-remove {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
}

.purchase-receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.purchase-receipt-actions label {
  cursor: pointer;
}

.purchase-receipt-pane .receipt-state {
  margin-top: 9px;
}

.receipt-recognition-status {
  margin: 9px 0 0;
  line-height: 1.45;
}

.purchase-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.purchase-review-check {
  margin-top: 3px;
  background: #f7f9f6;
}

.purchase-review-check.reviewed {
  border-color: #7ba985;
  background: #f1f8f2;
}

#purchaseDialog .sign-box {
  max-height: min(88vh, 900px);
  overflow-y: auto;
  padding-right: 5px;
}

.purchase-filter-bar {
  grid-template-columns: minmax(210px, 1.7fr) repeat(4, minmax(118px, 1fr));
}

.purchase-private-fields {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8f6;
}

.purchase-private-fields span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.purchase-lines-section .purchase-section-heading > button {
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .purchase-review-layout {
    grid-template-columns: 1fr;
  }

  .purchase-receipt-preview {
    min-height: 260px;
    max-height: 440px;
  }

  .purchase-line-head {
    display: none;
  }

  .purchase-line-row {
    grid-template-columns: 54px minmax(0, 1fr) 64px;
    align-items: end;
  }

  .purchase-line-row .purchase-line-description {
    grid-column: 2 / -1;
  }
}

@media (max-width: 600px) {
  .purchase-receipt-pane,
  .purchase-recognized-fields {
    padding: 10px;
  }

  .purchase-receipt-preview {
    min-height: 220px;
  }

  .purchase-receipt-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .purchase-receipt-actions .primary-button {
    grid-column: 1 / -1;
  }

  .purchase-line-row {
    grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1fr) 34px;
  }

  .purchase-line-row .purchase-line-quantity {
    grid-column: 1;
  }

  .purchase-line-row .purchase-line-excl {
    grid-column: 2;
  }

  .purchase-line-row .purchase-line-vat {
    grid-column: 3 / -1;
  }

  .purchase-line-row .purchase-line-incl {
    grid-column: 1 / 4;
  }

  .purchase-line-row .purchase-line-remove {
    grid-column: 4;
  }
}

#productDialog .sign-box {
  max-height: min(86vh, 860px);
  overflow-y: auto;
  padding-right: 4px;
}

#quoteDialog .sign-box {
  max-height: min(88vh, 900px);
  overflow-y: auto;
  padding-right: 5px;
}

.quote-form-section {
  display: grid;
  gap: 11px;
  padding: 14px 0 2px;
  border-top: 1px solid var(--line);
}

.quote-form-section:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.route-calculation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(210px, 1.25fr);
  gap: 10px;
  align-items: end;
}

.route-result {
  display: grid;
  gap: 3px;
  min-height: 59px;
  padding: 9px 11px;
  border-left: 3px solid var(--blue);
  background: #f5f8fa;
}

.route-result strong {
  font-size: 13px;
}

.route-result span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.day-route-panel {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbf9;
}

.day-route-heading p {
  margin: 3px 0 0;
  font-size: 12px;
}

.day-route-legs {
  display: grid;
  gap: 1px;
}

.day-route-leg {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.day-route-leg > span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--yellow);
  font-size: 11px;
  font-weight: 700;
}

.day-route-leg div,
.day-route-metrics {
  display: grid;
  gap: 2px;
}

.day-route-leg small {
  color: var(--muted);
  font-size: 11px;
}

.day-route-metrics {
  text-align: right;
}

.product-code,
.product-stock {
  display: grid;
  gap: 2px;
}

.product-code span,
.product-stock span {
  color: var(--muted);
  font-size: 12px;
}

.link-button {
  border: 0;
  padding: 2px 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

.quote-customer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.quote-customer-row .ghost-button {
  min-height: 40px;
  white-space: nowrap;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(150px, 220px));
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbf9;
}

.filter-bar.single {
  grid-template-columns: 1fr;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

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

.item-card {
  padding: 11px;
}

.item-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

#ordersView .panel {
  padding: 14px;
}

#ordersView .panel-header {
  margin-bottom: 10px;
}

#ordersView .filter-bar {
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px);
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 8px;
  background: #f7f8f5;
}

#ordersView .stack {
  gap: 6px;
}

.order-list-head,
.order-row {
  display: grid;
  grid-template-columns: 104px minmax(210px, 1.35fr) minmax(150px, .85fr) 132px 92px 78px;
  column-gap: 12px;
  row-gap: 6px;
}

.order-list-head {
  align-items: end;
  margin: 2px 0 6px;
  padding: 0 11px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.order-row {
  align-items: center;
  grid-template-areas:
    "number customer supplier status received action"
    "number lines lines lines lines action";
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefd;
  box-shadow: none;
  transition: border-color .15s ease, background .15s ease;
}

.order-row > * {
  min-width: 0;
}

.order-row:hover {
  border-color: #cfd8d1;
  background: #fff;
}

.order-main,
.order-customer,
.order-meta,
.order-status-cell,
.order-received,
.order-lines-preview {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.order-main {
  grid-area: number;
}

.order-customer {
  grid-area: customer;
}

.order-meta {
  grid-area: supplier;
}

.order-status-cell {
  grid-area: status;
  justify-items: start;
}

.order-received {
  grid-area: received;
  align-content: center;
  justify-items: start;
}

.order-row .compact-actions {
  grid-area: action;
  justify-content: end;
}

.order-lines-preview {
  grid-area: lines;
  min-height: 24px;
}

.order-main strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
}

.order-customer strong,
.order-meta span,
.order-received strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-main small,
.order-customer span,
.order-meta small,
.order-status-cell small,
.order-lines-preview small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-progress {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0ed;
}

.order-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.order-progress.compact {
  width: 84px;
}

.order-status-cell .status {
  justify-self: start;
  min-height: 20px;
  max-width: 100%;
  padding: 2px 7px;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-row .primary-button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.order-lines-preview {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
}

.order-lines-preview span {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  min-height: 22px;
  gap: 5px;
  padding: 2px 7px;
  border: 1px solid #e4e8e2;
  border-radius: 999px;
  background: #f7f8f5;
  min-width: 0;
}

.order-lines-preview strong {
  display: inline-block;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-warning {
  grid-column: 1 / -1;
  padding: 6px 8px;
  border-radius: 8px;
  background: #fbf2e4;
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
}

.quote-send-state {
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fbf8ef;
}

.quote-send-state.signed {
  border-left-color: var(--green);
  background: #f0f7f1;
}

.quote-send-state strong {
  font-size: 13px;
}

.quote-send-state span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.subscription-picker {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f9f6;
}

.subscription-picker legend {
  padding: 0 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}


.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e7edf4;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status.green {
  background: #e4eee8;
  color: var(--green);
}

.status.amber {
  background: #f2eadc;
  color: var(--amber);
}

.status.red {
  background: #f0e1df;
  color: var(--red);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.compact-table {
  table-layout: fixed;
}

th,
td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
}

.compact-table td,
.compact-table th {
  vertical-align: top;
}

.compact-table td:first-child {
  width: 24%;
}

.compact-actions {
  gap: 6px;
}

.compact-actions .primary-button,
.compact-actions .ghost-button,
.compact-actions .danger-button {
  padding: 6px 8px;
  font-size: 12px;
}

.customer-table {
  table-layout: auto;
}

.customer-table th:first-child {
  width: 17%;
}

.customer-table th:nth-child(2),
.customer-table th:nth-child(3) {
  width: 20%;
}

.customer-table th:nth-child(4) {
  width: 22%;
}

.customer-table td {
  vertical-align: middle;
}

.customer-table td:first-child {
  width: auto;
}

.customer-name,
.customer-address,
.customer-contact {
  display: grid;
  gap: 3px;
}

.customer-name span,
.customer-address span,
.customer-contact span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.customer-dossiers {
  display: flex;
  gap: 4px 9px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}

.customer-dossiers span {
  white-space: nowrap;
}

.customer-dossiers strong {
  color: var(--ink);
  font-size: 12px;
}

.job-summary {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.job-summary-button {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbf9;
  color: var(--muted);
  cursor: pointer;
}

.job-summary-button strong {
  color: var(--ink);
  font-size: 15px;
}

.job-summary-button span {
  font-size: 12px;
  white-space: nowrap;
}

.job-summary-button.active {
  border-color: rgba(71, 115, 90, .5);
  background: #eaf1ec;
  color: var(--green);
}

.job-table {
  table-layout: auto;
}

.job-table th:first-child {
  width: 24%;
}

.job-table th:nth-child(2) {
  width: 18%;
}

.job-table th:nth-child(3),
.job-table th:nth-child(5) {
  width: 14%;
}

.job-table td {
  vertical-align: middle;
}

.job-table td:first-child {
  width: auto;
}

.job-title {
  display: grid;
  gap: 3px;
}

.job-title strong,
.job-customer strong {
  font-size: 13px;
}

.job-title span,
.job-customer span,
.job-planning span,
.job-material span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.job-row-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.flow {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.flow span,
.flow-step {
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.flow-step strong {
  font-size: 13px;
}

.flow-step span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.calm-card {
  box-shadow: none;
}

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

.timeline-item {
  border: 1px solid var(--line);
  border-left: 3px solid rgba(77, 111, 139, .55);
  padding: 10px 12px;
  background: #fffefd;
  border-radius: 8px;
}

.timeline-time {
  display: block;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

.timeline-item p {
  margin: 5px 0 8px;
  color: var(--ink);
  line-height: 1.4;
}

.calendar-panel {
  min-width: 0;
}

.plan-sidebar .item-card header strong {
  font-weight: 600;
}

.plan-sidebar .item-card p {
  line-height: 1.42;
}

.planning-job-card {
  cursor: grab;
}

.planning-job-card:active {
  cursor: grabbing;
}

.planning-hint {
  margin: -4px 0 12px;
  padding: 9px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--muted);
  font-size: 13px;
}

.planning-hint.active {
  border-style: solid;
  border-color: rgba(71, 115, 90, .35);
  background: #edf7f1;
  color: var(--green);
}

.calendar-panel .panel-header h2 {
  font-weight: 700;
}

.calendar-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
  gap: 1px;
}

.calendar-month-weeks {
  grid-column: 1 / -1;
  display: grid;
  gap: 1px;
}

.calendar-month-week {
  position: relative;
  overflow: hidden;
  background: var(--line);
}

.calendar-month-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  min-height: inherit;
}

.calendar-head,
.calendar-day {
  min-width: 0;
}

.calendar-head {
  padding: 9px 8px;
  background: #f3f6f4;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.calendar-day {
  min-height: 118px;
  padding: 8px;
  background: #fffefd;
  cursor: pointer;
  transition: background .16s ease, box-shadow .16s ease;
}

.calendar-day:hover {
  background: #f8fbf8;
}

.calendar-day.outside {
  background: #f7f7f3;
  color: #9aa1a7;
}

.calendar-day.today {
  box-shadow: inset 0 0 0 1px rgba(71, 115, 90, .7);
}

.day-number {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.day-number span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--ink);
  font-weight: 600;
}

.calendar-day.today .day-number span {
  background: var(--green);
  color: #fff;
}

.day-number small {
  font-weight: 400;
  color: #9aa1a7;
}

.event-chip {
  display: grid;
  gap: 2px;
  width: 100%;
  margin-top: 5px;
  border: 1px solid rgba(77, 111, 139, .18);
  border-radius: 6px;
  padding: 6px 7px 6px 8px;
  background: #eef5f8;
  color: #183a59;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.28;
  overflow: hidden;
}

.event-chip.ready {
  border-color: rgba(71, 115, 90, .20);
  background: #edf7f1;
  color: var(--green);
}

.event-chip.waiting {
  border-color: rgba(154, 118, 60, .20);
  background: #fbf2e4;
  color: var(--amber);
}

.event-time {
  font-size: 11px;
  font-weight: 600;
  color: currentColor;
}

.event-customer {
  color: var(--ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-worker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.month-span-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.month-span-event {
  position: absolute;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 6px;
  height: 23px;
  border: 1px solid rgba(77, 111, 139, .24);
  border-radius: 999px;
  padding: 3px 9px;
  background: #eef5f8;
  color: #183a59;
  box-shadow: 0 2px 6px rgba(31, 41, 55, .08);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  text-align: left;
  pointer-events: auto;
  z-index: 3;
}

.month-span-event.ready {
  border-color: rgba(71, 115, 90, .24);
  background: #edf7f1;
  color: var(--green);
}

.month-span-event.waiting {
  border-color: rgba(154, 118, 60, .24);
  background: #fbf2e4;
  color: var(--amber);
}

.month-span-event.continues-left {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.month-span-event.continues-right {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.month-span-event span,
.month-span-event strong,
.month-span-event small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-span-event strong {
  color: var(--ink);
  font-weight: 700;
}

.month-span-event small {
  color: var(--muted);
  font-size: 10px;
}

.calendar-week,
.calendar-day-view {
  display: grid;
  gap: 10px;
}

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

.week-column,
.day-column {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefd;
  padding: 10px;
}

.week-column h3,
.day-column h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.agenda-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.schedule-edit,
.time-tracking,
.order-edit {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.schedule-edit h3,
.time-tracking h3,
.order-edit h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.schedule-edit-collapsible > summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

.schedule-edit-collapsible[open] > summary {
  margin-bottom: 8px;
}

.team-picker {
  min-width: 0;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.team-picker legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 12px;
}

.team-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.team-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.team-option input {
  width: auto;
}

.team-time-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
}

.team-time-summary span {
  color: var(--muted);
}

.employee-add-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(130px, .55fr) minmax(130px, .55fr) auto;
  gap: 8px;
  align-items: end;
}

.employee-settings-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.employee-setting-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.employee-setting-card.archived {
  opacity: .6;
}

.employee-setting-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.employee-setting-card summary span:first-child {
  display: grid;
  gap: 2px;
}

.employee-setting-card summary small {
  color: var(--muted);
}

.employee-setting-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.employee-setting-fields label {
  padding-top: 10px;
  font-size: 11px;
}

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

.employee-setting-fields .form-error {
  grid-column: 1 / -1;
  margin: 0;
}

.demo-request-dialog {
  width: min(620px, calc(100vw - 28px));
}

.demo-request-dialog h2 {
  margin: 2px 0 6px;
}

.demo-local-confirm {
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.45;
}

.demo-verification {
  display: grid;
  gap: 14px;
}

.demo-verification label {
  max-width: 260px;
}

.demo-subscription-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 45;
  display: none;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid #b99b3d;
  border-radius: 23px;
  background: #d9c27b;
  color: #20272b;
  box-shadow: 0 12px 30px rgba(20, 29, 38, .2);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

body.demo-session .demo-subscription-fab:not([hidden]) {
  display: block;
}

body:has(dialog[open]) .demo-subscription-fab {
  display: none !important;
}

.app-confirm-dialog p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.subscription-picker {
  display: grid;
  gap: 7px;
}

.subscription-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.subscription-option:has(input:checked) {
  border-color: var(--green);
  box-shadow: inset 3px 0 0 var(--green);
}

.subscription-option input {
  width: auto;
}

.subscription-option span,
.subscription-option b {
  display: grid;
  gap: 2px;
}

.subscription-option b {
  justify-items: end;
  white-space: nowrap;
  font-size: 15px;
}

.subscription-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.subscription-cost-summary {
  align-self: end;
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  background: #f8f5e9;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.credit-note-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-self: end;
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  background: #f8f5e9;
}

.credit-note-summary span {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}

.credit-note-summary strong {
  color: var(--ink);
  font-size: 13px;
}

#financeRecoveryRows td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.pricing-dialog {
  width: min(900px, calc(100vw - 28px));
}

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

.price-option {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.price-option.featured {
  border-color: var(--green);
  box-shadow: inset 0 3px 0 var(--green);
}

.price-option h3 {
  margin: 14px 0 6px;
  font-size: 17px;
}

.price-option p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.price-option .price-amount {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 23px;
  font-weight: 850;
}

.price-amount small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.pricing-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 4px;
}

.pricing-foot p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.settings-disabled {
  opacity: .58;
}

.payment-page {
  min-height: 100vh;
  background: #f3f5f2;
}

.payment-shell {
  width: min(520px, calc(100% - 28px));
  margin: 0 auto;
  padding: 48px 0;
}

.payment-shell > img {
  display: block;
  width: min(270px, 72vw);
  margin: 0 auto 24px;
}

.payment-panel {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(23, 33, 43, .12);
}

.payment-panel h1 {
  margin: 6px 0 10px;
  font-size: 26px;
}

.payment-amount {
  margin: 22px 0;
  font-size: 30px;
  font-weight: 800;
}

.payment-panel .primary-button {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
}

.activation-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.activation-account {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6f8f5;
  font-size: 14px;
}

.activation-account span {
  text-align: right;
}

.pricing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.exit-dialog {
  text-align: center;
}

.exit-dialog-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #17212b;
  box-shadow: 0 6px 18px rgba(23, 33, 43, .18);
}

.exit-dialog-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.exit-dialog h2 {
  margin: 0 0 8px;
}

.exit-dialog p {
  margin: 0;
  color: var(--muted);
}

body.execution-session .purchase-review-check,
body.execution-session .purchase-payment-section,
body.execution-session #purchaseAssetFields,
body.execution-session #purchaseDeductibleVat,
body.execution-session #deletePurchaseButton {
  display: none !important;
}

.icon-close-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

body.demo-session .sync-status {
  width: auto;
  min-width: 8px;
}

body.demo-session .sync-status strong {
  display: inline;
}

.line-received-input {
  width: 72px;
  min-height: 34px;
  padding: 5px 7px;
}

#orderDialog h2 {
  margin-bottom: 0;
}

#orderDialogText {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

#orderDialog .order-edit {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

#orderDialog .order-edit .form-grid {
  gap: 8px;
  align-items: end;
}

.order-lines-table {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.order-lines-table th,
.order-lines-table td {
  padding: 7px 8px;
  font-size: 12px;
}

.order-lines-table th {
  font-size: 10px;
}

.order-lines-table .ghost-button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.order-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.order-summary span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.order-summary small {
  color: var(--muted);
  font-size: 11px;
}

.order-summary strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.field-registration {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.field-registration h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.field-report-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.field-report {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.field-report div {
  display: grid;
  gap: 2px;
}

.field-report span {
  color: var(--muted);
  font-size: 11px;
}

.time-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.time-entry div {
  display: grid;
  gap: 2px;
}

.time-entry strong {
  font-weight: 600;
}

.time-entry span {
  color: var(--muted);
  font-size: 12px;
}

.detail-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.detail-row span:first-child {
  color: var(--muted);
  font-weight: 800;
}

.signature-evidence-panel {
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid rgba(77, 111, 139, .24);
  border-radius: 8px;
  background: #f4f8f9;
}

.signature-evidence-panel[hidden] {
  display: none;
}

.compact-header {
  margin-bottom: 0;
}

.compact-header h3 {
  margin: 0;
  font-size: 16px;
}

.dialog-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-title-row h2 {
  min-width: 0;
  margin: 0;
}

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

.quiet-evidence-button {
  opacity: .72;
  font-size: 12px;
  min-height: 30px;
  padding: 5px 8px;
}

.install-app-button {
  border-color: rgba(154, 118, 60, .35);
  color: var(--amber);
}

.technical-settings {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbf9;
}

.technical-settings summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

#widgetEmbedCode {
  min-height: 150px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.evidence-json {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.evidence-json summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 800;
}

.evidence-json pre {
  max-height: 240px;
  overflow: auto;
  padding: 10px;
  border-radius: 8px;
  background: #20272b;
  color: #f7f7f4;
  font-size: 12px;
  white-space: pre-wrap;
}

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

.module-list span {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
  font-weight: 800;
}

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

.system-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.system-list div:last-child {
  border-bottom: 0;
}

.system-list span {
  color: var(--muted);
  font-size: 13px;
}

.system-list strong {
  text-align: right;
  font-size: 13px;
}

.template-layout {
  grid-template-columns: 330px minmax(0, 1fr);
  align-items: start;
}

.template-tools {
  position: sticky;
  top: 18px;
}

.field-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.template-editor-panel {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf5;
}

.template-editor-panel .form-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.palette-button {
  padding: 8px 10px;
  font-size: 13px;
}

.template-note {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.template-note strong {
  color: var(--ink);
}

.template-preview-panel {
  min-width: 0;
}

.template-stage {
  overflow: auto;
  max-height: calc(100vh - 190px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ecefeb;
}

.template-page {
  position: relative;
  width: 640px;
  min-height: 905px;
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d8ddd8;
  border-radius: 4px;
  box-shadow: 0 10px 24px rgba(31, 41, 55, .08);
}

.template-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .92;
  pointer-events: none;
}

.template-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

.template-guide {
  position: absolute;
  display: block;
  background: #d5a900;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .95), 0 0 10px rgba(213, 169, 0, .55);
}

.template-guide.vertical {
  top: 0;
  bottom: 0;
  width: 2px;
}

.template-guide.horizontal {
  left: 0;
  right: 0;
  height: 2px;
}

.template-file-notice {
  position: absolute;
  left: 46px;
  right: 46px;
  top: 32px;
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f7f4;
  color: var(--muted);
  font-size: 13px;
}

.template-file-notice strong {
  color: var(--ink);
}

.template-element {
  position: absolute;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 8px;
  border: 1px dashed #9aa8a0;
  border-radius: 6px;
  background: rgba(255, 255, 255, .88);
  color: var(--ink);
  cursor: move;
  user-select: none;
  white-space: normal;
  z-index: 5;
}

.template-element.selected {
  border-style: solid;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(77, 111, 139, .16);
}

.template-element.dragging {
  opacity: .92;
  z-index: 20;
}

.template-element strong {
  font-size: 11px;
  color: var(--blue);
  text-transform: uppercase;
}

.template-element span {
  color: var(--ink);
  line-height: 1.35;
}

.logo-element {
  padding: 0;
  place-items: center;
  background: rgba(255, 255, 255, .7);
}

.logo-element img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .25);
  width: min(560px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(20, 29, 38, .58);
  backdrop-filter: blur(2px);
}

dialog.wide-dialog {
  width: min(920px, calc(100vw - 28px));
}

.pdf-preview-dialog {
  width: min(1120px, calc(100vw - 24px));
  height: min(940px, calc(100dvh - 24px));
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  background: #e7eae7;
}

.pdf-preview-dialog::backdrop {
  background: rgba(20, 29, 38, .68);
}

.pdf-preview-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.pdf-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.pdf-preview-header h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

.pdf-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #e7eae7;
}

.sign-box {
  display: grid;
  gap: 14px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.signature-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
}

.signature-toolbar span {
  min-width: 44px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.signature-pad-wrap {
  display: grid;
  gap: 8px;
}

.signature-canvas {
  width: 100%;
  height: 150px;
  display: block;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}

.signed-quote-preview {
  max-height: 540px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ecefeb;
}

.signed-quote-preview .page-shell {
  width: calc(640px * var(--doc-scale, .58));
  height: calc(905px * var(--doc-scale, .58));
  margin: 0 auto;
  overflow: hidden;
}

.signed-quote-preview .page {
  position: relative;
  width: 640px;
  min-height: 905px;
  overflow: hidden;
  border: 1px solid #d8ddd8;
  background: #fff;
  box-shadow: 0 10px 24px rgba(31, 41, 55, .08);
  transform: scale(var(--doc-scale, .58));
  transform-origin: top left;
}

.signed-quote-preview .doc-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .92;
}

.signed-quote-preview .doc-element {
  position: absolute;
  white-space: normal;
  line-height: 1.35;
  color: var(--ink);
}

.signed-quote-preview .doc-element strong {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 11px;
  text-transform: uppercase;
}

.signed-quote-preview .doc-element table {
  width: 100%;
  border-collapse: collapse;
  font-size: inherit;
}

.signed-quote-preview .doc-element th,
.signed-quote-preview .doc-element td {
  padding: 5px 4px;
}

.document-signature {
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-size: 24px;
  color: var(--ink);
  line-height: 1.2;
}

.document-signature-image {
  max-width: 100%;
  max-height: 54px;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.document-signature-meta {
  margin-top: 5px;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
}

.quote-builder {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbf9;
}

.public-quote-body {
  min-height: 100vh;
  background: #f4f5f1;
}

.public-quote-shell {
  width: min(980px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.public-quote-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 18px;
}

.public-quote-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e7edf4;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.public-quote-card {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefd;
  box-shadow: var(--shadow);
}

.public-quote-card h1 {
  margin: 0;
  font-size: 24px;
}

.public-preview {
  max-height: none;
}

.public-preview .page-shell {
  margin: 0 auto;
}

.public-sign-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.public-sign-input-fields {
  display: grid;
  gap: 10px;
}

.public-sign-form .signature-canvas {
  min-height: 160px;
}

.signature-evidence-notice {
  margin: -4px 0 2px;
  padding: 10px 11px;
  border-left: 3px solid var(--gold);
  background: #f7f6f0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.signature-verification-step {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf7;
}

.signature-verification-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.signature-verification-step .card-actions {
  margin-top: 2px;
}

.form-error.success-message {
  color: var(--green);
}

.form-error.warning-message {
  color: var(--amber);
}

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

  .front-showcase,
  .front-features,
  .front-faq,
  .front-final-cta {
    grid-template-columns: 1fr;
  }

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

  .front-hero {
    min-height: 0;
    padding: 52px;
  }

  .content-grid.two,
  .content-grid.form-and-list,
  .content-grid.planning-layout,
  .template-layout {
    grid-template-columns: 1fr;
  }

  .template-tools {
    position: static;
  }

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

@media (max-width: 760px) {
  .login-screen {
    padding: 16px;
  }

  .login-brand .brand-logo {
    width: 220px;
  }

  .login-brand > div:last-child {
    display: none;
  }

  .front-nav {
    align-items: start;
  }

  .front-site-links {
    display: none;
  }

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

  .pricing-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .pricing-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-card {
    position: fixed;
    top: 78px;
    right: 16px;
    left: 16px;
    width: auto;
  }

  .front-hero {
    gap: 28px;
    padding: 42px 24px;
    background-image:
      linear-gradient(90deg, rgba(32, 39, 43, .90) 0%, rgba(32, 39, 43, .78) 100%),
      linear-gradient(180deg, rgba(217, 194, 123, .14), rgba(32, 39, 43, .08)),
      image-set(url("assets/frontpage-hero.webp") type("image/webp"), url("assets/frontpage-hero.png") type("image/png"));
  }

  .hero-copy h1 {
    font-size: 40px;
  }

  .hero-copy p:not(.eyebrow) {
    font-size: 16px;
  }

  .front-proof {
    display: grid;
  }

  .front-features {
    grid-template-columns: 1fr;
  }

  .front-audience {
    margin-top: 26px;
    padding-top: 34px;
  }

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

  .trade-grid a {
    min-height: 0;
  }

  .front-faq {
    gap: 24px;
    padding: 38px 0 44px;
  }

  .front-final-cta {
    gap: 26px;
    padding: 26px 22px;
  }

  .front-route {
    padding: 24px 16px 18px;
  }

  .route-intro {
    text-align: left;
  }

  .route-intro h2 {
    font-size: 23px;
  }

  .route-canvas {
    min-height: 0;
    display: grid;
    gap: 6px;
    margin-top: 18px;
  }

  .route-canvas .route-line {
    inset: 18px auto 18px 18px;
    width: 2px;
    height: calc(100% - 36px);
    background: #c1ad70;
  }

  .route-line path {
    display: none;
  }

  .route-node {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: 100%;
    min-height: 52px;
    grid-template-columns: 38px minmax(0, 1fr);
    grid-template-areas:
      "icon title"
      "icon text";
    justify-items: start;
    column-gap: 9px;
    row-gap: 1px;
    text-align: left;
    transform: none;
  }

  .route-node .route-icon {
    grid-area: icon;
  }

  .route-node strong {
    grid-area: title;
    align-self: end;
    margin-top: 0;
  }

  .route-node small {
    grid-area: text;
  }

  .front-showcase {
    padding-top: 42px;
  }

  .preview-flow,
  .preview-table div {
    grid-template-columns: 1fr;
  }

  .preview-table div {
    display: grid;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-content: start;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: calc(56px + env(safe-area-inset-top));
    min-width: 0;
    max-width: 100%;
    padding: calc(8px + env(safe-area-inset-top)) 88px 8px 12px;
    overflow: visible;
  }

  .mobile-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 40px;
  }

  .brand {
    margin: 0;
  }

  .brand .brand-mark {
    width: 34px;
    min-width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 15px;
  }

  .brand .brand-logo {
    display: block;
    width: 175px;
  }

  .brand .brand-symbol {
    display: none;
  }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid #465057;
    border-radius: 8px;
    background: #313a3f;
    color: #fff;
    font-weight: 700;
  }

  .mobile-menu-button span {
    font-size: 18px;
    line-height: 1;
  }

  .mobile-nav-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 52;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 12px;
    width: min(320px, 86vw);
    height: 100dvh;
    padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
    background: #20272b;
    box-shadow: -18px 0 44px rgba(0, 0, 0, .22);
    transform: translateX(105%);
    transition: transform .2s ease;
  }

  .mobile-nav-open .mobile-nav-panel {
    transform: translateX(0);
  }

  .mobile-nav-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    padding: 0 4px;
  }

  .mobile-nav-title strong {
    font-size: 18px;
  }

  .mobile-nav-title button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #313a3f;
    color: #fff;
    font-size: 25px;
  }

  .nav {
    display: grid;
    align-content: start;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    gap: 3px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 2px 6px;
    -webkit-overflow-scrolling: touch;
  }

  .nav-item {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    font-size: 15px;
  }

  .nav-item.active {
    box-shadow: inset 3px 0 0 #d9c27b;
  }

  .nav-item[data-view="templates"],
  .nav-item[data-view="settings"] {
    display: none;
  }

  .mobile-nav-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #384248;
  }

  .mobile-nav-actions .ghost-button {
    min-width: 0;
    background: #313a3f;
    border-color: #465057;
    color: #fff;
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 51;
    display: block;
    border: 0;
    background: rgba(17, 22, 25, .48);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }

  .mobile-nav-open .mobile-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    padding: 10px 10px calc(22px + env(safe-area-inset-bottom));
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 7px;
    margin-bottom: 10px;
  }

  .topbar .eyebrow {
    display: none;
  }

  h1 {
    font-size: 23px;
  }

  h2 {
    font-size: 18px;
  }

  .topbar-actions,
  .top-actions,
  .card-actions,
  menu {
    width: 100%;
    gap: 8px;
  }

  .topbar-actions {
    display: block;
    justify-content: stretch;
  }

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

  #employeePasswordButton,
  #logoutButton,
  #contextActions [data-action="exportCsv"],
  #contextActions [data-action="printFinance"] {
    display: none !important;
  }

  .primary-button,
  .ghost-button,
  .danger-button {
    min-height: 40px;
    padding: 9px 10px;
  }

  .sync-status {
    top: calc(7px + env(safe-area-inset-top));
    right: calc(7px + env(safe-area-inset-right));
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 10px;
  }

  .metric {
    min-height: 68px;
    padding: 9px 10px;
  }

  .metric strong {
    font-size: 20px;
  }

  .metric span {
    font-size: 12px;
    line-height: 1.25;
  }

  .module-list,
  .week-grid,
  .quote-customer-row,
  .form-grid,
  .form-grid.compact,
  .route-calculation-grid {
    grid-template-columns: 1fr;
  }

  .credit-note-summary {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .settings-group-heading,
  .day-route-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .section-heading > button,
  .settings-group-heading > button,
  .day-route-heading .card-actions,
  .day-route-heading .card-actions button {
    width: 100%;
  }

  .day-route-leg {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .day-route-metrics {
    grid-column: 2;
    grid-template-columns: auto auto;
    justify-content: start;
    gap: 8px;
    text-align: left;
  }

  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .filter-bar > label:first-child {
    grid-column: 1 / -1;
  }

  .filter-bar.single {
    grid-template-columns: 1fr;
  }

  .calendar-month {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    width: 100%;
    overflow: hidden;
  }

  .calendar-head {
    min-width: 0;
    padding: 6px 1px;
    font-size: 10px;
    text-align: center;
  }

  .calendar-month-weeks,
  .calendar-month-week,
  .calendar-month-days {
    min-width: 0;
    width: 100%;
  }

  .calendar-day {
    min-height: 58px;
    border-right: 0;
    padding: 4px 2px;
  }

  .calendar-day .day-number {
    justify-content: center;
    margin: 0;
    font-size: 11px;
  }

  .calendar-day .day-number span {
    min-width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .calendar-day .day-number small,
  .calendar-month .month-span-layer {
    display: none;
  }

  .mobile-month-activity {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 12px;
    margin-top: 3px;
  }

  .mobile-month-activity span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--blue);
  }

  .mobile-month-activity span.ready {
    background: var(--green);
  }

  .mobile-month-activity span.waiting {
    background: var(--amber);
  }

  .mobile-month-activity small {
    color: var(--muted);
    font-size: 8px;
  }

  .planning-layout .calendar-panel {
    order: 1;
  }

  .planning-layout .plan-sidebar {
    order: 2;
  }

  #planningForm {
    position: static;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 254, 253, .96);
    box-shadow: 0 8px 18px rgba(31, 41, 55, .08);
  }

  .mobile-planning-toggle {
    display: inline-flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 9px;
  }

  #planningForm:not(.mobile-open) {
    display: none;
  }

  #planningForm:not(.mobile-open) + .planning-hint:not(.active) {
    display: none;
  }

  .content-grid {
    gap: 10px;
  }

  .panel {
    padding: 12px;
  }

  .panel-header {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .filter-bar {
    padding: 8px;
  }

  input,
  select,
  textarea {
    min-height: 40px;
    font-size: 16px;
  }

  textarea {
    min-height: 96px;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 8px;
  }

  tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  td {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    align-items: start;
    padding: 8px 9px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }

  td:first-child,
  td:last-child,
  td[colspan] {
    grid-column: 1 / -1;
  }

  td:nth-last-child(2):not(:first-child) {
    border-bottom: 0;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  td[colspan] {
    display: block;
  }

  td[colspan]::before {
    display: none;
  }

  .compact-table {
    table-layout: auto;
  }

  .compact-table td:first-child {
    width: auto;
  }

  .compact-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
    width: 100%;
  }

  #ordersView .panel {
    padding: 10px;
  }

  #ordersView .filter-bar {
    grid-template-columns: 1fr;
    padding: 7px;
  }

  .order-list-head {
    display: none;
  }

  .order-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "number status"
      "customer customer"
      "supplier received"
      "lines lines"
      "warning warning"
      "action action";
    gap: 5px 10px;
    padding: 8px;
  }

  .order-customer,
  .order-meta,
  .order-received {
    padding-top: 5px;
    border-top: 1px solid var(--line);
  }

  .order-row .compact-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .order-progress.compact {
    width: 100%;
  }

  .order-lines-preview {
    display: flex;
  }

  .order-lines-preview span {
    max-width: 100%;
  }

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

  .compact-actions button,
  .card-actions button,
  menu button {
    width: 100%;
  }

  .card-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  #invoiceCards .item-card,
  #reminderCards .item-card {
    padding: 10px;
  }

  .signed-quote-preview table {
    display: table;
  }

  .signed-quote-preview thead {
    display: table-header-group;
  }

  .signed-quote-preview tbody {
    display: table-row-group;
  }

  .signed-quote-preview tr {
    display: table-row;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .signed-quote-preview th,
  .signed-quote-preview td {
    display: table-cell;
    min-height: 0;
    padding: 5px 4px;
    border-bottom: 0;
  }

  .signed-quote-preview td::before {
    content: none;
  }

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

  .signature-canvas {
    height: 132px;
  }

  .timer-actions,
  .time-entry {
    grid-template-columns: 1fr;
  }

  .timer-actions {
    display: grid;
  }

  .time-entry {
    align-items: stretch;
  }

  dialog,
  dialog.wide-dialog {
    width: calc(100vw - 16px);
    max-width: none;
    max-height: calc(100dvh - 16px);
    margin: auto;
    padding: 14px;
    overflow: auto;
  }

  dialog.pdf-preview-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border-radius: 0;
    overflow: hidden;
  }

  .pdf-preview-header {
    align-items: flex-start;
    padding: 10px 12px;
  }

  .pdf-preview-header .eyebrow {
    display: none;
  }

  .pdf-preview-header h2 {
    font-size: 15px;
  }

  .pdf-preview-actions .ghost-button,
  .pdf-preview-actions .primary-button {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 12px;
  }

  dialog menu {
    display: grid;
    grid-template-columns: 1fr;
    padding: 0;
  }

  .dashboard-result-row {
    grid-template-columns: 1fr;
  }

  .dashboard-result-row .primary-button {
    width: 100%;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .template-stage {
    max-height: 58vh;
    padding: 10px;
  }

  .template-page {
    transform: scale(.62);
    transform-origin: top left;
    margin: 0;
  }
}

@media (max-width: 430px) {
  .front-nav {
    flex-direction: row;
    align-items: center;
  }

  .front-price-button {
    padding-inline: 5px;
  }

  .subscription-option {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .subscription-option b {
    grid-column: 2;
    justify-items: start;
  }

  .login-brand .brand-logo {
    width: min(220px, calc(100vw - 140px));
  }

  .front-hero {
    padding: 34px 18px;
  }

  .hero-copy h1 {
    font-size: 34px;
  }

  .front-features {
    grid-template-columns: 1fr;
  }

  .top-actions:has(> :only-child) {
    grid-template-columns: 1fr;
  }

  .employee-add-row,
  .employee-setting-row {
    grid-template-columns: 1fr;
  }

  .employee-add-row button,
  .employee-setting-row button,
  #scheduleMapsButton {
    width: 100%;
  }

  .team-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .team-option {
    min-width: 0;
  }

  .demo-subscription-fab {
    right: 10px;
    bottom: 10px;
    max-width: 132px;
    min-height: 38px;
    padding: 0 11px;
    font-size: 11px;
  }
}

@media (max-width: 350px) {
  .brand .brand-logo {
    width: 130px;
  }
}

@media (max-width: 760px) {
  dialog#purchaseDialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border-radius: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  #purchaseDialog .sign-box {
    max-height: none;
    overflow: visible;
    gap: 12px;
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
  }

  #purchaseDialog .dialog-title-row {
    position: sticky;
    top: 0;
    z-index: 5;
    align-items: flex-start;
    padding: 8px 0 10px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }

  #purchaseDialog .purchase-review-layout {
    display: block;
  }

  #purchaseDialog .purchase-receipt-pane,
  #purchaseDialog .purchase-recognized-fields {
    padding: 0;
    border: 0;
    background: transparent;
  }

  #purchaseDialog .purchase-recognized-fields {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  #purchaseDialog .purchase-receipt-preview {
    min-height: 160px;
    max-height: 42dvh;
    padding: 6px;
  }

  #purchaseDialog .purchase-receipt-actions {
    grid-template-columns: 1fr;
  }

  #purchaseDialog .purchase-receipt-actions > * {
    width: 100%;
    text-align: center;
  }

  #purchaseDialog .form-grid {
    gap: 10px;
  }

  #purchaseDialog .setting-toggle {
    align-items: flex-start;
  }

  #purchaseDialog .purchase-line-row {
    grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr) 34px;
    align-items: end;
    gap: 8px;
  }

  #purchaseDialog .purchase-line-row .purchase-line-business {
    grid-column: 1;
  }

  #purchaseDialog .purchase-line-row .purchase-line-description {
    grid-column: 2 / 4;
  }

  #purchaseDialog .purchase-line-row .purchase-line-remove {
    grid-column: 4;
  }

  #purchaseDialog .purchase-line-row .purchase-line-quantity,
  #purchaseDialog .purchase-line-row .purchase-line-vat {
    grid-column: 1 / 3;
  }

  #purchaseDialog .purchase-line-row .purchase-line-excl,
  #purchaseDialog .purchase-line-row .purchase-line-incl {
    grid-column: 3 / 5;
  }

  #purchaseDialog menu {
    position: sticky;
    bottom: 0;
    z-index: 5;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 2px -12px -12px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .98);
  }

  #purchaseDialog menu .primary-button {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  #purchaseDialog menu #deletePurchaseButton[hidden] + .ghost-button {
    grid-column: 1 / -1;
  }
}
