:root {
  --ink: #1f1a16;
  --paper: #f7f3ea;
  --sand: #e7dcc7;
  --accent: #005f73;
  --accent-2: #d97706;
  --panel: #fffdf8;
  --line: #d9cdb7;
  --ok: #2d6a4f;
  --error: #a61b1b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Space Grotesk", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(0,95,115,0.22), transparent 28%),
    radial-gradient(circle at 90% 0%, rgba(217,119,6,0.28), transparent 30%),
    linear-gradient(140deg, #f9f1e2 0%, #f4e7d4 52%, #f0e1cb 100%);
  min-height: 100%;
}

.scene {
  width: min(1100px, 94vw);
  margin: 2rem auto 3rem;
  animation: rise 360ms ease-out;
}

.scene-login {
  display: grid;
  min-height: 94vh;
  place-items: center;
}

.card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(47, 34, 19, 0.14);
}

.login-card {
  width: min(560px, 92vw);
  padding: 2rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
}

.title {
  margin: 0.2rem 0 0.3rem;
  font-size: clamp(1.4rem, 2.8vw, 2.1rem);
  line-height: 1.12;
}

.subtitle, .muted, .hint {
  color: #61564a;
}

.stack {
  display: grid;
  gap: 0.85rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.field input, .field select {
  width: 100%;
  border: 1px solid #cfc2aa;
  border-radius: 11px;
  padding: 0.68rem 0.75rem;
  font: inherit;
  background: #fff;
}

.field input:focus, .field select:focus {
  outline: 2px solid rgba(0,95,115,0.35);
  border-color: var(--accent);
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.62rem 0.9rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(145deg, var(--accent), #0b7f94);
  color: #fff;
}

.btn-ghost {
  background: #fbf7ef;
  color: var(--ink);
  border-color: #d5c7af;
  text-decoration: none;
}

.badge {
  background: #e8efe8;
  border: 1px solid #b8cfba;
  color: #1f4e39;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel {
  padding: 1rem 1.1rem;
}

.panel-link {
  text-decoration: none;
  color: inherit;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.panel-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(47, 34, 19, 0.17);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

.table th, .table td {
  padding: 0.62rem 0.45rem;
  border-bottom: 1px solid #ecdfcc;
  text-align: left;
}

.list {
  margin: 0.4rem 0 0;
  padding-left: 1rem;
}

.row-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.edit-drawer {
  margin-top: 1rem;
  border-style: dashed;
  border-color: #cebfa7;
  background: #fffcf5;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 21, 12, 0.45);
  display: grid;
  place-items: center;
  z-index: 1000;
}

.modal-card {
  width: min(420px, 92vw);
  background: #fffdf8;
  border: 1px solid #d9cdb7;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: 0 12px 28px rgba(47, 34, 19, 0.25);
}

.toast-root {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.5rem;
  z-index: 1100;
}

.toast {
  min-width: 220px;
  max-width: 420px;
  color: #fff;
  border-radius: 10px;
  padding: 0.62rem 0.8rem;
  box-shadow: 0 8px 20px rgba(18, 12, 8, 0.25);
  animation: rise 180ms ease-out;
}

.toast-success {
  background: #2d6a4f;
}

.toast-error {
  background: #a61b1b;
}

.toast-exit {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.error {
  color: var(--error);
  min-height: 1rem;
}

.hidden {
  display: none;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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