/* Insert New Order — simple form styles. Layered on top of internal.css. */

/* Lighter app background — swap cream for plain white. */
body { --cream: #FFFFFF; background: var(--cream); }
.app, .topbar, .main { background: var(--cream); }

/* Cool light-grey neutral ramp — replaces the warm cream/beige defaults. */
body {
  --ink-50:  #F4F5F7;
  --ink-100: #E9EBEF;
  --ink-200: #D7DAE0;
  --ink-300: #B8BCC5;
  --ink-500: #6B7280;
  --ink-700: #374151;
  --ink-900: #111827;
}

/* ---------- Palette override: remove orange/rust everywhere ----------
   Map rust → navy so every existing rust usage becomes navy. Use sky for
   accents that need to read against dark surfaces (sidebar, spotlight). */
body {
  --rust: var(--navy);
  --rust-deep: var(--navy-deep);
  --focus-ring: 0 0 0 2px var(--cream), 0 0 0 4px var(--sky);
}
/* Sidebar active item: sky stripe (visible on navy-deep). */
.sb-nav a.active {
  background: rgba(127, 179, 213, 0.14);
  box-shadow: inset 2px 0 0 var(--sky);
}
/* Topbar bell dot — sky pop on white. */
.tb-actions .ico .dot { background: var(--sky); }

/* ---------- Cross-document page transitions ---------- */
/* Chrome/Edge: animates between documents on navigation. Other browsers ignore. */
@view-transition {
  navigation: auto;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
  animation-timing-function: cubic-bezier(.2,.7,.2,1);
}

/* Skeleton — shows the sidebar+topbar chrome before React mounts so there's no
   flash of white. React's createRoot() replaces this on mount. */
.app-skeleton {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 52px 1fr;
  height: 100vh;
  background: var(--cream);
}
.app-skeleton .sk-sidebar {
  grid-row: 1 / span 2;
  background: var(--navy-deep);
}
.app-skeleton .sk-sidebar .sk-logo {
  height: 36px;
  margin: 16px 14px;
  opacity: 0.5;
}
.app-skeleton .sk-topbar {
  background: var(--cream);
  border-bottom: 1px solid var(--ink-200);
}
.app-skeleton .sk-main {
  padding: 20px 24px;
}
.app-skeleton .sk-title {
  width: 180px;
  height: 22px;
  background: var(--ink-100);
  border-radius: 4px;
  margin-bottom: 18px;
}
.app-skeleton .sk-card {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  height: 360px;
  max-width: 1200px;
  margin: 0 auto;
}
@keyframes sk-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.app-skeleton .sk-title,
.app-skeleton .sk-card {
  animation: sk-pulse 1.4s ease-in-out infinite;
}

/* ---------- Dashboard ---------- */
.dash-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  max-width: 1280px;
  margin: 0 auto;
}
.dash-head { margin-bottom: 18px; }
.dash-head h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink-900);
}
.dash-head p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-500);
}
.dash-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 14px;
  min-height: 0;
}
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .dash-grid { grid-template-columns: 1fr; grid-auto-rows: minmax(180px, auto); }
}
.dash-card {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  min-height: 200px;
  position: relative;
  overflow: hidden;
  transition: border-color 140ms, box-shadow 140ms;
}
.dash-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
  transition: background 140ms;
}
.dash-card:hover {
  border-color: var(--navy);
  box-shadow: 0 1px 2px rgba(10,22,61,0.04), 0 4px 12px rgba(10,22,61,0.06);
}
.dash-card:hover::before { background: var(--rust); }

.dash-card .ico-box {
  width: 48px; height: 48px;
  border-radius: 10px;
  background: var(--ink-50);
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  transition: background 140ms, color 140ms;
}
.dash-card:hover .ico-box {
  background: var(--navy);
  color: #fff;
}
.dash-card .ico-box .ic { stroke-width: 1.6; }

.dash-card .title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  line-height: 1.22;
  margin-bottom: 6px;
}
.dash-card .blurb {
  font-size: 12.5px;
  color: var(--ink-500);
  line-height: 1.5;
  flex: 1;
}
.dash-card .foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--ink-200);
  display: flex;
  align-items: center;
}
.dash-card .file {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-500);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-card .cta {
  margin-left: auto;
  color: var(--rust);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  font-size: 12px;
}
.dash-card .cta .ic { transition: transform 140ms; }
.dash-card:hover .cta .ic { transform: translateX(2px); }

/* "Spotlight" variant — for the most common action */
.dash-card.spot {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.dash-card.spot::before { background: var(--sky); }
.dash-card.spot:hover {
  background: var(--navy-deep);
  border-color: var(--navy-deep);
}
.dash-card.spot .ico-box {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.dash-card.spot:hover .ico-box {
  background: var(--sky);
  color: var(--navy);
}
.dash-card.spot .title { color: #fff; }
.dash-card.spot .blurb { color: rgba(255,255,255,0.7); }
.dash-card.spot .foot { border-top-color: rgba(255,255,255,0.15); }
.dash-card.spot .file { color: rgba(255,255,255,0.55); }
.dash-card.spot .cta { color: #fff; }

/* ============================================================ */
/* Cases page                                                    */
/* ============================================================ */

.cases-page {
  max-width: 1400px;
  margin: 0 auto;
}

.cases-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}
.cases-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink-900);
}
.cases-head .sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-500);
}
.cases-head .sub .ct {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink-900);
}

.cases-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: 6px 6px 0 0;
  padding: 10px 14px;
  border-bottom: 0;
}
.cases-toolbar .search {
  position: relative;
  flex: 1 1 280px;
  min-width: 240px;
}
.cases-toolbar .search input {
  width: 100%;
  height: 30px;
  padding: 0 10px 0 30px;
  font: 400 13px var(--font-ui);
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  color: var(--ink-900);
}
.cases-toolbar .search input:focus { outline: none; border-color: var(--navy); background: var(--surface); }
.cases-toolbar .search .ic {
  position: absolute;
  left: 9px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-500);
}
.cases-toolbar .picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-500);
}
.cases-toolbar .picker .sel-wrap {
  width: 78px;
}
.cases-toolbar .picker select.sel {
  height: 28px;
  font-size: 12px;
}
.cases-toolbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* List */
.cases-list {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}
.cases-list .cl-head {
  display: grid;
  grid-template-columns: 60px 1.4fr 130px minmax(210px, 1.9fr) 130px 110px 130px;
  align-items: center;
  background: var(--ink-50);
  color: var(--ink-500);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.06em;
  font-weight: 600;
  min-height: 34px;
  padding: 6px 14px;
  line-height: 1.25;
  border-bottom: 1px solid var(--ink-200);
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
}
/* Compact mode: let header labels wrap cleanly instead of clipping against a
   fixed 34px row (e.g. "OWNER'S REF." on the Stock List). Wide mode relaxes
   this separately further down; this keeps the two consistent. */
.cases-list .cl-head > span,
.cases-list .cl-head .sortable {
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.2;
}
.cases-list .cl-head .sortable {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cases-list .cl-head .sortable:hover { color: var(--ink-900); }
.cases-list .cl-head .sortable.on { color: var(--ink-900); }
.cases-list .cl-head .sortable .arrow { font-size: 9px; }

.cases-list .case-row {
  border-bottom: 1px solid var(--ink-100);
}
.cases-list .case-row:last-child { border-bottom: 0; }

.cases-list .case-row .row-main {
  display: grid;
  grid-template-columns: 60px 1.4fr 130px minmax(210px, 1.9fr) 130px 110px 130px;
  align-items: center;
  padding: 6px 14px;
  min-height: 44px;
  gap: 12px;
  cursor: pointer;
  font-size: 13px;
}
.cases-list .case-row .row-main:hover { background: var(--ink-50); }
.cases-list .case-row.open .row-main { background: var(--sky-light); }

.cases-list .row-main .id {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-900);
  font-weight: 600;
}
.cases-list .row-main .client {
  color: var(--ink-900);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cases-list .row-main .filenum {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-700);
}
.cases-list .row-main .route {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  min-width: 0;
  overflow: visible;
  font-size: 12px;
  color: var(--ink-900);
}
.cases-list .row-main .route .city { font-weight: 500; white-space: nowrap; }
.cases-list .row-main .route .arr { color: var(--ink-400); }
.cases-list .row-main .route .ic { color: var(--ink-500); margin: 0 2px; }
.cases-list .row-main .updated {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--ink-500);
}
.cases-list .row-main .row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}
.cases-list .row-main .more-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 4px;
  border: 1px solid var(--ink-200);
  background: var(--surface);
  color: var(--ink-700);
  font: 500 11px var(--font-ui);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.cases-list .row-main .more-btn:hover { border-color: var(--navy); color: var(--navy); }
