:root {
  --bg: #f4f1e8;
  --surface: #ffffff;
  --surface-soft: #f8f5ed;
  --ink: #17271e;
  --muted: #6d776e;
  --line: #e3ded2;
  --line-strong: #d2cbbb;
  --accent: #1f6b4f;
  --accent-strong: #15523b;
  --accent-soft: #e3f1e8;
  --lime: #d9ef8c;
  --danger: #b44035;
  --danger-soft: #fbecea;
  --gutter: 20px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --shadow-card: 0 16px 40px -38px rgba(22, 45, 32, 0.45);
  --font: "Inter", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(80% 50% at 10% 0%, #e2eadf 0%, transparent 62%),
    #e8e3d7;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled),
a {
  cursor: pointer;
}

svg {
  display: block;
}

.app {
  position: relative;
  width: 100%;
  max-width: 560px;
  min-height: 100dvh;
  margin: 0 auto;
  overflow-x: clip;
  background:
    radial-gradient(115% 55% at 100% 0%, rgba(203, 226, 209, 0.5) 0%, transparent 58%),
    var(--bg);
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 50%;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  text-decoration: none;
  transform: translate(-50%, -160%);
  transition: transform 0.18s ease;
}

.skip-link:focus {
  transform: translate(-50%, 0);
}

/* Header */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top)) var(--gutter) 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 15px;
  color: var(--ink);
  text-decoration: none;
}

.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--accent);
  color: #f8f5ed;
  box-shadow:
    0 10px 22px -14px rgba(31, 107, 79, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-size: 18px;
  font-weight: 780;
  letter-spacing: -0.035em;
}

.brand-tagline {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.135em;
  text-transform: uppercase;
}

.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(23, 39, 30, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: #5f685f;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.offline-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b78d3d;
  content: "";
}

/* Views */

main {
  position: relative;
}

.view {
  animation: view-in 0.32s cubic-bezier(0.2, 0.75, 0.3, 1) both;
}

.view-calc {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.view-orders,
.view-settings {
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
}

body.with-total .view-calc {
  padding-bottom: calc(252px + env(safe-area-inset-bottom));
}

.view-head {
  padding: 18px var(--gutter) 21px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  max-width: 12ch;
  margin: 0;
  color: #13251c;
  font-size: clamp(31px, 8.7vw, 40px);
  font-weight: 790;
  letter-spacing: -0.045em;
  line-height: 1.03;
}

h1:focus {
  outline: none;
}

.lede {
  max-width: 36ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14.3px;
  line-height: 1.5;
}

/* Empty states */

.empty-state {
  margin: 2px var(--gutter) 0;
  padding: 34px 26px 30px;
  border: 1px dashed var(--line-strong);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.4);
  text-align: center;
}

.empty-art {
  display: grid;
  place-items: center;
  width: 98px;
  height: 98px;
  margin: 0 auto 19px;
  border-radius: 31px;
  background: linear-gradient(145deg, #ebf4ec, #d9e9de);
  box-shadow:
    0 18px 34px -26px rgba(31, 107, 79, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: rotate(-3deg);
}

.empty-art svg {
  width: 72px;
  height: 72px;
  transform: rotate(3deg);
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.035em;
}

.empty-state p {
  max-width: 31ch;
  margin: 0 auto 22px;
  color: var(--muted);
  font-size: 13.8px;
  line-height: 1.5;
}

/* Section heading and search */

#calcWorks,
.orders-body,
.settings-section {
  margin: 0 var(--gutter);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 740;
  letter-spacing: -0.02em;
}

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 25px;
  height: 24px;
  padding: 0 7px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  margin-bottom: 11px;
  padding: 0 10px 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.search:focus-within {
  border-color: rgba(31, 107, 79, 0.55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(31, 107, 79, 0.1);
}

.search > svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: #8a938a;
}

.search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.search input::placeholder {
  color: #99a098;
}

.search-clear {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: #efebe1;
  color: #647067;
}

.search-clear svg {
  width: 16px;
  height: 16px;
}

/* Work list */

.work-group + .work-group {
  margin-top: 18px;
}

.work-group-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 2px 8px;
}

.work-group-head h3 {
  margin: 0;
  color: #6d776e;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.work-group-head span {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 18px;
  padding: 0 5px;
  border-radius: 6px;
  background: #eeeae0;
  color: #7d867d;
  font-size: 9.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.work-group[data-kind="material"] .work-group-head h3 {
  color: #95692f;
}

.work-group[data-kind="material"] .work-group-head span {
  background: #f5ead8;
  color: #8d6128;
}

.work-list {
  display: grid;
  gap: 9px;
}

.work-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.work-card.is-selected {
  border-color: rgba(31, 107, 79, 0.4);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdf9 100%);
  box-shadow: 0 16px 34px -30px rgba(23, 61, 46, 0.62);
}

.work-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 66px;
  padding: 15px 15px 15px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.work-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
  border-radius: 17px;
}

