/* Läderach Store Shipping. Brand base is black and white; text is only ever black or white.
   Palette accents (light shades) are used for status backgrounds only. */

@font-face { font-family: "Albra Grotesk"; src: url("../fonts/Albra-Grotesk-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Albra Grotesk"; src: url("../fonts/Albra-Grotesk-Semi.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Albra Sans Laderach"; src: url("../fonts/Albra-Sans-Laderach-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --black: #000;
  --white: #fff;
  --paper: #f7f5f3;
  --line: #dfd9d5;          /* Hazelnut 1 */
  --line-strong: #b9b1ab;
  --muted-bg: #efebe8;
  --warn: #fff395;          /* Lemon 1 */
  --error: #f2c1ba;         /* Strawberry 1 */
  --ok: #cdccac;            /* Pistachio 1 */
  --info: #cadaf8;          /* Blueberry 1 */
  --focus: #5086a8;         /* Blueberry 4, focus ring only */
  --radius: 6px;
  --font: "Albra Grotesk", Arial, Helvetica, sans-serif;
  --font-head: "Albra Sans Laderach", "Albra Grotesk", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--black); font-family: var(--font); font-size: 15px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 500; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
strong, b, .semi { font-weight: 600; }
a { color: var(--black); text-underline-offset: 3px; }
p { margin: 0 0 .8em; }
small, .small { font-size: 13px; }
.muted { opacity: .72; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Header */
.topbar { background: var(--white); border-bottom: 1px solid var(--black); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 14px 20px 0; display: flex; align-items: flex-end; gap: 28px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; text-decoration: none; }
.brand img { height: 18px; width: auto; display: block; }
.brand span { font-size: 14px; padding-left: 14px; border-left: 1px solid var(--line-strong); white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a { text-decoration: none; padding: 10px 16px 12px; border-bottom: 3px solid transparent; font-weight: 600; }
.tabs a[aria-current="page"] { border-bottom-color: var(--black); }
.tabs a:hover { background: var(--muted-bg); }
.account { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; font-size: 14px; }
.account form { margin: 0; }
.mode-banner { background: var(--warn); border-bottom: 1px solid var(--black); }
.mode-banner div { max-width: 1240px; margin: 0 auto; padding: 8px 20px; font-size: 14px; }

main { max-width: 1240px; margin: 0 auto; padding: 28px 20px 64px; }
.narrow { max-width: 460px; margin: 48px auto; }
footer { max-width: 1240px; margin: 0 auto; padding: 0 20px 32px; font-size: 13px; opacity: .7; }

/* Cards and layout */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card + .card { margin-top: 24px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.stack > * + * { margin-top: 20px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.spacer { flex: 1; }
.step { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 20px; }
.step:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.step-title { display: flex; align-items: baseline; gap: 4px 10px; margin-bottom: 12px; flex-wrap: wrap; }
.step-title h3 { white-space: nowrap; }
.step-title .n { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border: 1px solid var(--black); border-radius: 50%; font-size: 13px; font-weight: 600; flex: none; }
.step-title h3 { margin: 0; }
.step-title .hint { font-size: 13px; opacity: .72; }

/* Forms */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.field { margin-bottom: 14px; }
.field small { display: block; margin-top: 4px; opacity: .72; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--black); background: var(--white); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 10px 12px; min-height: 42px;
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
input:focus, select:focus, textarea:focus { border-color: var(--black); outline: none; box-shadow: 0 0 0 1px var(--black); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--black); margin: 0; flex: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; margin: 0; }
.check input { margin-top: 2px; }
.inline-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 40px; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .72; pointer-events: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 14px;
  border-radius: var(--radius); border: 1px solid var(--black); background: var(--white); color: var(--black);
  padding: 9px 16px; min-height: 40px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--muted-bg); }
.btn.primary { background: var(--black); color: var(--white); }
.btn.primary:hover { background: #262626; }
.btn.large { min-height: 48px; padding: 12px 22px; font-size: 15px; }
.btn.small { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn.link { border-color: transparent; background: none; padding-left: 4px; padding-right: 4px; text-decoration: underline; font-weight: 400; }
.btn[disabled], .btn.is-busy { opacity: .55; cursor: progress; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }

/* Messages */
.msg { border: 1px solid var(--black); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; background: var(--info); }
.msg.success { background: var(--ok); }
.msg.warning { background: var(--warn); }
.msg.error { background: var(--error); }
.msg ul { margin: 0; padding-left: 18px; }
.flashes { margin-bottom: 8px; }

/* Destination picker */
.dest-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.dest-tools input[type=search] { flex: 1 1 220px; }
.dest-count { font-weight: 600; font-size: 14px; }
.dest-list { border: 1px solid var(--line-strong); border-radius: var(--radius); max-height: 430px; overflow: auto; background: var(--white); }
.dest-group { border-bottom: 1px solid var(--line); }
.dest-group:last-child { border-bottom: 0; }
.dest-group-head { position: sticky; top: 0; z-index: 1; background: var(--muted-bg); display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; font-weight: 600; font-size: 13px; }
.dest-group-head button { font: inherit; font-weight: 400; background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 0; }
.dest-item { display: flex; gap: 10px; padding: 8px 12px; align-items: flex-start; cursor: pointer; font-weight: 400; margin: 0; }
.dest-item:hover { background: var(--paper); }
.dest-item .addr { display: block; font-size: 12.5px; opacity: .72; }
.dest-item.is-origin { opacity: .45; cursor: not-allowed; }
.dest-item.is-origin .addr::after { content: " · Origin"; }
.origin-addr { font-size: 13px; margin-top: 6px; opacity: .8; }

/* Service options */
.services { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.service { position: relative; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 12px 12px 12px 40px; cursor: pointer; font-weight: 400; margin: 0; background: var(--white); }
.service input { position: absolute; left: 12px; top: 14px; }
.service .name { font-weight: 600; display: block; }
.service .note { font-size: 13px; opacity: .72; display: block; }
.service:has(input:checked) { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }
.service.express:has(input:checked) { background: var(--warn); }
.tag { display: inline-block; font-size: 12px; border: 1px solid var(--black); border-radius: 999px; padding: 0 8px; margin-left: 4px; font-weight: 400; background: var(--white); }

.package-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 24px; max-width: 900px; }
.package-grid .field small#packaging-hint { opacity: .72; }
#packaging-warning { max-width: 900px; margin-top: 4px; }
.pickup-fields { margin-top: 14px; padding: 14px; background: var(--paper); border-radius: var(--radius); border: 1px solid var(--line); }
.submit-bar { position: sticky; bottom: 0; background: var(--white); border-top: 1px solid var(--line); margin: 24px -24px -24px; padding: 16px 24px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; border-radius: 0 0 var(--radius) var(--radius); }
.submit-summary { font-size: 14px; flex: 1 1 260px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; background: var(--muted-bg); white-space: nowrap; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
td .sub { display: block; font-size: 12.5px; opacity: .72; }
.status { display: inline-block; border: 1px solid var(--black); border-radius: 999px; padding: 0 9px; font-size: 12.5px; white-space: nowrap; background: var(--white); }
.status.created, .status.active, .status.scheduled { background: var(--ok); }
.status.failed, .status.disabled { background: var(--error); }
.status.pending { background: var(--warn); }
.status.test { background: var(--warn); }
.empty { padding: 28px; text-align: center; opacity: .72; }

/* Batches list */
.batch { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--white); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.batch + .batch { margin-top: 10px; }
.batch .route { font-weight: 600; }
.batch .meta { font-size: 13px; opacity: .8; }
.batch .dests { font-size: 13.5px; margin-top: 4px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; font-size: 14px; }

/* Admin */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.subnav a { text-decoration: none; border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 14px; background: var(--white); font-size: 14px; }
.subnav a[aria-current="page"] { background: var(--black); color: var(--white); border-color: var(--black); }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.filters .field { margin: 0; }
.summary-line { display: flex; gap: 20px; flex-wrap: wrap; align-items: baseline; margin: 16px 0 10px; }

/* Dialog */
dialog { border: 1px solid var(--black); border-radius: var(--radius); padding: 0; max-width: 460px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog-body { padding: 22px 22px 8px; }
.dialog-head { background: var(--warn); padding: 14px 22px; border-bottom: 1px solid var(--black); font-weight: 600; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 22px 20px; flex-wrap: wrap; }

.auth-card h1 { font-size: 24px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; font-size: 14px; }
.hr { border-top: 1px solid var(--line); margin: 20px 0; }

@media (max-width: 960px) {
  .services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .package-grid { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  main { padding: 20px 16px 48px; }
  .topbar-inner { padding: 12px 16px 0; gap: 10px; }
  .account { width: 100%; justify-content: space-between; padding-bottom: 8px; }
  .card { padding: 18px 16px; }
  .submit-bar { margin: 20px -16px -18px; padding: 14px 16px; }
  .services, .filters, .inline-fields { grid-template-columns: minmax(0, 1fr); }
  .batch { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 24px; }
}
@media print {
  .topbar, .mode-banner, footer, .btn, .subnav { display: none !important; }
}