.cases-list .case-row.open .more-btn {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.cases-list .row-main .more-btn .chev { transition: transform 140ms; }
.cases-list .case-row.open .more-btn .chev { transform: rotate(180deg); }

.cases-list .row-main .icon-btn {
  width: 26px; height: 26px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.cases-list .row-main .icon-btn:hover {
  background: var(--ink-100);
  color: var(--ink-900);
}
.cases-list .row-main .icon-btn.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Detail expansion */
.cases-list .row-detail {
  display: none;
  padding: 16px 18px 18px 18px;
  background: #FAFCFE;
  border-top: 1px dashed var(--ink-200);
}
.cases-list .case-row.open .row-detail { display: block; animation: rowexp 200ms var(--ease-out); }
@keyframes rowexp {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.row-detail .dl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 24px;
}
.row-detail .dl-grid .it { min-width: 0; }
.row-detail .dl-grid .it .lab {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-500);
  font-weight: 600;
  margin-bottom: 3px;
}
.row-detail .dl-grid .it .val {
  font-size: 13px;
  color: var(--ink-900);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-detail .dl-grid .it.mn .val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.row-detail .dl-grid .it .val.empty { color: var(--ink-300); font-weight: 400; }

/* Edit-mode inputs in the row detail */
.row-detail .row-edit-input {
  width: 100%;
  height: 28px;
  padding: 4px 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-900);
  background: #FFFFFF;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm, 4px);
  outline: none;
  box-sizing: border-box;
  transition: border-color 120ms, box-shadow 120ms;
}
.row-detail .row-edit-input.mn {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.row-detail .row-edit-input:hover { border-color: var(--ink-300); }
.row-detail .row-edit-input:focus {
  border-color: var(--rust);
  box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px var(--rust);
}
.row-detail .row-edit-input::-webkit-calendar-picker-indicator {
  opacity: 0.55;
  cursor: pointer;
}
.case-row.editing .row-main { background: var(--sky-light); }
.case-row.editing .more-btn { opacity: 0.5; cursor: not-allowed; }

.row-detail .dl-actions {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--ink-200);
  display: flex;
  align-items: center;
  gap: 8px;
}
.row-detail .dl-actions .left {
  font-size: 11px;
  color: var(--ink-500);
}
.row-detail .dl-actions .left .pip {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 999px;
  background: var(--success);
  margin-right: 4px;
  vertical-align: middle;
}
.row-detail .dl-actions .right { margin-left: auto; display: flex; gap: 6px; }

/* Empty state */
.cases-list > .empty {
  padding: 36px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-500);
}
.cases-list > .empty .ic { color: var(--ink-300); margin-bottom: 6px; }

/* Pagination footer */
.cases-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  font-size: 12px;
  color: var(--ink-500);
}
.cases-foot .right { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.cases-foot .pg {
  background: transparent;
  border: 1px solid var(--ink-200);
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  color: var(--ink-700);
  cursor: pointer;
}
.cases-foot .pg:hover { background: var(--ink-50); }
.cases-foot .pg[disabled] { opacity: .4; cursor: not-allowed; }
.cases-foot .pg.cur { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Page */
.order-page {
  max-width: 1200px;
  margin: 0 auto;
}

/* Page title */
.order-title {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-900);
}

/* Form card — single bordered surface */
.formcard {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  padding: 4px 28px 24px;
}

/* Section group */
.fgroup { padding: 18px 0; border-top: 1px solid var(--ink-100); }
.fgroup:first-child { border-top: 0; }
.fgroup .fgroup-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.fgroup .fgroup-head .lab {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-900);
  font-weight: 600;
}
.fgroup .fgroup-head .hint {
  font-size: 11px;
  color: var(--ink-500);
}

/* 2-column field grid */
.fgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 48px;
  row-gap: 14px;
}

/* A single field row: label on the left, input on the right */
.field {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.field > .lab {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-700);
  line-height: 1.3;
}
.field > .lab .req { color: var(--rust); margin-left: 2px; }

/* Span entire grid width */
.field.full { grid-column: 1 / -1; }
.field.full > .lab { align-self: flex-start; padding-top: 8px; }

/* Empty cell to preserve grid layout when one column has no field */
.fspacer { /* invisible — keeps grid in sync */ }

/* Inputs */
.inp,
.sel,
.combo .trigger,
.date input {
  width: 100%;
  height: 32px;
  font: 400 13px var(--font-ui);
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  padding: 0 10px;
  transition: border-color 120ms;
}
.inp::placeholder, .date input::placeholder { color: var(--ink-300); }
.inp:hover, .sel:hover, .date input:hover { border-color: var(--ink-300); }
.inp:focus, .sel:focus, .date input:focus { outline: none; border-color: var(--navy); }
.inp.mono, .date input { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.sel { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: none; cursor: pointer; }

/* Wrap for native select chev */
.sel-wrap { position: relative; }
.sel-wrap .chev {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--ink-500); pointer-events: none;
}

/* Combo (searchable dropdown) — same look as native select */
.combo { position: relative; }
.combo .trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  padding-right: 30px;
  position: relative;
}
.combo.open .trigger { border-color: var(--navy); }
.combo .trigger .ph { color: var(--ink-300); }
.combo .trigger .val { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo .trigger .chev {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--ink-500); transition: transform 120ms;
}
.combo.open .trigger .chev { transform: translateY(-50%) rotate(180deg); }
.combo .trigger .clear {
  background: transparent;
  border: 0;
  color: var(--ink-500);
  padding: 2px;
  border-radius: 3px;
  display: inline-flex;
  margin-right: 4px;
}
.combo .trigger .clear:hover { background: var(--ink-100); color: var(--ink-900); }

.combo .panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  box-shadow: var(--shadow-pop);
  z-index: 50;
  overflow: hidden;
  max-height: 320px;
  display: flex;
  flex-direction: column;
}
.combo .panel .search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ink-200);
  color: var(--ink-500);
}
.combo .panel .search input {
  flex: 1;
  border: 0;
  background: transparent;
  font: 400 13px var(--font-ui);
  color: var(--ink-900);
  outline: none;
}
.combo .panel .list { overflow: auto; max-height: 260px; }
.combo .panel .opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--ink-900);
  cursor: pointer;
  line-height: 1.3;
}
.combo .panel .opt:hover { background: var(--ink-50); }
.combo .panel .opt.active { background: var(--sky-light); color: #1f5d85; }
.combo .panel .opt.selected { font-weight: 600; }
.combo .panel .opt .meta { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--ink-500); }
.combo .panel .empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-500);
}

/* Date */
.date { position: relative; }
.date input { padding-right: 32px; }
.date .cal {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--ink-500); pointer-events: none;
}
.date input::-webkit-calendar-picker-indicator {
  opacity: 0;
  position: absolute;
  right: 0; top: 0;
  width: 32px; height: 100%;
  cursor: pointer;
}

/* ---------- Notes editor ---------- */
.notes {
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.notes.focused { border-color: var(--navy); }

.notes-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--ink-200);
  background: var(--ink-50);
}
.notes-tools .tool {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-700);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}
.notes-tools .tool:hover { background: var(--surface); color: var(--ink-900); border-color: var(--ink-200); }
.notes-tools .tool.on { background: var(--surface); color: var(--navy); border-color: var(--navy); }
.notes-tools .divider {
  width: 1px;
  height: 18px;
  background: var(--ink-200);
  margin: 0 4px;
}
.notes-tools .count {
  margin-left: auto;
  font: 500 11px var(--font-mono);
  color: var(--ink-500);
}

