@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Serif+Display&display=swap");

:root {
  --bg: #faf9f7;
  --ink: #1a0f0a;
  --muted: #5e514a;
  --accent: #c0392b;
  --accent-dark: #8e271c;
  --border: rgba(26, 15, 10, 0.1);
  --card: #fffdf9;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Crect width='1' height='1' fill='%23c1b5ac' opacity='0.15'/%3E%3C/svg%3E");
  opacity: 0.6;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

header h1,
.card h2,
.card h3,
.card h4 {
  font-family: "DM Serif Display", serif;
  margin: 0 0 12px;
  color: var(--ink);
}

.header,
.admin-header {
  text-align: center;
  margin-bottom: 40px;
  position: relative;
}

.logo {
  height: 68px;
  margin-bottom: 12px;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 8px;
}

.admin-nav {
  display: inline-flex;
  gap: 16px;
  margin-top: 18px;
}

.nav-link {
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 12px;
}

.nav-link:hover {
  border-color: rgba(192, 57, 43, 0.35);
}

.nav-link.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 32px;
  border: 1px solid var(--border);
  box-shadow: 0 30px 60px rgba(26, 15, 10, 0.08);
}

.two-column {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 28px;
  align-items: flex-start;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.form-group label {
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

input,
textarea,
select {
  font-family: "DM Sans", sans-serif;
  font-size: 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(26, 15, 10, 0.25);
  padding: 10px 4px;
  border-radius: 0;
  transition: border-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.btn-primary,
.btn-secondary {
  font-family: "DM Sans", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn-primary {
  background: var(--ink);
  color: white;
}

.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  border-color: rgba(26, 15, 10, 0.35);
  color: var(--ink);
}

.btn-secondary:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-primary.loading,
.btn-secondary.loading {
  opacity: 0.7;
  pointer-events: none;
}

.status {
  color: var(--muted);
  font-size: 14px;
  margin-top: 10px;
}

.instructions-text {
  white-space: pre-line;
  line-height: 1.6;
}

#documentationLink,
.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

#documentationLink:hover,
.link:hover {
  text-decoration: underline;
}

.form-section {
  border: 1px solid rgba(26, 15, 10, 0.12);
  border-radius: 16px;
  padding: 20px;
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.subsection {
  border: 1px dashed rgba(26, 15, 10, 0.2);
  border-radius: 12px;
  padding: 16px;
}

.toggle {
  display: inline-flex;
  gap: 8px;
  font-weight: 600;
  color: var(--ink);
}

.filters,
.table-actions {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.filters label {
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.filters select {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(26, 15, 10, 0.25);
  min-width: 150px;
}

.group-card details {
  border: 1px solid rgba(26, 15, 10, 0.15);
  border-radius: 12px;
  margin-bottom: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.9);
}

.group-card summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}

.group-meta {
  font-size: 13px;
  color: var(--muted);
  margin-left: 8px;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(26, 15, 10, 0.08);
  vertical-align: top;
}

th {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.status-badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(26, 15, 10, 0.08);
  text-transform: capitalize;
}

.priority-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: capitalize;
  font-size: 13px;
  border: 1px solid transparent;
}

.priority-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.priority-critical {
  border-color: rgba(192, 57, 43, 0.35);
  color: var(--accent);
}

.priority-critical::before { background: var(--accent); }

.priority-high {
  border-color: rgba(255, 107, 53, 0.4);
  color: #b34725;
}

.priority-high::before { background: #ff6b35; }

.priority-medium {
  border-color: rgba(242, 153, 74, 0.45);
  color: #b9721f;
}

.priority-medium::before { background: #f2994a; }

.priority-low {
  border-color: rgba(26, 15, 10, 0.2);
  color: var(--muted);
}

.priority-low::before { background: rgba(26, 15, 10, 0.4); }

.duplicate-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--accent);
}

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

.actions .btn-primary,
.actions .btn-secondary {
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 8px 14px;
}

.priority-select {
  margin-top: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(26, 15, 10, 0.25);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 14px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 0.95;
  transform: translateY(0);
}

.toast.error {
  background: var(--accent);
}

@media (max-width: 640px) {
  .card {
    padding: 22px;
  }
}
