.orders-page {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper-2);
}

.orders-page::before {
  opacity: .025;
}

.tracker-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(20px, 5vw, 60px);
  background:
    radial-gradient(circle at 18% 10%, rgba(0, 142, 150, .28), transparent 32%),
    radial-gradient(circle at 86% 88%, rgba(239, 178, 45, .22), transparent 30%),
    linear-gradient(145deg, #102940, #08131e 72%);
}

.tracker-auth-card {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: clamp(26px, 5vw, 48px);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 22px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .38);
}

.tracker-auth-logo img {
  width: min(230px, 65vw);
  max-height: 64px;
  object-fit: contain;
  object-position: left center;
}

.tracker-eyebrow,
.tracker-title-block span {
  margin: 0;
  color: #ea580c;
  font-size: .76rem;
  font-weight: 950;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.tracker-auth-card h1 {
  margin: -8px 0 0;
  color: var(--navy);
  font-size: clamp(2.25rem, 8vw, 3.7rem);
  line-height: 1;
  letter-spacing: -.04em;
}

.tracker-auth-card > p:not(.tracker-eyebrow, .auth-error) {
  margin: 0;
  color: var(--muted);
}

.google-auth-wrap {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--paper);
}

.google-signin-button {
  min-height: 44px;
}

.auth-helper {
  max-width: 420px;
  margin: 0;
  color: var(--soft);
  font-size: .82rem;
  text-align: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--soft);
  font-size: .76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.password-auth-form {
  display: grid;
  gap: 8px;
}

.password-auth-form label {
  color: var(--ink);
  font-size: .85rem;
  font-weight: 900;
}

.password-auth-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.password-auth-row .button,
.tracker-back-link {
  min-height: 48px;
  justify-content: center;
}

.auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  color: #8f2115;
  background: rgba(231, 71, 47, .12);
  font-weight: 800;
}

.tracker-app {
  min-height: 100vh;
  min-height: 100dvh;
}

.tracker-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 78px;
  display: grid;
  grid-template-columns: auto minmax(210px, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 12px clamp(18px, 3vw, 44px);
  border-bottom: 3px solid var(--yellow);
  color: var(--white);
  background: rgba(16, 41, 64, .97);
  box-shadow: 0 10px 28px rgba(16, 41, 64, .24);
  backdrop-filter: blur(14px);
}

.tracker-brand img {
  width: clamp(125px, 11vw, 180px);
  max-height: 48px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.tracker-title-block h1 {
  margin: 0;
  color: var(--white);
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.05;
  letter-spacing: -.02em;
}

.tracker-title-block span {
  color: rgba(255, 255, 255, .72);
}

.tracker-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.tracker-header-actions .button {
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.tracker-header-actions .button.quiet {
  color: var(--white) !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tracker-header-actions .button.quiet:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  color: var(--white) !important;
}

.tracker-return-button {
  border: 0 !important;
  color: #ffffff !important;
  background: #ea580c !important;
  font-weight: 900 !important;
  transition: transform 0.15s ease, background 0.15s ease !important;
}

.tracker-return-button:hover {
  background: #c2410c !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

.tracker-create-button {
  border: 0;
  color: var(--ink);
  background: var(--yellow);
  font-weight: 950;
}

.role-pill,
.source-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 950;
  letter-spacing: .045em;
  line-height: 1.2;
  text-transform: uppercase;
}

.role-pill {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, .25);
  color: rgba(255, 255, 255, .86);
}

.tracker-main {
  width: min(100%, 1920px);
  margin: 0 auto;
  padding: clamp(14px, 2.2vw, 34px);
}

.tracker-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(260px, 1fr) minmax(190px, .45fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 8px 24px rgba(20, 24, 32, .06);
}

.tracker-summary {
  display: grid;
}

.tracker-summary strong {
  color: var(--navy);
  font-size: 1.05rem;
}

.tracker-summary span {
  color: var(--soft);
  font-size: .8rem;
}

.tracker-search,
.tracker-filter {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  width: 100%;
}

.tracker-search input,
.tracker-filter select {
  width: 100%;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 600;
  box-sizing: border-box;
  margin: 0;
  vertical-align: middle;
}

.status-guide {
  position: relative;
  display: flex;
  align-items: center;
}

.status-guide summary {
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--navy);
  background: var(--paper);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 900;
  list-style: none;
  white-space: nowrap;
  box-sizing: border-box;
  margin: 0;
}

