html, body, #root { margin: 0; min-height: 100%; }
body {
    background: var(--ds-page);
    font-family: 'KMR Melange Grotesk', 'Segoe UI', 'Noto Sans Hebrew', Arial, sans-serif;
    color: var(--ds-ink, #251f21);
    font-size: 14px; line-height: 24px;
}
* { box-sizing: border-box; }

.app { max-width: 640px; margin: 0 auto; padding: 4px 0 32px; }
.app-header { padding: 8px 2px 14px; border-bottom: 1px solid var(--ds-hairline, #eae9ea); margin-bottom: 16px; }
.app-title { font-size: 24px; font-weight: 700; }
.app-sub { color: var(--ds-ink-2, #585254); font-size: 13px; margin-top: 2px; }

.panel { display: flex; flex-direction: column; gap: 10px; }
.panel-title { font-size: 17px; font-weight: 700; margin: 4px 0; }
.hint { color: var(--ds-ink-2, #585254); font-size: 12.5px; line-height: 19px; }
.error { color: var(--ds-red, #ed313e); font-weight: 600; }
.empty { color: var(--ds-ink-2, #585254); padding: 12px 0; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-weight: 600; font-size: 13px; }
input, select, textarea {
    width: 100%; padding: 11px 12px; font: inherit; color: inherit;
    border: 1px solid var(--ds-hairline, #d9d6d7); border-radius: 8px; background: #fff;
    min-height: 46px;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ds-teal, #73a89a); outline-offset: -1px; }

button { font: inherit; cursor: pointer; min-height: 46px; border-radius: 8px; border: 1px solid transparent; }
.btn-primary { background: var(--ds-teal, #73a89a); color: #fff; font-weight: 700; padding: 12px 18px; font-size: 15px; }
.btn-primary:disabled { opacity: .5; }
.btn-secondary { background: #fff; border-color: var(--ds-hairline, #d9d6d7); color: var(--ds-ink, #251f21); padding: 11px 16px; }
.btn-danger { background: #fff; border-color: var(--ds-red, #ed313e); color: var(--ds-red, #ed313e); padding: 11px 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row > * { flex: 1 1 auto; }
.btn-mini { min-height: 40px; padding: 6px 12px; background: #fff; border: 1px solid var(--ds-hairline, #d9d6d7); border-radius: 8px; font-size: 13px; }
.btn-mini.is-danger { color: var(--ds-red, #ed313e); border-color: var(--ds-red, #ed313e); }
label.as-file { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }

.row-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; text-align: start; background: #fff;
    border: 1px solid var(--ds-hairline, #eae9ea); border-radius: 12px; padding: 12px 14px;
}
button.row-item:active { background: var(--ds-raised, #f4efec); }
.row-item.is-static { cursor: default; }
.row-item.is-void .row-name, .row-item.is-void .row-amount { text-decoration: line-through; color: var(--ds-ink-4, #c0bebf); }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-name { font-weight: 700; }
.row-sub { color: var(--ds-ink-2, #585254); font-size: 12.5px; }
.row-amount { font-weight: 700; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; }

.total-card {
    display: flex; flex-direction: column; gap: 2px; padding: 16px;
    background: var(--ds-raised, #f4efec); border-radius: 12px;
}
.total-card b { font-size: 26px; color: var(--ds-teal, #73a89a); }
.sum-table { border: 1px solid var(--ds-hairline, #eae9ea); border-radius: 12px; overflow: hidden; }
.sum-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--ds-hairline, #eae9ea); }
.sum-row:last-child { border-bottom: 0; }
.sum-row.is-empty { color: var(--ds-ink-4, #c0bebf); }
.sum-count { color: var(--ds-ink-2, #585254); font-size: 12.5px; }

.app-nav {
    position: sticky; top: 0; z-index: 10;
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: var(--ds-page, #fff); border-bottom: 1px solid var(--ds-hairline, #eae9ea);
    margin: -8px 0 14px;
}
.nav-btn {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    min-height: 60px; padding: 7px 2px 9px; background: none; border: 0; border-radius: 0;
    color: var(--ds-ink-2, #585254); font-size: 11px;
}
.nav-btn.is-active { color: var(--ds-ink, #251f21); font-weight: 700; box-shadow: inset 0 2px 0 var(--ds-teal, #73a89a); }
.nav-icon { font-size: 18px; }

.storage-note { color: var(--ds-ink-2, #585254); font-size: 12px; min-height: 16px; }

/* Receipt paper (screen + print) */
.paper {
    position: relative; background: #fff; border: 1px solid var(--ds-hairline, #eae9ea);
    border-radius: 12px; padding: 22px 20px; margin-top: 8px; max-width: 480px;
}
.paper-biz { font-size: 20px; font-weight: 700; }
.paper-biz-sub { color: var(--ds-ink-2, #585254); font-size: 12.5px; margin: 2px 0 14px; }
.paper-title { font-size: 17px; font-weight: 700; border-top: 1px solid var(--ds-hairline, #eae9ea); padding-top: 12px; }
.paper-date { color: var(--ds-ink-2, #585254); font-size: 13px; margin-bottom: 12px; }
.paper-rows { display: flex; flex-direction: column; gap: 8px; }
.paper-row { display: flex; justify-content: space-between; gap: 14px; }
.paper-row span { color: var(--ds-ink-2, #585254); white-space: nowrap; }
.paper-row b { text-align: left; }
.paper-total {
    display: flex; justify-content: space-between; align-items: baseline;
    border-top: 2px solid var(--ds-ink, #251f21); margin-top: 14px; padding-top: 10px; font-size: 17px;
}
.paper-total b { font-size: 22px; }
.paper-foot { margin-top: 16px; color: var(--ds-ink-2, #585254); font-size: 12px; text-align: center; }
.paper.is-void { opacity: .85; }
.void-stamp {
    position: absolute; inset-inline: 0; top: 42%; text-align: center;
    font-size: 40px; font-weight: 800; color: var(--ds-red, #ed313e); opacity: .55;
    transform: rotate(-12deg); pointer-events: none;
}

#print-root { display: none; }

@media print {
    .screen-only { display: none !important; }
    #print-root { display: block; }
    body { background: #fff; }
    .paper { border: 0; border-radius: 0; max-width: none; margin: 0; padding: 10mm 4mm; }
    @page { size: A5 portrait; margin: 12mm; }
}

@media (min-width: 768px) {
    .app-nav { border: 1px solid var(--ds-hairline, #eae9ea); border-radius: 12px; overflow: hidden; top: 8px; }
    .nav-btn { min-height: 54px; }
}

.confirm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--ds-red, #ed313e); border-radius: 12px; }
.confirm-bar span { flex: 1 1 200px; font-size: 13px; }

.hero-img { width: 160px; border-radius: 16px; display: block; margin: 6px auto; }
.proto-note {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ds-ink-2, #585254);
  background: var(--ds-hairline, #eae9ea);
  border-radius: 8px;
  padding: 4px 10px;
  display: inline-block;
}
.pdf-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; min-height: 46px; text-align: center; }
.pdf-link[aria-disabled="true"] { pointer-events: none; opacity: .5; }
.app, .panel, .paper, .btn-row > * { min-width: 0; }
.paper-row b { overflow-wrap: anywhere; }
