:root {
  --brand: #1a1f8f;
  --brand-dark: #11155f;
  --accent: #0f766e;
  --accent-soft: #e4f4f1;
  --ink: #16181d;
  --muted: #65717d;
  --line: #d8dde6;
  --paper: #ffffff;
  --paper-2: #f4f6fa;
  --error: #b42318;
  --error-soft: #fef3f2;
  --success: #157347;
  --success-soft: #e8f5ee;
  font-family: 'Barlow', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--paper-2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(26, 31, 143, 0.08), transparent 280px), var(--paper-2);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--brand);
  color: #ffffff;
  border-bottom: 5px solid var(--brand-dark);
  padding: 24px;
}

.hero {
  min-height: 170px;
}

.topbar {
  position: sticky;
  z-index: 100;
  top: 0;
  width: 100%;
  min-height: 72px;
  border-top: 3px solid var(--brand);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.topbar-inner {
  display: flex;
  width: min(1180px, calc(100% - 32px));
  min-height: 69px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 24px;
}

.app-shell:has(> .topbar) {
  width: 100%;
  padding-top: 0;
}

.app-shell:has(> .topbar) > :not(.topbar) {
  width: min(1180px, calc(100% - 32px));
  margin-right: auto;
  margin-left: auto;
}

.portal-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.portal-logo {
  width: 44px;
  height: 44px;
  flex: none;
  object-fit: contain;
}

.topbar h1 {
  overflow: hidden;
  color: var(--brand-dark);
  font-family: 'Barlow', system-ui, sans-serif;
  font-size: 23px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar h1 span {
  margin: 0 7px;
  color: #adb2bd;
  font-weight: 400;
}

.topbar h1 strong {
  font-weight: 700;
}

.portal-account {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
}

.account-email {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  padding: 0 12px;
  color: #434b57;
  font-size: 12px;
  font-weight: 600;
}

.account-email:hover {
  border-color: #b2b9c5;
}

.account-menu-toggle {
  display: grid;
  width: 38px;
  height: 38px;
  place-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  cursor: pointer;
}

.account-menu-toggle:hover,
.account-menu-toggle[aria-expanded='true'] {
  border-color: var(--brand);
  background: #f7f7fd;
}

.account-menu-toggle i {
  display: block;
  width: 15px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand-dark);
}

.portal-account-menu {
  position: absolute;
  z-index: 30;
  top: 45px;
  right: 0;
  width: 210px;
  max-width: calc(100vw - 24px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 5px;
  box-shadow: 0 12px 28px rgba(28, 31, 42, 0.16);
}

.portal-account-menu[hidden] {
  display: none;
}

.portal-account-menu a,
.portal-account-menu button {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  padding: 0 10px;
  color: #363e4a;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.portal-account-menu a:hover,
.portal-account-menu button:hover {
  background: #f2f3f7;
}

.account-menu-version {
  margin: 0;
  padding: 3px 10px 7px;
  color: #59616d;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.eyebrow {
  margin: 0 0 6px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.76;
}

h1,
h2 {
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 0.95;
}

.hero-copy {
  max-width: 560px;
  margin: 12px 0 0;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.82);
}

.directory-link {
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 6px;
  padding: 8px 12px;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.button-link {
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.account-panel {
  display: grid;
  justify-items: end;
  gap: 8px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  font-weight: 700;
}

.company-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.company-link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 82px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--ink);
  text-decoration: none;
}

.company-link:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 22px rgba(26, 31, 143, 0.12);
}

.company-link-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 22px;
}

.company-link strong {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 23px;
}

