:root {
  /* Konvert brand: the wordmark's ink, and the chevron's green-to-teal gradient. */
  --brand-ink: #313133;
  --brand-green: #7bbc64;
  --brand-teal: #3bb0c5;
  --brand-gradient: linear-gradient(90deg, var(--brand-green), var(--brand-teal));

  --bg: #f3f5f5;
  --card: #ffffff;
  --text: var(--brand-ink);
  --muted: #5f6368;
  --border: #dcdfe2;
  /* Konvert green, darkened so green text passes contrast on white (5.2:1). */
  --accent: #3f7a2e;
  /* The Konvert app's primary green. White text on it is 2.2:1, so buttons use the ink (6:1). */
  --button: #84c050;
  --button-text: var(--brand-ink);
  --error: #b42318;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18181a;
    --card: #232326;
    --text: #eeeef0;
    --muted: #a3a7ad;
    --border: #3a3a3e;
    --accent: #84c050;
    --error: #ff8a80;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.card {
  max-width: 560px;
  margin: 48px auto;
  padding: 28px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

/* The chevron's gradient, as a band across the top of the card. */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--brand-gradient);
}

@media (max-width: 600px) {
  .card {
    margin: 0;
    border-radius: 0;
    border-inline: 0;
    padding: 24px 16px;
  }
}

.brand {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--muted);
}

.brand img {
  display: block;
  height: 26px;
  width: auto;
  /* Sit the wordmark's baseline on the text's. */
  transform: translateY(3px);
}

.lede,
.who,
.hint {
  color: var(--muted);
}

.lede {
  margin: 0 0 20px;
}

.who {
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.hint {
  font-size: 0.875rem;
  margin: 6px 0 16px;
}

label {
  display: block;
  font-weight: 600;
  margin: 18px 0 6px;
}

textarea,
input,
select {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

/* The native select is shorter than an input and ignores padding on macOS, so draw our own. */
select {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 18px center, right 13px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}

/* The action under a form's fields. Block, so its margin merges with the one above it. */
form button[type="submit"],
textarea + button {
  display: block;
  margin-top: 20px;
}

.row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 480px) {
  .row {
    grid-template-columns: 1fr;
  }
}

button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 8px;
  padding: 10px 18px;
  background: var(--button);
  color: var(--button-text);
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.6;
  cursor: progress;
}

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  margin-top: 8px;
}

button.link {
  background: none;
  color: var(--accent);
  padding: 0;
  font-weight: 400;
}

.with-button {
  display: flex;
  gap: 8px;
}

#link {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  min-width: 0;
}

.with-button button {
  flex: none;
  margin-top: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions button {
  margin-top: 0;
}

.error {
  color: var(--error);
  min-height: 1.5em;
  margin: 10px 0 0;
}

[hidden] {
  display: none !important;
}

/* ---- Tabs between the staff pages --------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 20px;
}

.tabs a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  padding: 0 0 8px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
}

.tabs a:hover {
  color: var(--text);
}

.tabs a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tabs a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Sent Links ---------------------------------------------------------------------------- */

.links-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.links-head input {
  flex: 1;
  min-width: 0;
}

.links-head select {
  width: auto;
}

.links-head button {
  font-size: 0.875rem;
  flex: none;
}

#links-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#links-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.link-desc {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.link-meta {
  grid-column: 1;
  font-size: 0.85rem;
  color: var(--muted);
}

.link-status {
  grid-column: 1;
  font-size: 0.85rem;
}

.link-status::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--muted);
}

.link-status.opened::before {
  background: var(--brand-green);
}

.link-status.waiting::before {
  background: var(--brand-teal);
}

.link-status.revoked::before {
  background: var(--error);
}

#links-list li button {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  font-size: 0.85rem;
  padding: 6px 12px;
  margin: 0;
}

#links-list li button.confirm {
  background: var(--error);
  border-color: var(--error);
  color: var(--card);
}