.notes-body {
  min-height: 180px;
  max-height: 360px;
  overflow-y: auto;
  padding: 14px 16px;
  font: 400 13px/1.55 var(--font-ui);
  color: var(--ink-900);
  outline: none;
}
.notes-body:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-300);
  pointer-events: none;
}
.notes-body p { margin: 0 0 8px; }
.notes-body p:last-child { margin-bottom: 0; }
.notes-body ul, .notes-body ol { margin: 0 0 8px; padding-left: 22px; }
.notes-body blockquote {
  margin: 4px 0 8px;
  padding: 4px 10px;
  border-left: 3px solid var(--ink-300);
  color: var(--ink-700);
  font-style: italic;
}
.notes-body strong { font-weight: 600; }

/* ---------- Footer ---------- */
.formfoot {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.formfoot .meta {
  color: var(--ink-500);
  font-size: 12px;
}
.formfoot .right { margin-left: auto; display: flex; gap: 8px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: var(--shadow-modal);
  font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  z-index: 200;
  animation: toast-in 200ms var(--ease-out);
}
.toast .pip {
  width: 8px; height: 8px; border-radius: 999px; background: var(--success);
}
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Tweak: label position = "top" — labels above inputs (applied via body) */
body[data-labels="top"] .field {
  grid-template-columns: 1fr;
  align-items: flex-start;
  gap: 6px;
}
body[data-labels="top"] .field > .lab {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ink-500);
}
body[data-labels="top"] .field.full > .lab { padding-top: 0; }

/* ---------- In-page label-position switch (sits next to form titles) ---------- */
.order-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  flex-wrap: wrap;
}
.order-head .order-title { margin: 0; }
.order-head .lp-switch { margin-left: auto; }

.lp-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.lp-switch .lp-lab {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-500);
  font-weight: 600;
}
.lp-switch .lp-seg {
  display: inline-flex;
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  padding: 2px;
  gap: 1px;
}
.lp-switch .lp-seg button {
  background: transparent;
  border: 0;
  font: 500 11px var(--font-ui);
  letter-spacing: 0.02em;
  color: var(--ink-500);
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
  transition: color 120ms, background 120ms, box-shadow 120ms;
}
.lp-switch .lp-seg button:hover { color: var(--ink-900); }
.lp-switch .lp-seg button.on {
  background: var(--surface);
  color: var(--navy);
  box-shadow: 0 1px 2px rgba(10,22,61,0.08);
}
.lp-switch .lp-reset {
  background: transparent;
  border: 0;
  padding: 0;
  font: 500 11px var(--font-ui);
  color: var(--ink-500);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.lp-switch .lp-reset:hover { color: var(--navy); }

/* Hint paragraph below a Tweaks control */
.twk-hint {
  font: 400 10.5px/1.4 ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: rgba(41, 38, 27, 0.55);
  margin-top: -2px;
}

/* ---------- Settings modal (sidebar -> "Settings") ---------- */
/* Higher specificity than the generic .stk-modal / .stk-modal-overlay rules.
   We DON'T inherit the stk-pop / stk-fade animations because some preview /
   capture envs freeze animations mid-flight and leave the modal stuck at
   opacity 0. No animation means no chance of being stuck invisible. */
.stk-modal-overlay.settings-overlay {
  animation: none;
  opacity: 1;
}
.stk-modal.settings-modal {
  width: min(520px, 100%);
  animation: none;
  opacity: 1;
  transform: none;
}

.settings-section + .settings-section { margin-top: 18px; }
.settings-section-title {
  font: 600 10px var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-500);
  margin-bottom: 10px;
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--ink-100);
}
.settings-row:first-of-type { border-top: 0; padding-top: 4px; }
.settings-row-text { flex: 1; min-width: 0; }
.settings-row-text .lab {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-900);
  line-height: 1.3;
}
.settings-row-text .hint {
  font-size: 11.5px;
  color: var(--ink-500);
  margin-top: 2px;
  line-height: 1.4;
}
.settings-switch { flex-shrink: 0; }
.settings-switch .lp-seg { padding: 3px; }
.settings-switch .lp-seg button {
  padding: 5px 14px;
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- Language toggle pill ---------- */
.lang-toggle {
  display: inline-flex;
  background: var(--ink-100);
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  padding: 2px;
  gap: 1px;
}
.lang-toggle button {
  background: transparent;
  border: 0;
  font: 600 11px var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--ink-500);
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.lang-toggle button:hover { color: var(--ink-900); }
.lang-toggle button.on {
  background: var(--surface);
  color: var(--navy);
  box-shadow: 0 1px 2px rgba(10,22,61,0.08);
}

/* ---------- Shared additions ---------- */

/* Textarea, looks like inp but multiline */
.txta {
  width: 100%;
  min-height: 72px;
  font: 400 13px/1.5 var(--font-ui);
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  padding: 8px 10px;
  resize: vertical;
}
.txta::placeholder { color: var(--ink-300); }
.txta:hover { border-color: var(--ink-300); }
.txta:focus { outline: none; border-color: var(--navy); }

/* Disabled/read-only input look */
.inp:disabled, .inp[readonly], .txta:disabled, .txta[readonly] {
  background: var(--ink-50);
  color: var(--ink-500);
  cursor: not-allowed;
}

/* Currency-input pair: small sel + number input */
.curpair {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 6px;
}

/* Multi-input row (used for address / date+time / etc.) */
.multi {
  display: grid;
  gap: 6px;
}
.multi.cols-2 { grid-template-columns: 1fr 1fr; }
.multi.cols-3 { grid-template-columns: 2fr 1fr 1fr; }

/* Checkbox row */
.checkrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-900);
  cursor: pointer;
  user-select: none;
}
.checkrow .ck {
  width: 16px; height: 16px;
  border: 1.5px solid var(--ink-300);
  border-radius: 4px;
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.checkrow .ck.on {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.checkrow .ck.on::after { content: '✓'; font-size: 11px; line-height: 1; }
.checkrow input { position: absolute; opacity: 0; pointer-events: none; }

/* Info dot with tooltip-on-hover */
.infodot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: var(--ink-100);
  color: var(--ink-500);
  font: 600 10px var(--font-ui);
  cursor: help;
  margin-left: 6px;
}
.infodot:hover { background: var(--ink-200); color: var(--ink-900); }

/* ---------- Data table (Invoice rows / Document rows) ---------- */
.dtable {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 8px;
}
.dtable .head {
  display: grid;
  background: var(--ink-50);
  color: var(--ink-500);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.06em;
  font-weight: 600;
  border-bottom: 1px solid var(--ink-200);
}
.dtable .head > span {
  padding: 8px 12px;
  border-right: 1px solid var(--ink-200);
}
.dtable .head > span:last-child { border-right: 0; }
.dtable .row {
  display: grid;
  align-items: stretch;
  border-bottom: 1px solid var(--ink-100);
}
.dtable .row:last-child { border-bottom: 0; }
.dtable .row > span,
.dtable .row > input {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink-900);
  border: 0;
  background: transparent;
  border-right: 1px solid var(--ink-100);
  min-width: 0;
  font-family: inherit;
}
.dtable .row > input:focus { outline: none; background: var(--ink-50); }
.dtable .row > input.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.dtable .row > span:last-child,
.dtable .row > input:last-child { border-right: 0; }
.dtable .row .del {
  background: transparent;
  border: 0;
  color: var(--ink-500);
  padding: 0 8px;
  cursor: pointer;
}
.dtable .row .del:hover { color: var(--danger); }
.dtable .empty {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-500);
}
.dtable .foot {
  padding: 6px 8px;
  border-top: 1px solid var(--ink-100);
  background: var(--ink-50);
  display: flex;
  align-items: center;
}
.dtable .foot button {
  background: transparent;
  border: 1px dashed var(--ink-300);
  color: var(--ink-700);
  font: 500 12px var(--font-ui);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dtable .foot button:hover { background: var(--surface); color: var(--ink-900); border-style: solid; }

/* Roman-numeral section heads (customs warehouse entry) */
.fgroup-head .num {
  font: 700 11px/1 var(--font-mono);
  color: var(--rust);
  letter-spacing: 0.04em;
  margin-right: 6px;
}


/* ============================================================ */
/* Stock list page                                              */
/* ============================================================ */

.stock-page { max-width: 1500px; }

.stock-toolbar .btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* List header — 9 columns: ID, KTA, Client, Vessel, Msg, Owner, Readiness, Colis, Actions.
   Hard minimum ≈ 896px + gaps so the whole row fits a narrow content area
   (a 1280px window leaves only ~975px after the sidebar) WITHOUT a horizontal
   scrollbar; the fr columns absorb slack and expand on wider screens so there
   is no dead gap before the actions either. */
.cases-list.stock-list .cl-head,
.cases-list.stock-list .case-row .row-main {
  grid-template-columns: 58px 74px minmax(82px, 1.3fr) minmax(78px, 1.15fr) minmax(64px, 0.9fr) minmax(80px, 1fr) minmax(170px, 1.1fr) 46px 168px;
}
/* Let the flexible text columns actually compress (grid items default to
   min-width:auto, which would otherwise blow the track out to content size)
   and ellipsis instead of overflowing. */
.cases-list.stock-list .case-row .row-main > span { min-width: 0; }
.cases-list.stock-list .case-row .row-main .vessel,
.cases-list.stock-list .case-row .row-main .msg,
.cases-list.stock-list .case-row .row-main .owner {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cases-list.stock-list .cl-head .r,
.cases-list.stock-list .case-row .row-main .r { text-align: right; justify-content: flex-end; }

.stock-row .row-main .id {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-900);
  font-weight: 600;
}
.stock-row .row-main .kta,
.stock-row .row-main .vessel,
.stock-row .row-main .msg,
.stock-row .row-main .owner {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stock-row .row-main .client {
  color: var(--ink-900);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stock-row .row-main .empty { color: var(--ink-300); font-weight: 400; }
.stock-row .row-main .dim   { color: var(--ink-400, var(--ink-300)); font-size: 11px; letter-spacing: 0.04em; }

/* Colis count pill */
.stock-row .row-main .colis { display: inline-flex; justify-content: flex-end; }
.num-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--ink-100);
  color: var(--ink-900);
  font: 600 11px var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.case-row.open .row-main .num-pill { background: var(--surface); border: 1px solid var(--navy); color: var(--navy); }

/* Row actions group — slightly more icons than Cases */
.stock-row .row-main .row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}
.stock-row .row-main .ic-btn {
  width: 26px; height: 26px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.stock-row .row-main .ic-btn:hover {
  background: var(--ink-100);
  color: var(--ink-900);
  border-color: var(--ink-200);
}
.stock-row .row-main .ic-btn.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-bg);
}
.case-row.editing .ic-btn { opacity: 0.45; pointer-events: none; }
.case-row.editing .ic-btn[title="Edit"],
.case-row.editing .ic-btn[title="Επεξεργασία"] { opacity: 1; pointer-events: auto; }