.status-guide summary::-webkit-details-marker {
  display: none;
}

.status-guide p {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: min(420px, 85vw);
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--white);
  box-shadow: var(--shadow);
  font-size: .86rem;
}

.tracker-workspace {
  min-height: calc(100vh - 190px);
  display: grid;
  grid-template-columns: minmax(340px, .72fr) minmax(0, 1.65fr);
  gap: 16px;
  align-items: start;
}

.tracker-list-panel,
.tracker-detail-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 12px 36px rgba(20, 24, 32, .07);
}

.tracker-list-panel {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.tracker-list {
  display: grid;
}

.order-list-card {
  width: 100%;
  display: grid;
  gap: 9px;
  padding: 16px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  background: transparent;
  text-align: left;
  transition: background .18s ease, box-shadow .18s ease;
}

.order-list-card:hover {
  background: rgba(239, 178, 45, .07);
}

.order-list-card.is-selected {
  background: rgba(0, 142, 150, .09);
  box-shadow: inset 4px 0 0 var(--teal);
}

.order-list-card-top,
.order-list-card-bottom,
.detail-heading,
.detail-actions,
.sheet-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.order-list-id {
  color: var(--soft);
  font-size: .73rem;
  font-weight: 900;
  letter-spacing: .035em;
}

.order-list-title {
  margin: 0;
  color: var(--navy);
  font-size: 1rem;
  line-height: 1.25;
}

.order-list-customer {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
}

.order-list-date {
  color: var(--soft);
  font-size: .74rem;
  white-space: nowrap;
}

.source-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.source-online {
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  box-shadow: none !important;
}

.source-worker {
  color: #ffffff;
  background: #ea580c;
  box-shadow: none !important;
}

.order-list-content-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.order-list-text-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.order-list-thumb {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.order-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
  box-sizing: border-box;
}

.order-list-thumb.file-thumb {
  background: var(--paper-2);
}

.order-list-thumb .thumb-ext {
  font-size: 0.65rem;
  font-weight: 900;
  color: var(--navy);
  text-transform: uppercase;
}

.status-pill {
  padding: 6px 9px;
  color: var(--navy);
  background: rgba(16, 41, 64, .09);
}

.status-new { color: #8a5b00; background: rgba(239, 178, 45, .18); }
.status-waiting { color: #8f2115; background: rgba(231, 71, 47, .13); }
.status-materials { color: #69400a; background: rgba(239, 178, 45, .16); }
.status-production { color: #075f64; background: rgba(0, 142, 150, .14); }
.status-ready { color: #315f31; background: rgba(92, 142, 91, .17); }
.status-completed { color: #315f31; background: rgba(92, 142, 91, .24); }
.status-cancelled { color: #6d6870; background: rgba(20, 24, 32, .1); }

.tracker-list-empty {
  padding: 32px 18px;
  color: var(--soft);
  text-align: center;
}

.tracker-detail-panel {
  min-width: 0;
  padding: clamp(14px, 2vw, 28px);
}

.tracker-empty-state {
  min-height: 55vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  color: var(--soft);
  text-align: center;
}

.tracker-empty-state > span {
  color: var(--yellow);
  font-size: 3rem;
}

.tracker-empty-state h2,
.tracker-empty-state p {
  margin: 0;
}

.tracker-empty-state h2 {
  color: var(--navy);
}

.digital-order-sheet {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.detail-heading {
  padding-bottom: 10px;
  border-bottom: 2px solid var(--navy);
}

.detail-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: 1.35rem;
  line-height: 1.15;
}

.detail-heading p {
  margin: 3px 0 0;
  color: var(--soft);
  font-size: .8rem;
}

.detail-heading-badges {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.detail-actions .button,
.sheet-actions .button {
  min-height: 38px;
  padding: 6px 14px;
  font-size: 0.85rem;
  justify-content: center;
}

.danger-button {
  border-color: rgba(231, 71, 47, .35) !important;
  color: var(--red) !important;
}

.editor-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  min-height: 36px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  width: fit-content;
  margin: 6px 0 6px 0;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--navy);
  transform: none !important;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  line-height: 1;
  box-sizing: border-box;
}

.editor-back-btn:hover {
  background: var(--white);
  border-color: var(--navy);
  color: var(--navy);
  transform: none !important;
}

/* ==========================================
   ROCK-SOLID FORM SHEET & GRID LAYOUT
   ========================================== */
.order-form-sheet {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--paper);
  box-sizing: border-box;
}

.form-section h3 {
  margin: 0 0 4px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: var(--navy);
  font-size: .8rem;
  font-weight: 950;
  letter-spacing: .055em;
  text-transform: uppercase;
}

/* Grids: 2-column or 3-column with strict column alignment */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

.form-grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.form-grid.three {
  grid-template-columns: repeat(3, 1fr);
}

.form-grid.four {
  grid-template-columns: repeat(4, 1fr);
}

/* Single Form Field Container */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Strict Single-Line Label (Exactly 18px height) */
.form-field > span {
  display: flex;
  align-items: center;
  height: 18px;
  min-height: 18px;
  max-height: 18px;
  line-height: 18px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  padding: 0;
}

/* Strict Input Box Height (Exactly 36px for all input types) */
.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field input[type="tel"],
.form-field input[type="email"],
.form-field input[type="search"],
.form-field select,
.form-field .custom-select-trigger {
  box-sizing: border-box !important;
  width: 100% !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  line-height: 34px !important;
  padding: 0 10px !important;
  margin: 0 !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background-color: var(--white) !important;
  color: var(--navy) !important;
  font-family: inherit !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  display: flex !important;
  align-items: center !important;
  vertical-align: middle !important;
  outline: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
}

/* Native WebKit Date/Number inner element resets */
.form-field input[type="date"]::-webkit-calendar-picker-indicator {
  margin: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0.75;
  height: 16px;
  width: 16px;
}

.form-field input[type="number"]::-webkit-inner-spin-button,
.form-field input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
}

.form-field textarea {
  width: 100% !important;
  min-height: 60px !important;
  padding: 8px 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background-color: var(--white) !important;
  color: var(--navy) !important;
  font-family: inherit !important;
  font-size: 0.85rem !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  resize: vertical;
}

.form-field input:disabled,
.form-field select:disabled,
.form-field textarea:disabled,
.form-field .custom-select-trigger:disabled {
  opacity: 1 !important;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink) !important;
  background: rgba(255, 255, 255, .75) !important;
}

/* Custom Select Component Inner Layout */
.custom-select-wrapper {
  position: relative;
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.custom-select-trigger {
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  padding: 0 10px !important;
  margin: 0 !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background: var(--white) !important;
  color: var(--navy) !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  user-select: none !important;
}

.custom-select-trigger:hover {
  border-color: var(--navy) !important;
}

.custom-select-trigger.is-open {
  border-color: #ea580c !important;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15) !important;
}

.custom-select-label {
  display: flex !important;
  align-items: center !important;
  height: 100% !important;
  line-height: 1 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  flex: 1 1 auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

.custom-select-arrow {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 100% !important;
  flex: 0 0 16px !important;
  color: var(--navy) !important;
  margin: 0 !important;
  padding: 0 !important;
}

.custom-select-chevron {
  display: block !important;
  width: 6px !important;
  height: 6px !important;
  border-right: 2px solid currentColor !important;
  border-bottom: 2px solid currentColor !important;
  transform: rotate(45deg) !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
  transition: transform 0.2s ease !important;
}

.custom-select-trigger.is-open .custom-select-arrow .custom-select-chevron {
  transform: rotate(-135deg) !important;
  border-color: #ea580c !important;
}

/* Toolbar Filter Box Override */
.tracker-filter .custom-select-wrapper {
  height: 44px;
}

.tracker-filter .custom-select-trigger {
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  border-radius: 10px !important;
  background: var(--paper) !important;
  font-size: 0.88rem !important;
  font-weight: 800 !important;
  justify-content: center !important;
  text-align: center !important;
  padding: 0 14px !important;
}

.tracker-filter .custom-select-label {
  flex: 0 1 auto !important;
  justify-content: center !important;
  text-align: center !important;
}

.tracker-filter .custom-select-arrow {
  flex: 0 0 auto !important;
}

/* Dropdown Menu Starts Below the Box */
.custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 100%;
  max-height: 280px;
  overflow-y: auto;
  z-index: 9999;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(16, 41, 64, 0.18);
  padding: 6px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: dropdownSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownSlideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.custom-select-option {
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s ease, color 0.15s ease;
  box-sizing: border-box;
}

.custom-select-option:hover {
  background: rgba(234, 88, 12, 0.08);
  color: #ea580c;
  font-weight: 800;
}

.custom-select-option.is-selected {
  background: rgba(16, 41, 64, 0.08);
  color: var(--navy);
  font-weight: 800;
}

.custom-select-option.is-selected::after {
  content: "✓";
  font-size: 0.85rem;
  font-weight: 900;
  color: #ea580c;
}

.form-field input:disabled,
.form-field select:disabled,
.form-field textarea:disabled,
.items-table input:disabled {
  opacity: 1;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  background: rgba(255, 255, 255, .62);
}

.span-all {
  grid-column: 1 / -1;
}

.workflow-checks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.workflow-check {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.workflow-check input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--teal);
}

.workflow-check > span {
  color: var(--ink);
  font-size: .72rem;
  letter-spacing: 0;
  text-transform: none;
}

.status-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(0, 142, 150, .22);
  border-radius: 8px;
  background: rgba(0, 142, 150, .07);
}

.status-preview span:first-child {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 850;
}

/* Items Cards Container (100% Fluid & Responsive) */
.items-cards-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  box-sizing: border-box;
}

.order-item-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  box-sizing: border-box;
  width: 100%;
  box-shadow: 0 1px 4px rgba(16, 41, 64, 0.04);
}

.item-card-details-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.item-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.item-field-wrap.span-2 {
  grid-column: span 2;
}

.item-field-label {
  font-size: 0.7rem;
  font-weight: 850;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-field-wrap input {
  box-sizing: border-box !important;
  width: 100% !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background: var(--paper) !important;
  color: var(--navy) !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
}

.item-field-wrap input:focus {
  border-color: #ea580c !important;
  background: var(--white) !important;
  outline: none !important;
}

.item-card-bottom-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px dashed var(--line-soft);
  width: 100%;
  box-sizing: border-box;
}

.item-size-run {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 320px;
  min-width: 0;
}

.item-section-sublabel {
  font-size: 0.7rem;
  font-weight: 850;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.item-sizes-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(38px, 1fr));
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.item-size-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 2px;
  box-sizing: border-box;
}

.size-box-label {
  font-size: 0.68rem;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  line-height: 1;
}

.item-size-box input {
  width: 100% !important;
  height: 28px !important;
  min-height: 28px !important;
  border: 1px solid var(--line-soft) !important;
  border-radius: 4px !important;
  background: var(--white) !important;
  color: var(--navy) !important;
  font-size: 0.85rem !important;
  font-weight: 750 !important;
  text-align: center !important;
  padding: 0 2px !important;
  box-sizing: border-box !important;
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

.item-size-box input::-webkit-inner-spin-button,
.item-size-box input::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

.item-size-box input:focus {
  border-color: #ea580c !important;
  outline: none !important;
}

.item-pricing-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 1 auto;
}

.price-field {
  width: 95px !important;
}

.item-metrics-block {
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-metric-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  min-height: 36px;
  box-sizing: border-box;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.item-metric-pill strong {
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 900;
}

.item-metric-pill.total {
  background: rgba(16, 41, 64, 0.06);
  border-color: rgba(16, 41, 64, 0.15);
}

.item-metric-pill.total strong {
  color: var(--navy);
}

.item-remove-btn {
  height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(231, 71, 47, 0.3);
  border-radius: 6px;
  background: rgba(231, 71, 47, 0.08);
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.item-remove-btn:hover {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

.line-items-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}

.line-items-actions .button {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.82rem;
}

.totals-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.total-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--white);
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.total-card strong {
  color: var(--navy);
  font-size: 1.15rem;
  font-weight: 900;
}

.attachments-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 2px 10px rgba(16, 41, 64, 0.05);
  margin-bottom: 16px;
}

.attachments-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.attachments-card-header h3 {
  margin: 0;
  color: var(--navy);
  font-size: 0.95rem;
  font-weight: 850;
  display: flex;
  align-items: center;
  gap: 8px;
}

.attachments-card-count {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--muted);
  background: var(--paper);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
}