.work-toggle:active .work-name {
  opacity: 0.7;
}

.checkbox {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border: 1.5px solid #c9d0c8;
  border-radius: 8px;
  background: #fff;
  color: #fff;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.checkbox svg {
  width: 14px;
  height: 14px;
  opacity: 0;
  transform: scale(0.55);
  transition:
    opacity 0.16s ease,
    transform 0.16s cubic-bezier(0.2, 0.8, 0.3, 1.4);
}

.work-card.is-selected .checkbox {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 5px 12px -6px rgba(31, 107, 79, 0.8);
}

.work-card.is-selected .checkbox svg {
  opacity: 1;
  transform: scale(1);
}

.work-copy {
  display: block;
  flex: 1;
  min-width: 0;
}

.work-name {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 15.2px;
  font-weight: 670;
  letter-spacing: -0.015em;
  line-height: 1.28;
  transition: opacity 0.15s ease;
}

.work-price {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.3px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.price-unit {
  color: #98a098;
}

.qty-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 0 15px 15px 52px;
  animation: panel-in 0.22s ease both;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.qty-label {
  color: #879087;
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: 0.01em;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  border-radius: 12px;
  background: #f1eee6;
}

.step-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  transition:
    background 0.14s ease,
    transform 0.14s ease;
}

.step-btn:hover {
  background: #fff;
}

.step-btn:active {
  transform: scale(0.92);
}