.company-link small {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.notice {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 22px;
}

.notice.error {
  border-color: rgba(180, 35, 24, 0.35);
  background: var(--error-soft);
  color: var(--error);
}

.notice h1 {
  font-size: 32px;
  color: var(--ink);
}

.access-notice {
  max-width: 760px;
  margin: 28px auto 0;
}

.access-notice p {
  margin: 8px 0 0;
  color: var(--ink);
}

.access-page {
  max-width: 680px;
  margin: 42px auto 0;
  border: 1px solid var(--line);
  border-top: 5px solid var(--brand);
  border-radius: 12px;
  background: var(--paper);
  padding: clamp(30px, 6vw, 54px);
  text-align: center;
  box-shadow: 0 14px 34px rgba(22, 24, 29, 0.08);
}

.access-page h2 {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: clamp(34px, 5vw, 46px);
  line-height: 1;
}

.access-page p {
  margin: 8px auto;
  max-width: 540px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.access-page p strong {
  color: var(--ink);
}

.access-support-email {
  color: var(--brand);
  font-weight: 400;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.access-support-email:hover {
  color: var(--brand-dark);
}

.access-support-email:focus-visible {
  border-radius: 3px;
  outline: 3px solid rgba(26, 31, 143, 0.18);
  outline-offset: 3px;
}

.access-action {
  margin-top: 24px;
}

.company-directory {
  max-width: 760px;
  margin: 42px auto 0;
  border: 1px solid var(--line);
  border-top: 5px solid var(--brand);
  border-radius: 12px;
  background: var(--panel);
  padding: clamp(28px, 5vw, 48px);
  box-shadow: 0 14px 34px rgba(22, 24, 29, 0.08);
}

.company-directory h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: clamp(30px, 4vw, 40px);
}

.company-directory > p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.company-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.equipment-list {
  margin-top: 0;
}

.company-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 17px 19px;
  color: var(--brand-dark);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.company-link:hover,
.company-link:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 7px 18px rgba(22, 24, 29, 0.1);
  transform: translateY(-1px);
}

.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: calc(100vh - 84px);
  padding: 24px 0;
}

.auth-card {
  display: flex;
  flex-direction: column;
  width: min(100%, 510px);
  min-height: min(675px, calc(100vh - 48px));
  overflow: visible;
  border: 1px solid #cfd6e2;
  border-top: 5px solid var(--brand);
  border-radius: 14px;
  background: var(--paper);
  padding: clamp(28px, 6vw, 44px);
  box-shadow: 0 20px 55px rgba(17, 21, 95, 0.14), 0 3px 10px rgba(22, 24, 29, 0.06);
}

.auth-brand {
  margin-bottom: 26px;
  text-align: center;
}

.auth-brand img {
  display: block;
  width: min(100%, 320px);
  height: auto;
  margin: 0 auto 22px;
}

.auth-brand h1 {
  margin: 0;
  color: var(--brand-dark);
  font-family: 'Barlow', system-ui, sans-serif;
  font-size: clamp(28px, 5vw, 34px);
  font-weight: 800;
  line-height: 1.12;
}

.auth-help {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.auth-help a {
  color: var(--brand);
  font-weight: 700;
  text-underline-offset: 3px;
}

.auth-help a:hover {
  color: var(--brand-dark);
}

.auth-help a:focus-visible {
  border-radius: 3px;
  outline: 3px solid rgba(26, 31, 143, 0.18);
  outline-offset: 3px;
}

.auth-section h2 {
  margin: 0 0 16px;
  color: var(--ink);
  font-family: 'Barlow', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.account-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.auth-subview h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.auth-description {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.auth-entry h2,
.auth-entry .auth-description {
  text-align: center;
}

.auth-entry {
  flex: none;
  margin-top: 28px;
}

.auth-entry h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.auth-entry-actions {
  display: grid;
  gap: 12px;
}

.auth-entry-actions .auth-primary-button,
.auth-entry-actions .auth-secondary-action {
  min-height: 60px;
  font-size: 18px;
}

.auth-entry .auth-secondary-action {
  margin-top: 0;
}

.auth-field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
}

.auth-field span,
.auth-field > label {
  color: #30343b;
  font-size: 14px;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  height: 48px;
  border: 1px solid #aeb8c7;
  border-radius: 7px;
  background: #ffffff;
  padding: 0 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.auth-field input:hover {
  border-color: #7f8ca0;
}

.auth-field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 31, 143, 0.13);
}

.auth-password-input {
  position: relative;
}

.auth-password-input input {
  padding-right: 52px;
}

.auth-password-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #5f6b7c;
  cursor: pointer;
}

.auth-password-toggle:hover {
  background: #f0f2f6;
  color: var(--brand);
}