/* Expanded grid for stock detail — wider, more dense */
.row-detail .dl-grid.stock-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 28px;
}

/* "Position" chip in detail values */
.row-detail .val .chip {
  display: inline-block;
  padding: 1px 8px;
  background: var(--ink-100);
  border: 1px solid var(--ink-200);
  border-radius: 4px;
  font: 600 11px var(--font-mono);
  color: var(--ink-700);
  letter-spacing: 0.04em;
}

.row-detail .val .pill.p-warn {
  background: var(--warning-bg);
  color: var(--warning);
}
.row-detail .val .pill.p-warn .dot { background: var(--warning); }
.row-detail .val.dim { color: var(--ink-400, var(--ink-500)); }

/* Tiny link button inside dl-actions left */
.dl-actions .left .lnk {
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 11px;
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.dl-actions .left .lnk:hover { color: var(--rust); }

/* ---- Danger button ---- */
.btn.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger);
}
.btn.btn-danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ============================================================ */
/* Stock list — modals (Record history + Delete confirm)         */
/* ============================================================ */

.stk-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 61, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: stk-fade 160ms var(--ease-out);
}
@keyframes stk-fade { from { opacity: 0; } to { opacity: 1; } }

.stk-modal {
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border-radius: var(--radius-lg, 10px);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: stk-pop 200ms var(--ease-out);
}
.stk-modal.stk-modal-sm { width: min(440px, 100%); }
@keyframes stk-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.stk-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px 20px;
  border-bottom: 1px solid var(--ink-100);
}
.stk-modal-head .eyebrow {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--ink-500);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.stk-modal-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-900);
}
.stk-modal-head .sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink-500);
}
.stk-modal-head .icon-x {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink-500);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stk-modal-head .icon-x:hover { background: var(--ink-100); color: var(--ink-900); }

.stk-modal-body {
  padding: 14px 20px 20px;
  overflow: auto;
  flex: 1;
}

.stk-modal-foot {
  padding: 12px 16px;
  background: var(--ink-50);
  border-top: 1px solid var(--ink-100);
  display: flex;
  justify-content: flex-start;
  gap: 8px;
}
.stk-modal-foot.end { justify-content: flex-end; }

/* History list */
.hist-empty {
  padding: 28px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-500);
}

.hist-list {
  list-style: none;
  margin: 0;
  padding: 2px 0 2px 2px;
  position: relative;
}
.hist-list::before {
  content: '';
  position: absolute;
  left: 11px; top: 18px; bottom: 18px;
  width: 2px;
  border-radius: 2px;
  background: var(--ink-200);
}
.hist-item {
  position: relative;
  padding: 10px 0 18px 32px;
}
.hist-item:last-child { padding-bottom: 4px; }
/* Filled status dot, sitting cleanly on the rail via a white ring punch-out
   plus a soft colour halo. Default = edited (blue); .create = green. */
.hist-item .dot {
  position: absolute;
  left: 6px; top: 15px;
  width: 12px; height: 12px;
  border-radius: 999px;
  background: #1f5d85;
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 5px rgba(31, 93, 133, 0.16);
  z-index: 1;
}
.hist-item.create .dot {
  background: var(--success);
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 5px rgba(47, 122, 79, 0.16);
}

.hist-item .head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.hist-item .who {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-900);
}
.hist-item .when {
  margin-left: auto;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--ink-500);
}
.hist-item .tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font: 500 10px var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  height: 18px;
}
.hist-item .tag-create { background: var(--success-bg); color: var(--success); }
.hist-item .tag-edit   { background: var(--sky-light);  color: #1f5d85; }

.hist-item .changes {
  list-style: none;
  margin: 0;
  padding: 6px 10px 8px 10px;
  background: var(--ink-50);
  border-radius: 6px;
  border: 1px solid var(--ink-100);
  font-size: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}
.hist-item .changes li {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 14px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.hist-item .changes .field {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  font-weight: 600;
}
.hist-item .changes .from {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-500);
  text-decoration: line-through;
  text-decoration-color: var(--ink-300);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hist-item .changes .to {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-900);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hist-item .changes .ic { color: var(--ink-400, var(--ink-500)); }


/* ============================================================
   Delivery Notes — list page
   Matches the Stock List row-expand pattern: row click expands,
   each row has print + more/less actions. Same chrome as cases.
   ============================================================ */

.dn-page { /* inherits .cases-page sizing */ }

/* List header + row grid: ID, Client, Vessel, Date, Status, Pcs (r), Weight (r), Actions */
.cases-list.dn-list .cl-head,
.cases-list.dn-list .case-row .row-main {
  grid-template-columns: 84px 1.6fr 1.2fr 1.1fr 120px 70px 110px 180px;
}
.cases-list.dn-list .cl-head .r,
.cases-list.dn-list .case-row .row-main .r {
  text-align: right;
  justify-content: flex-end;
}

.dn-row .row-main .id {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-900);
  font-weight: 600;
}
.dn-row .row-main .vessel,
.dn-row .row-main .date,
.dn-row .row-main .pcs,
.dn-row .row-main .weight {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-700);
}
.dn-row .row-main .client {
  color: var(--ink-900);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.dn-row .row-main .time-sm {
  color: var(--ink-500);
  font-size: 11px;
}
.dn-row .row-main .dim {
  color: var(--ink-300);
  font-size: 11px;
  letter-spacing: 0.04em;
}

/* Urgent (flagged) — subtle: navy text + warm dot. No alarming row paint. */
.dn-row.urgent .row-main .client {
  color: var(--ink-900);
}
.dn-flag-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: transparent;
  border: 2px solid var(--warning);
  flex-shrink: 0;
}
.dn-flag-dot.solid {
  background: var(--warning);
  border-color: var(--warning);
}

