:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #63706b;
  --line: #d8dfdc;
  --paper: #ffffff;
  --canvas: #f4f6f5;
  --green: #126a4a;
  --green-dark: #0b5038;
  --green-soft: #e6f3ed;
  --red: #a72c2c;
  --red-soft: #fff1f1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }

.topbar {
  align-items: center;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 64px;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1080px) / 2));
}

.brand { color: var(--ink); font-size: 18px; font-weight: 750; text-decoration: none; }
.security-mark { color: var(--green); font-size: 13px; font-weight: 700; }
.quiet-link, .text-link { color: var(--green); font-size: 14px; font-weight: 700; text-decoration: none; }
.quiet-link:hover, .text-link:hover { text-decoration: underline; }
.shell { margin: 0 auto; max-width: 1080px; padding: 64px 24px 96px; }
.shell.narrow { max-width: 660px; }
.auth-shell { max-width: 560px; }
.page-heading { margin-bottom: 28px; }
.page-heading h1 { font-size: 34px; letter-spacing: 0; line-height: 1.15; margin: 6px 0 10px; }
.page-heading p:last-child { color: var(--muted); margin: 0; }
.page-heading .requested-service { color: var(--ink); font-size: 15px; margin: 0 0 8px; }
.eyebrow { color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: 0; margin: 0; text-transform: uppercase; }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgb(23 32 29 / 5%);
  padding: 28px;
}

.panel + .panel { margin-top: 18px; }
label { display: block; font-size: 14px; font-weight: 700; margin: 0 0 7px; }
input, select, textarea {
  background: #fff;
  border: 1px solid #aeb9b5;
  border-radius: 6px;
  color: var(--ink);
  display: block;
  margin: 0 0 20px;
  min-height: 46px;
  padding: 10px 12px;
  width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); outline: 3px solid rgb(18 106 74 / 15%); }
.optional { color: var(--muted); font-weight: 500; }

