:root {
  color-scheme: light;
  --red: #d5000d;
  --red-dark: #a90009;
  --graphite: #292b2f;
  --ink: #202328;
  --muted: #686e76;
  --line: #dfe2e6;
  --paper: #f4f5f6;
  --white: #fff;
  --green: #20744b;
  --blue: #235f91;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; }

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  z-index: 30;
  top: 12px;
  left: 14px;
  padding: 10px 14px;
  color: var(--white);
  background: var(--red);
  border-radius: 8px;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

.site-header {
  min-height: 76px;
  padding: 14px max(22px, env(safe-area-inset-right)) 14px max(22px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { width: 146px; height: 42px; display: block; object-fit: contain; object-position: center; }
.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy small { color: #757a81; font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.secure-label { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-size: 12px; font-weight: 750; }
.secure-label i { width: 8px; height: 8px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 4px rgba(32, 116, 75, .12); }

.logout-button, .reveal-button, .load-more, .primary-button, .action-link { min-height: 44px; border-radius: 9px; font-weight: 750; cursor: pointer; }
.logout-button { padding: 9px 13px; color: #4f555c; background: var(--white); border: 1px solid var(--line); }

main { width: min(calc(100% - 40px), 1120px); margin: auto; padding: 60px 0; }

.login-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(390px, .82fr); align-items: center; gap: clamp(48px, 9vw, 110px); }
.login-intro { position: relative; padding: 30px 0; }
.login-intro::before { content: ""; position: absolute; z-index: -1; width: 420px; height: 420px; left: -260px; top: -110px; background: radial-gradient(circle, rgba(213, 0, 13, .13), transparent 70%); }
.eyebrow { margin: 0 0 14px; display: flex; align-items: center; gap: 9px; color: var(--red-dark); font-size: 12px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow span { width: 28px; height: 2px; background: var(--red); }
.login-intro h1, .documents-heading h1 { margin: 0; letter-spacing: -.04em; line-height: 1.07; }
.login-intro h1 { max-width: 650px; font-size: clamp(40px, 5.4vw, 64px); }
.login-intro > p:not(.eyebrow) { max-width: 610px; margin: 24px 0 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
.login-intro ul { margin: 27px 0 0; padding: 0; display: grid; gap: 11px; list-style: none; color: #444a51; font-size: 14px; font-weight: 650; }
.login-intro li { display: flex; align-items: center; gap: 10px; }
.login-intro li span { width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; color: var(--green); background: #e9f5ee; border-radius: 50%; font-size: 12px; }

.login-card, .documents-card { background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 22px 65px rgba(24, 27, 31, .11); }
.login-card { padding: clamp(24px, 4vw, 36px); }
.card-heading { display: flex; align-items: center; gap: 13px; }
.lock-mark { width: 45px; height: 45px; flex: 0 0 auto; display: grid; place-items: center; color: var(--white); background: var(--graphite); border-radius: 13px; font-size: 10px; box-shadow: inset 0 0 0 12px rgba(255,255,255,.1); }
.card-heading h2 { margin: 0; font-size: 21px; }
.card-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
form { margin-top: 26px; }
.field { margin-top: 16px; }
.field:first-child { margin-top: 0; }
.field label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 800; }
.field input { width: 100%; min-height: 49px; padding: 11px 13px; color: var(--ink); background: var(--white); border: 1px solid #bfc4ca; border-radius: 10px; font-size: 16px; }
.field input[aria-invalid="true"] { border-color: var(--red); }
.password-field { position: relative; }
.password-field input { padding-right: 82px; }
.reveal-button { position: absolute; right: 5px; top: 5px; min-height: 39px; padding: 7px 10px; color: #50565e; background: #f3f4f5; border: 0; font-size: 11px; }
.form-message { min-height: 20px; margin: 10px 0 4px; color: var(--red-dark); font-size: 12px; font-weight: 750; }
.primary-button { width: 100%; min-height: 50px; padding: 11px 18px; color: var(--white); background: var(--red); border: 0; font-size: 14px; }
.primary-button:hover { background: var(--red-dark); }
.primary-button:disabled { opacity: .58; cursor: wait; }
.help-note { margin: 20px 0 0; padding-top: 18px; display: flex; align-items: flex-start; gap: 9px; color: var(--muted); border-top: 1px solid #eceef0; font-size: 12px; }
.help-note span, .privacy-footer span { width: 20px; height: 20px; flex: 0 0 auto; display: grid; place-items: center; color: var(--blue); background: #e9f1f8; border-radius: 50%; font-size: 11px; font-weight: 900; }

.documents-view { width: 100%; }
.documents-heading { margin-bottom: 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; }
.documents-heading h1 { font-size: clamp(35px, 5vw, 55px); }
.documents-heading > div:first-child > p:last-child { margin: 14px 0 0; color: var(--muted); }
.session-card { min-width: 180px; padding: 14px 16px; display: flex; flex-direction: column; color: var(--green); background: #eaf5ef; border: 1px solid #cfe6da; border-radius: 11px; }
.session-card small { font-size: 11px; }
.session-card strong { margin-top: 2px; font-size: 13px; }
.notice { margin-bottom: 16px; padding: 12px 14px; color: #71333a; background: #fff0f1; border: 1px solid #f0cdd0; border-radius: 10px; font-size: 13px; }
.documents-card { padding: clamp(20px, 3vw, 30px); }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.list-heading h2 { margin: 0; font-size: 20px; }
.list-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.count { flex: 0 0 auto; padding: 8px 11px; color: #555b62; background: #f1f2f3; border-radius: 999px; font-size: 12px; }
.count strong { color: var(--ink); }
.loading { min-height: 170px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 14px; }
.loading span { width: 22px; height: 22px; border: 3px solid #e2e4e7; border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { min-height: 250px; padding: 40px 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state > span { width: 52px; height: 52px; display: grid; place-items: center; color: var(--green); background: #e9f5ee; border-radius: 50%; font-size: 24px; }
.empty-state h3 { margin: 16px 0 4px; }
.empty-state p { max-width: 520px; margin: 0; color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 13px 11px; color: #737980; background: #f7f8f8; border-bottom: 1px solid var(--line); font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: .05em; }
td { padding: 15px 11px; border-bottom: 1px solid #eceef0; font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.cell-main { display: block; color: #30343a; font-weight: 750; }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.serial { max-width: 160px; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; }
.status-pill { display: inline-flex; padding: 5px 8px; color: var(--green); background: #e9f5ee; border-radius: 999px; font-size: 10px; font-weight: 800; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.action-link { min-height: 38px; padding: 8px 11px; display: inline-flex; align-items: center; justify-content: center; color: #3d434a; background: var(--white); border: 1px solid #cfd3d8; font-size: 11px; text-decoration: none; }
.action-link.primary { color: var(--white); background: var(--graphite); border-color: var(--graphite); }
.load-more { width: 100%; margin-top: 16px; padding: 10px 14px; color: #474d54; background: #f4f5f6; border: 1px solid var(--line); }
.privacy-footer { margin: 18px 0 0; display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 12px; }

footer { min-height: 62px; padding: 18px max(22px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left)); display: flex; justify-content: center; flex-wrap: wrap; gap: 14px 28px; color: #858b92; background: var(--white); border-top: 1px solid var(--line); font-size: 11px; }
footer a { color: #555b62; }

input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgba(213, 0, 13, .23); outline-offset: 3px; }

@media (max-width: 820px) {
  main { width: min(calc(100% - 28px), 640px); padding: 42px 0; }
  .login-view { display: block; }
  .login-intro { padding: 0; margin-bottom: 30px; }
  .login-intro h1 { font-size: clamp(36px, 10vw, 52px); }
  .documents-heading { align-items: flex-start; flex-direction: column; }
  .session-card { min-width: 0; }
  .list-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
}

@media (max-width: 660px) {
  .site-header { min-height: 68px; padding-inline: 14px; }
  .brand-logo { width: 126px; height: 36px; }
  .brand-copy small, .secure-label { display: none; }
  .logout-button { min-height: 38px; font-size: 11px; }
  main { width: min(calc(100% - 20px), 640px); padding: 30px 0; }
  .login-card, .documents-card { padding: 20px 16px; border-radius: 14px; }
  .table-wrap { overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  tbody { display: grid; gap: 12px; padding-top: 16px; }
  tr { padding: 13px; border: 1px solid var(--line); border-radius: 11px; }
  td { padding: 8px 0; display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; border: 0; }
  td::before { content: attr(data-label); color: #7b8188; font-size: 10px; font-weight: 800; text-transform: uppercase; }
  .actions { margin-top: -4px; }
  .action-link { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