.step-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.qty-input {
  width: 43px;
  min-width: 0;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.qty-input:focus {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(31, 107, 79, 0.38);
}

.qty-input[aria-invalid="true"] {
  color: var(--danger);
}

.qty-total {
  flex: none;
  padding-bottom: 2px;
  text-align: right;
}

.qty-total span {
  display: block;
  color: #929b92;
  font-size: 9px;
  font-weight: 680;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.qty-total strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 730;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.no-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 26px 12px 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.no-results strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 680;
}

/* Forms */

.work-form {
  scroll-margin-top: 14px;
  margin: 0 var(--gutter) 27px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.work-form.is-editing {
  border-color: rgba(31, 107, 79, 0.45);
  box-shadow:
    0 0 0 3px var(--accent-soft),
    var(--shadow-card);
}

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

.form-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 740;
  letter-spacing: -0.025em;
}

.form-chip {
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kind-choice {
  min-width: 0;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.kind-choice .field-label {
  padding: 0;
}

.kind-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border-radius: 13px;
  background: #f1eee6;
}

.kind-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.kind-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.kind-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: 10px;
  color: #6b756c;
  font-size: 12.5px;
  font-weight: 650;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.kind-option input:checked + span {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 5px 12px -10px rgba(23, 61, 46, 0.8);
}

.kind-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field {
  display: block;
  margin-bottom: 13px;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: #3b493f;
  font-size: 12px;
  font-weight: 660;
  letter-spacing: 0.005em;
}

.field input {
  width: 100%;
  height: 49px;
  padding: 0 14px;
  border: 1px solid #ded8ca;
  border-radius: 13px;
  outline: 0;
  background: #fbfaf6;
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.field input::placeholder {
  color: #a5aaa2;
  font-weight: 400;
}

.field input:focus {
  border-color: rgba(31, 107, 79, 0.7);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(31, 107, 79, 0.1);
}

.field input[aria-invalid="true"] {
  border-color: rgba(180, 64, 53, 0.65);
  background: #fffafa;
}

.field input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 4px rgba(180, 64, 53, 0.1);
}

.money-input {
  position: relative;
  display: block;
}

.money-input input {
  padding-right: 42px;
  font-variant-numeric: tabular-nums;
}

.money-suffix {
  position: absolute;
  top: 50%;
  right: 15px;
  color: #78827a;
  font-size: 15px;
  font-weight: 650;
  pointer-events: none;
  transform: translateY(-50%);
}

.field-error {
  display: block;
  margin-top: 5px;
  color: var(--danger);
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.35;
}

.form-error {
  margin: 2px 0 13px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: #8c3129;
  font-size: 12px;
  line-height: 1.4;
}

.form-actions {
  display: flex;
  gap: 9px;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 690;
  letter-spacing: -0.005em;
  line-height: 1.2;
  text-decoration: none;
  transition:
    background 0.16s ease,
    transform 0.12s ease,
    box-shadow 0.16s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  flex: 1;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 24px -18px rgba(31, 107, 79, 0.85);
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
}

.btn-ghost {
  flex: 0 0 auto;
  background: #f1ede4;
  color: var(--ink);
}

.btn-ghost:hover {
  background: #e9e4d8;
}

.btn-danger {
  flex: 1;
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #9d352c;
}

.btn-soft {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 11px;
  background: #fff;
  color: var(--accent);
  font-size: 12.5px;
  box-shadow: 0 6px 14px -12px rgba(23, 61, 46, 0.55);
}

.btn-inline {
  width: auto;
  min-height: 46px;
  margin: 0 auto;
  padding: 0 17px;
}

/* Saved works */

.settings-section {
  margin-bottom: 4px;
}

.settings-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 11px 12px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.settings-item:hover {
  border-color: #d6d0c2;
}

.settings-item.is-editing {
  border-color: rgba(31, 107, 79, 0.45);
  background: #fbfdf9;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.settings-copy {
  flex: 1;
  min-width: 0;
}

.settings-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.settings-name {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14.3px;
  font-weight: 650;
  letter-spacing: -0.012em;
  line-height: 1.28;
}

.kind-badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 8.5px;
  font-weight: 760;
  letter-spacing: 0.035em;
  line-height: 1.2;
  text-transform: uppercase;
}

.kind-badge.kind-work {
  background: var(--accent-soft);
  color: var(--accent);
}

.kind-badge.kind-material {
  background: #f6ead6;
  color: #8b5c22;
}

.settings-price {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.settings-actions {
  display: flex;
  flex: none;
  gap: 3px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #616d63;
  transition:
    background 0.14s ease,
    color 0.14s ease,
    transform 0.12s ease;
}

.icon-btn:hover {
  background: #f2eee5;
}

.icon-btn:active {
  transform: scale(0.93);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.icon-btn.edit {
  background: #f1f7f3;
  color: var(--accent);
}

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

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.settings-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.settings-empty svg {
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  color: #a0a99f;
}

.settings-empty p {
  max-width: 31ch;
  margin: 0;
  font-size: 12.8px;
  line-height: 1.45;
}

/* Orders */

.orders-empty {
  margin: 0;
  padding-bottom: 28px;
}

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

.order-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.order-card:hover {
  border-color: #d4cdbf;
  box-shadow: 0 18px 34px -33px rgba(23, 39, 30, 0.65);
}

.order-card-btn {
  display: block;
  width: 100%;
  padding: 15px 16px 14px;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.order-card-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

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

.order-number {
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.order-date {
  flex: none;
  color: #8a938a;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.order-object {
  display: block;
  margin: 7px 0 3px;
  overflow-wrap: anywhere;
  font-size: 16.5px;
  font-weight: 730;
  letter-spacing: -0.028em;
  line-height: 1.25;
}

.order-address {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12.1px;
  line-height: 1.4;
}

.order-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}

.order-card-client {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.order-client-name {
  overflow: hidden;
  color: #3d4b41;
  font-size: 12.2px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-positions {
  color: #8a938a;
  font-size: 10.5px;
}

.order-card-total {
  display: flex;
  align-items: center;
  flex: none;
  gap: 4px;
}

.order-card-total strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.order-card-total svg {
  width: 16px;
  height: 16px;
  color: #a0a8a0;
}

/* Order dialogs */

.sheet-dialog {
  width: min(520px, calc(100vw - 24px));
  max-width: 520px;
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 26px;
  background: transparent;
  color: var(--ink);
}

.sheet-dialog[open] {
  animation: dialog-in 0.2s ease both;
}

.sheet-dialog::backdrop {
  background: rgba(17, 36, 26, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.save-dialog {
  max-width: 440px;
}

.save-order-form,
.order-sheet {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 40px 90px -22px rgba(12, 28, 19, 0.55);
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex: none;
  gap: 12px;
  padding: 20px 21px 13px;
  border-bottom: 1px solid #f1ede4;
}

.sheet-head .eyebrow {
  margin-bottom: 4px;
}

.sheet-head h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 22px;
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.22;
}

.sheet-close {
  flex: none;
  background: #f3f0e8;
}

.save-order-scroll,
.order-detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.save-order-scroll {
  padding: 15px 21px 4px;
}

.order-detail-scroll {
  padding: 16px 21px 22px;
}

.sheet-actions {
  display: flex;
  flex: none;
  gap: 9px;
  padding: 13px 21px calc(15px + env(safe-area-inset-bottom));
  border-top: 1px solid #f1ede4;
  background: #fff;
}

.sheet-actions .btn {
  flex: 1;
  padding-inline: 12px;
  font-size: 13.5px;
}

.sheet-actions .btn-primary {
  flex: 1.35;
}

.save-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  padding: 14px 16px;
  border-radius: 17px;
  background:
    radial-gradient(130% 160% at 100% -20%, rgba(217, 239, 140, 0.16), transparent 55%),
    linear-gradient(135deg, #1a4535 0%, #123126 82%);
  color: #fff;
}

.save-summary > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.save-summary span {
  color: #b4c8bc;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.save-summary strong {
  color: var(--lime);
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 1.1;
  white-space: nowrap;
}

.save-summary .save-summary-meta {
  max-width: 54%;
  color: #d5e1da;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.35;
  text-align: right;
  text-transform: none;
}

.save-breakdown {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 5px 12px;
  padding: 0 4px 12px;
  color: #7b857c;
  font-size: 10.8px;
}

.save-breakdown b {
  margin-left: 3px;
  color: var(--ink);
  font-weight: 670;
}

.save-note {
  margin: 2px 0 10px;
  color: #8d958d;
  font-size: 10.8px;
  line-height: 1.45;
}

.order-detail-address {
  margin: 0 0 14px;
  overflow-wrap: anywhere;
  color: #5d6a60;
  font-size: 13px;
  line-height: 1.45;
}

.order-contact-card {
  display: grid;
  gap: 8px;
  padding: 13px 14px;
  border-radius: 16px;
  background: var(--surface-soft);
}

.contact-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.4;
}

.contact-label {
  flex: none;
  color: #818b82;
  font-size: 11.5px;
}

.contact-value {
  overflow-wrap: anywhere;
  font-weight: 620;
  text-align: right;
}

.contact-row a {
  overflow-wrap: anywhere;
  color: var(--accent);
  font-weight: 660;
  text-align: right;
  text-decoration: none;
}

.order-detail-group {
  margin-top: 18px;
}

.order-detail-group-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 2px;
}

.order-detail-group-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 740;
  letter-spacing: -0.01em;
}

.order-detail-group-head span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 19px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 700;
}

.order-items {
  margin: 0;
  padding: 0;
  border-top: 1px solid #f0ece3;
  list-style: none;
}

.order-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #f0ece3;
}

.order-item-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.order-item-name {
  overflow-wrap: anywhere;
  font-size: 12.8px;
  font-weight: 610;
  line-height: 1.3;
}

.order-item-meta {
  color: #899289;
  font-size: 10.4px;
  font-variant-numeric: tabular-nums;
}

.order-item-total {
  flex: none;
  font-size: 12.8px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.order-totals {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding: 14px;
  border-radius: 17px;
  background: var(--surface-soft);
}

.order-total-final {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-top: 2px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 650;
}

.order-total-final strong {
  color: var(--accent);
  font-size: 21px;
  font-variant-numeric: tabular-nums;
  font-weight: 780;
  letter-spacing: -0.04em;
}

.order-detail-actions .btn-primary {
  flex: 1;
}

.btn-danger-soft {
  flex: 0 0 auto;
  background: var(--danger-soft);
  color: #a23930;
  padding-inline: 15px;
}

.btn-danger-soft:hover {
  background: #f7ddd9;
}

/* Informational cards */

.install-card,
.info-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 14px var(--gutter) 0;
  padding: 15px;
  border: 1px solid #dce6db;
  border-radius: 18px;
  background: #eef4ec;
}

.install-card {
  display: grid;
  grid-template-columns: auto 1fr;
}

.install-card .btn {
  grid-column: 2;
  justify-self: start;
  margin-top: 2px;
}

.info-card {
  margin-bottom: 8px;
  border-color: #eadfd1;
  background: #f8f1e7;
}

.info-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent);
  box-shadow: 0 6px 14px -12px rgba(23, 61, 46, 0.55);
}