/* Row-detail flag banner */
.dn-flag-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  border-radius: 4px;
  font-size: 12px;
  color: var(--ink-900);
  margin-bottom: 10px;
}
.dn-flag-banner .lab {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ink-700);
}
.dn-flag-banner .msg { color: var(--ink-900); }

/* Row actions group (matches stock-row icon-button styles) */
.dn-row .row-main .row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.dn-row .row-main .ic-btn {
  width: 26px; height: 26px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  color: var(--ink-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.dn-row .row-main .ic-btn:hover {
  background: var(--ink-100);
  color: var(--ink-900);
  border-color: var(--ink-200);
}

/* Detail grid — 4 columns of meta */
.dl-grid.dn-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 18px;
  padding: 14px 18px 4px;
}
.dl-grid.dn-grid .it { min-width: 0; }
.dl-grid.dn-grid .lab {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ink-500);
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dl-grid.dn-grid .lab-ct {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--ink-500);
  letter-spacing: 0;
  text-transform: none;
}
.dl-grid.dn-grid .val {
  font-size: 13px;
  color: var(--ink-900);
}
.dl-grid.dn-grid .mn .val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.dl-grid.dn-grid .val .empty {
  color: var(--ink-300);
}

/* Stock id pills inside the detail */
.dn-stock-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.dn-stock-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  height: 22px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--ink-900);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 120ms, color 120ms;
}
.dn-stock-pill:hover {
  border-color: var(--navy);
  color: var(--navy);
}
.dn-stock-pill .ar { color: var(--ink-500); }
.dn-stock-pill:hover .ar { color: var(--navy); }

/* ============================================================
   Customs warehousing — list page
   7 columns: A/A, Τύπος, Stock ID, Πελάτης, Supplier, Ημ/νία, Actions
   Reuses cases-list + dn-grid (detail). Type badge is the only new piece.
   ============================================================ */
.cusl-page { /* inherits .cases-page sizing */ }

.cases-list.cusl-list .cl-head,
.cases-list.cusl-list .case-row .row-main {
  grid-template-columns: 72px 88px 110px 1.5fr 1.3fr 110px 190px;
}

.cusl-row .row-main .id {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-900);
  font-weight: 600;
}
.cusl-row .row-main .client,
.cusl-row .row-main .supplier {
  color: var(--ink-900);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cusl-row .row-main .supplier {
  color: var(--ink-700);
  font-weight: 400;
}
.cusl-row .row-main .date {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-700);
}
.cusl-row .row-main .stock { display: inline-flex; align-items: center; }

