:root {
  --navy: #163C6E;
  --navy-dark: #0E2A50;
  --ground: #F4F6F9;
  --card: #FFFFFF;
  --line: #E1E5EB;
  --line-soft: #EEF0F3;
  --text: #1B2430;
  --muted: #4A5563;
  --quiet: #5B6573;
  --sel: #E3ECF9;
  --warn: #D9480F;
  --warn-bg: #FFF0E6;
  --bad: #C92A2A;
  --bad-bg: #FFE3E3;
  --good: #2B8A3E;
  --good-bg: #EBFBEE;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--text); font-family: Heebo, Arial, sans-serif; font-size: 14px; }
button, input, select { font-family: inherit; font-size: inherit; }
a { color: var(--navy); }
[hidden] { display: none !important; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; padding: 10px 24px; min-height: 60px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-name { font-size: 20px; font-weight: 700; }
.brand-sub { font-size: 12px; color: #C9D6EA; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
.nav a { color: #DCE5F2; text-decoration: none; padding: 8px 14px; border-radius: 6px; }
.nav a.active { color: #fff; font-weight: 600; background: rgba(255,255,255,.16); }
.user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #DCE5F2; }
.phase-badge { background: rgba(255,255,255,.14); padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; }

.btn-primary { background: var(--navy); color: #fff; border: 0; border-radius: 6px; padding: 9px 16px; font-weight: 600; cursor: pointer; }
.btn-primary:disabled { background: #C9D1DC; cursor: not-allowed; }
.btn { background: #fff; color: var(--text); border: 1px solid #D5DAE1; border-radius: 6px; padding: 7px 14px; cursor: pointer; }

.login { max-width: 420px; margin: 80px auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 32px; text-align: center; }
.login h1 { margin: 0 0 8px; color: var(--navy); }
.error { color: var(--bad); min-height: 1.4em; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.toolbar h1 { margin: 0; font-size: 18px; }
.toolbar .spacer { flex: 1 1 auto; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.toolbar select { height: 32px; border: 1px solid #D5DAE1; border-radius: 6px; padding: 0 8px; background: #fff; }
.meta { font-size: 13px; color: var(--quiet); }
.tabs { display: flex; gap: 4px; padding: 3px; background: #EEF1F5; border-radius: 8px; }
.tabs button { border: 0; background: transparent; border-radius: 6px; padding: 6px 14px; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: #fff; color: var(--navy); font-weight: 600; box-shadow: 0 1px 2px rgba(20,30,50,.12); }

.layout { display: flex; flex-wrap: wrap; gap: 16px; padding: 16px 24px 24px; align-items: flex-start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.grow { flex: 999 1 720px; min-width: 0; }
.side { flex: 1 1 300px; max-width: 360px; padding: 18px; }
.scroll { overflow: auto; max-height: calc(100vh - 190px); }

table.data { border-collapse: collapse; width: 100%; }
table.data th, table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: right; }
table.data thead th { background: #F7F9FC; color: var(--muted); font-size: 12px; font-weight: 600; position: sticky; top: 0; z-index: 1; }

/* order grid */
table.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft); }
table.grid thead th { position: sticky; z-index: 2; background: #fff; }
table.grid thead tr.countries th { top: 0; height: 28px; font-size: 12px; font-weight: 700; text-align: center; }
table.grid thead tr.products th { top: 28px; width: 50px; min-width: 50px; max-width: 50px; font-size: 10.5px; font-weight: 500; line-height: 1.15; padding: 4px 2px; vertical-align: bottom; color: #2E3A4A; }
table.grid .name { position: sticky; right: 0; z-index: 1; background: #fff; text-align: right; padding: 0 12px; white-space: nowrap; font-weight: 600; min-width: 120px; border-left: 1px solid var(--line); }
table.grid thead .name { z-index: 3; }
table.grid tr.stock th, table.grid tr.stock td { background: #F7F9FC; color: var(--navy); font-weight: 600; font-size: 12px; text-align: center; height: 28px; }
table.grid tr.stock th { text-align: right; }
table.grid tr.left td.neg { background: var(--bad-bg); color: var(--bad); }
table.grid tr.left td.pos { color: var(--good); }
table.grid tr.left th, table.grid tr.left td { border-bottom: 2px solid #C9D1DC; }
table.grid tr.total th, table.grid tr.total td { background: #F7F9FC; font-weight: 700; text-align: center; height: 30px; border-top: 2px solid #C9D1DC; }
table.grid tr.total th { text-align: right; }
table.grid tr.lin th, table.grid tr.lin td, table.grid tr.lin td button { background: #F3F4F6; }
table.grid td.cell { padding: 0; }
table.grid td.cell button { position: relative; display: block; width: 50px; height: 30px; border: 0; margin: 0; padding: 0; background: #fff; cursor: pointer; font-weight: 600; color: var(--text); }
table.grid td.cell button:empty { cursor: default; }
table.grid td.cell button.sel { outline: 2px solid var(--navy); outline-offset: -2px; background: var(--sel); }
table.grid td.cell button .dot { position: absolute; top: 3px; left: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-left: 6px; }

.side h2 { margin: 0; font-size: 18px; }
.side .sub { color: var(--quiet); font-size: 13px; margin-top: 2px; }
.side dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0 0; font-size: 13px; }
.side dt { color: var(--quiet); }
.side dd { margin: 0; font-weight: 600; }
.line-card { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.alert { background: var(--warn-bg); border: 1px solid #F5B58C; color: #7A2E0B; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-top: 12px; }
.ok { background: var(--good-bg); border: 1px solid #B2F2BB; color: #1E6B30; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #F1F3F5; color: #495057; }
.badge.billed { background: #DBE4FF; color: #23398A; }
.badge.future { background: #FFF3BF; color: #7A5200; }
.badge.broadcast { background: var(--good-bg); color: var(--good); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 8px; border: 1px solid rgba(0,0,0,.15); vertical-align: middle; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; padding: 16px 24px 24px; }
.cards .card { padding: 16px; }
.cards h2 { margin: 0 0 4px; font-size: 16px; }
.empty { padding: 40px; text-align: center; color: var(--quiet); }
.progress { margin-top: 12px; font-size: 13px; color: var(--muted); white-space: pre-line; }
.import-box { max-width: 760px; margin: 24px auto; padding: 24px; }
.import-box ol { line-height: 1.8; }

/* שת"פ */
.shtp-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)); gap: 16px; padding: 16px 24px 24px; }
.shtp-wrap .card { padding: 0 0 8px; overflow-x: auto; }
.shtp-h { margin: 0; padding: 12px 14px; font-size: 15px; background: #F7F9FC; border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; }
table.shtp { margin-bottom: 14px; }
table.shtp th, table.shtp td { padding: 6px 10px; font-size: 13px; }
table.shtp thead th { background: var(--head, #F7F9FC); color: var(--text); }
table.shtp thead th:first-child { font-weight: 700; font-size: 13px; }
table.shtp tr.sum td { font-weight: 700; background: #F7F9FC; border-top: 2px solid #C9D1DC; }
table.shtp.idle td { color: #9AA3AF; }