.info-icon svg {
  width: 21px;
  height: 21px;
}

.install-copy h3,
.info-card h3 {
  margin: 1px 0 4px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.install-copy p,
.info-card p {
  margin: 0;
  color: #68746a;
  font-size: 12.1px;
  line-height: 1.45;
}

/* Sticky total and navigation */

.bottom-dock {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  pointer-events: none;
  transform: translateX(-50%);
}

.total-bar,
.tabbar {
  pointer-events: auto;
}

.total-bar {
  position: relative;
  display: grid;
  gap: 9px;
  margin: 0 12px 9px;
  padding: 10px 11px 11px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 22px;
  background:
    radial-gradient(120% 180% at 96% -20%, rgba(217, 239, 140, 0.18) 0%, transparent 52%),
    linear-gradient(135deg, #1a4535 0%, #123126 82%);
  color: #fff;
  box-shadow: 0 22px 48px -24px rgba(10, 30, 20, 0.8);
}

.total-line {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 4px 0 6px;
}

.total-copy {
  flex: 1;
  min-width: 0;
}

.total-label {
  display: block;
  color: #aac0b3;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.total-meta {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: #d2dfd7;
  font-size: 11.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.total-value {
  flex: none;
  color: #e5f5a3;
  font-size: clamp(23px, 6.7vw, 30px);
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.045em;
  line-height: 1.1;
  white-space: nowrap;
}

.total-value.is-long {
  font-size: clamp(18px, 5.2vw, 23px);
  letter-spacing: -0.055em;
}

.total-clear {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: #d7e4db;
  transition:
    background 0.14s ease,
    opacity 0.14s ease,
    transform 0.12s ease;
}

.total-clear:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.13);
}

.total-clear:active:not(:disabled) {
  transform: scale(0.93);
}

.total-clear:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.total-clear:disabled {
  opacity: 0.3;
}

.total-clear svg {
  width: 19px;
  height: 19px;
}

.total-save {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 43px;
  border: 0;
  border-radius: 13px;
  background: var(--lime);
  color: #173d2e;
  font-size: 13.5px;
  font-weight: 760;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 18px -16px rgba(0, 0, 0, 0.7);
  transition:
    background 0.16s ease,
    opacity 0.16s ease,
    transform 0.12s ease;
}

.total-save:hover:not(:disabled) {
  background: #e4f7a2;
}

.total-save:active:not(:disabled) {
  transform: scale(0.995);
}

.total-save:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.total-save:disabled {
  cursor: default;
  opacity: 0.38;
}

.total-save svg {
  width: 18px;
  height: 18px;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(23, 39, 30, 0.08);
  background: rgba(247, 244, 237, 0.92);
  box-shadow: 0 -12px 30px -28px rgba(23, 39, 30, 0.7);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 56px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: #7c857d;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    color 0.16s ease,
    background 0.16s ease;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.5);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.tab.is-active {
  color: var(--accent);
  font-weight: 700;
}

.tab-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 26px;
  border-radius: 9px;
  transition:
    background 0.16s ease,
    transform 0.16s ease;
}