/* Type badge — entry/exit/transfer. Matches semantic-bg tokens. */
.cusl-type {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.cusl-type.is-entry {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(47,122,79,0.18);
}
.cusl-type.is-exit {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(184,132,43,0.22);
}
.cusl-type.is-tr {
  background: var(--info-bg, var(--sky-light));
  color: var(--info, var(--navy));
  border-color: rgba(10,31,61,0.16);
}

/* Row actions — extra icon-button slot for edit. Same chrome as dn-row. */
.cusl-row .row-main .row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.cusl-row .row-main .ic-btn {
  width: 26px; height: 26px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  color: var(--ink-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}
.cusl-row .row-main .ic-btn:hover {
  background: var(--ink-100);
  color: var(--ink-900);
  border-color: var(--ink-200);
}

/* ============================================================
   Wide layout — "Show every column" mode + print sheet (shared).
   `.cases-list.is-wide` applies to every list page: Cases, Customs,
   Delivery notes, Stock list. Each list ALSO sets its own grid-template
   to lay out its specific column set. The print stylesheet at the bottom
   forces wide mode regardless of the user's preference.
   ============================================================ */

/* Scroll shell: only meaningful in wide mode; in compact it's a no-op. */
.cases-list .cusl-scroll { width: 100%; }
.cases-list.is-wide { overflow: hidden; }
.cases-list.is-wide .cusl-scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

/* ---- Customs (cusl-list) — 13 columns. Actions pulled to col 1 in wide. ---- */
.cases-list.cusl-list.is-wide .cl-head.cusl-head-grid-wide,
.cases-list.cusl-list.is-wide .case-row .row-main.cusl-row-grid-wide {
  display: grid;
  grid-template-columns:
    110px                       /* actions (pulled-left in wide) */
    72px 88px 110px
    minmax(200px, 1.4fr) minmax(180px, 1.2fr)
    110px 110px
    130px 130px 130px
    minmax(180px, 1fr) minmax(220px, 1.6fr);
  min-width: 1950px;
}
/* Match the row wrapper to the row-main grid so its border + hover extend
   to the last column even when the user has scrolled horizontally. */
.cases-list.cusl-list.is-wide .case-row { min-width: 1950px; }

/* ---- Cases (no extra class) — adds 11 detail columns + drops route. ---- */
.cases-list.is-wide:not(.cusl-list):not(.dn-list):not(.stock-list):not(.vat-list) .cl-head,
.cases-list.is-wide:not(.cusl-list):not(.dn-list):not(.stock-list):not(.vat-list) .case-row .row-main {
  display: grid;
  grid-template-columns:
    60px                      /* actions (pulled-left in wide) */
    60px                      /* id     */
    minmax(160px, 1.4fr)      /* client */
    120px                     /* file   */
    130px 130px               /* mawb / hawb */
    120px                     /* mode   */
    minmax(120px, 1fr)        /* origin */
    minmax(120px, 1fr)        /* originCity */
    minmax(120px, 1fr)        /* dest   */
    minmax(120px, 1fr)        /* destCity */
    minmax(140px, 1fr)        /* vessel */
    100px 100px 100px         /* dispatched / arrival / delivery */
    140px                     /* status */
    100px;                    /* updated */
  min-width: 2040px;
  gap: 10px;
}
.cases-list.is-wide:not(.cusl-list):not(.dn-list):not(.stock-list):not(.vat-list) .case-row { min-width: 2040px; }

/* ---- Delivery notes (dn-list) — adds time, transport, related, stock count. ---- */
.cases-list.dn-list.is-wide .cl-head,
.cases-list.dn-list.is-wide .case-row .row-main {
  display: grid;
  grid-template-columns:
    140px                     /* actions (pulled-left in wide) */
    84px                      /* id      */
    minmax(180px, 1.6fr)      /* client  */
    minmax(140px, 1.2fr)      /* vessel  */
    100px                     /* date    */
    70px                      /* time    */
    100px                     /* transport */
    110px                     /* related */
    60px                      /* stock count */
    70px                      /* pcs r   */
    110px;                    /* weight r */
  min-width: 1320px;
}
.cases-list.dn-list.is-wide .case-row { min-width: 1320px; }

/* ---- Stock list — adds ~30 detail columns. ---- */
.cases-list.stock-list.is-wide .cl-head,
.cases-list.stock-list.is-wide .case-row .row-main {
  display: grid;
  grid-template-columns:
    160px                     /* actions (pulled-left in wide) */
    72px                      /* id       */
    80px                      /* kta      */
    minmax(160px, 1.4fr)      /* client   */
    minmax(120px, 1fr)        /* vessel   */
    100px                     /* msg      */
    110px                     /* owner    */
    120px                     /* supRef   */
    minmax(140px, 1fr)        /* supplier */
    80px 80px                 /* gross / net */
    72px 72px 72px 72px       /* vol road/sea/air/courier */
    minmax(140px, 1fr)        /* packing  */
    90px                      /* position */
    100px                     /* dg       */
    140px                     /* awb      */
    minmax(180px, 1fr)        /* hub      */
    140px                     /* alk      */
    150px                     /* mrn      */
    120px                     /* cOrigin  */
    120px                     /* ciOrigin */
    72px                      /* gr       */
    150px                     /* readiness */
    100px                     /* readinessDate */
    100px                     /* storage  */
    72px                      /* pickup   */
    100px                     /* dateIn   */
    140px                     /* dnImport */
    100px                     /* dateOut  */
    100px                     /* dnExport */
    120px                     /* cDest    */
    120px                     /* ciDest   */
    130px                     /* status   */
    100px                     /* insUpd   */
    70px;                     /* colis r  */
  min-width: 4600px;
}
.cases-list.stock-list.is-wide .case-row { min-width: 4600px; }

/* In wide mode the row-main is no longer a click target — keep it neutral. */
.cases-list.is-wide .case-row .row-main { cursor: default; }
.cases-list.is-wide .case-row .row-main:hover { background: var(--surface); }
.cases-list.is-wide .case-row.open .row-main { background: var(--surface); }

/* Header: let it grow to fit multi-line labels (Greek copy in particular is
   long). Default cases-list locks .cl-head at 34px; in wide mode we relax
   that and align the wrapped labels to the bottom so they sit just above
   the data row instead of overflowing into it. */
.cases-list.is-wide .cl-head {
  height: auto;
  min-height: 34px;
  padding-top: 8px;
  padding-bottom: 8px;
  align-items: end;
  line-height: 1.2;
}
.cases-list.is-wide .cl-head > span,
.cases-list.is-wide .cl-head .sortable {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.2;
  align-self: end;
}

/* Wide-mode cell helpers: monospace numerics, truncated overflow, soft empties.
   Applied to every list type's row-main cells so we don't have to repeat per
   list-prefix selector. */
.cases-list.is-wide .row-main .cell-mn {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cases-list.is-wide .row-main .cell-trunc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-700);
  font-size: 13px;
}
.cases-list.is-wide .row-main .cell-empty {
  color: var(--ink-300);
  font-weight: 400;
}

/* The "Show every column" segmented switch in Settings is wider than the
   side/top one — give it room so the labels don't wrap. */
.settings-switch.is-wide .lp-seg button { padding: 5px 12px; white-space: nowrap; }

/* ============================================================
   Wide-mode — pull row actions to the LEFT.

   In compact mode the edit/delete icons live at the end of the row
   (right-aligned, after status). In wide mode the table scrolls
   horizontally and the actions would scroll off-screen, so we:
     1. Reserve the actions width as the FIRST grid column (done above
        in each list's `.is-wide` grid-template-columns).
     2. Use CSS `order: -1` to visually move the row-actions cell to
        column 1 without changing DOM order — sort handlers, ARIA, and
        keyboard tab order all stay intact.
     3. Pin it with `position: sticky; left: 0` so edit/delete remain
        accessible no matter how far the user has scrolled. A subtle
        right-edge shadow shows that content slides underneath.
   The header has a trailing `<span />` placeholder that mirrors the
   actions cell — same treatment.
   ============================================================ */
.cases-list.is-wide .case-row .row-main > .row-actions,
.cases-list.is-wide .cl-head > span:last-child {
  order: -1;
  position: sticky;
  left: 0;
  z-index: 2;
  justify-content: flex-start;
  padding-left: 0;
  padding-right: 8px;
  /* a hairline + soft falloff so scrolled content reads as "underneath" */
  box-shadow:
    1px 0 0 0 var(--ink-200),
    6px 0 8px -6px rgba(10, 22, 61, 0.12);
}
.cases-list.is-wide .case-row .row-main > .row-actions {
  background: var(--surface);
  margin-left: -14px; /* cancel the row-main's left padding so we hug the edge */
  padding-left: 14px;
}
.cases-list.is-wide .cl-head > span:last-child {
  background: var(--ink-50);
  margin-left: -14px;
  padding-left: 14px;
}
/* When a row is hovered or selected, keep the sticky cell's background
   in sync so it doesn't look detached. */
.cases-list.is-wide .case-row.open .row-main > .row-actions,
.cases-list.is-wide .case-row.selected .row-main > .row-actions {
  background: var(--bg-stripe, var(--surface));
}

/* ============================================================
   Print sheet — always wide, always landscape, every list page.
   We hide the app chrome and force the table into wide layout
   regardless of the stored pref (a beforeprint listener flushes a
   React re-render so the wide cells are in DOM). Per-list grid
   templates below pack the columns to fit landscape A4.
   ============================================================ */
@page { size: A4 landscape; margin: 10mm; }

@media print {
  html, body {
    background: #fff !important;
    height: auto !important;
    overflow: visible !important;
  }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Hide app chrome. */
  .sidebar,
  .topbar,
  .cases-toolbar,
  .cases-foot,
  .cases-head .btn,
  .row-actions,
  .lp-switch-shell,
  .lp-switch,
  .tweaks-toggle,
  .twk-panel,
  .stk-modal-overlay { display: none !important; }

  /* Collapse the 240/1fr · 100vh grid so the main column flows the full page. */
  .app {
    display: block !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    height: auto !important;
    min-height: 0 !important;
    min-width: 0 !important;
    background: #fff !important;
  }
  .main {
    overflow: visible !important;
    padding: 0 !important;
    height: auto !important;
    min-width: 0 !important;
  }
  .cases-page { padding: 0 !important; }
  .cases-head { margin-bottom: 4mm !important; padding: 0 !important; }
  .cases-head h1 { font-size: 16pt !important; margin: 0 !important; }
  .cases-head .sub { display: none !important; }

  /* Generic: every list type loses its scroll shell & sticky header chrome. */
  .cases-list {
    overflow: visible !important;
    border: 1px solid #000 !important;
    border-radius: 0 !important;
  }
  .cases-list .cusl-scroll { overflow: visible !important; }
  .cases-list .cl-head {
    position: static !important;
    background: #eee !important;
    color: #000 !important;
    align-items: end !important;
    height: auto !important;
    min-height: 24px !important;
    padding: 4px 6px !important;
    font-size: 8pt !important;
    line-height: 1.2 !important;
  }
  .cases-list .case-row .row-main {
    padding: 4px 6px !important;
    height: auto !important;
    min-height: 24px !important;
    gap: 6px !important;
    font-size: 9pt !important;
    line-height: 1.25 !important;
    cursor: default !important;
    background: #fff !important;
    border-bottom: 1px solid #999 !important;
  }
  /* Strip cell decorations for paper. */
  .cases-list .row-actions { display: none !important; }
  .cases-list .row-detail { display: none !important; }
  .cases-list .case-row { page-break-inside: avoid; break-inside: avoid; }
  .cases-list .cusl-type,
  .cases-list .dn-stock-pill,
  .cases-list .pill,
  .cases-list .num-pill,
  .cases-list .chip {
    background: transparent !important;
    border: 1px solid #999 !important;
    color: #000 !important;
    padding: 0 4px !important;
    height: auto !important;
    font-size: 8pt !important;
    box-shadow: none !important;
  }
  .cases-list .row-main .empty,
  .cases-list .row-main .cell-empty,
  .cases-list .row-main .dim { color: #777 !important; }
  .cases-list .row-main .client,
  .cases-list .row-main .supplier,
  .cases-list .row-main .cell-trunc {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  /* ---- Per-list grid templates packed for landscape A4. ---- */
  /* Customs — 13 cols, 36/60/70/1.4fr/1.2fr/60/60/78/78/78/1fr/1.8fr/(no actions) */
  .cases-list.cusl-list .cl-head,
  .cases-list.cusl-list .case-row .row-main {
    display: grid !important;
    grid-template-columns:
      36px 60px 70px
      minmax(110px, 1.4fr) minmax(100px, 1.2fr)
      58px 58px
      72px 72px 72px
      minmax(100px, 1fr) minmax(140px, 1.8fr) !important;
    min-width: 0 !important;
  }
  /* Cases — drop "route" + actions, keep id/client/file + 11 detail cols + status + updated */
  .cases-list:not(.cusl-list):not(.dn-list):not(.stock-list) .cl-head,
  .cases-list:not(.cusl-list):not(.dn-list):not(.stock-list) .case-row .row-main {
    display: grid !important;
    grid-template-columns:
      34px
      minmax(110px, 1.4fr)
      72px
      80px 80px
      70px
      minmax(80px, 1fr) minmax(80px, 1fr)
      minmax(80px, 1fr) minmax(80px, 1fr)
      minmax(90px, 1fr)
      62px 62px 62px
      90px 62px !important;
    min-width: 0 !important;
  }
  /* Delivery notes — id/client/vessel/date/time/transport/related/stock-count/pcs/weight */
  .cases-list.dn-list .cl-head,
  .cases-list.dn-list .case-row .row-main {
    display: grid !important;
    grid-template-columns:
      48px
      minmax(120px, 1.6fr)
      minmax(110px, 1.2fr)
      64px 50px 70px 78px 40px 50px 80px !important;
    min-width: 0 !important;
  }
  /* Stock list — print as a compact summary (always-visible columns only).
     The wide "Show every column" mode adds ~30 cells which can't fit on
     landscape A4 — hide them in print and keep the readable subset. */
  .cases-list.stock-list .cl-head,
  .cases-list.stock-list .case-row .row-main {
    display: grid !important;
    grid-template-columns:
      44px                          /* id     */
      62px                          /* kta    */
      minmax(120px, 1.8fr)          /* client */
      minmax(100px, 1.4fr)          /* vessel */
      82px                          /* msg    */
      minmax(100px, 1.2fr)          /* owner  */
      44px !important;              /* colis  */
    min-width: 0 !important;
  }
  /* Hide every cell from the 7th onwards (all wide-mode extras + actions). */
  .cases-list.stock-list .cl-head > *:nth-child(n+7),
  .cases-list.stock-list .case-row .row-main > *:nth-child(n+7) {
    display: none !important;
  }
  /* …but keep the colis cell (second-to-last) visible in the 7th column. */
  .cases-list.stock-list .cl-head > *:nth-last-child(2),
  .cases-list.stock-list .case-row .row-main > *:nth-last-child(2) {
    display: block !important;
    text-align: right !important;
  }
}


/* ============================================================ */
/* Stock list — Print options modal                              */
/* ============================================================ */
.stk-modal.print-modal {
  width: min(640px, 100%);
}
.stk-modal.print-modal .stk-modal-body { padding: 0; }

.pr-section {
  padding: 18px 22px;
  border-bottom: 1px solid var(--ink-100);
}
.pr-section:last-child { border-bottom: 0; }

.pr-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.pr-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.pr-head h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: 0.01em;
}

/* Custom checkbox */
.pr-check {
  display: grid; grid-template-columns: 16px 1fr; gap: 10px;
  align-items: start;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}
.pr-check.tight { margin: 8px 0 2px; }
.pr-check input { position: absolute; opacity: 0; pointer-events: none; }
.pr-check .box {
  width: 16px; height: 16px; border-radius: 3px;
  border: 1.5px solid var(--ink-300);
  background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 120ms, border-color 120ms;
  margin-top: 1px;
}
.pr-check input:checked + .box {
  background: var(--navy);
  border-color: var(--navy);
}
.pr-check input:checked + .box::after {
  content: ''; width: 9px; height: 5px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.pr-check input:focus-visible + .box {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}
.pr-check .lbl {
  font-size: 12.5px;
  color: var(--ink-900);
  line-height: 1.45;
  display: flex; flex-direction: column; gap: 3px;
}
.pr-check .lbl .hint {
  font-size: 11px;
  color: var(--ink-500);
  display: inline-flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.beta-tag {
  display: inline-block;
  padding: 0px 6px;
  border-radius: 3px;
  background: var(--warning-bg);
  color: var(--warning);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 1px;
}

/* Template cards */
.pr-tpls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.pr-tpl {
  display: grid;
  grid-template-columns: 32px 1fr 18px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 120ms, border-color 120ms;
  font: inherit;
  color: var(--ink-900);
}
.pr-tpl:hover { background: var(--ink-50); border-color: var(--ink-300); }
.pr-tpl.on {
  border-color: var(--navy);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--navy);
}
.pr-tpl:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}
.pr-tpl .tk-ic {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: var(--ink-50);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-500);
}
.pr-tpl.on .tk-ic {
  background: var(--navy);
  color: #fff;
}
.pr-tpl .tk-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pr-tpl .tk-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900);
}
.pr-tpl .tk-sub {
  font-size: 11.5px;
  color: var(--ink-500);
  line-height: 1.35;
}
.pr-tpl .tk-radio {
  width: 18px; height: 18px;
  border-radius: 999px;
  border: 1.5px solid var(--ink-300);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: #fff;
  color: var(--navy);
}
.pr-tpl.on .tk-radio {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

/* Form fields */
.pr-field {
  display: flex; flex-direction: column; gap: 5px;
  margin-bottom: 10px;
}
.pr-field:last-child { margin-bottom: 0; }
.pr-field.is-disabled .pr-label { color: var(--fg-disabled); }
.pr-label {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 600;
}
.pr-input {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--ink-900);
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 4px;
  padding: 8px 10px;
  outline: 0;
  transition: border-color 120ms, box-shadow 120ms;
}
.pr-input:hover { border-color: var(--ink-300); }
.pr-input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(10,31,61,0.10);
}
.pr-input:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 1px;
}
.pr-input:disabled {
  background: var(--bg-sunk, var(--ink-50));
  color: var(--fg-disabled);
  cursor: not-allowed;
}
.pr-textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.45;
}

