:root {
  --brand: #2e7bb8;
  --brand-dark: #1f5f8f;
  --ink: #1a2332;
  --muted: #5b6b7c;
  --line: #d7e0ea;
  --bg: #f3f7fb;
  --panel: #ffffff;
  --ok: #2f8f5b;
  --danger: #c0392b;
  --warn: #c47d16;
}

* { box-sizing: border-box; }

/* Fixed corner mark so users can tell rewrite (SO2) from legacy so.specialty-apparel.com */
.env-badge {
  position: fixed;
  right: 0.65rem;
  bottom: 0.45rem;
  z-index: 50;
  pointer-events: none;
  user-select: none;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.2;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.18rem 0.4rem;
}

html, body {
    margin: 0;
    padding: 0;
    color: var(--ink);
    background: radial-gradient(circle at top left, rgba(46, 123, 184, 0.12), transparent 30%), linear-gradient(180deg, #eef4f9 0%, var(--bg) 40%, #e8eef4 100%);
    font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
    min-height: 100vh;
    height: 100%;
    overflow-y: auto; /* new — contains .page's bottom margin so it can't escape */
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }

.topbar {
  background: linear-gradient(90deg, var(--brand-dark), var(--brand));
  color: #fff;
  box-shadow: 0 2px 10px rgba(20, 40, 60, 0.18);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    padding: 10px 0;
    box-sizing: border-box;
}

.brand:hover { color: #fff; text-decoration: none; }

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,0.18);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 800;
}

.nav-links {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.nav-links a {
  color: rgba(255,255,255,0.92);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,255,255,0.16);
  text-decoration: none;
}

.user-chip {
  margin-left: auto;
  font-size: 0.9rem;
  opacity: 0.95;
}

.page {
  max-width: 1280px;
  margin: 1.25rem auto 2.5rem;
  padding: 0 1.25rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
}

.page-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  box-shadow: 0 8px 24px rgba(26, 45, 70, 0.05);
  margin-bottom: 1rem;
}

.panel h2, .panel h3 {
  margin-top: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 140px;
}

.field-with-action {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
}

.field-with-action input {
  flex: 1;
  min-width: 0;
}

.field-with-action .btn {
  white-space: nowrap;
  flex-shrink: 0;
  align-self: stretch;
}

.field-with-action input[type="color"] {
  flex: 0 0 3rem;
  padding: 0.15rem;
  min-height: 2.4rem;
  cursor: pointer;
}

.app-dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem;
  max-width: 420px;
  width: calc(100% - 2rem);
  box-shadow: 0 12px 40px rgba(15, 35, 60, 0.18);
}

.app-dialog::backdrop {
  background: rgba(20, 35, 55, 0.45);
}

.app-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.app-dialog-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.light-red { color: #c0392b; }

.status-swatch {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  vertical-align: middle;
  margin-right: 0.35rem;
}

.field label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.field select,
.field textarea,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font: inherit;
  background: #fff;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(46,123,184,0.25);
  border-color: var(--brand);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { text-decoration: none; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-secondary { background: #e8eef5; color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.85rem; }

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.data th,
table.data td {
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.45rem;
  text-align: left;
  vertical-align: top;
}

table.data th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f7fafc;
}

table.data tr:hover td { background: #f8fbfe; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e8eef5;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.size-price-section {
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem 1rem;
}

.size-price-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
}

.size-price-section-title h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.size-price-section-title .muted,
.size-price-section-header .muted {
  margin: 0;
  font-size: 0.85rem;
}

.size-price-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  flex-shrink: 0;
  min-width: 7rem;
}

.size-price-total-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.size-price-total strong {
  font-size: 1.15rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.order-totals-panel {
  margin-bottom: 1rem;
  padding: 0.85rem 1.1rem;
}

.order-totals {
  display: grid;
  gap: 0.35rem;
  max-width: 22rem;
  margin-left: auto;
}

.order-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  font-size: 0.95rem;
}

.order-totals-label {
  color: var(--muted);
}

.order-totals-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.order-totals-grand {
  margin-top: 0.25rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line);
  font-size: 1.05rem;
}

.order-totals-grand .order-totals-label,
.order-totals-grand .order-totals-value {
  color: var(--ink);
  font-weight: 700;
}

.order-totals-note {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  text-align: right;
}

table.data th.num,
table.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/*
 * Order list grids: header + every data row share the SAME grid-template-columns
 * so Description / Qty / Cost (etc.) stay locked in matching tracks.
 */