.auth-password-toggle:focus-visible {
  outline: 3px solid rgba(26, 31, 143, 0.18);
  outline-offset: -1px;
}

.auth-eye-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.auth-eye-hide,
.auth-password-toggle[aria-pressed="true"] .auth-eye-show {
  display: none;
}

.auth-password-toggle[aria-pressed="true"] .auth-eye-hide {
  display: block;
}

.auth-code-input {
  letter-spacing: 5px;
  text-align: center;
  font-size: 21px;
  font-weight: 700;
}

.auth-password-requirements {
  position: absolute;
  z-index: 10;
  top: 23px;
  left: calc(100% + 18px);
  width: 220px;
  visibility: hidden;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #d7dde7;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(17, 21, 95, 0.16);
  color: #4b5565;
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-6px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.auth-password-field-group {
  position: relative;
}

.auth-password-field-group:focus-within .auth-password-requirements {
  visibility: visible;
  opacity: 1;
  transform: translateX(0);
}

.auth-password-requirements::before {
  position: absolute;
  top: 20px;
  left: -7px;
  width: 12px;
  height: 12px;
  border-bottom: 1px solid #d7dde7;
  border-left: 1px solid #d7dde7;
  background: #ffffff;
  content: '';
  transform: rotate(45deg);
}

.auth-password-requirements strong {
  display: block;
  margin-bottom: 4px;
  color: #30343b;
  font-size: 13px;
}

.auth-password-requirements ul {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
}

.auth-password-row {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 15px;
}

.auth-primary-button,
.auth-secondary-action,
.auth-microsoft-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.auth-primary-button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(26, 31, 143, 0.18);
}

.auth-primary-button:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
}

.auth-secondary-action {
  margin-top: 10px;
  border: 1px solid #c7cfda;
  background: #f8f9fb;
  color: var(--brand-dark);
}

.auth-secondary-action:hover,
.auth-microsoft-button:hover {
  border-color: #8995a7;
  background: #f4f6f9;
}

.auth-primary-button:disabled,
.auth-secondary-action:disabled,
.auth-microsoft-button:disabled,
.auth-text-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.auth-text-button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--brand);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.auth-text-button:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 13px;
  margin: 24px 0;
  color: #778292;
  font-size: 13px;
  font-weight: 600;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  background: var(--line);
  content: '';
}

.auth-microsoft-button {
  gap: 12px;
  border: 1px solid #8b95a4;
  background: #ffffff;
  color: #24272c;
  box-shadow: 0 1px 2px rgba(22, 24, 29, 0.06);
}

.microsoft-icon {
  width: 20px;
  height: 20px;
  flex: none;
}

@media (max-width: 1020px) {
  .auth-password-requirements {
    top: calc(100% - 8px);
    right: 0;
    left: auto;
    width: min(100%, 260px);
    transform: translateY(-6px);
  }

  .auth-password-field-group:focus-within .auth-password-requirements {
    transform: translateY(0);
  }

  .auth-password-requirements::before {
    top: -7px;
    right: 22px;
    left: auto;
    transform: rotate(135deg);
  }
}

.auth-account-switch {
  margin: 20px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.auth-compact-provider-option {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
}

.auth-secondary-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  margin-top: 20px;
  font-size: 14px;
}

.auth-secondary-links .auth-account-switch {
  margin: 0;
}

.auth-notice {
  margin: -6px 0 22px;
  border: 1px solid #bed2e8;
  border-radius: 7px;
  background: #eef6ff;
  padding: 12px 14px;
  color: #194b7a;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.auth-notice.error {
  border-color: rgba(180, 35, 24, 0.32);
  background: var(--error-soft);
  color: var(--error);
}

.auth-notice.success {
  border-color: rgba(21, 115, 71, 0.3);
  background: var(--success-soft);
  color: var(--success);
}

.form-shell {
  margin-top: 18px;
}

.form-heading {
  margin: 0 0 14px;
  padding-inline: 20px;
}

.form-heading h2 {
  margin: 0;
  color: var(--brand-dark);
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1;
}

.success-page {
  max-width: 720px;
  margin: 36px auto 0;
  border: 1px solid rgba(21, 115, 71, 0.3);
  border-radius: 8px;
  background: var(--paper);
  padding: clamp(28px, 6vw, 56px);
  text-align: center;
  box-shadow: 0 14px 34px rgba(22, 24, 29, 0.08);
}

