:root {
  --page: #f4efec;
  --ink: #251f21;
  --ink-2: #7a716d;
  --hairline: #e7dfd9;
  --teal: #0e7d6c;
  --teal-soft: #e7f3f1;
  --red: #c2402f;
  --amber: #b36a1f;
}
* { box-sizing: border-box; }
html, body, #root { margin: 0; height: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Hebrew", "Noto Sans", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.app-root { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; position: relative; }

.appbar {
  flex: none; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.appbar-icon { display: inline-flex; color: #9fc9bb; }
.appbar-title { font-weight: 600; font-size: 17px; }
.appbar-sub { margin-inline-start: auto; font-size: 11px; color: #c9c2c4; white-space: nowrap; }

.app-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.page { padding: 14px 12px 110px; display: none; }
.page.is-active { display: block; }

.bottomnav {
  flex: none; z-index: 30;
  display: flex; justify-content: space-around;
  background: #fff; border-top: 1px solid var(--hairline);
  box-shadow: 0 -2px 12px rgba(0,0,0,.07);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}
.bottomnav button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 56px; min-height: 48px; padding: 6px 8px;
  background: none; border: 0; cursor: pointer;
  color: var(--ink-2); font-size: 11px; font-family: inherit;
}
.bottomnav button.is-active { color: var(--teal); font-weight: 600; }
.bottomnav svg { width: 20px; height: 20px; }

.group { margin-bottom: 18px; }
.group-label { font-size: 15px; font-weight: 700; margin: 0 2px 10px; }
.rows { background: #fff; border: 1px solid var(--hairline); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.rows > .row + .row { border-top: 1px solid var(--hairline); }
.row-main { flex: 1; min-width: 0; }
.row-name { display: block; font-weight: 600; font-size: 14px; }
.row-detail { display: block; font-size: 12px; color: var(--ink-2); margin-top: 2px; line-height: 1.5; }
.row-value { font-weight: 700; font-size: 14px; white-space: nowrap; }

.callout { background: #efe8e3; border-radius: 14px; padding: 14px; line-height: 1.6; font-size: 13px; color: var(--ink-2); }
.callout b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--hairline); border-radius: 14px; padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 20px; line-height: 24px; }
.stat span { font-size: 12px; color: var(--ink-2); }

input[type=text], input[type=tel], input[type=number], input[type=date], input[type=password], textarea, select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--hairline); border-radius: 12px;
  font: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
textarea { min-height: 76px; resize: vertical; line-height: 1.6; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--ink-2); margin: 0 2px 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--teal); color: #fff; border: 0; border-radius: 12px; padding: 12px 22px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn:active { transform: scale(0.98); }
.btn-dark { background: var(--ink); }
.btn-ghost { background: #efe8e3; color: var(--ink); font-weight: 500; }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #ecc7c1; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.chips button { border: 1px solid var(--hairline); background: #fff; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.chips button.is-active { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 3px 10px; }
.badge-draft { background: #efe8e3; color: var(--ink-2); }
.badge-sent { background: #e8effa; color: #2b5aa6; }
.badge-approved { background: var(--teal-soft); color: var(--teal); }
.badge-rejected { background: #fae8e6; color: var(--red); }

.fab {
  position: absolute; z-index: 25;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px)); inset-inline-start: 18px;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--teal); color: #fff; border: 0; font-size: 30px; line-height: 1;
  box-shadow: 0 6px 18px rgba(14,125,108,.4); cursor: pointer;
}

.overlay { position: absolute; inset: 0; z-index: 40; background: var(--page); display: flex; flex-direction: column; overflow-y: auto; padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 30px; }
.overlay-head { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; position: sticky; top: 0; background: var(--page); z-index: 2; }
.overlay-title { font-weight: 700; font-size: 16px; flex: 1; }
.overlay-close { background: #efe8e3; border: 0; border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer; }

.item-row { background: #fff; border: 1px solid var(--hairline); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.item-row .ir-top { display: flex; gap: 8px; align-items: center; }
.item-row .ir-desc { flex: 1; min-width: 0; border: 0; padding: 4px 0; font: inherit; font-size: 14px; background: transparent; }
.item-row .ir-nums { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.item-row .ir-nums input { width: 80px; padding: 8px 10px; font-size: 13px; }
.item-row .ir-total { flex: 1; text-align: left; font-weight: 700; font-size: 14px; }
.item-row .ir-del { background: none; border: 0; color: var(--red); font-size: 18px; cursor: pointer; padding: 4px 8px; }

.totals { background: #fff; border: 1px solid var(--hairline); border-radius: 14px; padding: 4px 14px; margin: 12px 0; }
.totals .t-row { display: flex; justify-content: space-between; padding: 9px 0; font-size: 14px; }
.totals .t-row + .t-row { border-top: 1px dashed var(--hairline); }
.totals .t-grand { font-weight: 700; font-size: 16px; color: var(--teal); }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; border: 1px solid var(--hairline); background: #fff; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(37,31,33,.75); color: #fff; font-size: 12px; cursor: pointer; }

.check-line { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 4px 2px; }
.check-line input { width: 20px; height: 20px; accent-color: var(--teal); }

.empty { text-align: center; color: var(--ink-2); padding: 34px 20px; font-size: 13.5px; line-height: 1.7; }
.fp-banner { position: fixed; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); left: 16px; right: 16px; background: #251f21; color: #fff; border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; z-index: 60; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); flex-wrap: wrap; }
.fp-banner-yes { background: #0e7d6c; color: #fff; border: 0; border-radius: 10px; padding: 8px 16px; font-weight: 600; cursor: pointer; font-family: inherit; }
.fp-banner-no { background: transparent; color: #cfc8c4; border: 0; cursor: pointer; font-size: 13px; font-family: inherit; }
.fp-banner input { flex: 1; min-width: 140px; padding: 8px 12px; border: 1px solid #4a4245; border-radius: 10px; background: #fff; font: inherit; }

/* Morning-style quote document */
.doc { background: #fff; border: 1px solid var(--hairline); border-radius: 10px; padding: 22px 20px; font-size: 13px; line-height: 1.6; }
.doc-subject { border-inline-start: 3px solid #43a047; padding-inline-start: 8px; }
.doc-head { display: flex; gap: 14px; margin-bottom: 16px; }
.doc-biz { flex: 1; min-width: 0; }
.doc-logo { font-weight: 800; letter-spacing: 1px; font-size: 13px; color: var(--ink); margin-bottom: 10px; }
.doc-logo span { font-weight: 400; font-size: 10px; letter-spacing: 3px; color: var(--ink-2); }
.doc-biz-lines { font-size: 12px; color: var(--ink); line-height: 1.8; }
.doc-blue { flex: 1.2; min-width: 0; background: #388e3c; color: #fff; border-radius: 8px; padding: 14px; border-top: 4px solid #2e7031; }
.doc-date { font-size: 11px; }
.doc-for { margin-top: 12px; font-size: 12px; line-height: 1.7; }
.doc-title { margin-top: 16px; padding-top: 10px; border-top: 2px solid rgba(255,255,255,.55); font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.doc-subject { font-weight: 700; font-size: 14px; margin: 4px 0 12px; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.doc-table th { text-align: right; font-size: 12px; border-bottom: 2px solid #43a047; padding: 6px 4px; color: #2e7031; }
.doc-table td { padding: 8px 4px; border-bottom: 1px solid var(--hairline); vertical-align: top; font-size: 12.5px; }
.doc-table .c, .doc-table th:first-child, .doc-table th:nth-child(3), .doc-table th:nth-child(4) { text-align: center; white-space: nowrap; }
.doc-totals { margin-bottom: 14px; }
.dt-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--hairline); font-size: 12.5px; }
.dt-grand { border-bottom: 0; font-weight: 700; font-size: 15px; padding-top: 8px; }
.dt-box { background: #388e3c; color: #fff; border-radius: 4px; padding: 6px 12px; }
.doc-remarks { font-size: 12px; color: var(--ink-2); margin: 10px 0 18px; }
.doc-sign { font-size: 12.5px; margin-top: 8px; }
.doc-sign-line { display: inline-block; width: 150px; border-bottom: 1px solid var(--ink-2); }

@media print {
  .appbar, .bottomnav, .fab, .doc-actions, .overlay-close { display: none !important; }
  body { background: #fff; }
  .overlay { position: static; padding: 0; }
  .doc { border: 0; border-radius: 0; padding: 0; }
}
