:root {
  color-scheme: light;
  --ink: #141416;
  --muted: #727272;
  --line: #e2e5e8;
  --surface: #ffffff;
  --canvas: #f4f6f8;
  --brand-blue: #0088cb;
  --brand-blue-deep: #006fa8;
  --brand-blue-soft: #eaf6fc;
  --brand-red: #ed1c24;
  --brand-yellow: #ffcb05;
  --brand-charcoal: #141416;
}

html { min-width: 320px; min-height: 100%; background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Poppins", "Aptos", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.brand, .topbar-right { display: flex; align-items: center; gap: 12px; }
.brand { min-width: 0; font-size: 16px; font-weight: 700; }
.product-identity { display: flex; flex-direction: column; min-width: 0; gap: 5px; }
.product-title { font-size: 16px; font-weight: 500; line-height: 1.4; overflow-wrap: break-word; }
.product-credit { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.5; }
.product-credit strong { color: var(--brand-blue-deep); font-weight: 600; }
.corporate-brand { display: inline-flex; flex-shrink: 0; align-items: center; border: 1px solid var(--line); border-radius: 4px; padding: 5px 9px; background: #fff; }
.corporate-brand img { display: block; width: 180px; height: 40px; object-fit: contain; }
.environment-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0; }
.signed-in-user { color: #3f4349; font-size: 13px; overflow-wrap: anywhere; }
.sign-out-button, .sign-in-link {
  border: 1px solid #b0b0b0;
  padding: 6px 11px;
  background: transparent;
  color: #3f4349;
  font-size: 12px;
  cursor: pointer;
}
.sign-out-button:hover, .sign-in-link:hover { border-color: var(--brand-blue); background: var(--brand-blue-soft); color: var(--brand-blue-deep); }
.topbar-right ul { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0; list-style: none; }

.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 82px); }
.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 30px 16px;
  border-right: 1px solid var(--line);
  background: #fff;
}
.sidebar-label { margin: 0 10px 9px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0; }
.sidebar-spaced { margin-top: 24px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 0 10px;
  color: #3f4349;
  font-size: 13px;
}
.sidebar-link:hover { background: var(--brand-blue-soft); color: var(--brand-blue-deep); }
.nav-indicator { width: 6px; height: 6px; background: #a0a1aa; }
.sidebar-link:hover .nav-indicator { background: var(--brand-blue); }
.sidebar-foot { position: absolute; right: 16px; bottom: 20px; left: 26px; color: var(--muted); font-size: 11px; }
.main-content { width: min(100%, 1440px); padding: 40px clamp(22px, 4vw, 58px) 60px; }

.page-heading, .section-heading, .admin-shortcut { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.page-heading { margin-bottom: 30px; }
.eyebrow { margin: 0 0 7px; color: var(--brand-blue-deep); font-size: 10px; font-weight: 700; letter-spacing: 0; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: 30px; line-height: 1.2; font-weight: 600; }
h2 { margin-bottom: 0; font-size: 19px; line-height: 1.3; font-weight: 650; }
h3 { margin-bottom: 5px; font-size: 16px; font-weight: 650; }
.heading-copy { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.button-primary { background: var(--brand-blue); color: var(--brand-charcoal); }
.button-primary:hover { background: var(--brand-blue-deep); color: #fff; }
.button-secondary { border-color: #b0b0b0; background: #fff; color: #3f4349; }
.button-secondary:hover { border-color: var(--brand-blue); background: var(--brand-blue-soft); color: var(--brand-blue-deep); }
.button-danger { border-color: #f2b8bb; background: #fff; color: #c4161d; }
.button-danger:hover { background: #fff0f0; color: #a90f15; }

.metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 38px; }
.metric { min-height: 100px; border: 1px solid var(--line); border-top: 3px solid #888c9a; padding: 16px 18px; background: var(--surface); }
.metric-active { border-top-color: var(--brand-blue); }
.metric-suspended { border-top-color: var(--brand-red); }
.metric-label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.metric strong { font-size: 25px; line-height: 1; font-weight: 700; }
.content-section { margin: 0 0 28px; }
.section-heading { align-items: center; margin-bottom: 14px; }
.section-heading .eyebrow { margin-bottom: 4px; }
.result-count, .subtle { color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { padding: 12px 15px; border-bottom: 1px solid var(--line); background: #f4f6f8; color: #3f4349; font-size: 10px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 13px 15px; border-bottom: 1px solid #e8eaec; color: #3f4349; font-size: 13px; }
.data-table tr:last-child td { border-bottom: 0; }
.company-name { color: var(--ink) !important; font-weight: 700; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status::before { width: 7px; height: 7px; background: currentColor; content: ""; }
.status-active { color: var(--brand-blue-deep); }
.status-suspended { color: #c4161d; }
.table-action { text-align: right; }
.table-action form { display: inline; }
.empty-state { border: 1px dashed #b0b0b0; padding: 40px 22px; background: rgba(255,255,255,.7); text-align: center; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }
.empty-mark { display: block; margin-bottom: 8px; color: var(--brand-blue); font-size: 24px; }
.compact-empty { padding: 24px 18px; text-align: left; }
.admin-shortcut { align-items: center; margin-top: 34px; border-top: 1px solid var(--line); padding-top: 25px; }
.admin-shortcut p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.notice { margin-bottom: 18px; border-left: 3px solid var(--brand-blue); padding: 11px 14px; background: var(--brand-blue-soft); color: #075d86; font-size: 13px; }
.notice-error { border-left-color: var(--brand-red); background: #fff0f0; color: #a90f15; }
.invoice-search-form { display: grid; grid-template-columns: minmax(150px, 1.15fr) minmax(145px, 1fr) repeat(2, minmax(125px, .7fr)) minmax(175px, 1fr) auto; align-items: end; gap: 12px; }
.optional-label { color: #84918b; font-size: 11px; font-weight: 400; }
.error-filter { display: flex; align-items: center; gap: 8px; min-height: 40px; color: #3f4349; font-size: 12px; font-weight: 700; }
.error-filter input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand-blue); }
.notice-warning { border-left-color: var(--brand-yellow); background: #fff9db; color: #5a4b00; }
.transaction-result { margin-bottom: 14px; border: 1px solid var(--line); background: var(--surface); }
.transaction-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding: 15px 18px; }
.transaction-heading .eyebrow { margin-bottom: 3px; }
.transaction-heading h3 { margin: 0; }
.transaction-warning { margin: 0; border-bottom: 1px solid #efd0c2; padding: 10px 18px; background: #fff7f2; color: #91452a; font-size: 12px; }
.analysis-section { margin: 20px 0; border-top: 1px solid var(--line); padding-top: 18px; }
.analysis-disclaimer { margin: 9px 0 0; color: var(--muted); font-size: 11px; }
.status-pending { color: #8a6424; }
.xml-details { border-bottom: 1px solid var(--line); }
.xml-details:last-child { border-bottom: 0; }
.xml-details summary { padding: 12px 18px; color: var(--brand-blue-deep); font-size: 12px; font-weight: 700; cursor: pointer; }
.xml-details pre { max-height: 430px; overflow: auto; margin: 0; border-top: 1px solid var(--line); padding: 14px 18px; background: #f4f6f8; color: #3f4349; font-family: Consolas, "Cascadia Code", monospace; font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.form-section { border-top: 1px solid var(--line); padding-top: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 860px; }
.assignment-form { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr) auto; align-items: end; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; color: #3f4349; font-size: 12px; font-weight: 700; }
.field input, .field select { width: 100%; min-height: 40px; border: 1px solid #b0b0b0; border-radius: 0; padding: 8px 10px; background: #fff; color: var(--ink); font-size: 13px; }
.field input:focus, .field select:focus { outline: 2px solid var(--brand-blue); outline-offset: 1px; }
.field-error, .validation-summary { color: #a33e28; font-size: 12px; }
.validation-summary:empty { display: none; }
.certificate-option { display: flex; align-items: flex-start; gap: 9px; color: #3f4349; font-size: 12px; font-weight: 700; }
.certificate-option input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--brand-blue); }
.security-note { grid-column: 1 / -1; margin: -10px 0 0 25px; color: var(--muted); font-size: 11px; }
.form-actions { display: flex; align-items: end; }

.access-page { min-height: 100dvh; display: flex; flex-direction: column; background: var(--canvas); color: var(--ink); color-scheme: light; }
.access-header { display: flex; align-items: center; justify-content: space-between; gap: 32px; border-top: 4px solid var(--brand-blue); border-bottom: 1px solid var(--line); padding: 24px 40px; background: #fff; }
.access-brand { display: inline-flex; min-width: 0; color: var(--ink); }
.access-brand:hover { color: var(--ink); }
.access-main { display: grid; place-items: center; flex: 1; width: 100%; padding: 45px 24px 70px; }
.access-form { width: 100%; max-width: 380px; min-width: 0; }
.access-heading { margin-bottom: 28px; }
.access-eyebrow { display: block; margin-bottom: 12px; color: var(--brand-blue-deep); font-size: 11px; font-weight: 600; }
.access-heading h1 { margin: 0 0 10px; color: var(--ink); font-size: 30px; font-weight: 600; line-height: 1.25; }
.access-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.access-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 21px; }
.access-field label { color: #3f4349; font-size: 13px; font-weight: 500; }
.access-field input { width: 100%; height: 48px; min-width: 0; border: 1px solid #b0b0b0; border-radius: 4px; padding: 0 14px; background: #fff; color: var(--ink); font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.access-field input::placeholder { color: var(--muted); }
.access-field input:focus { border-color: var(--brand-blue); outline: 0; box-shadow: 0 0 0 3px #0088cb26; }
.access-remember { display: flex; align-items: center; gap: 9px; margin: 3px 0 25px; color: #3f4349; font-size: 13px; cursor: pointer; }
.access-remember input { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--brand-blue); }
.access-submit { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; border: 1px solid var(--brand-blue); border-radius: 4px; padding: 12px 18px; background: var(--brand-blue); color: var(--brand-charcoal); font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; }
.access-submit:hover { border-color: var(--brand-blue-deep); background: var(--brand-blue-deep); color: #fff; }
.access-submit:focus-visible, .access-page a:focus-visible { outline: 3px solid var(--brand-blue); outline-offset: 3px; }
.access-register { margin: 26px 0 0; border-top: 1px solid var(--line); padding-top: 23px; color: var(--muted); font-size: 13px; text-align: center; }
.access-register a { color: var(--brand-blue-deep); font-weight: 600; }
.access-register a:hover { text-decoration: underline; }
.access-footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 20px 24px; color: var(--muted); font-size: 11px; }
.access-footer span { color: #b0b0b0; }
.access-page .field-error { color: #c4161d; }
.access-errors.validation-summary-valid { display: none; }
.access-errors.validation-summary-errors { margin-bottom: 22px; border-left: 3px solid var(--brand-red); border-radius: 4px; padding: 12px 14px; background: #fff0f0; color: #a90f15; font-size: 13px; }
.access-errors ul { margin: 0; padding: 0; list-style: none; }
.access-field .input-validation-error { border-color: var(--brand-red); }
.access-page .access-form { max-width: 440px; border: 1px solid var(--line); border-top: 3px solid var(--brand-blue); border-radius: 4px; padding: 34px 36px; background: #fff; box-shadow: 0 8px 26px #1414160a; }
@media (max-width: 480px) {
  .access-header { flex-direction: column; align-items: flex-start; gap: 18px; padding: 20px 24px; }
  .brand { flex-wrap: wrap; }
  .product-title { font-size: 14px; }
  .corporate-brand img { width: 135px; height: 30px; }
  .access-main { padding: 32px 18px 48px; }
  .access-page .access-form { padding: 28px 22px; }
  .access-heading h1 { font-size: 27px; }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 175px minmax(0, 1fr); }
  .main-content { padding: 30px 22px 45px; }
  .assignment-form { grid-template-columns: 1fr 1fr; }
  .assignment-form .button { grid-column: 1 / -1; justify-self: start; }
  .invoice-search-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-search-form > .button { justify-self: start; }
}
@media (max-width: 620px) {
  .topbar { min-height: 82px; height: auto; flex-wrap: wrap; gap: 15px; padding: 16px; }
  .brand { flex-wrap: wrap; }
  .environment-label { display: none; }
  .app-shell { display: block; min-height: calc(100vh - 82px); }
  .sidebar { flex-direction: row; gap: 5px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .sidebar-label, .sidebar-foot { display: none; }
  .sidebar-link { flex: 0 0 auto; min-height: 36px; }
  .main-content { padding: 27px 16px 40px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 15px; }
  .metric-row { gap: 8px; }
  .metric { min-height: 82px; padding: 11px 10px; }
  .metric-label { min-height: 30px; font-size: 10px; }
  .metric strong { font-size: 22px; }
  .admin-shortcut { align-items: flex-start; flex-direction: column; }
  .form-grid, .assignment-form { grid-template-columns: 1fr; }
  .invoice-search-form { grid-template-columns: 1fr; }
  .assignment-form .button { grid-column: auto; }
}