@media print {
  .stk-modal.print-modal { display: none !important; }
}

/* ---- VAT print dialog additions ---- */
.vpr-hint {
  margin: 4px 0 10px;
  font-size: 11px;
  color: var(--ink-500);
  line-height: 1.45;
}
.vpr-scope {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.vpr-scope-opt {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.vpr-scope-opt:hover { background: var(--ink-50); border-color: var(--ink-300); }
.vpr-scope-opt.on {
  border-color: var(--navy);
  box-shadow: inset 0 0 0 1px var(--navy);
}
.vpr-scope-opt.dim {
  opacity: 0.5;
  cursor: not-allowed;
}
.vpr-scope-opt input { position: absolute; opacity: 0; pointer-events: none; }
.vpr-scope-opt .rd {
  width: 18px; height: 18px;
  border-radius: 999px;
  border: 1.5px solid var(--ink-300);
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff;
  color: var(--navy);
}
.vpr-scope-opt.on .rd {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.vpr-scope-opt .bd {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-width: 0;
}
.vpr-scope-opt .lab {
  font-size: 12.5px; font-weight: 600; color: var(--ink-900);
}
.vpr-scope-opt .ct {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--ink-500);
  background: var(--ink-50);
  padding: 1px 7px;
  border-radius: 999px;
}
.vpr-scope-opt.on .ct {
  color: var(--navy);
  background: rgba(10,31,61,0.08);
}

.vpr-tplgrp-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 600;
  margin: 14px 0 8px;
}
.vpr-tplgrp-label:first-child { margin-top: 4px; }

.vpr-issuer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.vpr-issuer-grid .pr-field { margin-bottom: 0; }
.vpr-issuer-grid .pr-field.span2 { grid-column: 1 / -1; }

/* ============================================================
   VAT exemption — list page
   Inherits .cases-page chrome. 12 columns in compact mode:
   check, no., inv#, client, vessel, date, net (r), vat (r),
   status, actions.
   ============================================================ */
.vat-page { max-width: 1500px; }

.vat-page .cases-head .sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vat-page .cases-head .sub .sep { color: var(--ink-300); }
.vat-page .cases-head .sub-stat { font-size: 12px; color: var(--ink-700); }
.vat-page .cases-head .sub-stat .mono { color: var(--ink-900); }

/* Compact grid: check | id | inv# | client | vessel | date | net | vat | status | actions */
.cases-list.vat-list .cl-head,
.cases-list.vat-list .case-row .row-main {
  grid-template-columns: 36px 64px 140px 1.4fr 1.2fr 100px 110px 110px 130px 100px;
}
.cases-list.vat-list .cl-head .r,
.cases-list.vat-list .case-row .row-main .r { text-align: right; justify-content: flex-end; }

.vat-row .row-main .id {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-900);
  font-weight: 600;
}
.vat-row .row-main .invnum {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-900);
  font-weight: 600;
}
.vat-row .row-main .client {
  color: var(--ink-900);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vat-row .row-main .vessel {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vat-row .row-main .date,
.vat-row .row-main .net,
.vat-row .row-main .vat {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-700);
}
.vat-row .row-main .net,
.vat-row .row-main .vat { color: var(--ink-900); font-weight: 500; }
.vat-row .row-main .dim { color: var(--ink-300); font-size: 11px; }

/* Selected-row state — subtle navy fill so the row stands out without
   competing with the .open expanded state. */
.case-row.vat-row.selected .row-main {
  background: rgba(10,31,61,0.04);
  box-shadow: inset 3px 0 0 var(--navy);
}
.case-row.vat-row.selected.open .row-main { background: var(--sky-light); }

/* Urgent dot on client cell — same chrome as dn-row.urgent. */
.vat-row .vat-flag-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--warning);
  margin-right: 8px;
  box-shadow: 0 0 0 3px rgba(184,132,43,0.18);
  vertical-align: middle;
}

