:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #64748b;
  --line: #d8dee8;
  --primary: #166534;
  --primary-hover: #14532d;
  --danger: #b91c1c;
  --disabled: #94a3b8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 20px clamp(16px, 4vw, 40px);
  background: #0f172a;
  color: #fff;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

.topbar p {
  color: #cbd5e1;
  margin-top: 4px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 20px;
  padding: 20px clamp(16px, 4vw, 40px);
}

.panel, .login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.login-box {
  width: min(100%, 380px);
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

input, textarea, button {
  font: inherit;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 220px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

legend {
  padding: 0 6px;
  color: var(--muted);
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.inline input {
  width: auto;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  min-height: 40px;
}

button:hover {
  background: var(--primary-hover);
}

button.secondary {
  background: #e2e8f0;
  color: #0f172a;
}

button.danger {
  background: var(--danger);
}

button:disabled {
  background: var(--disabled);
  cursor: not-allowed;
}

.actions, .section-head, .url-row, .card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.url-row input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.result {
  margin-top: 16px;
}

.hidden {
  display: none;
}

.message {
  min-height: 24px;
  color: var(--danger);
}

.list {
  display: grid;
  gap: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.card-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.meta, .masked {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.status {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #dcfce7;
  color: #166534;
  white-space: nowrap;
}

.status.off {
  background: #fee2e2;
  color: #991b1b;
}

.sub-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

  .topbar, .card-title, .actions, .section-head, .url-row, .card-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
