* {
  box-sizing: border-box;
}

:root {
  --bg: #f6f1fb;
  --surface: #ffffff;
  --ink: #221b2e;
  --ink-soft: #6c6280;
  --border: #e9e1f5;
  --primary: #ff7a45;
  --primary-2: #ffb020;
  --primary-dark: #e35a25;
  --accent-violet: #7c3aed;
  --accent-teal: #0ea5a4;
  --accent-green: #16a34a;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow: 0 16px 40px -20px rgba(80, 40, 120, 0.35);
}

html,
body {
  height: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 32px 20px 60px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 122, 69, 0.16) 0%, transparent 42%),
    radial-gradient(circle at 92% 12%, rgba(124, 58, 237, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(14, 165, 164, 0.12) 0%, transparent 55%),
    var(--bg);
  min-height: 100%;
}

h1,
h2,
h3 {
  font-family: "Poppins", "Inter", sans-serif;
  color: var(--ink);
}

h1 {
  margin: 0 0 6px;
  font-size: 1.75rem;
  line-height: 1.2;
}

h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

p {
  color: var(--ink-soft);
}

a {
  color: var(--accent-violet);
  text-decoration: none;
  font-weight: 600;
}

a:hover {
  text-decoration: underline;
}

.brand {
  width: fit-content;
  max-width: 1000px;
  margin: 0 auto 28px;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(120deg, var(--primary) 0%, var(--primary-2) 100%);
  padding: 8px 18px 8px 14px;
  border-radius: 999px;
  box-shadow: 0 10px 24px -12px rgba(227, 90, 37, 0.55);
}

.brand-mark {
  font-size: 1.15rem;
}

.site-footer {
  max-width: 1080px;
  margin: 40px auto 0;
  padding: 20px 0;
  text-align: center;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
}

.site-footer a:hover {
  color: var(--accent-violet);
  border-color: #e2d6f9;
  background: #f4effb;
  text-decoration: none;
}

.site-footer a + a {
  margin-left: 10px;
}

.legal-text {
  white-space: pre-line;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--ink);
}

.shell {
  max-width: 420px;
  margin: 0 auto;
}

.shell.page-form,
.shell.page-success {
  max-width: 520px;
}

.shell.page-admin {
  max-width: 1080px;
}

.shell.page-legal {
  max-width: 760px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-2) 45%, var(--accent-violet) 100%);
}

.card + .card {
  margin-top: 24px;
}

.card-header {
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field input.has-error {
  border-color: #d9455f;
}

.field-error {
  font-size: 0.85rem;
  font-weight: 600;
  color: #d9455f;
  margin: 0;
}

.form-error {
  font-size: 0.9rem;
  font-weight: 600;
  color: #d9455f;
  background: #fdecef;
  border: 1px solid #f6c6cf;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  font: inherit;
  color: var(--ink);
  background: #fffdfa;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 122, 69, 0.2);
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--primary-dark);
  border-radius: var(--radius-md);
  background: linear-gradient(120deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff;
  transition: filter 0.15s ease, transform 0.05s ease;
}

button:hover,
.btn:hover {
  filter: brightness(0.94);
  text-decoration: none;
}

button:active,
.btn:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: #f4effb;
  color: var(--accent-violet);
  border-color: #e2d6f9;
}

.btn-secondary:hover {
  background: #ece0fb;
  color: var(--accent-violet);
  filter: none;
}

.btn-ghost {
  width: auto;
  min-height: auto;
  padding: 6px 12px;
  font-size: 0.85rem;
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: #f2edfa;
  color: var(--accent-violet);
  filter: none;
}

.btn-danger {
  width: 100%;
  min-height: 46px;
  padding: 10px 18px;
  margin-top: 24px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid #d9455f;
  border-radius: var(--radius-md);
  background: transparent;
  color: #d9455f;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-danger:hover {
  background: #d9455f;
  color: #fff;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.form-actions .btn,
.form-actions button {
  width: auto;
  flex: 1;
}

.hint {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 8px;
}

.foot-note {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, var(--accent-green) 0%, var(--accent-teal) 100%);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 18px;
}

.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0fbfa;
  border: 1px dashed var(--accent-teal);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 10px 0 18px;
}

.link-box code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  color: var(--ink);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar .welcome {
  margin: 0;
  color: var(--ink-soft);
}

.admin-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  align-items: start;
  gap: 24px;
}

.admin-grid > * {
  min-width: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  table-layout: auto;
}

th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent-violet);
  padding: 10px;
  background: #f4effb;
}

th:first-child {
  border-radius: 8px 0 0 8px;
}

th:last-child {
  border-radius: 0 8px 8px 0;
}

.truncate {
  display: block;
  max-width: 220px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

td {
  background: #fffdfa;
  border-top: 1px solid var(--border);
  padding: 12px 10px;
  font-size: 0.92rem;
  white-space: nowrap;
}

tbody tr:hover td {
  background: #fdf6f1;
}

tr:first-child td {
  border-top: none;
}

.empty-state {
  color: var(--ink-soft);
  text-align: center;
  padding: 28px 10px;
}

.copy-btn {
  width: auto;
  min-height: 38px;
  padding: 6px 14px;
  font-size: 0.85rem;
}

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

@media (max-width: 700px) {
  body {
    padding: 20px 14px 48px;
  }

  .card {
    padding: 22px;
  }

  h1 {
    font-size: 1.4rem;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  table {
    border-spacing: 0 12px;
  }

  tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: block;
  }

  td {
    display: grid;
    grid-template-columns: minmax(96px, 34%) 1fr;
    gap: 12px;
    border-top: 0;
    border-bottom: 1px solid var(--border);
    white-space: normal;
  }

  td:last-child {
    border-bottom: 0;
  }

  .truncate {
    max-width: none;
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }

  td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--ink-soft);
  }

  td.empty-state {
    display: block;
    text-align: left;
  }

  td.empty-state::before {
    content: "";
  }

  .form-actions {
    flex-direction: column;
  }
}