.success-icon {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 36px;
  font-weight: 800;
}

.success-page h2 {
  margin: 0 0 16px;
  color: var(--success);
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1;
}

.success-page p {
  margin: 6px 0;
  color: var(--muted);
  font-size: 17px;
}

.success-action {
  margin-top: 24px;
}

.order-form {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-panel {
  display: none;
}

.form-status {
  margin-bottom: 14px;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--muted);
  padding: 12px;
  font-weight: 700;
}

.form-status.hidden {
  display: none;
}

.form-status.success {
  background: var(--success-soft);
  color: var(--success);
}

.form-status.error {
  background: var(--error-soft);
  color: var(--error);
}

.order-form {
  padding: 20px;
}

.form-section {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.form-section legend {
  width: 100%;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 7px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 21px;
  font-weight: 800;
  color: var(--brand-dark);
}

.photo-field {
  position: relative;
  grid-column: 1 / -1;
}

.photo-field .photo-add-button {
  display: inline-flex;
  width: fit-content;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid #aab0c8;
  border-radius: 6px;
  background: var(--paper-2);
  color: #000;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.photo-field .photo-button-open-paren {
  display: inline-block;
  margin-left: 1px;
}

.photo-field .photo-add-button:hover:not(:disabled),
.photo-field .photo-add-button:focus-visible {
  border-color: var(--brand);
  background: #f0f1fb;
  box-shadow: 0 0 0 2px rgba(26, 31, 143, 0.12);
}

.photo-field .photo-add-button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.photo-field .photo-add-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.photo-field .photo-add-button[hidden] {
  display: none;
}

.photo-error {
  display: block;
  margin-top: 4px;
}

.photo-error:empty {
  display: none;
}

.photo-list {
  display: grid;
  gap: 9px;
}

.photo-list:empty {
  display: none;
}

.photo-list:not(:empty) {
  margin-bottom: 3px;
}

.photo-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}

.photo-preview-wrap,
.photo-preview,
.photo-field .photo-preview-fallback {
  width: 58px;
  height: 58px;
  border-radius: 6px;
}

.photo-preview {
  display: block;
  object-fit: cover;
}

.photo-preview-fallback {
  place-items: center;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.photo-field .photo-preview-fallback:not([hidden]) {
  display: grid;
}

.photo-details {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.photo-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.photo-heading strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-status {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.photo-item-uploaded .photo-status {
  color: var(--success);
}

.photo-status-check {
  margin-right: 4px;
}

.photo-details progress {
  width: 100%;
  height: 7px;
  accent-color: var(--brand);
}

.photo-item-uploaded .photo-details progress {
  accent-color: var(--success);
}

.photo-actions {
  display: flex;
  gap: 6px;
}

.photo-action {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--brand);
  padding: 6px 9px;
  font-weight: 700;
  cursor: pointer;
}

.photo-action:hover:not(:disabled),
.photo-action:focus-visible {
  border-color: #aab0c8;
  background: var(--paper-2);
}

.photo-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field-textarea {
  grid-column: 1 / -1;
}

.field span,
.part-row-labels span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.field em,
.part-row-labels em {
  margin-left: 3px;
  color: var(--error);
  font-style: normal;
}

.field input,
.field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 10px 11px;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  outline: none;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 31, 143, 0.12);
}

.field input[aria-invalid='true'],
.field textarea[aria-invalid='true'] {
  border-color: var(--error);
}

.field-error {
  color: var(--error);
  font-size: 13px;
  font-weight: 700;
}

.field-hint {
  color: #65717d;
  font-size: 12px;
}

.parts-editor,
.part-details-side {
  display: grid;
  min-width: 0;
  align-content: start;
}

.parts-editor {
  gap: 6px;
}

.part-details-side {
  gap: 14px;
}

.part-row-labels,
.part-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(88px, 3fr) 32px;
  gap: 8px;
}

.part-row-labels {
  align-items: center;
}

.part-rows {
  display: grid;
  gap: 8px;
}

.part-entry-row {
  align-items: center;
}

