:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e3e5e9;
  --text: #1a1d24;
  --text-muted: #5b6472;
  --accent: #ee4d2d;
  --accent-hover: #d8431f;
  --red: #dc2626;
  --green: #16a34a;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 8px 28px rgba(16, 24, 40, 0.1), 0 2px 6px rgba(16, 24, 40, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1a1d24;
    --border: #2b2f38;
    --text: #e8e9ec;
    --text-muted: #9aa0aa;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.5);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .logo-icon { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; }
.topbar .brand { font-weight: 700; font-size: 0.95rem; }
.topbar nav { display: flex; gap: 0.4rem; margin-left: 1rem; flex-wrap: wrap; }
.topbar nav a {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
}
.topbar nav a:hover { background: var(--bg); color: var(--text); }
.topbar nav a.active { background: rgba(238, 77, 45, 0.12); color: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar .logout-btn {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}
.topbar .logout-btn:hover { color: var(--text); }

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}
h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 1.1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.1rem;
}

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}
.field { margin-bottom: 1rem; }
input[type="text"], input[type="search"], textarea, select {
  width: 100%;
  font-size: 0.92rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}
textarea { resize: vertical; min-height: 5rem; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(238, 77, 45, 0.15);
}
.checkbox-row { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: none;
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--text);
}
.checkbox-row input { width: auto; }

button.btn {
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  background: var(--accent);
  cursor: pointer;
}
button.btn:hover { background: var(--accent-hover); }
button.btn:disabled { opacity: 0.6; cursor: default; }
button.btn.secondary {
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
button.btn.secondary:hover { color: var(--text); }
button.btn.danger { background: var(--red); }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.02em; }
tr:last-child td { border-bottom: none; }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(238, 77, 45, 0.1);
  color: var(--accent);
  border-radius: 6px;
  padding: 0.1rem 0.45rem;
  margin: 0 0.2rem 0.2rem 0;
}
.muted { color: var(--text-muted); font-size: 0.85rem; }
.error {
  background: rgba(220, 38, 38, 0.08);
  color: var(--red);
  font-size: 0.85rem;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  margin-bottom: 1rem;
  display: none;
}
.error.show { display: block; }
.success {
  background: rgba(22, 163, 74, 0.08);
  color: var(--green);
  font-size: 0.85rem;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  margin-bottom: 1rem;
  display: none;
}
.success.show { display: block; }
.actions-cell { white-space: nowrap; }
.actions-cell button { margin-right: 0.4rem; }