/* Banner inside expanded detail for urgent rows. */
.vat-flag-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 0 0 14px;
  border: 1px solid rgba(184,132,43,0.30);
  background: var(--warning-bg);
  border-radius: 6px;
  font-size: 12.5px;
}
.vat-flag-banner .vat-flag-dot.solid {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(184,132,43,0.18);
  margin: 0;
}
.vat-flag-banner .lab { font-weight: 600; color: var(--ink-700); }
.vat-flag-banner .msg { color: var(--ink-900); }

/* Row actions */
.vat-row .row-main .row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.vat-row .row-main .ic-btn {
  width: 26px; height: 26px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  color: var(--ink-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.vat-row .row-main .ic-btn:hover {
  background: var(--ink-100);
  color: var(--ink-900);
}

/* Checkbox cell — used in header + every row. */
.vat-list .checkcell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vat-list .cb {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.vat-list .cb input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.vat-list .cb .bx {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  border: 1.5px solid var(--ink-300);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 120ms, background 120ms;
}
.vat-list .cb:hover .bx { border-color: var(--navy); }
.vat-list .cb input:checked + .bx {
  background: var(--navy);
  border-color: var(--navy);
}
.vat-list .cb input:checked + .bx::after {
  content: '';
  display: block;
  width: 8px;
  height: 5px;
  border-left: 1.6px solid #fff;
  border-bottom: 1.6px solid #fff;
  transform: translateY(-1px) rotate(-45deg);
}
.vat-list .cb input:focus-visible + .bx {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}

/* Selection action bar — appears between toolbar and list when any row
   is selected. Sticky-ish: sits in flow above the list. */
.vat-selbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--navy);
  color: #fff;
  border-radius: 6px 6px 0 0;
  border: 1px solid var(--navy);
  border-bottom: 0;
  margin-bottom: -1px;
  font-size: 12.5px;
}
.vat-selbar .ct { font-weight: 600; }
.vat-selbar .sep { color: rgba(255,255,255,0.35); }
.vat-selbar .totals { display: inline-flex; align-items: center; gap: 8px; color: rgba(255,255,255,0.85); }
.vat-selbar .totals .dot-sep { color: rgba(255,255,255,0.35); }
.vat-selbar .totals .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.vat-selbar .right { margin-left: auto; display: inline-flex; gap: 6px; }
.vat-selbar .btn.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.20);
}
.vat-selbar .btn.btn-secondary:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.35);
}
.vat-selbar .btn.btn-primary {
  background: var(--rust);
  border-color: var(--rust);
  color: #fff;
}
.vat-selbar .btn.btn-primary:hover { filter: brightness(0.95); }
.vat-page .vat-selbar + .cases-list { border-top-left-radius: 0; border-top-right-radius: 0; }

/* Detail grid */
.dl-grid.vat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 22px;
  padding: 14px 18px 4px;
}
.dl-grid.vat-grid .it { min-width: 0; }
.dl-grid.vat-grid .lab {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ink-500);
  margin-bottom: 4px;
}
.dl-grid.vat-grid .val {
  font-size: 13px;
  color: var(--ink-900);
}
.dl-grid.vat-grid .mn .val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.dl-grid.vat-grid .val .empty { color: var(--ink-300); }
.dl-grid.vat-grid .val .num-strong {
  font-weight: 600;
  color: var(--ink-900);
  font-size: 13px;
}

/* Chip variants used in invoice-type / format cells. The base .chip is
   defined in stock-list scope (.row-detail .val .chip); these add the
   colored variants and let the chip live in the row-main too. */
.vat-list .chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  background: var(--ink-50);
  color: var(--ink-700);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--ink-200);
  line-height: 18px;
  white-space: nowrap;
}
.vat-list .chip.chip-info {
  background: var(--info-bg, var(--sky-light));
  color: var(--info, var(--navy));
  border-color: rgba(10,31,61,0.16);
}
.vat-list .chip.chip-mut {
  background: var(--ink-50);
  color: var(--ink-500);
  border-color: var(--ink-200);
}
.vat-list .chip.chip-strong {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.row-detail .val .chip.chip-info,
.row-detail .val .chip.chip-mut,
.row-detail .val .chip.chip-strong {
  /* inherit base from .row-detail .val .chip but allow the variants */
  display: inline-block;
}
.row-detail .val .chip.chip-info {
  background: var(--info-bg, var(--sky-light));
  color: var(--info, var(--navy));
}
.row-detail .val .chip.chip-strong {
  background: var(--navy);
  color: #fff;
}

/* ---- Wide layout for VAT exemption ---- */
.cases-list.vat-list.is-wide .cl-head,
.cases-list.vat-list.is-wide .case-row .row-main {
  display: grid;
  grid-template-columns:
    60px              /* actions (pulled-left in wide) */
    36px              /* checkbox */
    64px              /* No. */
    140px             /* invoice # */
    1.2fr             /* client */
    1.1fr             /* vessel */
    100px             /* date */
    1.1fr             /* supplier */
    160px             /* invoice type */
    90px              /* format */
    180px             /* MRN */
    150px             /* AWB */
    130px             /* protocol # */
    130px             /* exception */
    110px             /* net (r) */
    110px             /* vat (r) */
    130px;            /* status */
  align-items: center;
  gap: 10px;
  min-width: 2100px;
}
.cases-list.vat-list.is-wide .case-row { min-width: 2100px; }

/* ============================================================ */
/* Row action icon-buttons — shared across all list pages.       */
/* Each row type also defines its own .ic-btn rule (see          */
/* .stock-row, .dn-row, .cusl-row, .vat-row above) — this block  */
/* fills in Cases (which has no row-type-specific class) and     */
/* gives every page the red hover for `.ic-btn.danger` so the    */
/* trash icon reads as destructive consistently.                 */
/* ============================================================ */

.cases-list .case-row .row-main .ic-btn {
  width: 26px; height: 26px;
  border-radius: 4px;
  border: 1px solid var(--ink-200);
  background: var(--surface);
  color: var(--ink-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}
.cases-list .case-row .row-main .ic-btn:hover {
  background: var(--ink-100);
  color: var(--ink-900);
  border-color: var(--ink-300);
}
.cases-list .case-row .row-main .ic-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.cases-list .case-row .row-main .ic-btn.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-bg);
}



/* =================================================================
   Settings → Sidebar order reorder list
   A vertical list inside the Settings modal. Each row has a drag
   grip, an icon (mirrors what shows in the sidebar), the label, a
   small ordinal, and up/down keyboard buttons. Drop-target row gets
   a top accent; the dragged row dims so the user sees what's moving.
   ================================================================= */
.settings-section-title--with-action {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.settings-link {
  background: transparent;
  border: 0;
  padding: 0;
  font: 500 11px var(--font-ui);
  color: var(--navy);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.settings-link:hover { color: var(--navy-deep); text-decoration: underline; }
.settings-link:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
  border-radius: 2px;
}

.settings-row--block {
  display: block;
  padding: 12px 0 4px;
}

.reorder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 4px;
}
.reorder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: grab;
  user-select: none;
  position: relative;
  transition: background 120ms ease;
}
.reorder-item:hover { background: var(--ink-50); }
.reorder-item:active { cursor: grabbing; }
.reorder-item.is-dragging {
  opacity: 0.4;
  background: var(--ink-100);
  border-style: dashed;
  border-color: var(--ink-300);
}
.reorder-item.is-over::before {
  content: '';
  position: absolute;
  left: 6px; right: 6px; top: -3px;
  height: 2px;
  background: var(--rust);
  border-radius: 2px;
}
.reorder-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 22px;
  color: var(--ink-300);
  flex-shrink: 0;
}
.reorder-item:hover .reorder-grip { color: var(--ink-500); }
.reorder-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--ink-700);
  flex-shrink: 0;
}
.reorder-label {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reorder-index {
  font: 500 11px var(--font-mono);
  color: var(--ink-500);
  font-variant-numeric: tabular-nums;
  min-width: 14px;
  text-align: right;
}
.reorder-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.reorder-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--ink-500);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.reorder-btn:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--ink-200);
  color: var(--ink-900);
}
.reorder-btn:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 1px;
}
.reorder-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
