:root {
  --ink: #1f2733;
  --muted: #66707d;
  --line: #d9dde3;
  --blue: #0b5fff;
  --bg: #f5f6f8;
  --card: #fff;
  --danger: #c62828;
  --ok: #1b7f3b;
}

* { box-sizing: border-box; }

/* Author display rules (for example .form-row) otherwise override the browser's
   user-agent hidden rule. Keep conditional Portal sections truly invisible. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.portal-login-page { display: grid; min-height: 100vh; padding: 24px; place-items: center; background: radial-gradient(circle at top, #e7efff, var(--bg) 48%); }
.portal-login-card { width: min(100%, 420px); padding: 34px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 16px 44px rgba(23, 32, 51, .12); }
.portal-login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; color: #172033; font-weight: 700; }
.portal-login-brand > div:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.portal-login-brand small { margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 600; }
.portal-login-mark { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: var(--blue); color: #fff; font-size: 18px; }
.portal-login-card h1 { margin-bottom: 8px; font-size: 27px; }
.portal-login-card > p { margin: 0; color: var(--muted); }
.portal-login-button { width: 100%; gap: 10px; margin-top: 26px; }
.portal-login-help { margin-top: 16px !important; text-align: center; font-size: 12px; }

.contract-header {
  min-height: 48px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #172033;
  color: #fff;
}

.contract-header a { color: #c9d4e8; font-size: 13px; text-decoration: none; }
.contract-header .portal-brand { color: #fff; font-size: 16px; font-weight: 600; }
.contract-header nav { display: flex; align-items: center; gap: 16px; }
.contract-header .active-nav { color: #fff; font-weight: 600; }
.header-user { margin-left: auto; color: #8fa1c0; font-size: 13px; }

.contract-shell { max-width: 1240px; margin: 24px auto; padding: 0 16px; }
h1 { margin: 0; font-size: 28px; line-height: 1.2; }
h2 { font-size: 18px; }
.eyebrow { margin: 0; color: var(--blue); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.lede, .request-meta { color: var(--muted); }
.request-meta, .form-error { overflow-wrap: anywhere; }

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.requests-heading { align-items: center; }
.page-heading h1 { margin: 2px 0 4px; }
.page-heading .lede { max-width: 720px; margin: 0; }
.page-heading-actions { display: flex; flex: none; }

.contract-card {
  margin: 18px 0;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.form-grid, .entitlement-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
label.full { grid-column: 1 / -1; }
input, select, textarea { width: 100%; border: 1px solid #bfc9d8; border-radius: 7px; padding: 9px 10px; font: inherit; }
input[readonly], textarea[readonly] { background: #f1f4f8; color: #536175; }
textarea { min-height: 76px; }
.capacity { display: flex; gap: 8px; }
.actions, .heading-row { display: flex; gap: 12px; justify-content: space-between; margin-top: 24px; }
.heading-row { align-items: center; margin-bottom: 24px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.compact { min-height: 36px; padding: 0 13px; font-size: 14px; }
.new-request-button {
  flex: none;
  min-height: 0;
  padding: 9px 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: nowrap;
}

.button.danger, .form-error { color: var(--danger); }
.review { margin-top: 22px; padding: 18px; background: #f7f9fd; border: 1px solid #dce5f5; border-radius: 8px; }
.review pre { white-space: pre-wrap; }
.success { color: var(--ok); font-weight: 600; }

.decision-action { display: flex; align-items: flex-end; gap: 12px; margin-top: 16px; }
.decision-action label { flex: 1; }
.decision-action .button { flex: 0 0 110px; }

.contract-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 16px;
  border: 1px solid #b8dfc5;
  border-radius: 8px;
  background: #effaf2;
  color: var(--ok);
  box-shadow: 0 6px 20px rgba(23, 32, 51, .16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .18s ease, transform .18s ease;
}
.contract-toast.visible { opacity: 1; transform: translateY(0); }
.contract-toast[data-kind="error"] { border-color: #efb7b7; background: #fff3f3; color: var(--danger); }

.portfolio-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.portfolio-stats div { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-right: 1px solid var(--line); }
.portfolio-stats div:last-child { border-right: 0; }
.portfolio-stats strong { font-size: 21px; line-height: 1.2; }
.portfolio-stats span { color: var(--muted); font-size: 12px; }

.request-list-card { margin: 0; padding: 0; overflow: hidden; border-radius: 8px; box-shadow: 0 1px 2px rgba(23, 32, 51, .04); }
.list-toolbar { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.search-field { position: relative; flex: 1; }
.search-field span { position: absolute; left: 12px; top: 50%; color: var(--muted); font-size: 19px; transform: translateY(-55%); }
.search-field input { padding: 8px 10px 8px 36px; }
.mode-field { flex: 0 0 190px; gap: 0; color: transparent; font-size: 0; }
.mode-field select { padding: 8px 10px; }
.mode-field select { color: var(--ink); font-size: 14px; }

.mode-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; padding: 0; border: 0; }
.mode-selector > legend { grid-column: 1 / -1; margin-bottom: 8px; color: #4d5867; font-size: 13px; font-weight: 650; }
.mode-card {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 11px;
  min-height: 78px;
  padding: 14px 44px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.mode-card:has(input:checked) { border-color: var(--blue); background: #eef4ff; box-shadow: 0 0 0 1px var(--blue); }
.mode-card input { width: auto; margin-top: 3px; accent-color: var(--blue); }
.mode-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mode-copy strong { font-size: 14px; }
.mode-copy span { color: var(--muted); font-size: 12px; }
.mode-check {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.mode-card:has(input:checked) .mode-check { display: block; }

.flow-badge {
  flex: none;
  padding: 7px 12px;
  border-radius: 999px;
  background: #e7eefb;
  color: #38537b;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.new-request-form .request-section {
  margin: 0 0 20px;
  padding: 24px;
  border-color: #dfe3e9;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(23, 32, 51, .04);
}

.section-heading { margin-bottom: 20px; }
.section-heading > div { display: flex; align-items: flex-start; gap: 12px; }
.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.step-number {
  display: inline-grid;
  place-items: center;
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  background: #172033;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.form-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; }
.field { display: flex; flex: 1; flex-direction: column; min-width: 220px; }
.field.small { flex: 0 0 200px; min-width: 140px; }
.field label { color: #4d5867; font-size: 13px; }
.contract-name-guidance {
  margin-top: 9px;
  padding: 11px 12px;
  border: 1px solid #d8e3f3;
  border-radius: 7px;
  background: #f8faff;
}
.contract-name-pattern { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 9px; }
.contract-name-pattern > span, .contract-name-suggestion-row > span { color: #5f6f86; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.contract-name-pattern code { color: #244e8f; font-size: 12px; font-weight: 650; }
.contract-name-guidance p { margin: 5px 0 9px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.contract-name-suggestion-row { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 7px 10px; }
.contract-name-suggestion-row > span { padding-top: 5px; }
.contract-name-suggestions { display: flex; flex: 1 1 320px; flex-wrap: wrap; gap: 6px; }
.contract-name-suggestion {
  border: 1px solid #c9d8ee;
  border-radius: 999px;
  padding: 4px 9px;
  background: #fff;
  color: #31527f;
  font: inherit;
  font-size: 11px;
  line-height: 1.35;
  cursor: pointer;
}
.contract-name-suggestion:hover { border-color: #7ca4df; background: #edf4ff; color: #174f9f; }
.contract-name-suggestion:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.field-label { display: block; line-height: 1.35; }
.required-marker { color: var(--danger); font-weight: 700; }
.field label.required::after, .license-type-selector legend.required::after { content: " *"; color: var(--danger); }
.field input, .field select, .field textarea {
  border-color: var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
}

.hint { min-height: 14px; margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.optional { color: #8b95a2; font-size: 11px; font-weight: 500; }
.scope-notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 18px 0;
  padding: 13px 15px;
  border: 1px solid #cbdcfb;
  border-radius: 8px;
  background: #f3f7ff;
}

.scope-notice p { margin: 2px 0 0; color: #52647e; font-size: 12px; }
.notice-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 20px;
  height: 20px;
  border-radius: 50%;
  background: #d9e7ff;
  color: #1559d6;
  font-family: Georgia, serif;
  font-weight: 700;
}

.current-license-card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #f8fafc;
}

.current-license-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.current-license-heading h3 { margin: 0; color: var(--ink); font-size: 14px; text-transform: none; }
.current-license-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.current-license-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
  margin: 14px 0 0;
  border-top: 1px solid #e2e7ee;
}

.current-license-meta > div {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  align-items: baseline;
  min-width: 0;
  padding: 9px 0;
  border-bottom: 1px solid #edf0f4;
}

.current-license-meta dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.current-license-meta dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; }

.license-type-selector { margin: 18px 0 0; padding: 0; border: 0; }
.license-type-selector > legend { margin-bottom: 8px; color: #4d5867; font-size: 13px; font-weight: 650; }
.license-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.license-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.license-option { flex-direction: row; }
.license-option:has(input:checked) { border-color: var(--blue); background: #eef4ff; box-shadow: 0 0 0 1px var(--blue); }
.license-option input { width: auto; margin-top: 4px; accent-color: var(--blue); }
.license-option > span:last-child { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.license-option small { color: var(--muted); line-height: 1.4; }
.license-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 15px;
  font-weight: 700;
}

.license-icon.online { background: #dce9ff; color: #1559d6; }
.license-icon.offline { background: #fff0d8; color: #7a4b13; }
.commercial-fields { align-items: flex-start; margin-top: 18px; margin-bottom: 0; }
.capacity-field { flex: 1.2 1 260px; }
.capacity-input-group { display: flex; align-items: stretch; }
.capacity-input-group input { flex: 1; min-width: 0; border-radius: 6px 0 0 6px; }
.capacity-input-group select {
  flex: 0 0 88px;
  width: auto;
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: #f7f8fa;
  color: #364152;
  font-size: 13px;
  font-weight: 600;
}

.submit-bar { margin: 0 0 24px; padding: 15px 18px; border-color: #dfe3e9; border-radius: 8px; }
.actions-bar { display: flex; align-items: center; gap: 12px; }
.request-summary { display: flex; flex: 1; flex-direction: column; line-height: 1.35; }
.request-summary span { color: var(--muted); font-size: 12px; }
.submit-bar .review { margin: 0 0 14px; }

.customer-group { margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: #fff; }
.customer-group:last-of-type { border-bottom: 0; }
.customer-group > summary { display: flex; align-items: center; gap: 16px; padding: 16px 20px; cursor: pointer; background: #fff; list-style: none; }
.customer-group > summary::-webkit-details-marker { display: none; }
.customer-group > summary::before { content: "▸"; color: var(--muted); font-size: 12px; }
.customer-group[open] > summary::before { content: "▾"; }
.customer-group > summary > span:first-of-type { display: flex; flex: 1; flex-direction: column; gap: 2px; text-align: left; }
.customer-group > summary strong { font-size: 16px; }
.customer-group > summary small { color: var(--muted); font-size: 12px; font-weight: 400; }
.account-content { padding: 0 20px 20px 42px; background: #fbfcfd; border-top: 1px solid #eef0f3; text-align: left; }

.contract-list-item { margin: 16px 0 0; padding: 18px; border-radius: 8px; box-shadow: 0 1px 2px rgba(23, 32, 51, .03); }
.contract-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.contract-card-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.contract-card-header p strong { color: var(--ink); }
.contract-title { display: flex; align-items: center; gap: 8px; }
.contract-actions { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; }
.license-badge { padding: 3px 8px; border-radius: 999px; background: #e4eeff; color: #1957bd; font-size: 11px; }
.license-badge.offline { background: #fff0d8; color: #7a4b13; }

.entitlement-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.entitlement-summary dt { color: var(--muted); font-size: 11px; }
.entitlement-summary dd { margin: 4px 0; font-weight: 700; }
.expiration-reminder { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border: 1px solid #edc46f; border-radius: 999px; background: #fff8e7; color: #7a4d00; font-size: 11px; font-weight: 650; line-height: 1; white-space: nowrap; }
.expiration-reminder-icon { display: grid; place-items: center; width: 15px; height: 15px; flex: none; border-radius: 50%; background: #d88400; color: #fff; font-size: 10px; font-weight: 800; line-height: 15px; text-align: center; }
/* Kept for the React-served management UI's shared warning primitive. */
.expiration-warning {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px solid #f1b7b7;
  border-radius: 999px;
  background: #fff0f0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.role-add-form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; padding-bottom: 18px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.role-add-form label { display: grid; gap: 5px; min-width: 220px; }
.role-add-form button { margin-top: 12px; }
.role-user-list { overflow-x: auto; }
.role-user-header, .role-user-row { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(80px, .35fr)) minmax(155px, auto); align-items: center; min-width: 720px; }
.role-user-header { padding: 10px 0; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); }
.role-user-row { gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.role-cell { display: grid; place-items: center; }
.role-cell input { width: 16px; height: 16px; }
.role-user-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.feishu-mapping-add-form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; padding-bottom: 18px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.feishu-mapping-add-form label { display: grid; gap: 5px; min-width: 240px; }
.feishu-mapping-add-form button { margin-top: 12px; }
.feishu-user-search-form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; padding: 14px 0 10px; }
.feishu-user-search-form label { display: grid; gap: 5px; min-width: 280px; }
.feishu-user-results { width: min(100%, 520px); margin: 4px 0 18px; }
.feishu-user-results.is-empty { padding: 8px 0; color: var(--muted); font-size: 13px; }
.feishu-user-results-list { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.feishu-user-result { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.feishu-user-result:last-child { border-bottom: 0; }
.feishu-user-result > div { display: grid; gap: 2px; min-width: 0; }
.feishu-user-result span { color: var(--muted); font-size: 12px; }
.feishu-user-result code { color: #52647f; font-size: 11px; overflow-wrap: anywhere; }
.feishu-mapping-list { overflow-x: auto; }
.feishu-mapping-header, .feishu-mapping-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(150px, .6fr) minmax(180px, auto); align-items: center; min-width: 800px; }
.feishu-mapping-header { padding: 10px 0; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); }
.feishu-mapping-row { gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.feishu-mapping-open-id { min-width: 0; width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.feishu-mapping-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.pending-change-note { margin-top: 14px; padding: 9px 11px; border: 1px solid #f0d99e; border-radius: 6px; background: #fff9e9; color: #72500b; font-size: 12px; }

.fact-grid { display: grid; grid-template-columns: minmax(120px, .7fr) minmax(0, 2fr); gap: 7px 16px; }
.fact-grid dt { color: var(--muted); font-weight: 600; }
.fact-grid dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.changed { color: var(--blue); font-weight: 700; }
.history-row { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.history-panel { margin-top: 12px; padding-top: 0; border: 0; text-align: left; }
.history-panel > summary { cursor: pointer; color: #39475a; font-size: 12px; font-weight: 650; }
.history-panel > summary span { margin-left: 5px; color: var(--muted); font-weight: 400; }
.history-scroll { overflow-x: auto; }
.history-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 12px; }
.history-table th, .history-table td { padding: 8px 10px; border-bottom: 1px solid #eef0f3; text-align: left; vertical-align: top; white-space: nowrap; }
.history-table th { color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.history-table tr:last-child td { border-bottom: 0; }
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #e3edff; color: var(--blue); font-size: 12px; font-weight: 600; }
.status-badge.PENDING, .status-badge.pending { background: #fff3d6; color: #a15c00; }
.status-badge.REJECTED, .status-badge.rejected { background: #fadcdc; color: var(--danger); }
.status-badge.APPROVED, .status-badge.applied, .status-badge.applied_locally { background: #ddf2e3; color: var(--ok); }
.history-rejection { margin: 6px 0 0; color: var(--danger); }
.empty-state { margin: 0; padding: 32px; color: var(--muted); text-align: center; }
.decision-card { position: sticky; bottom: 0; }

@media (max-width: 800px) {
  .portfolio-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-toolbar { flex-direction: column; align-items: stretch; }
  .mode-field { flex-basis: auto; }
  .customer-group > summary { align-items: flex-start; }
  .account-content { padding: 0 12px 14px; }
  .contract-card-header { flex-direction: column; }
  .contract-actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 640px) {
  .contract-header { padding: 10px 14px; align-items: flex-start; flex-direction: column; gap: 10px; }
  .contract-header nav { gap: 10px; flex-wrap: wrap; font-size: 12px; }
  .contract-shell { margin: 20px auto; padding: 0 16px; }
  .page-heading, .actions, .heading-row { align-items: stretch; flex-direction: column; }
  .page-heading-actions, .new-request-button { width: 100%; }
  .form-grid, .entitlement-summary, .fact-grid { grid-template-columns: 1fr; }
  .form-row, .actions-bar { align-items: stretch; flex-direction: column; }
  .field, .field.small { flex-basis: auto; min-width: 0; }
  .mode-selector, .license-options { grid-template-columns: 1fr; }
  .license-options { grid-template-columns: 1fr; }
  .current-license-meta { grid-template-columns: 1fr; }
  .portfolio-stats { grid-template-columns: 1fr; }
  .portfolio-stats div { border-right: 0; border-bottom: 1px solid var(--line); }
  .portfolio-stats div:last-child { border-bottom: 0; }
  .button { width: 100%; }
  .decision-action { align-items: stretch; flex-direction: column; }
  .decision-action .button { flex-basis: auto; }
  .feishu-user-result { align-items: stretch; flex-direction: column; }
  .contract-actions { flex-direction: column; }
  .history-table, .history-table tbody, .history-table tr, .history-table td { display: block; }
  .history-table thead { display: none; }
  .history-table tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .history-table td { padding: 5px 0; border: 0; white-space: normal; }
  .history-table td::before { display: block; color: var(--muted); font-size: 11px; font-weight: 600; content: attr(data-label); }
  .decision-card { box-shadow: 0 -6px 18px #1521431a; }
}

.qa-login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f5f7fb; }
.qa-login-card { width: min(400px, 100%); display: grid; gap: 16px; padding: 30px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 30px #15214318; }
.qa-login-card .brand { display: flex; align-items: center; gap: 10px; }
.qa-login-card .brand-mark { display: grid; place-items: center; width: 32px; height: 32px; color: #fff; background: #1769e0; border-radius: 8px; }
.qa-login-card .brand-name, .qa-login-card .brand-sub { display: block; }
.qa-login-card .brand-sub, .qa-login-card p { color: var(--muted); font-size: 13px; }
.qa-login-card h1 { margin: 0; }
.qa-login-card form { display: grid; gap: 14px; }
.qa-login-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.qa-login-card input { padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }

/* Contract Archive (spec 107 US11). */
.archive-tabs { display: inline-flex; gap: 4px; margin: 0 0 14px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.archive-tab { padding: 6px 16px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.archive-tab.active { background: #e3edff; color: var(--blue); }
.contract-list-item.archived { background: #f3f4f6; color: var(--muted); }
.contract-list-item.archived .license-badge { filter: grayscale(1); }
.archive-status { margin-top: 12px; }
.archive-refused { margin-top: 12px; padding: 9px 11px; border: 1px solid #f2c4c4; border-radius: 6px; background: #fdf0f0; color: var(--danger); font-size: 12px; }
.archive-refused ul { margin: 4px 0 0; padding-left: 18px; }
.archived-note { margin: 10px 0 0; font-size: 12px; }
.archive-form { display: grid; gap: 10px; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.archive-form label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.archive-notice { margin: 0; color: var(--muted); font-size: 12px; }
.archive-panel h2 { font-size: 16px; }
.conflict-list { margin: 0; padding-left: 18px; }
.conflict-list li { margin-bottom: 8px; }
