:root {
  color-scheme: light;
  --ink: #23392f;
  --dark: #17392e;
  --muted: #58695f;
  --paper: #f7f6f0;
  --surface: #fffefa;
  --line: #d9dfd6;
  --gold: #b4955d;
  --gold-light: #e6d2a8;
  font: 15px/1.55 Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid #9b7940; outline-offset: 4px; }
.wrap { width: min(1120px, calc(100% - 72px)); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-inner, .top-actions, .brand, .language { display: flex; align-items: center; }
.topbar-inner { min-height: 74px; justify-content: space-between; gap: 20px; }
.brand { gap: 12px; text-decoration: none; letter-spacing: .17em; font-size: 15px; font-weight: 700; line-height: 1.2; }
.brand img { flex: none; display: block; border-radius: 5px; }
.brand small { display: block; font-size: 10px; font-weight: 400; color: var(--muted); letter-spacing: .13em; text-transform: uppercase; margin-top: 4px; }
.top-actions { gap: clamp(14px, 2.8vw, 30px); }
.top-actions a { font-size: 13px; text-decoration: none; }
.top-actions a:hover, .footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.language { gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 5px; }
.language button { border: 0; border-radius: 3px; background: transparent; color: var(--muted); padding: 6px 8px; font-size: 12px; }
.language button[aria-pressed="true"] { background: var(--dark); color: #fff; }
.portal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 546px;
  margin-top: clamp(35px, 7.2vh, 80px);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgb(36 55 42 / .06);
  border-radius: 8px;
  overflow: hidden;
}
.intro { display: flex; flex-direction: column; background: var(--dark); color: #fffdf5; min-width: 0; }
.intro-copy { padding: clamp(33px, 5vw, 55px); }
.intro h1, .panel h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: -.03em; }
.intro h1 { font-size: clamp(40px, 5.2vw, 72px); line-height: 1.02; max-width: 10ch; margin: 0 0 21px; }
.intro p { max-width: 33ch; margin: 0; color: #dce4d9; }
.stone {
  flex: 1;
  min-height: 175px;
  background-color: #ece6da;
  background-image: url("/assets/portal-stone.jpg");
  background-position: center 50%;
  background-size: cover;
  border-top: 3px solid var(--gold);
}
.panel {
  background: var(--surface);
  padding: clamp(29px, 5vw, 56px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#portal-state { width: 100%; max-width: 420px; margin: 0 auto; }
.panel h2 { font-size: clamp(32px, 4.1vw, 46px); line-height: 1; margin: 0 0 13px; }
.panel p { margin: 0; }
.panel h2 + p { color: var(--muted); margin-bottom: 22px; }
.mode { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin: 0 0 24px; }
.mode button { padding: 0 0 9px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 14px; text-align: left; }
.mode button[aria-pressed="true"] { border-color: var(--gold); color: var(--ink); font-weight: 700; }
.portal-form { display: grid; gap: 16px; }
.portal-form label { display: grid; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 700; }
.portal-form input { min-height: 46px; width: 100%; padding: 10px 13px; border: 1px solid #b7c1b6; border-radius: 5px; color: var(--ink); background: #fff; font-weight: 400; }
.portal-form input::placeholder { color: #617167; }
.portal-form input:focus { outline: 2px solid #9b7940; outline-offset: 2px; }
.button {
  min-height: 44px;
  display: inline-flex;
  padding: 10px 15px;
  border: 1px solid transparent;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  gap: 10px;
}
.button:disabled { opacity: .65; cursor: wait; }
.button-primary { background: var(--dark); color: #fff; }
.button-primary:hover:not(:disabled) { background: #254d3e; }
.button-secondary { border-color: #b9c3b8; background: transparent; color: var(--ink); }
.button-secondary:hover:not(:disabled) { background: var(--paper); }
.portal-form .button { justify-self: stretch; justify-content: space-between; margin-top: 3px; }
.message { padding: 11px 13px; margin: 0 0 16px; border: 1px solid #adc3ae; border-radius: 5px; background: #edf5eb; color: #21442c; font-size: 13px; }
.message[data-kind="error"] { background: #fff1ec; color: #782b20; border-color: #ddac9d; }
.identity { padding: 11px 0; line-height: 1.45; overflow-wrap: anywhere; }
.identity strong, .identity small { display: block; }
.identity small { color: var(--muted); }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 16px 0 0; }
.footer { display: flex; justify-content: space-between; gap: 18px; color: var(--muted); font-size: 12px; padding: 22px 0 30px; }
.footer a { text-decoration: none; }
.portal-layout[data-view="owner"] { grid-template-columns: minmax(0, 1fr); min-height: 0; }
.portal-layout[data-view="owner"] .intro { display: none; }
.portal-layout[data-view="owner"] #portal-state { max-width: none; }
.owner-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 20px; }
.owner-head .panel-actions { margin: 0; }
.owner-list { padding-top: 14px; border-top: 1px solid var(--line); }
.owner-rows { list-style: none; padding: 0; margin: 0; }
.owner-list h3 { font-size: 16px; margin: 0 0 13px; }
.owner-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; align-items: center; gap: 18px; padding: 8px 0; border-top: 1px solid var(--line); min-width: 0; }
.owner-row:last-child { border-bottom: 1px solid var(--line); }
.owner-row .panel-actions { margin: 0; justify-content: flex-end; }
.owner-row .panel-actions .button { min-height: 40px; }
.badge { border-radius: 3px; padding: 4px 8px; background: #ecefe9; color: #36483c; font-size: 12px; white-space: nowrap; }
.badge[data-status="pending"] { background: #f4ead1; color: #694d18; }
.badge[data-status="approved"] { background: #e8f3e6; color: #295738; }
.badge[data-status="rejected"], .badge[data-status="revoked"] { background: #f7ebe7; color: #702d23; }
@media (max-width: 800px) {
  .wrap { width: calc(100% - 38px); }
  .portal-layout { grid-template-columns: minmax(0, 1fr); margin-top: 24px; min-height: 0; }
  .intro { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
  .intro-copy { padding: 26px; }
  .intro h1 { font-size: clamp(29px, 6.5vw, 53px); margin-bottom: 11px; max-width: 15ch; }
  .intro p { font-size: 13px; }
  .stone { border-top: 0; border-left: 2px solid var(--gold); min-height: 0; }
  #portal-state { max-width: 510px; }
  .panel { padding: 30px 26px; }
  .owner-row { grid-template-columns: minmax(0, 1fr) auto; }
  .owner-row .panel-actions { grid-column: 1 / -1; justify-content: flex-start; margin: -8px 0 8px; }
}
@media (max-width: 475px) {
  .wrap { width: calc(100% - 28px); }
  .topbar-inner { gap: 8px; min-height: 62px; }
  .top-actions { gap: 9px; }
  .top-actions a { font-size: 11px; text-align: right; line-height: 1.25; max-width: 105px; }
  .brand { font-size: 13px; gap: 8px; white-space: nowrap; }
  .brand img { width: 29px; height: auto; }
  .brand small { font-size: 8px; }
  .language button { padding-inline: 5px; }
  .intro { grid-template-columns: minmax(0, 1fr) 76px; }
  .intro-copy { padding: 19px; }
  .panel { padding: 25px 19px; }
  .owner-head { flex-direction: column; }
  .owner-row { gap: 9px; }
  .owner-row .panel-actions { margin: 0 0 4px; }
  .footer { flex-wrap: wrap; gap: 4px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