.part-entry-row input {
  width: 100%;
  min-width: 0;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 10px 11px;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  outline: none;
}

.part-entry-row input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 31, 143, 0.12);
}

.part-entry-row input[aria-invalid='true'] {
  border-color: var(--error);
}

.part-remove-placeholder,
.remove-part-button {
  width: 32px;
  height: 32px;
}

.remove-part-button {
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  color: #5d6470;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.remove-part-button:hover,
.remove-part-button:focus-visible {
  border-color: #cfd4e4;
  background: #f0f1fa;
  color: var(--brand-dark);
  outline: none;
}

.add-part-button {
  justify-self: start;
  border: 0;
  background: transparent;
  padding: 3px 0;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.add-part-button:hover,
.add-part-button:focus-visible {
  color: var(--brand-dark);
  text-decoration: underline;
  outline: none;
}

.custom-date-control {
  position: relative;
  display: flex;
  min-width: 0;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  cursor: pointer;
}

.custom-date-control:hover {
  border-color: #aab3c0;
}

.custom-date-control.open,
.custom-date-control:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 31, 143, 0.12);
}

.custom-date-control input[data-date-display-for] {
  min-width: 0;
  height: 42px;
  flex: 1;
  border: 0;
  background: transparent;
  cursor: text;
}

.custom-date-control input[data-date-display-for]:focus {
  border: 0;
  box-shadow: none;
}

.custom-date-control input[data-date-display-for]::placeholder {
  color: #a8afb9;
  opacity: 1;
}

.calendar-trigger {
  display: grid;
  width: 43px;
  flex: none;
  place-items: center;
  border: 0;
  border-left: 1px solid #e0e4ea;
  background: transparent;
  cursor: pointer;
}

.calendar-trigger > span {
  position: relative;
  display: block;
  width: 16px;
  height: 15px;
  border: 1.7px solid var(--brand-dark);
  border-radius: 3px;
}

.calendar-trigger > span::before {
  position: absolute;
  inset: 3px -1.7px auto;
  height: 1.7px;
  background: var(--brand-dark);
  content: '';
}

.calendar-trigger > span::after {
  position: absolute;
  top: -3px;
  left: 3px;
  width: 7px;
  height: 4px;
  border-right: 1.7px solid var(--brand-dark);
  border-left: 1.7px solid var(--brand-dark);
  content: '';
}

.date-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  left: 50%;
  width: 310px;
  border: 1px solid #d4d9e1;
  border-radius: 10px;
  background: #ffffff;
  padding: 12px;
  box-shadow: 0 18px 45px rgba(25, 29, 39, 0.2), 0 3px 10px rgba(25, 29, 39, 0.08);
  transform: translateX(-50%);
  cursor: default;
}

.date-popover[hidden] {
  display: none;
}

.custom-date-control.open-upward .date-popover {
  top: auto;
  bottom: calc(100% + 8px);
}

.custom-date-control.viewport-overlay .date-popover {
  position: fixed;
  top: 8px;
  right: auto;
  bottom: auto;
  left: 50%;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  transform: translateX(-50%);
  overscroll-behavior: contain;
}

.calendar-header {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 5px;
  margin-bottom: 9px;
}

.month-nav {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--brand-dark);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.month-nav:hover {
  background: #f1f2f7;
}

.month-year-controls {
  position: relative;
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 4px;
}

.month-picker,
.year-picker {
  position: relative;
  min-width: 0;
}

.month-toggle,
.year-toggle {
  display: flex;
  width: 100%;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.month-toggle:hover,
.month-toggle[aria-expanded='true'],
.year-toggle:hover,
.year-toggle[aria-expanded='true'] {
  border-color: var(--line);
  background: #f8f9fb;
}

.month-toggle i,
.year-toggle i {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--brand-dark);
  border-bottom: 1.5px solid var(--brand-dark);
  transform: translateY(-2px) rotate(45deg);
}

.month-menu,
.year-menu {
  position: absolute;
  z-index: 50;
  top: 38px;
  max-height: 192px;
  overflow-y: auto;
  border: 1px solid #d4d9e1;
  border-radius: 7px;
  background: #ffffff;
  padding: 4px;
  box-shadow: 0 10px 24px rgba(25, 29, 39, 0.17);
  overscroll-behavior: contain;
}

