/* The store owner's admin. A place for daily work, so it stays calm and quick. */

:root {
  --ground: #f3f2ef;
  --surface: #fff;
  --ink: #17160f;
  --muted: #6d6a62;
  --line: #e2e0da;
  --strong: #17160f;
  --good: #14795c;
  --warn: #9a6b00;
  --bad: #b3261e;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { background: var(--ground); color: var(--ink); font: 400 15px/1.5 'Schibsted Grotesk', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img { display: block; }
:focus-visible { outline: 2px solid var(--strong); outline-offset: 2px; }

.screen { min-height: 100%; }

/* Layout */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 22px 14px 16px; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; text-decoration: none; }
.brand i { width: 7px; height: 20px; background: var(--strong); border-radius: 1px; }
.store-name { margin: 18px 10px 14px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: none; border: 0; border-radius: 7px; text-align: left; color: var(--muted); font-weight: 500; cursor: pointer; transition: background-color 140ms ease, color 140ms ease; }
.nav button:hover { color: var(--ink); background: rgb(23 22 15 / 0.05); }
.nav button[aria-current='page'] { color: var(--ink); background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.count { min-width: 20px; padding: 0 6px; background: var(--strong); color: #fff; border-radius: 99px; font-size: 12px; font-weight: 600; text-align: center; }
.side__foot { display: flex; flex-direction: column; gap: 2px; margin-top: auto; padding: 0 10px; font-size: 14px; }
.side__foot a, .side__foot button { padding: 4px 0; background: none; border: 0; color: var(--muted); text-align: left; text-decoration: none; cursor: pointer; }
.side__foot a:hover, .side__foot button:hover { color: var(--ink); }
.main { min-width: 0; padding: 30px clamp(18px, 3.4vw, 44px) 70px; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 20px; }
.head h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.note { color: var(--muted); }

/* Parts */
.button { display: inline-block; padding: 9px 15px; background: var(--strong); color: #fff; border: 0; border-radius: 8px; font-weight: 600; text-decoration: none; cursor: pointer; transition: transform 140ms var(--ease), opacity 140ms ease; }
.button:active { transform: scale(0.98); }
.button:disabled { opacity: 0.5; cursor: default; }
.quiet { display: inline-block; padding: 8px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-weight: 500; text-decoration: none; cursor: pointer; transition: border-color 140ms ease; }
.quiet:hover { border-color: #bdbab1; }
.danger { background: none; border: 0; padding: 8px 0; color: var(--bad); font-weight: 500; cursor: pointer; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { padding: 16px 18px; }
.stat b { display: block; margin-top: 4px; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.stat span { color: var(--muted); font-size: 14px; }
.subhead { margin: 0 0 10px; font-size: 16px; font-weight: 600; }

.rows { overflow: hidden; }
.row { display: grid; grid-template-columns: 74px minmax(0, 1.3fr) minmax(0, 1.2fr) 96px 110px; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; cursor: pointer; transition: background-color 120ms ease; }
.row:first-child { border-top: 0; }
.row:hover { background: rgb(23 22 15 / 0.025); }
.row__code { font-weight: 600; }
.row__who { font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row__what { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row__total { font-weight: 600; text-align: right; }
.row small { display: block; color: var(--muted); font-size: 13px; }
.status { justify-self: end; padding: 2px 9px; border-radius: 99px; font-size: 13px; font-weight: 600; background: #f0efea; }
.status--New { background: #17160f; color: #fff; }
.status--Confirmed { background: #fdf0d2; color: var(--warn); }
.status--Delivered { background: #dcf1e9; color: var(--good); }
.status--Cancelled { color: var(--muted); text-decoration: line-through; }

.empty { padding: 44px 24px; text-align: center; color: var(--muted); }
.empty b { display: block; margin-bottom: 4px; color: var(--ink); font-weight: 600; }

/* One order */
.order { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.order__box { padding: 18px; }
.line { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); }
.line:first-of-type { border-top: 0; }
.line small { display: block; color: var(--muted); }
.line--total { font-weight: 600; font-size: 17px; border-top: 2px solid var(--strong); }
.facts { display: grid; gap: 12px; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.back { display: inline-block; margin-bottom: 12px; padding: 0; background: none; border: 0; color: var(--muted); cursor: pointer; }
.back:hover { color: var(--ink); }

/* Products */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.product { display: block; width: 100%; padding: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-align: left; cursor: pointer; transition: border-color 140ms ease, transform 200ms var(--ease); }
@media (hover: hover) { .product:hover { border-color: #bdbab1; transform: translateY(-2px); } }
.product__pic { position: relative; display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; background: #f3f2ef; color: var(--muted); font-size: 30px; font-weight: 600; }
.product__pic img { position: absolute; inset: 7%; width: 86%; height: 86%; object-fit: contain; }
.product__text { display: block; padding: 10px 12px 12px; }
.product__name { display: block; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.product__price { color: var(--muted); }
.flag { float: right; color: var(--bad); font-size: 13px; font-weight: 600; }

.form { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; padding: 20px; align-items: start; }
.form__pic { width: 100%; padding: 0; overflow: hidden; background: #f3f2ef; border: 1px dashed #c3c0b7; border-radius: 10px; cursor: pointer; }
.form__pic .product__pic { background: none; font-size: 14px; }
.form__hint { margin-top: 6px; color: var(--muted); font-size: 13px; text-align: center; }
.fields { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 5px; font-weight: 500; }
.field small { color: var(--muted); font-weight: 400; }
.field input, .field textarea, .field select { width: 100%; padding: 9px 11px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-weight: 400; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 0; border-color: var(--strong); }
.error { color: var(--bad); font-weight: 500; }
.error:empty { display: none; }

.table-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 120px minmax(0, 1fr) 34px; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.table-row:first-child { border-top: 0; }
.table-row input { width: 100%; padding: 7px 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.icon { padding: 4px; background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.icon:hover { color: var(--bad); }

/* Signing in */
.gate { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.gate__box { display: grid; gap: 14px; width: min(100%, 380px); padding: 26px; }
.gate h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 20; padding: 10px 16px; background: var(--strong); color: #fff; border-radius: 8px; font-weight: 500; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity 180ms ease, transform 260ms var(--ease); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; padding: 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .store-name { margin: 8px 10px 10px; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav button { flex: none; gap: 6px; }
  .side__foot { flex-direction: row; gap: 14px; margin-top: 8px; }
  .row { grid-template-columns: 58px minmax(0, 1fr) auto; }
  .row__what { display: none; }
  .row .status { grid-column: 2 / -1; grid-row: 2; justify-self: start; }
  .order, .form { grid-template-columns: minmax(0, 1fr); }
  .form__pic { max-width: 240px; }
  .table-row { grid-template-columns: minmax(0, 1fr) 90px 34px; }
  .table-row .optional { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.messages { display: grid; gap: 12px; }
.message { padding: 16px; }
.message.is-new { border-color: var(--ink); }
.message__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.message__head small { color: var(--muted); font-size: 13px; margin-left: auto; }
.message__body { margin: 8px 0 0; white-space: pre-line; max-width: 70ch; }
.store-choice { margin-bottom: 14px; }
.extra-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.extra-photo { position: relative; width: 62px; height: 62px; }
.extra-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.extra-photo button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; padding: 0; background: #fff; color: #17160f; border: 0; border-radius: 50%; line-height: 1; cursor: pointer; }
.extra-add { width: 100%; min-height: 40px; background: none; border: 1px dashed var(--line); border-radius: 6px; font: inherit; font-size: 14px; cursor: pointer; }
