/* YardManage — industrial yard operations design system */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #eceae4;
  --bg-deep: #e2dfd7;
  --ink: #1a1d21;
  --ink-soft: #3a4048;
  --muted: #6a717a;
  --card: #f7f5f1;
  --card-solid: #fffcf8;
  --line: #d4d0c8;
  --line-strong: #b8b3a8;
  --steel: #2c333c;
  --steel-mid: #3d4652;
  --charcoal: #14171b;
  --amber: #d4920f;
  --amber-hot: #e8a82a;
  --amber-soft: #f3e4c2;
  --ok: #2a6b4a;
  --ok-bg: #e4f0e9;
  --danger: #9b2f2f;
  --danger-bg: #f6e6e6;
  --warn: #8a6420;
  --warn-bg: #f6ecd6;
  --radius: 4px;
  --radius-lg: 8px;
  --shadow: 0 1px 0 rgba(26, 29, 33, 0.04), 0 12px 28px rgba(26, 29, 33, 0.06);
  --font-display: 'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', Consolas, monospace;
  --pad-x: clamp(18px, 4vw, 36px);
  --max: 1180px;
  --header-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(236, 234, 228, 0.92), rgba(236, 234, 228, 0.96)),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 11px,
      rgba(26, 29, 33, 0.015) 11px,
      rgba(26, 29, 33, 0.015) 12px
    ),
    var(--bg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--steel-mid); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
