:root {
  --bg: #08110c;
  --panel: #101a14;
  --panel-soft: #14231a;
  --field: #07100b;
  --line: rgba(72, 187, 120, 0.28);
  --line-strong: rgba(72, 187, 120, 0.48);
  --text: #edfdf2;
  --muted: #b8d6c0;
  --primary: #39d873;
  --primary-dark: #16a34a;
  --danger: #ff5b5b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --glow: 0 0 28px rgba(57, 216, 115, 0.18);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(57, 216, 115, 0.13), transparent 34rem),
    linear-gradient(135deg, #08110c 0%, #0d1710 46%, #06100a 100%);
  color: var(--text);
}

a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

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

.panel {
  width: 100%;
  background: rgba(16, 26, 20, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--glow);
  padding: 28px;
}

.panel--sm {
  max-width: 460px;
}

.panel--md {
  max-width: 760px;
}

.title {
  margin: 0 0 24px;
  color: var(--primary);
  font-size: clamp(1.7rem, 3vw, 2.25rem);
  text-align: center;
  letter-spacing: 0;
}

.subtitle {
  margin: -12px 0 22px;
  color: var(--muted);
  text-align: center;
}

.topbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.inline-form {
  margin: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.action-card {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.action-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  background: rgba(57, 216, 115, 0.08);
}

.action-card h2 {
  margin: 0;
  color: var(--primary);
  font-size: 1.35rem;
}

.action-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.form-group {
  margin-top: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 14px;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
}

.page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: #c9f7d6;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(57, 216, 115, 0.14);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  color: #06100a;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(57, 216, 115, 0.22);
  text-decoration: none;
}

.button--block {
  width: 100%;
  margin-top: 18px;
}

.button--soft {
  border-color: var(--line);
  background: rgba(57, 216, 115, 0.08);
  color: var(--primary);
}

.button--danger {
  border-color: rgba(255, 91, 91, 0.42);
  background: rgba(255, 91, 91, 0.12);
  color: var(--danger);
}

.button--sm {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.message {
  min-height: 22px;
  margin-top: 14px;
  text-align: center;
  font-weight: 700;
}

.link-row {
  margin-top: 16px;
  text-align: center;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(57, 216, 115, 0.07);
  color: var(--muted);
  font-weight: 700;
}

.stat span {
  display: block;
  margin-top: 4px;
  color: var(--primary);
  font-size: 1.25rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid rgba(72, 187, 120, 0.18);
  text-align: left;
}

th {
  background: rgba(57, 216, 115, 0.1);
  color: var(--primary);
}

tr:hover td {
  background: rgba(57, 216, 115, 0.06);
}

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

.detail {
  display: none;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(57, 216, 115, 0.06);
}

.detail--open {
  display: block;
}

.detail h2 {
  margin: 0 0 12px;
  color: var(--primary);
}

.detail p {
  margin: 8px 0;
  color: var(--muted);
}

.detail strong {
  color: #d7fbe0;
}

.text-success {
  color: var(--primary);
  font-weight: 800;
}

.text-danger {
  color: var(--danger);
  font-weight: 800;
}

.detail hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}

.footer {
  margin-top: 28px;
  color: rgba(237, 253, 242, 0.55);
  font-size: 13px;
  text-align: center;
}

.flash {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 100;
  width: min(440px, calc(100% - 32px));
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-weight: 800;
  text-align: center;
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.36), var(--glow);
  transform: translateX(-50%);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.flash::before {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
}

.flash--success {
  border: 1px solid var(--line);
  background: rgba(12, 34, 20, 0.92);
  color: var(--primary);
}

.flash--success::before {
  content: "✓";
  background: rgba(57, 216, 115, 0.16);
  color: var(--primary);
}

.flash--error {
  border: 1px solid rgba(255, 91, 91, 0.42);
  background: rgba(38, 14, 16, 0.92);
  color: var(--danger);
}

.flash--error::before {
  content: "!";
  background: rgba(255, 91, 91, 0.16);
  color: var(--danger);
}

.flash--hide {
  opacity: 0;
  transform: translate(-50%, -10px);
  pointer-events: none;
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 20px, 1120px);
    padding: 16px 0;
  }

  .panel {
    padding: 20px;
  }

  .topbar .button {
    width: 100%;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .page-actions .button {
    width: 100%;
  }
}
