:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-soft: #ebf1ff;
  --line: #e0e0e0;
  --line-strong: #99bbff;
  --text: #141414;
  --muted: #525252;
  --subtle: #7a7a7a;
  --accent: #0036a3;
  --accent-surface: #99bbff;
  --accent-dark: #4785ff;
  --danger: #c0453b;
  --success: #287a3f;
  --amber: #d97706;
  --warning: #8a5a00;
  --backdrop: rgb(20 20 20 / 40%);
  --focus-ring: rgb(153 187 255 / 30%);
  --radius: 2px;
  --duration-fast: 150ms;
  --duration-base: 240ms;
  --ease-standard: cubic-bezier(.2, .7, .2, 1);
  color: var(--text);
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-weight: 300;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }

.hidden { display: none !important; }
.shell { min-height: 100vh; }

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 72px;
  padding-inline: max(24px, calc((100vw - 1180px) / 2));
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  color: var(--text);
  display: flex;
  gap: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  display: block;
  height: 46px;
  width: 105px;
}

.product-name {
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  padding-left: 16px;
}


.header-actions, .form-actions, .dialog-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.dialog-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

h1, h2, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
h1 { font-size: 30px; letter-spacing: -0.02em; margin-bottom: 8px; }
h2 { font-size: 18px; letter-spacing: -0.01em; margin: 0; }

.dialog-close {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  font-size: 20px;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.dialog-close:hover { border-color: var(--accent); color: var(--accent); }

.button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 400;
  height: 38px;
  justify-content: center;
  line-height: 1;
  padding: 0 14px;
  text-decoration: none;
  transition: 120ms ease;
  white-space: nowrap;
}

.button:disabled, .button[aria-disabled="true"] { cursor: not-allowed; opacity: 0.45; pointer-events: none; }
.button.primary { border-color: var(--text); color: var(--text); }
.button.primary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.button.secondary, .button.ghost { color: var(--muted); }
.button.secondary:hover:not(:disabled), .button.ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.button.danger { border-color: var(--danger); color: var(--danger); }
.button.danger:hover:not(:disabled) { opacity: 0.72; }
.button.compact { padding: 0 10px; }
.button:focus-visible, .dialog-close:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

.sign-in-panel {
  max-width: 420px;
  text-align: center;
}

.sign-in-panel h1 {
  font-size: 38px;
  margin: 0 0 20px;
}

.sign-in-panel p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  margin: 0 0 32px;
}

.sign-in-gate {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 72px - 112px);
  padding: 48px 0 104px;
}

.sign-in-action {
  display: inline-flex;
  min-width: 10rem;
}

.keys-page { margin: 0 auto; max-width: 1276px; padding: 56px 48px 104px; }
.page-heading { align-items: center; display: flex; justify-content: space-between; margin-bottom: 40px; }
.page-heading h1 { font-size: 38px; margin: 0; }
.keys-page > .form-error:empty { display: none; }
.keys-list { border-top: 1px solid var(--line); }
.key-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 40px;
  grid-template-columns: minmax(180px, 0.75fr) minmax(0, 1.7fr) 160px;
  padding: 9px 16px;
}
.key-summary { pointer-events: none; position: relative; z-index: 1; }
.key-identity { min-width: 0; }
.key-identity strong { display: block; font-size: 13px; font-weight: 600; line-height: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-identity strong code { font-size: 13px; font-weight: 400; }
.key-identity a { color: inherit; text-decoration: none; }
.key-identity a:hover { color: var(--accent); }
.back-link { color: var(--muted); display: inline-block; font-size: 12px; margin-bottom: 8px; text-decoration: none; }
.back-link::before { content: "← "; }
.back-link:hover { color: var(--accent); }
#key-detail-summary .key-row { grid-template-columns: 1fr; }
.sandboxes-table { margin-top: 40px; overflow-x: auto; }
.sandboxes-table table { border-collapse: collapse; font-size: 12px; min-width: 820px; width: 100%; }
.sandboxes-table th { border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 400; padding: 8px 12px; text-align: left; }
.sandboxes-table td { border-bottom: 1px solid var(--line); padding: 9px 12px; white-space: nowrap; }
.sandboxes-table code { font-size: 11px; }
.sandboxes-table .number { font-variant-numeric: tabular-nums; text-align: right; }
#key-sandboxes-note:empty { display: none; }
.key-credential { align-items: baseline; display: flex; gap: 8px; height: 20px; margin-top: 2px; white-space: nowrap; }
.key-credential code { color: var(--subtle); font-size: 11px; }
.key-state { color: var(--muted); font-size: 11px; }
.key-state.revoked { color: var(--danger); }
.key-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; position: relative; z-index: 1; }
.key-summary { display: grid; gap: 32px; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; }
.key-summary dt { color: var(--muted); font-size: 11px; line-height: 14px; }
.key-summary dd { font-family: Georgia, "Times New Roman", serif; font-size: 17px; line-height: 20px; margin: 2px 0 0; }
.key-summary dd small { color: var(--muted); font-family: "Helvetica Neue", Arial, sans-serif; font-size: 11px; margin-left: 3px; }
.ended-keys { margin-top: 48px; }
.ended-keys h2 { margin-bottom: 16px; }
.issue-key-dialog { max-width: 560px; }

label { color: var(--muted); display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.01em; position: relative; }
input, textarea, select {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  display: block;
  margin-top: 7px;
  outline: none;
  padding: 10px 11px;
  resize: vertical;
  width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-dark); box-shadow: 0 0 0 3px var(--focus-ring); }
.form-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin: 14px 0; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.input-suffix, .input-prefix { bottom: 11px; color: var(--subtle); pointer-events: none; position: absolute; right: 11px; }
.label-note { color: var(--subtle); font-weight: 400; }
.form-error { color: var(--danger); font-size: 11px; margin: 0; min-height: 16px; }

.dialog {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  max-width: min(760px, calc(100vw - 32px));
  padding: 0;
  width: 100%;
}
.dialog::backdrop { background: var(--backdrop); }
.dialog > form { padding: 28px; }
.dialog-close { font-size: 24px; font-weight: 300; }
.issue-key-dialog label { margin-bottom: 15px; }
.policy-dialog { max-width: 620px; }
.checkbox-label { align-items: center; display: flex; gap: 8px; margin: 14px 0; }
.checkbox-label input { margin: 0; width: auto; }
.dialog-actions { border-top: 1px solid var(--line); justify-content: flex-end; margin-top: 14px; padding-top: 18px; }

.toast { background: var(--text); border-radius: var(--radius); bottom: 24px; color: var(--surface); font-size: 12px; left: 50%; opacity: 0; padding: 11px 15px; pointer-events: none; position: fixed; transform: translate(-50%, 10px); transition: 180ms ease; z-index: 50; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.empty-copy { color: var(--subtle); font-size: 12px; padding: 24px 18px; text-align: center; }

@media (max-width: 920px) {
  .key-row { align-items: start; grid-template-columns: minmax(180px, 1fr) minmax(380px, 1.5fr); row-gap: 12px; }
  .key-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .key-actions:empty { display: none; }
  .key-summary { gap: 12px 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .keys-page { padding: 36px 16px 64px; }
  .page-heading { flex-wrap: wrap; gap: 16px; margin-bottom: 28px; }
  .key-row { gap: 12px; grid-template-columns: 1fr; }
  .key-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .button, .toast { transition: none; }
}