.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.attachment-preview-box {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  overflow: hidden;
  transition: all 0.2s ease;
}

.attachment-preview-box:hover {
  border-color: var(--navy);
  box-shadow: 0 6px 16px rgba(16, 41, 64, 0.1);
}

.attachment-img-wrap {
  width: 100%;
  height: 180px;
  background-color: #1e293b;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px),
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 16px 16px, 32px 32px, 32px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

.attachment-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
  transition: transform 0.25s ease;
}

.attachment-preview-box:hover .attachment-img-wrap img {
  transform: scale(1.04);
}

.attachment-file-generic {
  width: 100%;
  height: 140px;
  background: var(--paper-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.attachment-file-chip {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.attachment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--white);
  border-top: 1px solid var(--line-soft);
}

.attachment-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

.attachment-name {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-size {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
}

.attachment-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.attachment-download-btn:hover {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.sheet-actions {
  position: sticky;
  bottom: 12px;
  z-index: 20;
  justify-content: flex-end;
  padding: 12px;
  border: 1px solid rgba(16, 41, 64, .18);
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 16px 38px rgba(16, 41, 64, .18);
  backdrop-filter: blur(12px);
}

.tracker-workspace.editor-open {
  grid-template-columns: 1fr;
}

.tracker-workspace.editor-open .tracker-list-panel {
  display: none;
}

.tracker-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 16px;
  border-radius: 10px;
  color: var(--white);
  background: var(--navy);
  box-shadow: var(--shadow);
  font-weight: 850;
}

@media (min-width: 1700px) {
  .tracker-workspace {
    grid-template-columns: minmax(380px, .65fr) minmax(0, 2fr);
  }

  .tracker-detail-panel {
    padding: 34px;
  }

  .form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .tracker-header {
    grid-template-columns: auto 1fr;
  }

  .tracker-title-block {
    display: none;
  }

  .tracker-header-actions {
    min-width: 0;
  }

  .role-pill {
    display: none;
  }

  .tracker-workspace {
    grid-template-columns: minmax(280px, .8fr) minmax(0, 1.5fr);
    gap: 12px;
  }

  .tracker-toolbar {
    grid-template-columns: minmax(180px, .7fr) minmax(220px, 1fr) minmax(160px, .5fr);
  }

  .workflow-checks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .item-card-details-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 960px) {
  .tracker-header {
    position: relative;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
    padding: 14px;
  }

  .tracker-header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .tracker-header-actions .button {
    flex: 1 1 145px;
  }

  .tracker-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .tracker-summary,
  .status-guide {
    grid-column: 1 / -1;
  }

  .tracker-workspace {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .tracker-list-panel {
    position: static;
    max-height: 380px;
  }

  .tracker-detail-panel {
    min-height: 0;
    overflow-x: hidden;
  }

  .form-grid,
  .form-grid.two,
  .form-grid.three,
  .form-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .totals-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .item-card-details-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .item-card-bottom-row {
    flex-direction: column;
    align-items: stretch;
  }

  .item-sizes-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .item-pricing-wrap {
    justify-content: space-between;
    width: 100%;
  }
}

@media (max-width: 700px) {
  .tracker-auth {
    padding: 12px;
    place-items: start center;
  }

  .tracker-auth-card {
    margin-top: 10px;
    padding: 24px 18px;
    border-radius: 16px;
  }

  .password-auth-row,
  .tracker-toolbar,
  .form-grid,
  .form-grid.two,
  .form-grid.three,
  .form-grid.four,
  .workflow-checks {
    grid-template-columns: 1fr !important;
  }

  .totals-summary {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .tracker-main {
    padding: 10px;
  }

  .tracker-toolbar {
    padding: 12px;
  }

  .tracker-summary,
  .status-guide {
    grid-column: auto;
  }

  .tracker-detail-panel {
    padding: 12px 10px;
    border-radius: 12px;
    overflow-x: hidden;
  }

  .item-card-details-grid {
    grid-template-columns: 1fr;
  }

  .item-field-wrap.span-2 {
    grid-column: auto;
  }

  .item-sizes-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .item-pricing-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .price-field {
    width: 100% !important;
  }

  .item-metrics-block {
    justify-content: space-between;
    width: 100%;
  }

  .item-metric-pill {
    flex: 1 1 auto;
  }

  .detail-heading {
    align-items: flex-start;
  }

  .detail-heading-badges {
    justify-content: flex-start;
  }

  .form-section {
    padding: 12px;
  }

  .span-all {
    grid-column: auto;
  }

  .sheet-actions,
  .detail-actions {
    align-items: stretch;
  }

  .sheet-actions .button,
  .detail-actions .button {
    width: 100%;
  }

  .status-preview {
    align-items: flex-start;
    flex-direction: column;
  }
}