.primary, .copy-row button, [data-copy-secret] {
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 6px;
  color: #fff;
  font-weight: 750;
  min-height: 44px;
  padding: 9px 15px;
}
.primary:hover, .copy-row button:hover, [data-copy-secret]:hover { background: var(--green-dark); }
.primary { width: 100%; }
.secondary {
  background: #fff;
  border: 1px solid #99a7a1;
  border-radius: 6px;
  color: var(--ink);
  font-weight: 750;
  min-height: 44px;
  padding: 9px 15px;
}
.secondary:hover { background: #f0f4f2; }
.secondary.compact { min-height: 40px; }
.button-stack { display: grid; gap: 10px; }
.segmented { background: #edf1ef; border-radius: 6px; display: grid; gap: 3px; grid-template-columns: 1fr 1fr; margin-bottom: 24px; padding: 3px; }
.segmented button { background: transparent; border: 0; border-radius: 4px; color: var(--muted); font-size: 14px; font-weight: 750; min-height: 38px; padding: 7px 10px; }
.segmented button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 4px rgb(23 32 29 / 12%); color: var(--ink); }
.field-hint { color: var(--muted); font-size: 12px; margin: -13px 0 20px; }
.form-status { color: var(--red); font-size: 14px; margin: 12px 0 0; min-height: 21px; }
.inline-status { color: var(--muted); }
.status-info { color: var(--muted); }
.status-success { color: var(--green); }
.status-error { color: var(--red); }
.state-panel.status-error { background: var(--red-soft); }
.result label { margin-top: 22px; }
.success-line { align-items: flex-start; display: flex; gap: 12px; }
.success-line p { color: var(--muted); margin: 2px 0 0; }
.check { align-items: center; background: var(--green-soft); border-radius: 50%; color: var(--green); display: flex; flex: 0 0 30px; font-weight: 900; height: 30px; justify-content: center; }
.copy-row { display: grid; gap: 8px; grid-template-columns: 1fr auto; }
.copy-row input { margin: 0; min-width: 0; }
.state-panel { color: var(--muted); }
.panel > .state-panel { padding: 2px 0 20px; }

.secret { border-top: 1px solid var(--line); margin-top: 22px; }
.secret-row { border-bottom: 1px solid var(--line); display: grid; gap: 14px; grid-template-columns: 100px 1fr; padding: 18px 0; }
.secret-row > span { color: var(--muted); font-size: 13px; font-weight: 700; }
.secret-row > div { align-items: center; display: flex; gap: 8px; justify-content: space-between; min-width: 0; }
.secret-row code { overflow-wrap: anywhere; }
.secret-row button { flex: 0 0 auto; min-height: 34px; padding: 4px 10px; }
.notes-row p { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.danger-zone { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 20px; }
.danger { background: #fff; border: 1px solid #d9a9a9; border-radius: 6px; color: var(--red); font-weight: 700; min-height: 42px; padding: 8px 13px; }
.danger:hover { background: #fff4f4; }
.account-nav { align-items: center; display: flex; gap: 16px; min-width: 0; }
.account-nav span { color: var(--muted); font-size: 13px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-button { background: transparent; border: 0; color: var(--green); font-size: 13px; font-weight: 750; min-height: 32px; padding: 4px; }
.link-button:hover { text-decoration: underline; }
.dashboard-shell { max-width: 920px; padding-top: 42px; }
.dashboard-heading, .section-heading { align-items: center; display: flex; justify-content: space-between; }
.dashboard-heading { border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.dashboard-heading h1 { font-size: 30px; line-height: 1.2; margin: 5px 0 0; }
.new-request-section { padding: 28px 0 40px; }
.new-request-section h2, .requests-section h2 { font-size: 17px; margin: 0 0 14px; }
.dashboard-create-form { align-items: end; display: grid; gap: 16px; grid-template-columns: minmax(0, 1.5fr) minmax(180px, .75fr) auto; }
.dashboard-create-form input, .dashboard-create-form select { margin: 0; }
.dashboard-create-form .primary { min-width: 190px; width: auto; }
.dashboard-create-form .form-status { grid-column: 1 / -1; margin: -4px 0 0; }
.compact-panel { padding: 22px; }
.inline-status { color: var(--muted); font-size: 14px; min-height: 21px; }
.requests-section { min-width: 0; }
.request-list { display: grid; gap: 12px; }
.request-row { align-items: start; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) auto; min-height: 112px; padding: 20px; }
.request-row > div:first-child { min-width: 0; }
.request-name { color: var(--ink); font-size: 15px; font-weight: 750; }
.request-name-link { text-decoration: none; }
.request-name-link:hover { color: var(--green); text-decoration: underline; }
.request-name-link:focus-visible { border-radius: 2px; outline: 2px solid var(--green); outline-offset: 3px; }
.request-row p { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.client-link-row { align-items: center; display: grid; gap: 8px; grid-template-columns: minmax(0, 480px) auto; margin-top: 12px; max-width: 540px; min-width: 0; }
.client-link-row .client-url { background: var(--canvas); color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; margin: 0; min-height: 40px; min-width: 0; padding: 7px 9px; width: 100%; }
.client-link-row .link-button { flex: 0 0 auto; min-height: 44px; padding: 0 4px; }
.row-actions { align-items: flex-end; display: flex; flex-direction: column; gap: 4px; }
.status-badge { border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 800; padding: 3px 8px; text-transform: uppercase; }
.status-submitted { background: var(--green-soft); border-color: #b7d7c8; color: var(--green); }
.status-expired, .status-deleted { background: #f1f2f2; }
.empty-state { color: var(--muted); margin: 0; padding: 28px 0; }
[hidden] { display: none !important; }

@media (max-width: 560px) {
  .topbar { height: 58px; padding: 0 18px; }
  .shell { padding: 42px 16px 72px; }
  .page-heading h1 { font-size: 29px; }
  .panel { padding: 22px 18px; }
  .copy-row { grid-template-columns: 1fr; }
  .secret-row { grid-template-columns: 1fr; }
  .security-mark { font-size: 12px; }
  .account-nav span { display: none; }
  .dashboard-heading { align-items: flex-start; gap: 16px; }
  .request-row { align-items: flex-start; grid-template-columns: 1fr; }
  .row-actions { align-items: flex-start; }
}

@media (max-width: 720px) {
  .dashboard-create-form { align-items: stretch; grid-template-columns: 1fr; }
  .dashboard-create-form .primary { width: 100%; }
  .dashboard-create-form .form-status { grid-column: auto; }
}
