/* ERP Master Data Requests — Global Gases Group
   Colour bands borrow from gas-cylinder shoulder coding: each request type owns one colour. */
:root {
  --ink: #13293d;
  --steel: #4a6274;
  --paper: #f3f5f7;
  --surface: #ffffff;
  --line: #d9e0e6;
  --primary: #1e5a7a;
  --primary-dark: #15435c;
  --c-customer: #0f7c74;
  --c-vendor: #b26b12;
  --c-item: #4b4fa8;
  --accent: var(--primary);
  --bs-body-font-family: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 30, 90, 122;
  --bs-link-color: var(--primary);
  --bs-link-color-rgb: 30, 90, 122;
  --bs-border-color: var(--line);
}
.accent-customer { --accent: var(--c-customer); }
.accent-vendor { --accent: var(--c-vendor); }
.accent-item { --accent: var(--c-item); }

body { font-size: 15px; line-height: 1.5; }
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5 { font-weight: 600; letter-spacing: -0.01em; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark); --bs-btn-active-bg: var(--primary-dark); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); --bs-btn-active-bg: var(--primary); }
.form-control, .form-select, .ts-wrapper .ts-control { border-color: #c9d2da; background-color: #fff; }
.form-control:disabled, .form-select:disabled { background-color: #eef1f4; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--accent) 18%, transparent); }
.form-label { font-weight: 500; margin-bottom: .3rem; }
.req { color: #b3261e; }

/* Top bar */
.topbar { background: var(--ink); color: #fff; border-bottom: 4px solid var(--accent); }
.topbar .container-xl { min-height: 62px; }
.brand { display: flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; font-size: 12px; color: #a9bccb; }
.brand-mark { display: inline-flex; flex-direction: column; gap: 3px; width: 18px; }
.brand-mark i { display: block; height: 5px; border-radius: 1px; }
.brand-mark i:nth-child(1) { background: var(--c-customer); }
.brand-mark i:nth-child(2) { background: var(--c-vendor); }
.brand-mark i:nth-child(3) { background: var(--c-item); }
.topnav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.topnav a { color: #d4e0e9; text-decoration: none; font-size: 14px; }
.topnav a:hover { color: #fff; text-decoration: underline; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1.5rem; }
.panel.narrow { max-width: 460px; margin: 2rem auto; }
fieldset.panel { margin-bottom: 1.25rem; }
fieldset.panel > legend { float: none; width: auto; font-size: 1.05rem; font-weight: 600; margin: 0 0 1rem; padding: 0; }
.panel-verify { border-left: 4px solid var(--accent); }

/* Start page */
.start { max-width: 980px; }
.start-intro h1 { font-size: 1.9rem; margin-bottom: .4rem; }
.start-intro p { color: var(--steel); max-width: 62ch; margin-bottom: 2rem; }
.start-step { margin-bottom: 2rem; }
.start-step h2 { font-size: 1.1rem; display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.step-no { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; display: inline-grid; place-items: center; }
.sub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.sub-option { position: relative; cursor: pointer; }
.sub-option input { position: absolute; opacity: 0; }
.sub-option span { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .75rem .9rem; transition: border-color .15s, box-shadow .15s; }
.sub-option small { display: block; color: var(--steel); font-size: 12.5px; }
.sub-option:hover span { border-color: #9fb0be; }
.sub-option input:checked + span { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: #eef4f8; }
.sub-option input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 2px; }

.type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.type-card { display: flex; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 0; overflow: hidden; color: var(--ink); min-height: 128px; transition: transform .15s, border-color .15s; }
.type-card .band { width: 14px; flex: none; background: var(--band); background-image: linear-gradient(to bottom, var(--band) 0 42%, rgba(255,255,255,.55) 42% 47%, var(--band) 47%); }
.type-card .type-body { padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .35rem; }
.type-card strong { font-size: 1.1rem; }
.type-card .type-body > span { color: var(--steel); font-size: 14px; }
.type-card:hover { border-color: var(--band); transform: translateY(-2px); }
.type-customer { --band: var(--c-customer); }
.type-vendor { --band: var(--c-vendor); }
.type-item { --band: var(--c-item); }
@media (prefers-reduced-motion: reduce) { .type-card { transition: none; } .type-card:hover { transform: none; } }

/* Request form */
.form-head { margin-bottom: 1.25rem; padding-left: 1rem; border-left: 6px solid var(--accent); }
.form-head h1 { font-size: 1.7rem; margin: .2rem 0; }
.back { font-size: 14px; color: var(--steel); }
.back::before { content: "‹ "; }
.req-form { max-width: 980px; }
.submit-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 0 2rem; }
.otp-input { letter-spacing: .3em; font-weight: 600; max-width: 12rem; }
.otp-input::placeholder { letter-spacing: normal; font-weight: 400; }
body > .ts-dropdown { z-index: 1060; }
.dup-hint:empty { display: none; }
.dup-hint { margin-top: .4rem; font-size: 13px; background: #fff7e6; border: 1px solid #f0d49a; border-radius: 4px; padding: .5rem .7rem; }
.dup-hint.dup-exact { background: #fdecea; border-color: #f1b4ae; }
.dup-hint ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.dup-hint li span { color: var(--steel); }
[hidden] { display: none !important; }

/* BOM */
.bom-panel { border-left: 4px solid var(--c-item); }
.bom-edit th { font-weight: 500; color: var(--steel); font-size: 13px; }
.bom-edit td.bom-no { color: var(--steel); font-variant-numeric: tabular-nums; }
.bom-opt { display: flex; justify-content: space-between; gap: .75rem; }
.bom-opt small { color: var(--steel); white-space: nowrap; }
.bom-table td:nth-child(3) { font-variant-numeric: tabular-nums; }
.ts-wrapper .ts-control { border-color: #c9d2da; }

/* Done / detail */
.done-card { background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--accent); border-radius: 6px; padding: 2rem; max-width: 640px; margin: 2rem auto; }
.ref { font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.section-title { font-size: .98rem; font-weight: 600; margin: 1.5rem 0 .6rem; color: var(--steel); }
.kv { display: grid; grid-template-columns: minmax(140px, 38%) 1fr; gap: .35rem 1rem; margin: 0; }
.kv dt { font-weight: 400; color: var(--steel); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-tight { font-size: 13.5px; margin-top: .4rem; }
.att-list { padding-left: 1.1rem; }
.status { display: inline-block; font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: .2rem .65rem; white-space: nowrap; }
.status-in_progress { background: #e6f0f7; color: #1e5a7a; }
.status-completed { background: #e3f3ea; color: #1d6b3d; }
.status-rejected { background: #fbe7e5; color: #a1261c; }
.status-cancelled { background: #eceff2; color: #56636e; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 1.1rem 1.75rem; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #9fb0be; background: var(--surface); }
.timeline li::after { content: ""; position: absolute; left: 11px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .tl-approved::before { background: #1d6b3d; border-color: #1d6b3d; }
.timeline .tl-pending::before { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 25%, #fff); }
.timeline .tl-rejected::before { background: #a1261c; border-color: #a1261c; }
.tl-title { font-weight: 500; }
.tl-status { font-size: 12.5px; color: var(--steel); font-weight: 400; margin-left: .35rem; }
.tl-meta { font-size: 13px; color: var(--steel); }
.tl-comment { margin-top: .35rem; font-size: 14px; background: var(--paper); border-radius: 4px; padding: .5rem .7rem; }
.action-panel { position: sticky; top: 1rem; border-top: 6px solid var(--accent); }

/* Admin */
.open-counts { display: flex; gap: .5rem; flex-wrap: wrap; }
.open-count { border: 1px solid var(--line); background: var(--surface); border-left: 6px solid var(--band); border-radius: 4px; padding: .45rem .8rem; text-decoration: none; color: var(--ink); font-size: 14px; }
.open-count strong { font-size: 1.1rem; margin-right: .2rem; }
.list-table th { font-weight: 500; color: var(--steel); font-size: 13px; white-space: nowrap; }
.ref-link { font-weight: 600; text-decoration: none; border-left: 4px solid var(--band); padding-left: .45rem; white-space: nowrap; }
.filter-bar { padding: 1rem; margin: 0; }

@media (max-width: 575px) {
  .kv { grid-template-columns: 1fr; }
  .kv dd { margin-bottom: .4rem; }
  .panel { padding: 1rem; }
  .topnav { gap: .8rem; }
}
@media print {
  .topbar, footer, .no-print, .btn { display: none !important; }
  body { background: #fff; }
  .panel { border: 0; padding: 0; }
}
