:root {
  --brand-yellow: #d2d648;
  --brand-white: #ffffff;
  --brand-black: #171717;

  --bg: #f6f8f4;
  --bg-soft: #f0f4e7;
  --surface: #ffffff;
  --surface-alt: #fbfdf7;
  --text: #171717;
  --text-soft: #5f6657;
  --line: #e6ead8;

  --accent: #d2d648;
  --accent-strong: #b8bd33;
  --accent-text: #171717;

  --topbar-a: #171717;
  --topbar-b: #171717;
  --topbar-text: #ffffff;

  --menu-bg: rgba(23, 23, 23, 0.9);
  --menu-link: #f1f1f1;
  --menu-link-hover: #2a2a2a;
  --menu-link-active-bg: linear-gradient(120deg, #d2d648, #b8bd33);
  --menu-link-active-text: #171717;

  --pill-bg: rgba(255, 255, 255, 0.08);
  --pill-border: rgba(255, 255, 255, 0.22);

  --field-bg: #ffffff;
  --focus-border: #d2d648;
  --focus-ring: rgba(210, 214, 72, 0.32);

  --shadow-soft: 0 8px 24px rgba(23, 23, 23, 0.06);
  --shadow-strong: 0 20px 50px rgba(23, 23, 23, 0.1);

  --danger: #c44c59;
  --success-bg: #f4f9df;
  --success-border: #d2d648;
  --error-bg: #fff0f2;
  --error-border: #efbcc4;
}

:root[data-theme="dark"] {
  --bg: #111111;
  --bg-soft: #1a1a1a;
  --surface: #1a1a1a;
  --surface-alt: #202020;
  --text: #ffffff;
  --text-soft: #b7b7b7;
  --line: #2e2e2e;

  --accent: #d2d648;
  --accent-strong: #c3c93f;
  --accent-text: #171717;

  --topbar-a: #0d0d0d;
  --topbar-b: #171717;
  --topbar-text: #ffffff;

  --menu-bg: rgba(23, 23, 23, 0.82);
  --menu-link: #efefef;
  --menu-link-hover: #2a2a2a;
  --menu-link-active-bg: linear-gradient(120deg, #d2d648, #b8bd33);
  --menu-link-active-text: #171717;

  --pill-bg: rgba(210, 214, 72, 0.15);
  --pill-border: rgba(210, 214, 72, 0.44);

  --field-bg: #141414;
  --focus-border: #d2d648;
  --focus-ring: rgba(210, 214, 72, 0.34);

  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.28);
  --shadow-strong: 0 24px 60px rgba(0, 0, 0, 0.46);

  --danger: #da6672;
  --success-bg: #2b331a;
  --success-border: #7d8538;
  --error-bg: #3a2024;
  --error-border: #83404a;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Poppins", "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(1200px 600px at -10% -20%, var(--bg-soft), transparent 70%),
    radial-gradient(1000px 500px at 110% 120%, var(--bg-soft), transparent 65%),
    var(--bg);
}

h1,
h2,
button,
.button-link,
.menu a {
  font-family: "Anton", "Poppins", sans-serif;
  font-weight: 400;
  letter-spacing: 0.3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  color: var(--topbar-text);
  background: linear-gradient(120deg, var(--topbar-a), var(--topbar-b));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-soft);
}

.topbar-main {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.9rem;
  line-height: 1;
}

.topbar p {
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.pill,
.theme-toggle {
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.85rem;
  background: var(--pill-bg);
  color: var(--topbar-text);
  backdrop-filter: blur(6px);
}

.theme-toggle {
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: var(--menu-bg);
  backdrop-filter: blur(8px);
}

.logout-form {
  margin-left: auto;
}

.logout-form button {
  padding: 8px 12px;
}

.menu a {
  text-decoration: none;
  color: var(--menu-link);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 1rem;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.menu a:hover {
  background: var(--menu-link-hover);
  transform: translateY(-1px);
}

.menu a.active {
  background: var(--menu-link-active-bg);
  color: var(--menu-link-active-text);
  box-shadow: inset 0 0 0 1px rgba(23, 23, 23, 0.15);
}

.container {
  width: min(1200px, calc(100% - 32px));
  margin: 18px auto 36px;
}

.grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--surface), var(--surface-alt));
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.narrow {
  max-width: 900px;
}

.login-card {
  max-width: 420px;
  margin: 72px auto;
  box-shadow: var(--shadow-strong);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
}

.form-grid {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

input,
select {
  width: 100%;
  background: var(--field-bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: "Poppins", sans-serif;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-check input {
  width: auto;
}

button,
.button-link {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: var(--accent-text);
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease;
}

button.secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--line);
}

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

button:hover,
.button-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

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

.small-link {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 700;
}

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

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

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  vertical-align: top;
}

th {
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

.muted {
  color: var(--text-soft);
  font-size: 0.86rem;
}

.alerts {
  margin-bottom: 12px;
}

.alert {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.alert.success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
}

.alert.error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
}

.hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.hint.success {
  color: #4f8d2e;
}

.hint.error {
  color: #bb4c5a;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.actions form {
  margin: 0;
}

@media (max-width: 800px) {
  .topbar-main { flex-direction: column; align-items: flex-start; }

  .topbar-right {
    justify-content: flex-start;
  }

  .logout-form {
    margin-left: 0;
  }
}
