:root {
  --ink: #14212b;
  --ink-soft: #3d4f5c;
  --paper: #f3f6f4;
  --paper-2: #e7eee9;
  --line: #c5d2cb;
  --accent: #0f6e56;
  --accent-deep: #0a4f3d;
  --danger: #9b2c2c;
  --danger-bg: #fdecec;
  --shadow: 0 18px 50px rgba(20, 33, 43, 0.12);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(15, 110, 86, 0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(20, 33, 43, 0.08), transparent 50%),
    linear-gradient(160deg, var(--paper) 0%, var(--paper-2) 100%);
  background-attachment: fixed;
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-stage {
  width: min(440px, 100%);
  animation: rise 0.55s ease-out both;
}

.brand {
  margin-bottom: 28px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(15, 110, 86, 0.15);
  animation: pulse 2.4s ease-in-out infinite;
}

.brand-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}

.brand h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 5vw, 2.7rem);
  line-height: 1.05;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.brand p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.5;
}

.panel {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(197, 210, 203, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.panel h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}

.panel .sub {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.field {
  margin-bottom: 16px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
input[type="text"],
input[type="email"],
input[type="password"],
select {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 110, 86, 0.12);
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  width: 100%;
  margin-top: 8px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 110, 86, 0.25);
}

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

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  padding: 10px 14px;
}

.btn-ghost:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
}

.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f2c7c7;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  animation: shake 0.35s ease;
}

.app-frame {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 20px;
  border-right: 1px solid rgba(197, 210, 203, 0.9);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  animation: fade-down 0.45s ease both;
}

.sidebar-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 28px;
}

.sidebar-brand .brand-dot {
  margin-top: 6px;
  flex: 0 0 auto;
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.2;
}

.sidebar-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-nav a {
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.95rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.is-active {
  color: var(--accent-deep);
  background: rgba(15, 110, 86, 0.1);
}

.sidebar-footer {
  margin-top: auto;
}

.sidebar-logout {
  width: 100%;
}

.content {
  padding: 36px 28px 48px;
  width: min(1100px, 100%);
  animation: rise 0.55s ease 0.08s both;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(197, 210, 203, 0.85);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  animation: fade-down 0.45s ease both;
}

.topbar .title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.topbar .meta {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.main {
  padding: 36px 28px 48px;
  width: min(960px, 100%);
  margin: 0 auto;
  animation: rise 0.55s ease 0.08s both;
}

.main-wide {
  width: min(1100px, 100%);
}

.hero-block h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.hero-block p {
  margin: 0 0 28px;
  color: var(--ink-soft);
  max-width: 42rem;
  line-height: 1.55;
}

.status-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.status-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.7);
}

.status-item span {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
  margin-bottom: 6px;
}

.status-item strong {
  font-size: 1.05rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.nav {
  display: flex;
  gap: 8px;
}

.nav a {
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.9rem;
}

.nav a:hover,
.nav a.is-active {
  color: var(--accent-deep);
  background: rgba(15, 110, 86, 0.1);
}

.section-gap {
  margin-bottom: 22px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.flash {
  background: rgba(15, 110, 86, 0.1);
  border: 1px solid rgba(15, 110, 86, 0.25);
  color: var(--accent-deep);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.error-list {
  margin: 0;
  padding-left: 18px;
}

.user-rows {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.user-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1.1fr 1.3fr 1.1fr;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.btn-inline {
  width: auto;
  min-width: 160px;
  display: inline-block;
}

.hero-with-action {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-with-action p {
  margin-bottom: 0;
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 32px);
}

.modal::backdrop {
  background: rgba(20, 33, 43, 0.45);
  backdrop-filter: blur(3px);
}

.modal-card {
  width: min(420px, 100%);
  margin: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
  animation: rise 0.25s ease both;
}

.modal-card-wide {
  width: min(720px, 100%);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  margin-bottom: 8px;
}

.form-grid .field {
  margin-bottom: 0;
}

.field-span-2 {
  grid-column: span 2;
}

.status-pill.is-unknown {
  background: rgba(61, 79, 92, 0.1);
  color: var(--ink-soft);
}

.modal-card .field {
  width: 100%;
}

.modal-card .field input {
  width: 100%;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}

.modal-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--ink);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.modal-actions .btn {
  width: auto;
  min-width: 0;
  margin-top: 0;
}

.modal-actions .btn-primary {
  width: auto;
  min-width: 120px;
  margin-top: 0;
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid #f2c7c7;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.btn-danger-ghost:hover {
  background: var(--danger-bg);
}

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

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

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table th {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.data-table .actions {
  text-align: right;
  white-space: nowrap;
}

.data-table .actions form {
  display: inline-block;
  margin-left: 6px;
}

.btn-small {
  padding: 8px 12px;
  font-size: 0.85rem;
  min-width: 0;
  width: auto;
  margin-top: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill.is-active {
  background: rgba(15, 110, 86, 0.12);
  color: var(--accent-deep);
}

.status-pill.is-inactive {
  background: rgba(155, 44, 44, 0.1);
  color: var(--danger);
}

.field-toggle {
  margin-top: 4px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 0;
}

.toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.hint {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.field input[readonly],
.field input:disabled {
  background: #f1f4f2;
  color: var(--ink-soft);
  cursor: not-allowed;
}

.muted {
  color: var(--ink-soft);
}

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

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

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 6px rgba(15, 110, 86, 0.15);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(15, 110, 86, 0.08);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 16px 18px;
    flex-direction: column;
    align-items: flex-start;
  }

  .main,
  .content {
    padding: 28px 18px 40px;
  }

  .panel {
    padding: 22px;
  }

  .user-row {
    grid-template-columns: 1fr;
  }

  .hero-with-action {
    flex-direction: column;
  }

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

  .field-span-2 {
    grid-column: span 1;
  }

  .topbar-left {
    gap: 14px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(197, 210, 203, 0.9);
    padding: 18px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-nav a {
    padding: 10px 12px;
  }

  .sidebar-footer {
    margin-top: 0;
  }

  .sidebar-logout {
    width: auto;
  }
}