.month-menu {
  left: 0;
  width: 122px;
}

.year-menu {
  right: 0;
  width: 86px;
}

.month-menu[hidden],
.year-menu[hidden] {
  display: none;
}

.month-option,
.year-option {
  display: block;
  width: 100%;
  height: 31px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  padding: 0 9px;
  color: #313946;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.year-option {
  text-align: center;
}

.month-option:hover,
.year-option:hover {
  background: #f0f1f7;
}

.month-option.selected,
.year-option.selected {
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.weekday-row {
  margin-bottom: 4px;
}

.weekday-row span {
  display: grid;
  height: 28px;
  place-items: center;
  color: #818a97;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.calendar-day {
  display: grid;
  width: 36px;
  height: 34px;
  place-items: center;
  justify-self: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #29313c;
  font-size: 12px;
  cursor: pointer;
}

.calendar-day:hover {
  background: #eeeefa;
  color: var(--brand-dark);
}

.calendar-day.other-month {
  color: #b4bbc4;
}

.calendar-day.selected {
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(26, 31, 143, 0.24);
}

.calendar-day:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.submit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.submit-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

.submit-row .submit-button,
.submit-row .secondary-button {
  width: 120px;
}

.submit-button {
  border: 1px solid #aab0c8;
  background: var(--paper-2);
  color: #000;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.submit-button:hover:not(:disabled),
.submit-button:focus-visible {
  border-color: var(--brand);
  background: #f0f1fb;
  box-shadow: 0 0 0 2px rgba(26, 31, 143, 0.12);
}

.submit-button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.submit-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

code {
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 4px;
}

@media (max-height: 500px) {
  .date-popover {
    width: 286px;
    padding: 8px;
  }

  .calendar-header {
    grid-template-columns: 30px 1fr 30px;
    gap: 3px;
    margin-bottom: 4px;
  }

  .month-nav {
    width: 30px;
    height: 30px;
    font-size: 24px;
  }

  .month-toggle,
  .year-toggle {
    height: 30px;
    font-size: 12px;
  }

  .month-menu,
  .year-menu {
    top: 33px;
    max-height: 158px;
  }

  .month-option,
  .year-option {
    height: 29px;
  }

  .weekday-row {
    margin-bottom: 2px;
  }

  .weekday-row span {
    height: 20px;
  }

  .weekday-row,
  .calendar-grid {
    gap: 1px;
  }

  .calendar-day {
    width: 32px;
    height: 27px;
    font-size: 11px;
  }
}

@media (max-width: 860px) {
  .form-shell {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 22px, 1180px);
    padding-top: 12px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .topbar {
    min-height: 64px;
  }

  .topbar-inner {
    width: min(100% - 22px, 1180px);
    min-height: 61px;
    gap: 12px;
    padding: 9px 12px;
  }

  .app-shell:has(> .topbar) > :not(.topbar) {
    width: min(100% - 22px, 1180px);
  }

  .portal-identity {
    gap: 9px;
  }

  .portal-logo {
    width: 38px;
    height: 38px;
  }

  .topbar h1 {
    font-size: 17px;
    white-space: normal;
  }

  .topbar h1 span {
    display: none;
  }

  .topbar h1 strong {
    display: block;
  }

  .account-email {
    overflow: hidden;
    max-width: 170px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .photo-item {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .photo-preview-wrap,
  .photo-preview,
  .photo-preview-fallback {
    width: 50px;
    height: 50px;
  }

  .submit-row {
    flex-direction: column;
    justify-content: stretch;
  }

  .submit-row .secondary-button {
    display: none;
  }

  .submit-row .submit-button {
    width: 100%;
  }

  .auth-page {
    min-height: calc(100vh - 24px);
    padding: 0;
  }

  .auth-card {
    border-radius: 10px;
    padding: 28px 22px;
  }

  .auth-brand img {
    width: min(100%, 270px);
  }
}

@media (max-width: 430px) {
  .account-email {
    display: none;
  }

  .date-popover {
    width: min(310px, calc(100vw - 40px));
  }
}