a, button, input, select, textarea { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

/* —— Header / nav —— */
.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: var(--header-h);
  padding: 0 var(--pad-x);
  background: linear-gradient(180deg, #1c2128 0%, var(--charcoal) 100%);
  color: #f3f0ea;
  border-bottom: 3px solid var(--amber);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  flex-shrink: 0;
  z-index: 2;
}
.brand:hover { color: #fff; }
.brand-mark {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--amber-hot);
  line-height: 1;
}
.brand-light { color: #f7f5f1; font-weight: 600; }
.brand-caption {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9aa3ad;
  border-left: 1px solid #3d4652;
  padding-left: 12px;
  line-height: 1.35;
  max-width: 88px;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid #4a5561;
  color: #f3f0ea;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  z-index: 45;
}
.nav-toggle[aria-expanded="true"] {
  border-color: var(--amber);
  color: var(--amber-hot);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.top-nav a {
  color: #b8c0c8;
  text-decoration: none;
  padding: 10px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.top-nav a:hover,
.top-nav a[aria-current="page"] {
  background: rgba(232, 168, 42, 0.12);
  color: #fff;
}
.top-nav a[aria-current="page"] {
  box-shadow: inset 0 -2px 0 var(--amber);
}

.who {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 13px;
  flex-shrink: 0;
}
.who-desktop { margin-left: auto; }
.who-in-nav { display: none; }
.identity strong,
.identity small { display: block; }
.identity strong {
  font-weight: 600;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.identity small {
  color: #9aa3ad;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.inline { display: inline; }
.inline button {
  font-size: 12px;
  padding: 10px 14px;
  min-height: 44px;
}
.top .inline button {
  background: transparent;
  border: 1px solid #4a5561;
  color: #e8edf2;
  border-radius: var(--radius);
}
.top .inline button:hover {
  border-color: var(--amber);
  color: var(--amber-hot);
  background: transparent;
}

.nav-backdrop {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 23, 27, 0.55);
  z-index: 30;
}

/* —— Layout —— */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 36px var(--pad-x) 48px;
  min-height: calc(100vh - 160px);
}
.foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px var(--pad-x) 36px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
}
.foot a { color: var(--ink-soft); font-weight: 600; text-decoration: none; }
.foot a:hover { color: var(--ink); }
.sample-label { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }

/* —— Type —— */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.1;
}
h1 { font-size: clamp(34px, 5vw, 46px); margin: 0 0 12px; }
h2 { font-size: 24px; margin: 0 0 12px; }
p { margin: 0 0 14px; }
.lead {
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 42rem;
  font-size: 16px;
  line-height: 1.5;
}
.eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 10px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.page-heading .lead { margin: 0; }
.page-heading > .btn,
.page-heading > .actions,
.page-heading > .heading-actions { flex-shrink: 0; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* —— Surfaces —— */
.panel {
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.panel-quiet {
  background: transparent;
  border: 1px dashed var(--line-strong);
  box-shadow: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat {
  position: relative;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 20px 18px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--steel-mid);
}
.stat > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  margin: 10px 0 8px;
  letter-spacing: 0.02em;
}
.stat small { font-size: 12px; color: var(--muted); }
a.stat:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.stat.attention::before { background: var(--amber); }
.stat.attention b { color: #9a6a0c; }

.search-banner {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 28px;
  background:
    linear-gradient(135deg, rgba(212, 146, 15, 0.12), transparent 42%),
    linear-gradient(180deg, #1f252d, #161a1f);
  color: #f3f0ea;
  padding: 28px 30px;
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  border: 1px solid #2c333c;
  box-shadow: var(--shadow);
}
.search-banner .eyebrow { color: var(--amber-hot); }
.search-banner h2 {
  color: #fff;
  font-size: 28px;
  margin-bottom: 8px;
}
.search-banner p:not(.eyebrow) {
  font-size: 14px;
  color: #aeb6bf;
  margin: 0;
}
.quick-search { display: flex; gap: 8px; }
.quick-search input {
  min-width: 0;
  background: #0f1215;
  border-color: #3d4652;
  color: #fff;
}
.quick-search input::placeholder { color: #7a8490; }
.quick-search button {
  flex-shrink: 0;
  background: var(--amber);
  color: var(--charcoal);
  border-color: var(--amber);
}
.quick-search button:hover {
  background: var(--amber-hot);
  color: var(--charcoal);
}

.section-heading,
.results-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.section-heading { margin-bottom: 18px; }
.section-heading h2 { margin: 0 0 4px; }
.section-heading p { margin: 0; }
.text-link {
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  color: var(--steel-mid);
}
.text-link:hover { color: var(--ink); }
.results-heading { margin: 0 0 14px; }
.results-heading p { margin: 0; color: var(--muted); font-size: 13px; }

/* —— Forms —— */
label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 14px 0 7px;
}
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
input::placeholder,
textarea::placeholder { color: #8a9199; }
textarea { min-height: 96px; resize: vertical; }
input[type=checkbox] {
  width: 20px;
  min-height: 20px;
  accent-color: var(--amber);
}
.select-add {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.select-add select {
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.select-add .icon-btn {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  min-height: 48px;
  height: auto;
  padding: 0;
  flex: 0 0 48px;
  align-self: stretch;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -1px;
}
.select-add .icon-btn .action-icon {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.new-customer { margin-top: 10px; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--steel);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .btn:hover {
  background: var(--steel-mid);
  color: #fff;
}
button.secondary, .btn.secondary {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
button.secondary:hover, .btn.secondary:hover {
  background: var(--bg-deep);
  color: var(--ink);
}
button.danger, .btn.danger {
  background: var(--danger);
  color: #fff;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
}
.filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr auto;
  gap: 16px;
  align-items: end;
}
.filter-grid label { margin-top: 0; }
.filter-actions { align-self: end; }

.flash, .errorbox {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 22px;
  font-weight: 500;
}
.flash {
  background: var(--ok-bg);
  border: 1px solid #b7d4c3;
  color: var(--ok);
}
.errorbox {
  background: var(--danger-bg);
  border: 1px solid #e0b6b6;
  color: var(--danger);
}

/* —— Tables / cards —— */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.panel > .table-wrap {
  margin: 0 -2px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
th, td {
  padding: 14px 14px;
  border-bottom: 1px solid #ebe7e0;
  vertical-align: middle;
}
th {
  background: #f0ece4;
  color: var(--ink-soft);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 700;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #faf7f1; }
td a { font-weight: 650; text-decoration: none; color: var(--ink); }
td a:hover { color: #8a6410; }
.date-cell { font-size: 12px; white-space: nowrap; color: var(--muted); }
.badge {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #ebe7e0;
  color: #3f4750;
  white-space: nowrap;
}
.badge.ready { background: var(--ok-bg); color: var(--ok); }
.badge.hold { background: var(--danger-bg); color: var(--danger); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.event { text-transform: capitalize; font-weight: 600; letter-spacing: 0; }
.serial {
  font-family: var(--font-mono), Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}
.grid2 > .panel { margin-bottom: 0; }
.muted { font-size: 13px; color: var(--muted); }
.stack > * + * { margin-top: 4px; }
.stack > label { margin-bottom: 0; }
.checkrow {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 12px 0;
}
.checkrow input { flex-shrink: 0; margin-top: 4px; }
.checkrow label {
  margin: 0;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 14px;
}

.card-list { display: grid; gap: 12px; }
.card-item {
  padding: 18px;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-item > a {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}
.card-item .meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.back-link {
  display: inline-block;
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 18px;
  font-weight: 600;
  color: var(--muted);
}
.back-link:hover { color: var(--ink); }
.record-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
}
.record-nav a {
  padding: 11px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--card-solid);
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.record-nav a:hover {
  border-color: var(--amber);
  color: var(--ink);
  background: var(--amber-soft);
}

.empty-state {
  text-align: left;
  padding: 36px 28px;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(212, 146, 15, 0.08), transparent 50%),
    var(--card-solid);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}
.empty-state h2,
.empty-state strong {
  display: block;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 10px;
}
.empty-state p { margin: 0 0 18px; max-width: 36rem; }
.empty-state .actions { margin: 0; }
td.empty-state {
  background: transparent;
  border: 0;
  padding: 28px 16px;
}

.report-card { padding: 30px; }
.report-card > p { color: var(--muted); }
.report-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--amber-soft);
  color: #8a6410;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 18px;
}

/* —— Login —— */
body:has(.login-shell) {
  background: var(--charcoal);
}
.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  min-height: calc(100vh - 48px);
  margin: -36px calc(-1 * var(--pad-x)) 0;
  max-width: none;
  width: calc(100% + 2 * var(--pad-x));
}
.login-atmosphere {
  position: relative;
  padding: clamp(36px, 6vw, 72px);
  color: #f3f0ea;
  background:
    linear-gradient(160deg, rgba(20, 23, 27, 0.2), rgba(20, 23, 27, 0.75)),
    linear-gradient(45deg, #1c232c 0%, #2a313a 45%, #1a1f25 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.login-atmosphere::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 48px,
      rgba(232, 168, 42, 0.04) 48px,
      rgba(232, 168, 42, 0.04) 49px
    );
  pointer-events: none;
}
.login-atmosphere > * { position: relative; z-index: 1; }
.login-atmosphere .brand-mark {
  font-size: clamp(48px, 8vw, 72px);
  margin-bottom: 18px;
  display: block;
}
.login-atmosphere h2 {
  color: #fff;
  font-size: clamp(36px, 5vw, 52px);
  max-width: 12ch;
  margin-bottom: 14px;
}
.login-atmosphere p {
  max-width: 28rem;
  color: #b8c0c8;
  font-size: 16px;
}
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 28px;
  background: var(--bg);
}
.login-box {
  width: min(420px, 100%);
  margin: 0;
  padding: 32px;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.login-box h1 {
  font-size: 36px;
  margin-bottom: 8px;
}
.login-box .lead { font-size: 14px; margin-bottom: 22px; }
.login-box button[type="submit"] {
  width: 100%;
  margin-top: 18px;
  background: var(--amber);
  color: #1a1d21;
  border-color: var(--amber);
  font-weight: 700;
}
.login-box button[type="submit"]:hover {
  background: var(--amber-hot);
  color: #1a1d21;
}
.login-brand {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}
.login-brand span {
  display: block;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
  font-weight: 600;
}
.login-app-download {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 22px;
}
.login-app-download .btn {
  width: 100%;
  margin-bottom: 12px;
}
.login-app-download .text-link {
  display: block;
  text-align: center;
  margin-bottom: 12px;
}
.login-app-download > p:last-child {
  text-align: center;
  font-size: 11px;
  margin-bottom: 0;
}

body:has(.login-shell) .foot {
  border-top-color: #2c333c;
  color: #8a9199;
}
body:has(.login-shell) .foot a { color: #c4c9ce; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed;
  left: 12px;
  top: -70px;
  padding: 10px 16px;
  background: #fff;
  z-index: 50;
}
.skip-link:focus { top: 12px; }

/* Settings / admin tables + modals */
.settings-table { min-width: 640px; }
.settings-table .row-inactive td { opacity: 0.72; }
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  white-space: nowrap;
}
.row-actions .btn,
.row-actions button {
  min-height: 44px;
  padding: 10px 12px;
  font-size: 12px;
}
.row-actions form.inline { display: inline-flex; margin: 0; }
.row-actions .icon-btn,
.row-actions form.inline .icon-btn {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  flex: 0 0 44px;
  align-self: center;
  letter-spacing: 0;
  text-transform: none;
}
.row-actions .icon-btn .action-icon {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.row-actions button.danger.icon-btn {
  background: transparent;
  border: 1px solid #c45c4a;
  color: #9a3412;
}
.row-actions button.danger.icon-btn:hover {
  background: #f8e8e4;
  color: #7f1d1d;
}
.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
}
.modal::backdrop {
  background: rgba(20, 23, 27, 0.62);
  backdrop-filter: blur(2px);
}
.modal-card {
  width: min(520px, calc(100vw - 24px));
  max-height: min(90vh, 760px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin: auto;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-top: 3px solid var(--amber);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.28);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.modal-head h2 { margin: 0; font-size: 26px; }
.modal-close { min-height: 44px; }
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.modal-actions button { min-width: 120px; }

.card-item.inactive-loc { opacity: 0.78; border-style: dashed; }
.card-item .actions { margin-top: 12px; margin-bottom: 0; }

.admin-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

@media (min-width: 901px) {
  .mobile-only { display: none !important; }
}

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-banner { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-actions { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .who-desktop { display: none; }
  .who-in-nav {
    display: flex;
    width: 100%;
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid #2c333c;
    justify-content: space-between;
  }
  .top-nav {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 16px var(--pad-x) 20px;
    background: #161a1f;
    border-bottom: 1px solid #2c333c;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
    z-index: 35;
  }
  body.nav-open .top-nav { display: flex; }
  body.nav-open .nav-backdrop { display: block; }
  .top-nav a {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #2c333c;
    background: #1c2128;
  }
  .desktop-only { display: none !important; }
  .login-shell { grid-template-columns: 1fr; min-height: auto; }
  .login-atmosphere { min-height: 240px; padding: 32px 24px; }
  .login-atmosphere h2 { max-width: none; }
  .admin-tiles { grid-template-columns: 1fr; }
  .quick-search { flex-direction: column; }
  .quick-search button { width: 100%; }
}

@media (max-width: 700px) {
  .wrap { padding: 26px var(--pad-x) 40px; }
  .page-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .page-heading > .btn,
  .heading-actions,
  .heading-actions .btn { width: 100%; }
  h1 { font-size: 34px; }
  .lead { font-size: 15px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 16px; }
  .stat b { font-size: 36px; }
  .panel { padding: 18px; }
  .grid2, .filter-grid { grid-template-columns: 1fr; }
  .filter-actions button { width: 100%; }
  .foot { flex-direction: column; gap: 8px; }
  .brand-caption { display: none; }
  .modal-card { width: calc(100vw - 16px); padding: 18px 14px; }
  .row-actions { flex-direction: column; align-items: stretch; }
  .empty-state { padding: 28px 18px; }
  .empty-state h2, .empty-state strong { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a.stat:hover { transform: none; }
}

.drag-col { width: 56px; }
.drag-cell { width: 56px; }
.drag-handle {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: grab;
  touch-action: none;
  border: 1px solid var(--line-strong);
  background: var(--card-solid);
  color: var(--steel);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: -2px;
  line-height: 1;
}
.drag-handle:active { cursor: grabbing; }
tr.is-dragging { opacity: 0.4; }
tr.is-drop-parent { outline: 2px solid var(--amber); outline-offset: -2px; background: var(--amber-soft); }
tr.is-drop-gap { box-shadow: inset 0 3px 0 var(--amber); }

.yard-notes textarea {
  min-height: 220px;
  font-size: 18px;
  line-height: 1.45;
}
.note-status {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.yard-tasks { margin-top: 18px; }
.yard-tasks .btn { min-height: 48px; }
.task-notes { margin-top: 4px; color: var(--ink-soft); white-space: pre-wrap; }
.todo-add { max-width: 520px; margin-bottom: 8px; }
.todo-list { list-style: none; margin: 8px 0 0; padding: 0; }
.todo-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.todo-item.is-done strong { color: var(--muted); text-decoration: line-through; }
.todo-item .row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.todo-item .row-actions form { margin: 0; }

.equip-scroll { overflow-x: auto; padding: 0; }
.equip-table { width: 100%; min-width: 980px; border-collapse: collapse; }
.equip-table th { padding: 10px; text-align: left; }
.equip-table td { padding: 0 4px; vertical-align: middle; border-top: 1px solid var(--line); }
button.cell-edit {
  min-height: 44px;
  width: 100%;
  justify-content: flex-start;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 14px;
  box-shadow: none;
}
button.cell-edit:hover { background: var(--amber-soft); color: var(--ink); }
.equip-action { padding: 6px 8px !important; white-space: nowrap; }
.equip-action button { min-height: 44px; }

.settings-launch { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 20px; }
.settings-launch .btn { min-width: 160px; min-height: 48px; }
.catalog-modal { width: min(1100px, calc(100vw - 16px)); }
.catalog-card {
  width: min(1100px, calc(100vw - 16px));
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
}
.catalog-scroll { overflow: auto; min-height: 120px; }
.catalog-card .modal-head { align-items: center; }
.sheet-modal { width: min(1140px, calc(100vw - 16px)); }
.sheet-card { width: min(1140px, calc(100vw - 16px)); max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
.sheet-scroll { overflow: auto; min-height: 180px; }
.sheet-date { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; font-weight: 700; }
.sheet-date input { max-width: 220px; min-height: 44px; }
.sheet-tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.sheet-tabs button { min-height: 44px; }
.sheet-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 8px; }
.sheet-gap { height: 18px; }
.sheet-title { margin: 0 0 6px; font-size: 18px; letter-spacing: 0.04em; }
.sheet-panel { border: 1px solid var(--ink); margin-bottom: 8px; }
.sheet-panel h3 { margin: 0; padding: 6px; text-align: center; border-bottom: 1px solid var(--ink); font-size: 14px; }
.sheet-panel table, .sheet-scroll > table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sheet-panel th, .sheet-panel td, .sheet-scroll > table th, .sheet-scroll > table td { border: 1px solid var(--line-strong); padding: 4px; text-align: center; }
.sheet-input { min-height: 44px; width: 100%; text-transform: none; letter-spacing: 0; font-weight: 500; }
@media (max-width: 800px) { .sheet-pair { grid-template-columns: 1fr; } }
@page {
  size: landscape;
  margin: 0.3in;
}
@media print {
  body.print-sheet header,
  body.print-sheet .page-heading,
  body.print-sheet .grid2,
  body.print-sheet .foot,
  body.print-sheet .no-print,
  body.print-sheet .modal-head,
  body.print-sheet .modal-actions,
  body.print-sheet .sheet-tabs { display: none !important; }
  body.print-sheet .sheet-modal,
  body.print-sheet .sheet-card,
  body.print-sheet .sheet-scroll {
    position: static !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }
  body.print-sheet .sheet-pair { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  body.print-sheet .sheet-panel th,
  body.print-sheet .sheet-panel td,
  body.print-sheet .sheet-scroll table th,
  body.print-sheet .sheet-scroll table td,
  body.print-sheet .sheet-input {
    white-space: nowrap;
    overflow: hidden;
    font-size: 8px;
    line-height: 1.1;
    padding: 1px 2px;
  }
  body.print-sheet .sheet-input { min-height: 0; border: 0; background: transparent; }
  body.print-sheet #sheetPrint { transform-origin: top left; }
}
.todo-item button, .todo-add button { min-height: 44px; }


/* YardManage identity: a junction, yard boundary and storage lanes. */
.brand { align-items: center; }
.brand-logo { display: block; width: 194px; height: auto; max-width: 100%; }
.login-atmosphere .brand-logo { width: min(388px, 100%); margin-bottom: 24px; }
@media (max-width: 600px) { .brand-logo { width: 176px; } }
