:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #e8f0f7;
  --text: #172331;
  --muted: #637282;
  --line: #d5e0ea;
  --primary: #4382ab;
  --primary-dark: #356f95;
  --accent: #4382ab;
  --focus: #4382ab;
  --shadow: 0 18px 45px rgba(31, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
}

main {
  flex: 1;
  min-width: 0;
}

.topbar {
  align-items: center;
  background: rgba(243, 245, 247, 0.96);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 82px;
  padding: 12px clamp(18px, 4vw, 56px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-logo {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  height: 70px;
  object-fit: contain;
  width: 164px;
}

.brand small {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.nav {
  display: flex;
  gap: 8px;
}

.nav a {
  border-radius: 8px;
  color: var(--muted);
  padding: 9px 12px;
  text-decoration: none;
}

.nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.admin-user-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  white-space: nowrap;
}

.admin-header-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.inline-password-form {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(120px, 1fr) auto;
  width: 100%;
}

.user-profile-form {
  grid-template-columns: minmax(140px, 1fr) minmax(110px, 0.8fr) auto;
  margin-bottom: 8px;
}

.hero {
  align-items: start;
  display: grid;
  gap: clamp(22px, 3vw, 40px);
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  min-height: auto;
  padding: clamp(26px, 4vw, 52px) clamp(18px, 5vw, 72px) clamp(28px, 4vw, 52px);
}

.hero-content {
  align-self: start;
  max-width: 780px;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 10px;
  text-transform: uppercase;
}

h1,
h2 {
  letter-spacing: 0;
  line-height: 1.08;
  margin: 0;
}

h1 {
  font-size: clamp(40px, 7vw, 78px);
}

.page-heading h1 {
  font-size: clamp(36px, 5vw, 58px);
}

h2 {
  font-size: 22px;
}

.lead,
.page-heading p {
  color: var(--muted);
  font-size: 18px;
  max-width: 680px;
}

.actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  text-decoration: none;
}

.button.primary {
  background: var(--primary);
  color: #fff;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.notice-panel,
.result-box,
.case-summary,
.form-shell,
.case-detail,
.case-actions-panel,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.notice-panel {
  align-self: start;
  padding: 28px;
}

.check-list {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
}

.check-list li {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.page,
.admin-page {
  margin: 0 auto;
  max-width: 1160px;
  padding: 42px 18px 64px;
}

.narrow {
  max-width: 760px;
}

.page-heading,
.admin-heading {
  margin-bottom: 28px;
}

.admin-heading {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.narrow .page-heading h1,
.admin-heading h1 {
  font-size: clamp(34px, 8vw, 52px);
}

.admin-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-shell {
  display: grid;
  gap: 22px;
  padding: clamp(20px, 4vw, 32px);
}

.form-shell.compact {
  gap: 16px;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

legend {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 14px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  color: var(--muted);
  display: grid;
  font-size: 14px;
  font-weight: 700;
  gap: 7px;
  margin-bottom: 16px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  outline: 3px solid rgba(67, 130, 171, 0.18);
}

.choice-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.radio-card {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  display: flex;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
}

.radio-card input {
  min-height: 0;
  width: auto;
}

.identity-fields {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.identity-fields[hidden] {
  display: none;
}

.form-note {
  color: var(--muted);
  margin: 0 0 14px;
}

.alert {
  background: #fff1ee;
  border: 1px solid #efc3b8;
  border-radius: 8px;
  color: #822f20;
  margin-bottom: 18px;
  padding: 13px 15px;
}

.alert.success {
  background: #edf7f1;
  border-color: #bbdfca;
  color: #23583d;
}

.result-box {
  padding: 32px;
}

.credentials {
  display: grid;
  gap: 14px;
  margin: 24px 0;
}

.credentials div,
.summary-row {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 14px;
}

dt,
.summary-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
}

.credentials dd {
  font-size: 24px;
  font-weight: 700;
}

.case-summary {
  margin-top: 22px;
  padding: 24px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.timeline {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}

.timeline li {
  border-left: 3px solid var(--primary);
  padding-left: 12px;
}

.timeline time {
  color: var(--muted);
  font-size: 13px;
}

.timeline p {
  margin: 3px 0 0;
}

.metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.metrics article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.metrics span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.metrics strong {
  display: block;
  font-size: 32px;
  margin-top: 6px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 780px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.pill {
  background: var(--surface-2);
  border-radius: 999px;
  display: inline-flex;
  padding: 5px 9px;
}

.table-link {
  color: var(--primary);
  font-weight: 700;
}

.empty,
.muted {
  color: var(--muted);
}

.case-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) 380px;
}

.users-layout {
  grid-template-columns: 360px minmax(0, 1fr);
}

.case-detail,
.case-actions-panel {
  padding: 24px;
}

.case-detail h2,
.case-actions-panel h2 {
  font-size: 20px;
  margin: 24px 0 14px;
}

.case-detail h2:first-child {
  margin-top: 0;
}

.detail-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-list div {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.report-text {
  white-space: pre-wrap;
}

.user-agent-box {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  overflow-wrap: anywhere;
}

.attachment-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.attachment-list li {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 12px;
}

.attachment-list span {
  color: var(--muted);
  font-size: 13px;
}

.footer {
  background: var(--primary);
  color: rgba(255, 255, 255, 0.86);
  margin-top: auto;
  padding: 20px clamp(18px, 4vw, 56px);
  text-align: center;
}

.footer p {
  font-size: 13px;
  margin: 14px auto 0;
  max-width: 840px;
}

.footer-logos {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: center;
  min-height: 70px;
}

.footer-logos img {
  filter: brightness(0) invert(1);
  max-height: 50px;
  max-width: 142px;
  object-fit: contain;
}

.footer-logos .footer-logo-cara {
  max-height: 66px;
  max-width: 150px;
}

@media (max-width: 820px) {
  body {
    overflow-x: hidden;
  }

  .topbar,
  .admin-heading,
  .summary-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 12px;
    min-height: 0;
  }

  .brand {
    justify-content: center;
    width: 100%;
  }

  .brand-logo {
    height: 78px;
    max-width: 78vw;
    width: 180px;
  }

  .brand span {
    min-width: 0;
  }

  .nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .admin-user-chip {
    text-align: center;
    width: 100%;
  }

  .admin-header-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .nav a {
    background: var(--surface);
    border: 1px solid var(--line);
    text-align: center;
  }

  .hero,
  .case-layout,
  .users-layout,
  .grid.two,
  .grid.three,
  .identity-fields,
  .metrics {
    grid-template-columns: 1fr;
  }

  .hero {
    gap: 20px;
    min-height: auto;
    padding-top: 32px;
  }

  .page,
  .admin-page {
    max-width: 100%;
    overflow-x: hidden;
    padding: 28px 14px 48px;
    width: 100%;
  }

  .form-shell,
  .notice-panel,
  .result-box,
  .case-summary,
  .case-detail,
  .case-actions-panel,
  .table-wrap {
    max-width: 100%;
    min-width: 0;
  }

  .choice-row {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 38px;
  }

  .page-heading h1,
  .narrow .page-heading h1,
  .admin-heading h1 {
    font-size: 34px;
  }

  .lead,
  .page-heading p {
    font-size: 16px;
  }

  .actions .button {
    width: 100%;
  }

  .notice-panel {
    align-self: stretch;
  }

  .table-wrap {
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  thead {
    display: none;
  }

  tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    padding: 12px;
  }

  td {
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 10px 0;
    overflow-wrap: anywhere;
  }

  .inline-password-form {
    grid-template-columns: 1fr;
  }

  .user-profile-form {
    grid-template-columns: 1fr;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    color: var(--muted);
    content: attr(data-label);
    flex: 0 0 42%;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .footer-logos img {
    max-height: 38px;
    max-width: 104px;
  }

  .footer-logos .footer-logo-cara {
    max-height: 54px;
    max-width: 118px;
  }
}
