:root{
  /* Warm stone + amber — matches marketing site (logistics / industrial) */
  --bg: #e7e5e4;
  --bg-mid: #d6d3d1;
  --panel: rgba(255, 252, 255, 0.94);
  --panelSolid: #fafaf9;
  --border: rgba(120, 113, 108, 0.18);
  --border-strong: rgba(154, 52, 18, 0.3);
  --text: #1c1917;
  --muted: #57534e;
  --muted2: #78716c;
  --primary: #c2410c;
  --primary-dim: rgba(234, 88, 12, 0.18);
  --primary2: #ea580c;
  --danger: #b91c1c;
  --warn: #b45309;
  --ok: #15803d;
  --shadow: 0 8px 32px rgba(28, 25, 23, 0.08), 0 2px 8px rgba(28, 25, 23, 0.04);
  --shadow-soft: 0 4px 24px rgba(28, 25, 23, 0.06);
  --radius-lg: 16px;
  --radius-md: 12px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --input-bg: #ffffff;
  --input-bg-focus: #fff7ed;
  --surface-raised: #ffedd5;
  --brand-title-gradient: linear-gradient(135deg, #9a3412 0%, #c2410c 42%, #ea580c 100%);
  --body-gradient:
    linear-gradient(180deg, #fafaf9 0%, #f5f5f4 22%, #e7e5e4 50%, #d6d3d1 76%, #c4c0bb 100%);
  --body-gradient-mobile:
    linear-gradient(180deg, #fafaf9 0%, #f5f5f4 28%, #e7e5e4 58%, #c4c0bb 100%);
  --body-gradient-narrow:
    linear-gradient(180deg, #fafaf9 0%, #f5f5f4 38%, #e7e5e4 68%, #c4c0bb 100%);
  --topbar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(250, 250, 249, 0.97) 100%);
  --footer-bg: linear-gradient(180deg, rgba(245, 245, 244, 0.85) 0%, rgba(231, 229, 228, 0.55) 100%);
  --panel-inset: 0 0 0 1px rgba(255, 255, 255, 0.85) inset;
  --stat-inset: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

html{
  min-height: 100%;
  color-scheme: light;
}

body{
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-feature-settings: "ss01" on, "cv11" on;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Stretch gradient with full page height — fixed height:100% on body stopped below the fold (grey canvas). */
  background-color: var(--bg);
  background-image: var(--body-gradient);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-attachment: scroll;
  color: var(--text);
}

.app{
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-footer{
  margin-top: auto;
  padding: 18px 18px 22px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
}

.footer-history-block{
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-history-title{
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

.footer-powered{
  display: flex;
  justify-content: flex-end;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-site-link{
  margin: 0;
  width: 100%;
  max-width: 1200px;
  text-align: center;
  font-size: 0.875rem;
}

.footer-site-link a{
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
}

.footer-site-link a:hover{
  color: var(--primary);
  text-decoration: underline;
}

.history.history--footer{
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  align-items: start;
}

.history.history--footer > .info-box{
  grid-column: 1 / -1;
  max-width: 40rem;
}

.topbar{
  padding: 18px 22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar--tool{
  align-items: center;
}

.toolbar-title{
  min-width: 0;
  flex: 1 1 auto;
}

.toolbar-title .brand-title{
  margin: 0;
}

.toolbar-title .brand-subtitle{
  margin: 4px 0 0;
}

.brand-title{
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.375rem;
  line-height: 1.15;
  background: var(--brand-title-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-subtitle{
  color: var(--muted);
  font-size: 12px;
  margin-top:4px;
}
.brand{
  display:flex;
  align-items:center;
  gap: 0;
}

a.brand.brand--home{
  text-decoration: none;
  color: inherit;
}

.brand-copy{
  display:flex;
  flex-direction:column;
}

.topbar-actions{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  align-items:center;
}

/* Match other toolbar buttons; keep Account at end (after Print Layout). */
.topbar-actions > .tool-account-cta.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  box-sizing: border-box;
}

.demo-badge{
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  margin-right: 4px;
}

.modal{
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal[hidden]{
  display: none;
}
.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(41, 37, 36, 0.45);
  backdrop-filter: blur(4px);
}
.modal-card{
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--panelSolid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--panel-inset);
  padding: 20px 20px 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.modal-title{
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
}
.modal-hint{
  font-size: 11px;
  line-height: 1.45;
  margin: 0 0 14px;
}
.modal-hint code{
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 6px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
}
.modal-form{
  padding: 0;
}
.modal-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
}
.auth-modal-error{
  margin-top: 10px;
  margin-bottom: 0;
  font-size: 13px;
}

.powered-by-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 252, 248, 0.75);
  text-decoration:none;
  color: var(--muted);
}

.powered-by-link:hover{
  border-color: rgba(120, 113, 108, 0.35);
  background: #fffcf7;
}

.powered-by-logo{
  height: 88px;
  width: auto;
  max-width: min(320px, 100%);
  display: block;
  filter: none;
  transition: filter 0.2s ease;
}

.layout{
  display:grid;
  grid-template-columns: 320px 1fr 340px;
  grid-template-areas:
    "left center right"
    "items items items";
  grid-template-rows: auto auto;
  gap: 18px;
  padding: 4px 18px 22px;
  /* Stretch columns in row 1 so all three panels share the same height (tallest wins). */
  align-items: stretch;
}

.panel-left{
  grid-area: left;
}
.panel-center{
  grid-area: center;
}
.panel-right{
  grid-area: right;
}
.panel-items-wide{
  grid-area: items;
  align-self: start;
}

/* Row 1: equal-height cards; content stays top-aligned inside each panel */
.panel-left,
.panel-right{
  display: flex;
  flex-direction: column;
  min-height: 0;
}

@media (max-width: 1100px){
  .layout{
    grid-template-columns: 1fr;
    grid-template-areas:
      "center"
      "items"
      "left"
      "right";
  }
  .panel-center{
    min-height: auto;
  }
  .topbar{
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .topbar-actions{
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 768px){
  body{
    /* Softer mobile gradient to avoid harsh transitions/banding */
    background: var(--body-gradient-mobile);
    min-height: 100dvh;
    background-attachment: scroll;
  }
  .topbar{
    padding: 12px 12px;
  }
  .brand-title{
    font-size: 20px;
  }
  .layout{
    gap: 10px;
    padding: 0 10px 12px;
  }
  .topbar-actions{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .topbar-actions .btn{
    width: 100%;
  }
  .stats-grid{
    grid-template-columns: 1fr;
  }
  .view-controls{
    gap: 10px;
    align-items: stretch;
  }
  .compact-field{
    min-width: 0;
    width: 100%;
  }
  .spacer{
    display:none;
  }
  .three-container{
    height: 360px;
  }
  .row-actions{
    flex-direction: column;
    align-items: stretch;
  }
  .row-actions .btn{
    width: 100%;
  }
  .item-card-head{
    flex-direction: column;
    align-items: stretch;
  }
  .item-card-actions{
    width: 100%;
    justify-content: stretch;
  }
  .item-card-actions .item-dup,
  .item-card-actions .item-remove{
    flex: 1;
    min-width: 0;
  }
  .history-top{
    flex-direction: column;
    align-items: stretch;
  }
  .history-actions{
    justify-content: flex-start;
  }
  .app-footer{
    padding: 14px 12px 18px;
    gap: 14px;
  }
  .footer-powered{
    justify-content: center;
  }
  .powered-by-logo{
    height: 68px;
  }
}

@media (max-width: 480px){
  body{
    background: var(--body-gradient-narrow);
  }
  .brand-title{
    font-size: 18px;
  }
  .topbar-actions{
    grid-template-columns: 1fr;
  }
  .form-grid, .stats-grid{
    padding: 10px 10px;
    gap: 10px;
  }
  .section-subtitle{
    margin: 8px 10px 6px;
  }
  .items-list, .warnings{
    padding-left: 10px;
    padding-right: 10px;
  }
  .three-container{
    height: 300px;
  }
  .powered-by-logo{
    height: 58px;
  }
}

.panel{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    var(--shadow-soft),
    var(--panel-inset);
}

.panel-title{
  padding: 15px 16px 11px;
  border-bottom: 1px solid rgba(120, 113, 108, 0.12);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-left, .panel-right, .panel-items-wide{
  padding: 0;
}

.panel-center{
  display: flex;
  flex-direction: column;
  min-height: 620px;
}

.panel-center .panel-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.form-grid, .stats-grid{
  padding: 14px 16px;
  display:grid;
  gap: 14px;
}

.stats-grid{
  grid-template-columns: 1fr 1fr;
}

.stat-card{
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 12px;
  background: var(--surface-raised);
  box-shadow: var(--stat-inset);
}
.stat-label{
  color: var(--muted2);
  font-size: 12px;
}
.stat-value{
  margin-top: 4px;
  font-weight: 850;
  font-size: 16px;
}
.stat-sublabel{
  margin-top: 2px;
  color: var(--muted2);
  font-size: 11px;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.section-subtitle{
  margin: 10px 16px 8px;
  color: var(--muted2);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-grid .field{
  display:flex;
  flex-direction:column;
  gap: 6px;
}

.field .label{
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
}

input[type="text"],
input[type="number"]{
  background: var(--input-bg);
  border: 1px solid rgba(120, 113, 108, 0.22);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input[type="text"]:hover,
input[type="number"]:hover{
  border-color: rgba(120, 113, 108, 0.35);
}
input[type="text"]:focus,
input[type="number"]:focus{
  border-color: rgba(154, 52, 18, 0.45);
  box-shadow: 0 0 0 3px var(--primary-dim);
  background: var(--input-bg-focus);
}
input[type="text"]::placeholder{
  color: rgba(120, 113, 108, 0.45);
}
input[type="number"]{
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Native selects: custom chevron + no OS chrome (kept separate so focus doesn’t drop the arrow) */
select{
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%2357534e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--text);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid rgba(120, 113, 108, 0.22);
  border-radius: var(--radius-md);
  padding: 11px 2.875rem 11px 14px;
  background-color: var(--input-bg);
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
  min-height: 2.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
select::-ms-expand{
  display: none;
}
select:hover{
  border-color: rgba(120, 113, 108, 0.38);
  background-color: #fffcf7;
}
select:focus{
  border-color: rgba(154, 52, 18, 0.45);
  box-shadow: 0 0 0 3px var(--primary-dim);
  background-color: var(--input-bg-focus);
}
select:active{
  background-color: #faf7f2;
}
select:disabled{
  opacity: 0.5;
  cursor: not-allowed;
}
select option{
  background-color: var(--panelSolid);
  color: var(--text);
  font-weight: 500;
  padding: 0.5rem;
}

.form-grid .field-wide{
  grid-column: 1 / -1;
}

/* Manual vs Auto: two-segment control (radios styled as a single toggle strip) */
.load-mode-field .load-mode-toggle{
  display: flex;
  width: 100%;
  padding: 4px;
  border-radius: var(--radius-md);
  background: rgba(120, 113, 108, 0.1);
  border: 1px solid rgba(120, 113, 108, 0.22);
  gap: 4px;
  box-sizing: border-box;
}
.load-mode-option{
  flex: 1;
  position: relative;
  min-width: 0;
  margin: 0;
}
.load-mode-option input[type="radio"]{
  position: absolute;
  inset: 0;
  opacity: 0.01;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.load-mode-option__text{
  display: block;
  padding: 9px 10px;
  border-radius: calc(var(--radius-md) - 3px);
  text-align: center;
  font-weight: 750;
  font-size: 13px;
  color: var(--muted2);
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
  pointer-events: none;
}
.load-mode-option:has(input:checked) .load-mode-option__text{
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.load-mode-option:has(input:focus-visible) .load-mode-option__text{
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.form-grid{
  grid-template-columns: 1fr;
}

.form-grid .field-row{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
}

.form-grid .field-row .check{
  flex: 1 1 130px;
}

.check{
  display:flex;
  align-items:center;
  gap: 10px;
  color: var(--text);
  user-select:none;
  font-size: 13px;
}

.check input{
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.btn{
  border: 1px solid rgba(120, 113, 108, 0.22);
  background: var(--surface-raised);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-weight: 700;
  font-family: inherit;
  cursor:pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover{
  border-color: rgba(120, 113, 108, 0.38);
  background: #fffcf7;
}
.btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-dim);
  border-color: var(--border-strong);
}
.btn:active{
  transform: translateY(1px);
}
.btn-primary{
  color: #fff;
  background: linear-gradient(165deg, #ea580c 0%, #c2410c 45%, #7c2d12 100%);
  border-color: rgba(154, 52, 18, 0.45);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 8px 20px rgba(194, 65, 12, 0.28);
}
.btn-primary:hover{
  filter: brightness(1.06);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 10px 28px rgba(124, 45, 18, 0.28);
}
.btn-primary:focus-visible{
  box-shadow:
    0 0 0 3px var(--primary-dim),
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 8px 20px rgba(124, 45, 18, 0.26);
}
.btn-danger{
  border-color: rgba(185, 28, 28, 0.45);
}
.btn-danger.btn-soft{
  background: rgba(254, 226, 226, 0.85);
  color: #991b1b;
}
.btn-ghost{
  background: rgba(255, 252, 247, 0.65);
}
.row-actions{
  padding: 0 16px 8px;
  display:flex;
  gap: 10px;
  align-items:center;
}
.row-actions .btn{
  flex:1;
}

.items-strip-hint{
  margin: 0;
  padding: 0 16px 14px;
  font-size: 0.8125rem;
  line-height: 1.45;
  border-bottom: 1px solid rgba(120, 113, 108, 0.08);
}

.items-list{
  padding: 0 16px 16px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}

/* Full-width strip below 3D: fewer, wider cards — min width avoids 5 cramped columns on desktop */
.items-list.items-list--grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 18px 20px;
  align-items: start;
  padding: 16px 16px 22px;
  box-sizing: border-box;
}
@media (min-width: 1100px){
  .items-list.items-list--grid{
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr));
  }
}
@media (max-width: 639px){
  .items-list.items-list--grid{
    grid-template-columns: 1fr;
    gap: 16px;
    padding-left: 12px;
    padding-right: 12px;
  }
}

.items-list.items-list--grid > .items-empty-hint{
  grid-column: 1 / -1;
  max-width: 36rem;
}
.item-card{
  border-radius: var(--radius-md);
  border: 1px solid rgba(120, 113, 108, 0.12);
  background: var(--surface-raised);
  padding: 16px 18px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.item-card--default{
  border-color: rgba(220, 38, 38, 0.55);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset, 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.item-card-sites{
  margin-top: 0;
  font-size: 12px;
  line-height: 1.5;
  padding-top: 2px;
}
.item-card-sites b{
  font-weight: 900;
}
.item-card-sites .dot{
  margin: 0 6px;
  opacity: 0.8;
}

.item-card-dims-wrap{
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(120, 113, 108, 0.2);
}
.item-card-dims-inner{
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.item-card-dims-hint{
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
}
.item-dims-toggle{
  margin-bottom: 4px;
  align-self: flex-start;
}
.item-card-default-editor{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(120, 113, 108, 0.25);
  display: grid;
  gap: 10px;
}
.item-card-default-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
  align-items: start;
}
.item-card-default-save{
  display: flex;
  flex-direction: column;
  gap: 0;
}
.item-card-default-save .btn{
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
  min-height: 44px;
  box-sizing: border-box;
}
@media (max-width: 520px){
  .item-card-default-grid{
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.item-card .field{
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.item-card input[type="number"]{
  min-height: 44px;
  font-size: 0.9375rem;
  width: 100%;
  box-sizing: border-box;
}
.item-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px 14px;
  flex-wrap: wrap;
}
.item-card-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  justify-content: flex-end;
  flex-shrink: 0;
  align-items: center;
}
.item-card-plan-included{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}
.item-card-priority{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: auto;
  font-size: 12px;
  font-weight: 700;
  color: #9a3412;
}
.item-unload-trailer{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
}
.item-dup{
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(234, 88, 12, 0.35);
  background: rgba(255, 237, 213, 0.9);
  color: #c2410c;
  cursor: pointer;
  font-weight: 800;
}
.item-dup:hover{
  background: rgba(254, 215, 170, 0.95);
}
.item-card-title{
  display:flex;
  flex-direction:column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 12rem;
}
.item-card-title strong{
  font-size: 0.9375rem;
  line-height: 1.3;
  word-break: break-word;
}
.item-card-title span,
.item-card-subtitle{
  color: var(--muted2);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.item-remove{
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(185, 28, 28, 0.35);
  background: rgba(254, 226, 226, 0.75);
  color: #991b1b;
  cursor:pointer;
  font-weight: 800;
}

.item-card-meta{
  margin-top: 0;
  display:flex;
  flex-wrap:wrap;
  gap: 8px 10px;
  align-items: flex-start;
}
.item-card-meta .pill--dim{
  flex: 1 1 100%;
  max-width: 100%;
  line-height: 1.45;
  border-radius: 10px;
}
.pill--warn{
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(254, 242, 242, 0.75);
  color: #991b1b;
  font-weight: 700;
}
.pill{
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid rgba(120, 113, 108, 0.18);
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.6);
  line-height: 1.35;
  max-width: 100%;
  word-break: break-word;
}

.view-controls-wrap{
  flex-wrap: wrap;
  align-items: flex-end;
}

.deck-move-target{
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding-top: 4px;
}
.deck-move-target .label{
  font-size: 12px;
  color: var(--muted);
}
.deck-move-target-keys{
  font-size: 11px;
}

.selected-pallet-toolbar{
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 10px;
  margin-top: 4px;
  background: #fef9c3;
  border: 1px dashed #ca8a04;
  border-radius: 8px;
}
.selected-pallet-toolbar .label{
  font-size: 12px;
  font-weight: 600;
  color: #78350f;
  margin-right: 4px;
}
.selected-pallet-toolbar[hidden]{
  display: none;
}

.canvas-stack{
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  justify-content: flex-start;
  align-items: stretch;
}

/* Single 3D view: trailer #2 is fully removed from layout (not just opacity). */
.canvas-stack:not(.canvas-stack--overspill-on) #threeHost2{
  display: none !important;
}
.canvas-stack:not(.canvas-stack--overspill-on) #threeHost{
  flex: 1 1 auto;
}

/* Two views: share vertical space evenly when overspill is on */
.canvas-stack--overspill-on .three-host{
  flex: 1 1 0;
  min-height: 0;
}

.three-host{
  padding: 10px 16px 6px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.three-host--secondary{
  flex: 0 0 auto;
  min-height: 0;
  padding-top: 2px;
  padding-bottom: 4px;
}

.three-host--active .three-container-wrap{
  border-color: rgba(154, 52, 18, 0.35);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55) inset, 0 0 0 3px rgba(234, 88, 12, 0.12);
}
.three-container-wrap{
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(120, 113, 108, 0.15);
  background: #e7e5e4;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55) inset;
}

.three-hover-tip{
  position: absolute;
  z-index: 5;
  max-width: min(420px, calc(100% - 24px));
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
  pointer-events: none;
  font-size: 12px;
  line-height: 1.35;
}
.three-hover-tip b{
  font-weight: 900;
}

.three-empty-overlay{
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  pointer-events: none;
  background: rgba(250, 247, 242, 0.88);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.three-empty-overlay[hidden]{
  display: none;
}

.three-container{
  position: relative;
  z-index: 1;
  width: 100%;
  height: 520px;
}

.stats-trailer2-block{
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.stats-trailer-label{
  margin-bottom: 4px !important;
}

.overspill-controls{
  padding: 10px 10px 2px;
  border-radius: 12px;
  border: 1px dashed rgba(120, 113, 108, 0.25);
  background: rgba(255, 255, 255, 0.4);
}
.three-hint{
  font-size: 11px;
  margin: 0;
  padding: 0 4px;
  color: var(--muted2);
  line-height: 1.35;
}

.row-actions-split{
  flex-wrap: wrap;
}

.pdf-import-wrap{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
}
.pdf-import-toggle{
  font-size: 0.8125rem;
  font-weight: 650;
  max-width: 100%;
}
.pdf-import-toggle span{
  line-height: 1.35;
}
@media (max-width: 768px){
  .pdf-import-wrap{
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }
  .pdf-import-wrap .btn{
    width: 100%;
  }
}

.trailer-deck-info{
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
}

.custom-trailer-grid .field-wide{
  grid-column: 1 / -1;
}

.legend{
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(120, 113, 108, 0.1);
}
.legend-title{
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.legend-items{
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.legend-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.legend-left{
  display:flex;
  align-items:center;
  gap: 10px;
}
.swatch{
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.swatch--default{
  box-shadow: 0 0 0 2px #dc2626;
}
.legend-sites{
  font-size: 10px;
  color: var(--muted2);
  margin-top: 2px;
  line-height: 1.25;
  max-width: 240px;
}
.legend-name{
  font-size: 12px;
  color: var(--text);
}
.legend-count{
  font-size: 12px;
  color: var(--muted2);
  font-weight: 700;
}

.view-controls{
  padding: 14px 16px 0;
  display:flex;
  gap: 16px;
  flex-wrap:wrap;
  align-items:center;
}

.compact-field{
  min-width: 230px;
}
.compact-field .label{
  display:block;
  margin-bottom: 5px;
}

.spacer{
  flex: 1;
}

.btn-small{
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

/* Collapse when pack results leave nothing (errors-only strip). */
.alerts-section:not(:has(.warning)) {
  display: none;
}

.warnings{
  padding: 0 16px 12px;
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.warning{
  border-radius: var(--radius-md);
  padding: 9px 12px;
  border: 1px solid rgba(120, 113, 108, 0.14);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 12px;
}
.warning.error{
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(254, 226, 226, 0.65);
  color: #7f1d1d;
}
.warning.warn{
  border-color: rgba(120, 113, 108, 0.18);
  background: rgba(245, 245, 244, 0.9);
  color: var(--text);
}
.warning.muted{
  color: var(--muted);
  font-size: 12px;
}

.history{
  padding: 0 16px 16px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.history-card{
  border-radius: var(--radius-md);
  border: 1px solid rgba(120, 113, 108, 0.12);
  background: var(--surface-raised);
  padding: 12px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
}
.history-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 10px;
}
.history-title{
  display:flex;
  flex-direction:column;
  gap: 3px;
}
.history-title strong{
  font-size: 12px;
}
.history-title span{
  font-size: 12px;
  color: var(--muted2);
}
.history-actions{
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.mini-btn{
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(120, 113, 108, 0.2);
  background: #fffcf7;
  color: var(--text);
  cursor:pointer;
  font-weight: 700;
  font-size: 12px;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.mini-btn:hover{
  border-color: rgba(120, 113, 108, 0.35);
  background: #faf7f2;
}
.mini-btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.mini-btn.danger{
  border-color: rgba(185, 28, 28, 0.35);
  background: rgba(254, 226, 226, 0.85);
  color: #991b1b;
}
.muted{
  color: var(--muted2);
}
.info-box{
  padding: 10px 12px;
  border: 1px solid rgba(120, 113, 108, 0.14);
  background: rgba(255, 252, 247, 0.85);
  border-radius: 14px;
  color: var(--text);
  line-height: 1.5;
  font-size: 12px;
}

.brand-curve{
  width: 100%;
  pointer-events: none;
  flex-shrink: 0;
}
/* Top decorative strip removed from layout — keep rule harmless if markup returns */
.brand-curve--top{
  display: none;
  height: 0;
  min-height: 0;
  overflow: hidden;
}
.brand-curve--bottom{
  height: 48px;
  margin-top: auto;
  background:
    linear-gradient(-18deg, rgba(234, 88, 12, 0.2) 0%, transparent 55%),
    linear-gradient(18deg, rgba(120, 113, 105, 0.14) 0%, transparent 50%),
    linear-gradient(0deg, rgba(231, 229, 228, 0.85) 0%, rgba(214, 211, 209, 0.35) 100%);
}
.brand-logo-img{
  height: 64px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
  margin-right: 14px;
  flex-shrink: 0;
}
.brand{
  align-items: center;
}
.meta-row{
  margin-bottom: 12px;
}

@media (prefers-reduced-motion: reduce){
  *{ transition:none !important; }
}