.list-grid {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.list-grid-costs {
  --list-cols: minmax(0, 1fr) 5.5rem 7.5rem 11rem;
}

.list-grid-items {
  --list-cols: minmax(0, 1.3fr) minmax(0, 1.1fr) minmax(0, 0.8fr) 5.5rem 7.5rem 6rem 18rem;
}

.list-grid-head,
.list-grid-row {
  display: grid;
  grid-template-columns: var(--list-cols);
  column-gap: 0.85rem;
  align-items: center;
  padding: 0.55rem 0.85rem;
  box-sizing: border-box;
}

.list-grid-head {
  background: #edf3f8;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.list-grid-row {
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.list-grid-row:last-child {
  border-bottom: 0;
}

.list-grid-row:hover {
  background: #f8fbfe;
}

.list-grid-head > div,
.list-grid-row > div {
  min-width: 0;
}

.list-grid .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.list-grid-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.4rem;
  white-space: nowrap;
}

.legacy-section {
  margin-top: 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line);
}

.legacy-section h3 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.legacy-section h3 .muted {
  font-weight: 500;
  font-size: 0.85rem;
}

.design-colors-grid {
  table-layout: fixed;
  width: 100%;
}

.design-colors-grid td {
  padding: 0.25rem;
  vertical-align: middle;
}

.design-colors-grid input[type="text"] {
  width: 100%;
  min-width: 0;
  padding: 0.35rem 0.45rem;
  font-size: 0.9rem;
}

.design-colors-grid .design-colors-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink);
  padding: 0.35rem 0.25rem;
}

.design-colors-grid tr.design-colors-header td {
  background: #edf3f8;
}

.design-colors-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
}

.size-price-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem 1rem;
  align-items: start;
}

