/* Connect4Sure Vendor Portal */
:root {
  --brand-cyan: #13c2ed;
  --brand-blue: #1aa7ee;
  --brand-indigo: #3943e8;
  --brand-grey: #575757;
  --brand-gradient: linear-gradient(120deg, #13c2ed 0%, #1aa7ee 45%, #3943e8 100%);
  --button-gradient: linear-gradient(120deg, #1584c9 0%, #3943e8 100%); 
  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-2: #f6f9fc;
  --text: #24272d;
  --muted: #646a73;
  --border: #dbe2ea;
  --primary: #2f4be0;
  --primary-text: #ffffff;
  --ok: #157a3b;
  --ok-bg: #e4f4e9;
  --warn: #8f5500;
  --warn-bg: #fff2d9;
  --info: #1d63d6;
  --info-bg: #e5f6fd;
  --err: #b42318;
  --err-bg: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141a; --surface: #192029; --surface-2: #1d2530; --text: #e6e9ee; --muted: #9aa3b0; --border: #2c3440;
    --primary: #4cc7f2; --ok: #5fd08a; --ok-bg: #173323; --warn: #f2b857; --warn-bg: #3a2c12;
    --info: #6fd2f4; --info-bg: #10303f; --err: #ff8a80; --err-bg: #3d1c1a; --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
h1 { font-size: 20px; margin: 0; }
h2 { margin: 0 0 8px; font-size: 18px; }
h3 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
a { color: var(--primary); }
code { font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--brand-gradient); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-logo { height: 16px; width: auto; display: block; }
.brand span { font-weight: 500; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--border); }
.topbar nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.topbar nav a { padding: 6px 9px; border-radius: 8px; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.topbar nav a:hover { background: var(--surface-2); }
.topbar nav a.active { background: var(--info-bg); color: var(--info); font-weight: 600; }
main { padding: 20px 24px 60px; max-width: 1440px; margin: 0 auto; }
.page-head { margin-bottom: 16px; }
.page-head p { margin: 4px 0 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.empty { text-align: center; color: var(--muted); padding: 28px 0 12px; }
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--button-gradient); border-color: transparent; color: var(--primary-text); font-weight: 600; }
.btn-primary:hover:not(:disabled) { border-color: transparent; filter: brightness(1.06); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-small { padding: 5px 10px; font-size: 12px; }
.pill { padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; display: inline-block; }
.pill-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-err { background: var(--err-bg); color: var(--err); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-info { background: var(--info-bg); color: var(--info); }
.hint { color: var(--muted); font-size: 12px; display: block; margin-top: 4px; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 150px; padding: 24px; border: 2px dashed var(--border); border-radius: var(--radius); cursor: pointer; text-align: center; background: var(--surface-2); }
.dropzone:not(.disabled):hover, .dropzone.over { border-color: var(--primary); background: var(--info-bg); }
.dropzone.disabled { opacity: .55; cursor: not-allowed; }
.dropzone small { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--info-bg); color: var(--info); border-radius: 99px; padding: 4px 6px 4px 12px; font-weight: 600; font-size: 13px; }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.field input, .field select { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); width: 100%; min-width: 0; }
.field input:focus, .field select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.field input.readonly { background: var(--surface-2); color: var(--muted); font-weight: 700; }
.field input.upper { text-transform: uppercase; }
.field.missing input, .field.missing select { border-color: var(--warn); background: var(--warn-bg); }
.field.invalid input { border-color: var(--err); }
.field.invalid .hint { color: var(--err); }
.field.disabled { opacity: .45; }
.banner { padding: 10px 12px; border-radius: 8px; margin-bottom: 10px; font-size: 13px; }
.banner-warn { background: var(--warn-bg); color: var(--warn); }
.banner-err { background: var(--err-bg); color: var(--err); }
.banner-ok { background: var(--ok-bg); color: var(--ok); }
.banner-info { background: var(--info-bg); color: var(--info); }
.banner .btn { margin-top: 8px; }
.error { color: var(--err); margin-top: 8px; white-space: pre-wrap; font-size: 13px; }
.error:empty { display: none; }
.v-account { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; font-size: 13px; }
.v-account select { font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.v-acc { font-size: 11px; color: var(--muted); }
dialog { border: 1px solid var(--border); border-radius: 12px; padding: 20px; max-width: 460px; width: calc(100% - 32px); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(10, 15, 25, .45); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 10px 18px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.2); z-index: 30; max-width: calc(100% - 32px); }
@media (max-width: 640px) {
  main { padding: 14px 16px 60px; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .topbar nav { order: 3; width: 100%; }
}
.login-wrap { min-height: calc(100vh - 40px); display: grid; place-items: center; }
.login-card { width: 100%; max-width: 400px; padding: 28px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.login-logo { width: 190px; height: auto; display: block; }
.login-brand span { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.login-card { position: relative; overflow: hidden; }
.login-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--brand-gradient); }
.login-card form { display: grid; gap: 12px; }
.login-card h2 { margin: 0; }
.login-card p { margin: 0; }
.btn.wide { width: 100%; justify-content: center; padding: 10px; }
.code-input { font-size: 22px !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.qr { display: grid; place-items: center; background: #fff; border-radius: 8px; padding: 8px; }
.qr svg { width: 200px; height: 200px; }
.secret { display: block; text-align: center; font-size: 13px; word-break: break-all; padding: 6px; }
.enroll-steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.login-foot { margin-top: 14px !important; text-align: center; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--border); white-space: nowrap; font-size: 13px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 180px; padding: 4px; z-index: 20; }
.user-menu .menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: inherit; color: var(--text); cursor: pointer; }
.user-menu .menu button:hover { background: var(--surface-2); }
.topbar nav a { white-space: nowrap; }
@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topbar .brand { flex: 1; }
  .topbar nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; }
}
body.is-vendor .topbar { justify-content: space-between; }
.v-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.v-tile .v-paid { color: var(--ok); }
.v-asof { margin: -6px 0 12px; }
.v-table tfoot td { border-bottom: 0; color: var(--muted); }
.v-table tfoot tr.total td { color: var(--text); border-top: 1px solid var(--border); }
.v-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.v-tile .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.v-tile .n { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.v-tile .v-overdue.has { color: var(--err); }
.v-tile .v-returned.has { color: var(--warn); }
.v-result { margin-top: 12px; font-size: 13px; }
.v-result ul { margin: 6px 0 0; padding-left: 18px; }
.v-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.v-head h3 { margin: 0; }
.v-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.v-filters input { min-width: 160px; font: inherit; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.chip { font: inherit; font-size: 12px; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip.active { background: var(--info-bg); color: var(--info); border-color: var(--info); font-weight: 600; }
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.v-table .reason { margin-top: 4px; font-size: 12px; color: var(--warn); }
.v-table .sub { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) {
  .v-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding: 16px 16px 48px; }
  .v-table thead { display: none; }
  .v-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .v-table td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .v-table td:first-child { display: block; text-align: left; padding-bottom: 6px; }
  .v-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; }
  .v-table td:empty { display: none; }
  .v-table td:not([data-label]):not(:first-child) { justify-content: flex-end; }
  .v-filters input { flex: 1; min-width: 0; }
}
