/* BriceBarclay Vendor Portal — site palette (#3366CC primary, #CC0000
   accent, #000066 headings, #F9FAFD background) + Open Sans, with the
   CRM's chrome details: white 56px sticky header, 8px radii, uppercase
   micro-labels, translucent focus ring. */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Open Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #222212;
  background: #F9FAFD;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */
.hdr {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.hdr-left { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.hdr-logo { height: 40px; width: auto; display: block; }
.hdr-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  border-left: 1px solid #DDDDDD;
  padding-left: 14px;
}
.hdr-user { font-size: 0.8rem; color: #6b7280; }
.hdr-right { display: flex; align-items: center; gap: 12px; }
.hdr-signout { font-size: 0.78rem; color: #3366CC; text-decoration: none; }
.hdr-signout:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.wrap {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  padding: 28px 32px;
}
.card-narrow { max-width: 480px; margin: 48px auto 0; text-align: center; }

h1 { font-size: 1.35rem; font-weight: 700; color: #000066; }
.sub-h {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin: 24px 0 8px;
}
.asof { font-size: 0.88rem; color: #444444; margin-top: 4px; }
.asof-err { color: #CC0000; }
.asof a { color: #3366CC; }

.card-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.card-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- controls ---------- */
#filter {
  font: inherit;
  font-size: 0.88rem;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  width: 220px;
  background: #fff;
}
#filter:focus {
  outline: none;
  border-color: #3366CC;
  box-shadow: 0 0 0 3px rgba(51, 102, 204, 0.15);
}
.btn {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  background: #3366CC;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #2a55ab; }
.btn-wide { display: block; margin: 8px 0; }
.vendor-list { list-style: none; margin-top: 16px; }

/* ---------- table ---------- */
.tbl-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #000066;
  background: #F0F4FB;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid #DDDDDD;
  white-space: nowrap;
  user-select: none;
}
#stock thead th { cursor: pointer; }
#stock thead th:hover { background: #e4ebf7; }
.sort-ind { margin-left: 4px; font-size: 0.6rem; color: #3366CC; }
tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid #eef0f3;
  vertical-align: top;
}
tbody tr:hover { background: #f0f9ff; }
.c-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86rem; white-space: nowrap; }
.c-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c-ctr { text-align: center; }
.c-desc { color: #444444; }
.c-avail { font-weight: 700; }
.qty-zero { color: #9ca3af; font-weight: 400; }

.tbl-note { font-size: 0.8rem; color: #5E5E5E; margin-top: 12px; }

/* ---------- PO drill-down ---------- */
.po-click { cursor: pointer; color: #3366CC; }
.po-click:hover { text-decoration: underline; }
.po-caret { font-size: 0.7rem; }
.po-detail td {
  background: #f4f8fd;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: #1c3d6e;
  padding: 8px 12px 8px 24px;
}
.po-line { padding: 2px 0; }
.input-file { font-size: 0.82rem; }
.admin-items { margin-top: 12px; border-top: 1px dashed #e5e7eb; padding-top: 10px; }

/* ---------- login ---------- */
.login-card { text-align: left; }
.login-card h1 { text-align: center; }
.login-card .asof { text-align: center; margin: 6px 0 18px; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}
.login-input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}
.login-input:focus {
  outline: none;
  border-color: #3366CC;
  box-shadow: 0 0 0 3px rgba(51, 102, 204, 0.15);
}
.login-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.4rem;
  letter-spacing: 0.35em;
  text-align: center;
}
.login-msg { font-size: 0.85rem; margin: 0 0 12px; }
.login-err {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 12px;
}
.login-resend { text-align: center; margin-top: 14px; }
.linklike {
  background: none;
  border: none;
  color: #3366CC;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.login-help {
  text-align: center;
  font-size: 0.8rem;
  color: #5E5E5E;
  margin-top: 22px;
}
.login-help a { color: #3366CC; }

/* ---------- admin ---------- */
.viewas-bar {
  background: #fff4e0;
  border-bottom: 1px solid #ecd9b0;
  color: #7a4b00;
  font-size: 0.85rem;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.viewas-exit { display: inline; }
.admin-vendor {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.admin-vendor-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  cursor: pointer;
  list-style: none;
}
.admin-vendor-head::before { content: '\25B8'; color: #3366CC; font-size: 0.8rem; }
details[open] > .admin-vendor-head { margin-bottom: 10px; }
details[open] > .admin-vendor-head::before { content: '\25BE'; }
.admin-vendor-head::-webkit-details-marker { display: none; }
.admin-vendor-head a { color: #000066; text-decoration: none; }
.admin-vendor-head a:hover { text-decoration: underline; }
.addv-form { display: flex; flex-direction: column; gap: 12px; max-width: 620px; }
.addv-field { display: flex; flex-direction: column; gap: 4px; }
.addv-form .btn { align-self: flex-start; }
.admin-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 720px) { .admin-lists { grid-template-columns: 1fr; } }
.mini-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 6px;
}
.chip-form { display: inline-block; margin: 0 6px 6px 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eef3fb;
  color: #1c3d6e;
  border-radius: 999px;
  padding: 3px 6px 3px 11px;
  font-size: 0.82rem;
}
.chip-danger { background: #fdecec; color: #8f1d1d; }
.chip-x {
  background: none;
  border: none;
  color: inherit;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 3px;
}
.chip-x:hover { color: #CC0000; }
.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
}
.input-sm { padding: 6px 10px; font-size: 0.85rem; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-danger { background: #CC0000; }
.btn-danger:hover { background: #a30000; }

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 2px 9px;
  vertical-align: middle;
}
.badge-ok   { background: #e8f6ee; color: #16803c; }
.badge-err  { background: #fdecec; color: #CC0000; }
.badge-warn { background: #fff4e0; color: #a15c00; }

/* ---------- footer ---------- */
.ftr {
  text-align: center;
  font-size: 0.78rem;
  color: #929092;
  padding: 18px 24px 26px;
}
.ftr a { color: #3366CC; }

@media (max-width: 640px) {
  .hdr { padding: 0 12px; }
  .hdr-logo { height: 30px; }
  .hdr-user { display: none; }
  .wrap { padding: 16px 10px 28px; }
  .card { padding: 18px 14px; border-radius: 10px; }
  #filter { width: 100%; }
  .card-actions { width: 100%; }
}