.size-price-list {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.size-price-head,
.size-price-row {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.4rem;
  align-items: center;
}

.size-price-head {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.size-price-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

.size-price-row input {
  width: 100%;
  min-width: 0;
  padding: 0.28rem 0.4rem;
  font-size: 0.9rem;
}

.size-price-row .input-qty,
.size-price-row .input-money,
.field .input-money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .size-price-columns {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}

.filter-row th {
    padding-top: 4px;
    padding-bottom: 8px;
}

.filter-field {
    display: flex;
    align-items: center;
    gap: 4px;
}

    .filter-field input,
    .filter-field select {
        width: 100%;
        font-size: 0.85rem;
        padding: 3px 6px;
    }

.clear-x {
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0 2px;
}

    .clear-x:hover {
        color: #475569;
    }

.grid-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 0;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.page-nav {
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
}

.page-input {
    width: 36px;
    text-align: center;
    padding: 2px;
}

.page-size {
    margin-left: 8px;
}

.page-summary {
    margin-left: 8px;
    color: #64748b;
}

.actions .btn-link {
    color: #2563eb;
    text-decoration: none;
}

.actions .btn-link-danger {
    color: #dc2626;
}

.actions .sep {
    color: #cbd5e1;
    margin: 0 4px;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 1.5rem 1rem 2rem;
}

/* Legacy login: centered vertical logo above the form (/images/logo_v.jpg). */
.login-brand {
  text-align: center;
  margin-top: 0.5rem;
}

.login-logo {
  display: block;
  width: min(456px, 88vw);
  height: auto;
  margin: 0 auto;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 18px 40px rgba(20, 40, 60, 0.12);
}

.login-card h1,
.login-card .login-heading {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
}

.login-card .sub {
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.stack { display: grid; gap: 0.85rem; }

.alert {
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.alert-error { background: #fdecea; color: #8a1f14; }
.field-error { display: block; margin-top: 0.25rem; color: #8a1f14; font-size: 0.875rem; }
input[readonly] { background: #f3f5f7; color: #445; cursor: default; }
.alert-ok { background: #eaf7ef; color: #1f6b3d; }
.alert-info { background: #eaf3fb; color: #1f5078; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.tabs a {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: #e8eef5;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.tabs a.active {
  background: var(--brand);
  color: #fff;
}

.muted { color: var(--muted); }
.req { color: var(--danger); }

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 2rem 0;
}

@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; }
  .user-chip { margin-left: 0; }
}

.advanced-panel {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafcfe;
    padding: 1rem 1.25rem 1.25rem;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

    .advanced-panel * {
        box-sizing: border-box;
    }

    .advanced-panel .adv-panel-header {
        font-weight: 600;
        font-size: 1rem;
        color: var(--ink);
        padding-bottom: 0.75rem;
        margin-bottom: 1rem;
        border-bottom: 1px solid var(--line);
    }

    .advanced-panel .adv-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.9rem 2rem;
    }

@media (max-width: 720px) {
    .advanced-panel .adv-grid {
        grid-template-columns: 1fr;
    }
}

.advanced-panel .adv-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    text-align: left;
    min-width: 0; /* lets this grid item shrink to fit its column instead of overflowing */
}

    .advanced-panel .adv-field > label {
        flex: 0 0 130px;
        font-size: 0.85rem;
        font-weight: 600;
        color: #475569;
        text-align: right;
        margin: 0;
    }

    .advanced-panel .adv-field > input,
    .advanced-panel .adv-field > select {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        padding: 6px 10px;
        border: 1px solid var(--line);
        border-radius: 6px;
        font-size: 0.9rem;
    }

.advanced-panel .adv-field-range .adv-range-inputs {
    flex: 1 1 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

    .advanced-panel .adv-field-range .adv-range-inputs input {
        flex: 1 1 0;
        min-width: 0;
        width: auto;
        padding: 6px 8px;
        border: 1px solid var(--line);
        border-radius: 6px;
        font-size: 0.85rem;
    }

.advanced-panel .adv-to-label {
    flex: 0 0 auto;
    font-size: 0.8rem;
    color: #64748b;
}

.advanced-panel .adv-field-group {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.6rem;
    text-align: left;
}

    .advanced-panel .adv-field-group > label {
        flex: 0 0 130px;
        font-size: 0.85rem;
        font-weight: 600;
        color: #475569;
        text-align: right;
        padding-top: 4px;
        margin: 0;
    }

.advanced-panel .adv-checkbox-list {
    flex: 1 1 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
}

.advanced-panel .adv-checkbox {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: normal;
    color: var(--ink);
    white-space: nowrap;
    margin: 0;
}

.advanced-panel .adv-actions {
    margin-top: 1.1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 0.6rem;
}

/* ============ Order Information card (scoped: .order-info) ============ */
.order-info {
    --oi-value: #8a6234; /* the brown value text in the legacy screen */
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

    .order-info * {
        box-sizing: border-box;
    }

    .order-info .oi-head {
        background: #f7f7f7;
        border-bottom: 1px solid var(--line);
        border-radius: 6px 6px 0 0;
        padding: 0.7rem 1.1rem;
        font-weight: 600;
        font-size: 0.95rem;
        color: var(--ink);
    }

    .order-info .oi-body {
        padding: 1.25rem 1.1rem 1.5rem;
    }

    .order-info .oi-grid-3 {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.55rem 1.5rem;
        align-items: start;
    }

    .order-info .oi-grid-2 {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem 1.5rem;
        align-items: start;
    }

    .order-info .oi-col {
        display: flex;
        flex-direction: column;
        gap: 0.55rem;
        min-width: 0;
    }

    .order-info .oi-row {
        display: flex;
        flex-direction: row;
        align-items: baseline;
        gap: 0.6rem;
        min-width: 0;
    }

    .order-info .oi-label {
        flex: 0 0 132px;
        text-align: right;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--ink);
    }

    .order-info .oi-value {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 0.9rem;
        color: var(--oi-value);
        word-break: break-word;
    }

    .order-info .oi-value-strong {
        color: var(--ink);
        font-weight: 700;
    }

    /* City : ____  State : ____ on one line */
    .order-info .oi-row-pair .oi-value {
        flex: 0 1 auto;
    }

    .order-info .oi-row-pair .oi-label-inline {
        flex: 0 0 auto;
        margin-left: 1.25rem;
        text-align: left;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--ink);
    }

    .order-info .oi-section {
        margin: 1.6rem 0 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px dashed var(--line);
        font-size: 1.05rem;
        font-weight: 600;
        color: var(--ink);
    }

    .order-info .oi-value:empty::after {
        content: "\00a0";
    }

    .order-info .oi-block {
        color: var(--oi-value);
        font-size: 0.9rem;
        white-space: pre-wrap;
    }

.oi-modified {
    margin: 0.25rem 0 1rem;
    text-align: right;
    font-style: italic;
    color: var(--muted);
}

table.data.data-sizes {
    font-size: 0.78rem;
    min-width: 1100px;
}

table.data.data-sizes th,
table.data.data-sizes td {
    text-align: center;
    padding: 0.35rem 0.25rem;
}

table.data.data-sizes td.cell-left,
table.data.data-sizes th.cell-left {
    text-align: left;
}

.item-meta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  margin-top: 0.45rem;
}

.items-detail-table th.num,
.items-detail-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.data tr.item-meta td {
    background: #f7fafc;
    font-weight: 500;
}

.file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.file-list li {
    min-width: 140px;
}

@media (max-width: 900px) {
    .order-info .oi-grid-3,
    .order-info .oi-grid-2 {
        grid-template-columns: 1fr;
    }

    .order-info .oi-label {
        flex-basis: 120px;
    }
}