body { background: var(--surface); }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* Sign in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--blue); }
.signin-box { width: min(420px, 100%); padding: 32px; background: var(--white); border-radius: 8px; border-top: 6px solid var(--green); }
.signin-box h1 { font-size: 1.5rem; margin-block: 14px 8px; }
.signin-box p { color: var(--muted); margin-bottom: 18px; }
.signin-box .btn { width: 100%; }
.signin-box .notice { margin-top: 14px; margin-bottom: 0; color: var(--ink); }

/* Top bar */
.top { background: var(--ink); color: var(--white); }
.top::after { content: ''; display: block; height: 4px; background: linear-gradient(90deg, var(--green) 0 50%, var(--blue) 50% 85%, var(--red) 85%); }
.top-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; min-height: 60px; padding-block: 6px; }
.brand { display: flex; align-items: center; gap: 2px; font-weight: 800; font-stretch: 110%; white-space: nowrap; }
.brand .logo-mark rect:nth-child(2) { fill: #5b8fe6; }
.brand .logo-mark rect:nth-child(1) { fill: #00a06f; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.tabs a { display: flex; align-items: center; gap: 6px; padding: 8px 12px; color: #cdd8e8; text-decoration: none; font-weight: 600; border-radius: 4px; }
.tabs a:hover { color: var(--white); background: #ffffff1a; }
.tabs a[aria-current="page"] { color: var(--white); background: #ffffff26; }
.badge { display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding-inline: 5px; border-radius: 11px; background: var(--red); color: var(--white); font-size: .78rem; font-weight: 700; }
.top-end { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: .9rem; }
.top-end a, .top-end button { color: #cdd8e8; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.top :focus-visible { outline-color: var(--white); }

/* Page */
.page { padding-block: 26px 70px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 1.7rem; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.panel + .panel { margin-top: 18px; }
.panel h2 { font-size: 1.12rem; margin-bottom: 14px; letter-spacing: 0; }
.muted { color: var(--muted); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.search { max-width: 320px; margin-bottom: 14px; }
.empty-note { padding: 34px; text-align: center; color: var(--muted); }

/* Stock table */
.table-wrap { background: var(--white); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.stock { width: 100%; border-collapse: collapse; }
.stock th { padding: 10px 12px; text-align: left; font-size: .82rem; color: var(--muted); font-weight: 600; background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stock td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.stock tr:last-child td { border-bottom: 0; }
.thumb { display: grid; place-items: center; width: 60px; height: 46px; background: var(--surface); border-radius: 4px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .sil { width: 86%; }
.pname { font-weight: 650; color: var(--ink); text-decoration: none; display: block; }
.pname:hover { text-decoration: underline; }
.psub { font-size: .84rem; color: var(--muted); }
.stock input[type="text"], .stock input[type="number"] { min-height: 36px; padding: 5px 8px; width: 84px; font-variant-numeric: tabular-nums; }
.stock input.qty { width: 68px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: .8rem; font-weight: 650; white-space: nowrap; background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.pill.go { background: #e2f3ec; color: var(--green-dark); border-color: #b5dfcd; }
.pill.info { background: #e4ecf9; color: var(--blue-dark); border-color: #bcd0f0; }
.pill.stop { background: #fbe6e7; color: var(--red-dark); border-color: #f2bcc0; }
button.pill { cursor: pointer; font-family: inherit; }
.low { color: var(--red-dark); font-weight: 650; font-size: .8rem; }

/* Editor */
.editor { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.editor .col { display: grid; gap: 18px; min-width: 0; }
.editor .panel + .panel { margin-top: 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fields .full { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--green); flex: none; }
.check small { display: block; color: var(--muted); font-weight: 400; }
.stack { display: grid; gap: 12px; }
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-top: 18px; padding: 12px 16px; background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 -6px 18px #0a1f4414; }
.err { color: var(--red-dark); font-weight: 600; }

/* Photos */
.drop { display: grid; place-items: center; gap: 4px; padding: 22px 14px; text-align: center; border: 2px dashed #aab6c2; border-radius: 8px; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--blue); background: #eef3fb; }
.drop:focus-within { outline: 3px solid var(--blue); outline-offset: 2px; }
.drop strong { color: var(--blue); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; margin-top: 14px; }
.photo { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; cursor: grab; }
.photo.dragging { opacity: .4; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.photo .main-tag { position: absolute; top: 5px; left: 5px; padding: 1px 7px; background: var(--green); color: var(--white); font-size: .72rem; font-weight: 700; border-radius: 3px; }
.photo-tools { display: flex; justify-content: space-between; background: var(--white); border-top: 1px solid var(--line); }
.photo-tools button { flex: 1; min-height: 34px; background: none; border: 0; cursor: pointer; font-size: .95rem; }
.photo-tools button:hover:not([disabled]) { background: var(--surface); }
.photo-tools button[disabled] { opacity: .3; cursor: default; }
.photo-tools .rm { color: var(--red-dark); }
.upload-row { margin-top: 10px; font-size: .9rem; color: var(--muted); }
progress { width: 100%; height: 6px; accent-color: var(--green); }

/* Offers */
.offer-preview { padding: 9px 12px; background: var(--surface); border-radius: 6px; font-weight: 600; }
.offer-preview del { color: var(--muted); font-weight: 400; margin-right: 6px; }
.offer-preview b { color: var(--red-dark); }
.radio-row { display: flex; flex-wrap: wrap; gap: 16px; }
.radio-row label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.radio-row input { accent-color: var(--blue); width: 17px; height: 17px; }

/* Orders */
.order-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 4px 16px; align-items: center; padding: 13px 16px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.order-row:last-child { border-bottom: 0; }
.order-row:hover { background: #fafbfc; }
.order-ref { font-weight: 700; font-variant-numeric: tabular-nums; }
.order-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.order-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.order-grid .panel + .panel { margin-top: 0; }
.item { display: flex; justify-content: space-between; gap: 14px; padding-block: 9px; border-bottom: 1px solid var(--line); }
.item b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.item-warn { margin-top: 2px; font-size: .86rem; color: var(--red-dark); font-weight: 600; }
.item-total { display: flex; justify-content: space-between; padding-top: 10px; font-weight: 750; font-size: 1.1rem; }
.address { white-space: pre-line; overflow-wrap: anywhere; }
.flow { display: grid; gap: 9px; }
.flow .btn { width: 100%; }

/* Toast and dialog */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50; max-width: calc(100vw - 32px); padding: 10px 16px; background: var(--ink); color: var(--white); border-radius: 6px; font-weight: 600; box-shadow: 0 8px 24px #0a1f4440; }
.toast.bad { background: var(--red-dark); }
.ask { max-width: min(440px, calc(100vw - 32px)); border: 0; border-radius: 8px; padding: 22px; color: var(--ink); }
.ask::backdrop { background: #0a1f4480; }
.ask .row { justify-content: flex-end; margin-top: 18px; }

@media (max-width: 900px) {
  .editor, .order-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .tabs { order: 3; width: 100%; }
  /* The stock table becomes a list of cards. */
  .stock thead { display: none; }
  .stock, .stock tbody, .stock tr { display: block; }
  .stock tr { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 8px 12px; padding: 12px; border-bottom: 1px solid var(--line); }
  .stock tr:last-child { border-bottom: 0; }
  .stock td { display: block; padding: 0; border: 0; }
  .stock td.num { grid-column: span 2; display: flex; align-items: center; justify-content: space-between; }
  .stock td.num::before { content: attr(data-label); font-size: .88rem; color: var(--muted); }
  .stock td.end { grid-column: span 2; display: flex; gap: 8px; justify-content: space-between; align-items: center; }
  .fields { grid-template-columns: 1fr; }
  .order-row { grid-template-columns: minmax(0, 1fr) auto; }
}