.tab.is-active .tab-icon {
  background: var(--accent-soft);
}

.tab:active .tab-icon {
  transform: scale(0.94);
}

.tab-icon svg {
  width: 21px;
  height: 21px;
}

/* Confirmation dialog and toast */

.confirm-dialog {
  width: min(calc(100vw - 36px), 380px);
  margin: auto;
  padding: 23px;
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 40px 90px -22px rgba(12, 28, 19, 0.5);
}

.confirm-dialog[open] {
  animation: dialog-in 0.18s ease both;
}

.confirm-dialog::backdrop {
  background: rgba(17, 36, 26, 0.46);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dialog-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--danger-soft);
  color: var(--danger);
}

.dialog-icon svg {
  width: 24px;
  height: 24px;
}

.confirm-dialog h2 {
  margin: 0 0 7px;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.confirm-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  gap: 9px;
  margin-top: 21px;
}

.dialog-actions .btn {
  flex: 1;
}

.toast {
  position: fixed;
  bottom: calc(98px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 60;
  max-width: calc(100vw - 40px);
  padding: 11px 17px;
  border-radius: 13px;
  background: #172b21;
  color: #fff;
  font-size: 12.8px;
  font-weight: 550;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 18px 36px -22px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

body.with-total .toast {
  bottom: calc(228px + env(safe-area-inset-bottom));
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Motion */

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Responsive refinements */

@media (max-width: 359px) {
  :root {
    --gutter: 15px;
  }

  .brand-tagline {
    display: none;
  }

  h1 {
    font-size: 29px;
  }

  .lede {
    font-size: 13.5px;
  }

  .qty-panel {
    padding-left: 16px;
  }

  .qty-label {
    display: none;
  }

  .qty-input {
    width: 37px;
  }

  .step-btn {
    width: 31px;
  }

  .total-line {
    gap: 8px;
    padding-left: 3px;
  }

  .total-value {
    font-size: 22px;
  }

  .total-save {
    height: 41px;
    font-size: 13px;
  }

  .tab {
    font-size: 9.5px;
  }

  .settings-item {
    padding-left: 13px;
  }

  .save-summary strong {
    font-size: 23px;
  }

  .save-summary .save-summary-meta {
    font-size: 9.8px;
  }

  .sheet-head,
  .sheet-actions {
    padding-left: 16px;
    padding-right: 16px;
  }

  .save-order-scroll,
  .order-detail-scroll {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (min-width: 640px) {
  body {
    padding: 0 18px;
  }

  .app {
    box-shadow:
      0 40px 90px -50px rgba(20, 50, 34, 0.55),
      0 0 0 1px rgba(23, 39, 30, 0.04);
  }

  .bottom-dock {
    bottom: 14px;
  }

  .tabbar {
    margin: 0 12px;
    padding-bottom: 7px;
    border: 1px solid rgba(23, 39, 30, 0.08);
    border-radius: 19px;
    box-shadow: 0 -12px 36px -30px rgba(23, 39, 30, 0.7);
  }

  .total-bar {
    margin-bottom: 8px;
  }

  body.with-total .view-calc {
    padding-bottom: 274px;
  }

  .view-orders,
  .view-settings {
    padding-bottom: 120px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
