@import url("https://fonts.googleapis.com/css2*family=Manrope:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #132338;
  --muted: #607085;
  --primary: #0f4ec9;
  --accent: #f57a18;
  --danger: #c23737;
  --line: #e3e8ef;
  --good: #1c8d57;
  --shadow: 0 16px 40px rgba(17, 43, 79, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fef4e8 0%, #f4f6f8 42%) fixed;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  background: var(--panel);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 34px;
  border: 1px solid var(--line);
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 8px;
  font-weight: 800;
}

.login-card h1 {
  margin: 0;
  font-size: 30px;
  font-family: "Space Grotesk", sans-serif;
}

.sub {
  margin: 10px 0 20px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

input,
select,
button,
textarea {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid #ccd6e4;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  background: linear-gradient(120deg, var(--primary), #2f73f4);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: linear-gradient(190deg, #0f2045 0%, #0d1a35 100%);
  color: #fff;
  padding: 26px 20px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(245, 122, 24, 0.18);
}

.brand h2 {
  margin: 0;
  font-size: 18px;
  font-family: "Space Grotesk", sans-serif;
}

.brand p {
  margin: 3px 0 0;
  font-size: 12px;
  opacity: 0.7;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-btn {
  text-align: left;
  background: transparent;
  color: #c7d6f1;
  border: 1px solid transparent;
}

.nav-btn.active,
.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.1);
}

.main {
  padding: 22px;
}

.topbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
  font-family: "Space Grotesk", sans-serif;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #f0f4fa;
  border-radius: 999px;
  padding: 7px 12px;
}

#userBadge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
}

.view {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.message {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
}

.message.ok {
  background: #eaf8f1;
  color: var(--good);
}

.message.error {
  background: #fdf0f0;
  color: var(--danger);
}

.grid-cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.card h3 {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card .value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 800;
  font-family: "Space Grotesk", sans-serif;
}

.toolbar,
.entity-head {
  display: flex;
  gap: 10px;
  align-items: center;
}

.entity-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid #eef2f7;
  font-size: 14px;
  vertical-align: top;
}

th {
  background: #f6f8fc;
  color: #4a5f78;
  font-weight: 700;
}

tbody tr:hover {
  background: #f9fbff;
}

.badge {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.badge.active {
  background: #eaf8f1;
  color: var(--good);
}

.badge.inactive {
  background: #f2f4f7;
  color: #697384;
}

.inline-actions {
  display: flex;
  gap: 6px;
}

.inline-actions button {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.inline-actions .secondary {
  background: #ebf1ff;
  color: #163f9b;
}

.inline-actions .danger {
  background: #fdf0f0;
  color: var(--danger);
}

.pager {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 16, 35, 0.58);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 1000;
}

.modal {
  width: min(700px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
}

.modal.wide {
  width: min(1000px, 100%);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.modal-head h3 {
  margin: 0;
}

.modal-head button {
  background: #f1f4fa;
  color: #1d2c44;
  width: 34px;
  padding: 6px 0;
}

.modal-form {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.modal-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.modal-form .span-2 {
  grid-column: 1 / -1;
}

.modal-actions {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.code-block {
  margin: 0;
  padding: 16px;
  font-family: "Consolas", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  max-height: 70vh;
  overflow: auto;
  background: #f5f7fc;
  border-radius: 0 0 14px 14px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-rows: auto auto auto;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .toolbar {
    flex-wrap: wrap;
  }
}
