/* Mouritz Trade styling (from the Plandroid app), laid out for phones and tablets first. */

/* Montserrat (SIL Open Font License, fonts/OFL.txt), served by the app itself so no page loads anything from another site. */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/montserrat-latin.woff2") format("woff2");
}

:root {
  --orange: #f39200;
  --orange-dark: #d98200;
  --blue: #006583;
  --teal: #006583;
  --teal-dark: #004f66;
  --cyan: #00b1ec;

  --text: #2b2b2b;
  --muted: #6b7280;
  --page: #f3f5f7;
  --card: #ffffff;
  --line: #dde3e8;

  --ok: #1e8e3e;
  --ok-bg: #e6f4ea;
  --bad: #c62828;
  --bad-bg: #fdecea;
  --warn: #8a5300;
  --warn-bg: #fff4e0;

  --font: "Montserrat", "Segoe UI", Arial, sans-serif;
  --radius: 6px;
  --tap: 48px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--page);
}

a { color: var(--blue); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { background: #fff; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { height: 36px; width: auto; display: block; }
.header-title { text-align: right; }
.header-title .kicker { color: var(--blue); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.header-title .title { color: var(--orange); font-weight: 800; font-size: 16px; line-height: 1.15; }

.site-nav { background: var(--orange); }
.site-nav .wrap { display: flex; align-items: stretch; padding: 0; overflow-x: auto; }
.site-nav a, .site-nav button {
  display: flex; align-items: center;
  padding: 0 16px; min-height: var(--tap);
  color: #fff; text-decoration: none; font: inherit; font-size: 15px; font-weight: 600;
  background: none; border: 0; cursor: pointer; white-space: nowrap;
}
@media (max-width: 420px) { .site-nav a, .site-nav button { padding: 0 10px; } }
@media (max-width: 359px) { .site-nav a, .site-nav button { padding: 0 6px; font-size: 14px; } }
.site-nav a.active { background: var(--orange-dark); }
.site-nav .spacer { flex: 1; }
.site-nav form { display: flex; }

.location-bar { background: var(--teal); color: #fff; font-size: 14px; }
.location-bar { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center; padding: 6px 16px; }
.location-bar .test { color: #ffe1a8; font-weight: 600; }
.location-bar .bad { color: #ffd2cc; font-weight: 700; }

main { padding: 16px 0 48px; }

/* Cards and forms */
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 17px; font-weight: 700; text-transform: uppercase; color: var(--teal); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
label, .label { font-weight: 600; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

input[type=text], input[type=password], input[type=search], input[type=number], input:not([type]), select, textarea {
  font: inherit; font-size: 16px; /* 16px stops iOS zooming in */
  color: var(--text); width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 1px solid #c9d1d9; border-radius: 4px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cyan); outline-offset: 0; border-color: var(--cyan); }

.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; text-transform: uppercase; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 10px 20px;
  font: inherit; font-weight: 700; font-size: 16px;
  border-radius: 4px; border: 2px solid var(--orange);
  background: var(--orange); color: #fff; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.btn.secondary { background: #fff; color: var(--teal); border-color: var(--teal); }
.btn.wide { width: 100%; }
.btn[disabled] { background: #c8ccd0; border-color: #c8ccd0; color: #fff; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 8px; }

/* Home tiles */
.tiles { display: grid; gap: 12px; grid-template-columns: 1fr; }
.tile {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 16px; min-height: 92px;
  background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  border-left: 6px solid var(--orange); color: var(--text); text-decoration: none;
}
a.tile:active { background: #fff4e5; }
.tile-title { font-size: 18px; font-weight: 800; color: var(--teal); text-transform: uppercase; }
.tile-text { color: var(--muted); font-size: 14px; }
.tile.soon { border-left-color: #c8ccd0; opacity: .75; }

/* Stock */
.stock-item .stock-code { font-size: 22px; font-weight: 800; color: var(--blue); }
.stock-item .stock-desc { color: var(--muted); margin-bottom: 12px; }
.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.figure { display: flex; flex-direction: column; align-items: center; padding: 12px 6px; border-radius: var(--radius); background: #f3f7f9; }
.figure .value { font-size: 26px; font-weight: 800; color: var(--blue); line-height: 1.1; }
.figure .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.figure.main { background: #fff4e5; }
.figure.main .value { color: var(--orange-dark); }

/* Messages */
.notice { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; border-left: 4px solid; }
.notice.warn { background: var(--warn-bg); border-color: var(--orange); color: var(--warn); }
.notice.bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.notice.ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.notice.info { background: #e8f3f7; border-color: var(--teal); color: var(--teal-dark); }
.notice code { background: rgba(0, 0, 0, .06); padding: 1px 4px; border-radius: 3px; }

/* Login */
.login-card { max-width: 420px; margin: 24px auto; }
.login-logo { display: block; width: 220px; max-width: 70%; height: auto; margin: 0 auto 20px; }

@media (min-width: 640px) {
  .site-header .wrap { min-height: 84px; }
  .brand img { height: 56px; }
  .header-title .title { font-size: 22px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .card { padding: 24px; }
}

/* Page heads and lists */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-head h1 { margin: 0; font-size: 22px; color: var(--teal); text-transform: uppercase; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08); color: var(--text); text-decoration: none; }
.list-main { font-size: 16px; }
.list-sub { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; padding: 1px 8px; margin-right: 6px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--warn-bg); color: var(--warn); vertical-align: middle; }
.badge.kind-damaged, .badge.kind-wrongitem { background: var(--bad-bg); color: var(--bad); }
.email-sent { color: var(--ok); }
.email-failed, .email-notconfigured { color: var(--warn); }
.block { display: block; }

/* Forms */
fieldset.field { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }
.field-row .field.narrow { flex: 0 0 110px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 8px 16px;
  border: 2px solid #c9d1d9; border-radius: 999px; font-weight: 600; cursor: pointer; background: #fff; }
.chip:has(input:checked) { border-color: var(--orange); background: #fff4e5; }
.chip input { accent-color: var(--orange); width: 18px; height: 18px; margin: 0; }
textarea { resize: vertical; }
.field-error { color: var(--bad); font-size: 13px; font-weight: 600; }
button.link { background: none; border: 0; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer; padding: 8px 0; }

/* Photos and signatures */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; display: block; background: #eef0f2; }
.photo { position: relative; }
.photo .remove { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.signature { position: relative; }
.signature canvas { display: block; width: 100%; height: 160px; border: 1px dashed #9aa5b1; border-radius: 4px; background: #fff; touch-action: none; }
.signature .link { position: absolute; top: 4px; right: 10px; }
.signed { margin-top: 12px; }
.signed img { display: block; max-width: 320px; width: 100%; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
dl.details dt { font-weight: 600; color: var(--muted); }
dl.details dd { margin: 0; }
.note { white-space: pre-wrap; background: #f6f8fa; padding: 12px; border-radius: 4px; }

/* Stock list and orders */
.list-head { font-size: 15px; color: var(--muted); margin: 16px 0 8px; }
.qty-ok { color: var(--ok); }
.incoming { margin: 12px 0 4px; font-weight: 600; color: var(--teal-dark); }
.overdue { color: var(--warn); font-weight: 700; }
.badge.done { background: var(--ok-bg); color: var(--ok); }
.list .badge.done { display: table; margin-bottom: 4px; }
.lines { width: 100%; border-collapse: collapse; margin: 8px 0 12px; }
.lines th, .lines td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lines th { font-size: 13px; color: var(--muted); font-weight: 600; }
.lines .qty { text-align: right; white-space: nowrap; font-weight: 700; }
.lines .code { font-weight: 700; white-space: nowrap; }
.lines .desc { color: var(--muted); font-size: 14px; }
.address { white-space: pre-line; }
.review { border: 2px solid var(--orange); }
.review h2 { color: var(--orange-dark); }
.signatures { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.signatures .signed { margin-top: 0; }
.list .list-item { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.lines .qty-input { width: 72px; min-height: 44px; text-align: right; }

/* Charges */
.notice.charges-due { display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.badge.due { background: var(--warn-bg); color: var(--warn); display: table; margin-bottom: 4px; }
.charge-line { margin: 0 0 16px; }
.charge-head { display: flex; justify-content: space-between; gap: 12px; }
.charge-head .money, .totals .qty { white-space: nowrap; }
.charge-items { margin: 4px 0 0; font-size: 14px; }
.charge-items .when { white-space: nowrap; color: var(--muted); width: 1%; }
.totals { margin-top: 0; }
.totals .total td { font-weight: 800; font-size: 17px; border-bottom: 0; }
.confirm-check { display: flex; gap: 12px; align-items: flex-start; padding: 12px; margin: 4px 0 8px; background: var(--warn-bg);
  border-radius: var(--radius); font-weight: 600; cursor: pointer; }
.confirm-check input { width: 24px; height: 24px; flex: 0 0 auto; margin: 0; accent-color: var(--orange); }
