:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #647282;
  --line: #dbe3ea;
  --blue: #2563eb;
  --green: #15803d;
  --red: #c2410c;
  --amber: #b45309;
  --shadow: 0 16px 48px rgba(23, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  padding: 22px;
  background: #17212b;
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #ffffff;
  color: #17212b;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 34px;
}

.nav a {
  padding: 12px 14px;
  border-radius: 8px;
  color: #d8e0e8;
  text-decoration: none;
}

.nav a:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.main {
  margin-left: 250px;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.user-pill {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.message {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.message.success {
  border-color: #bbf7d0;
  color: var(--green);
}

.message.error {
  border-color: #fed7aa;
  color: var(--red);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat {
  padding: 18px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.stat.warning strong {
  color: var(--amber);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

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

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-width: 34px;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 8px;
  background: #eef2f7;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}

.badge.ok {
  background: #dcfce7;
  color: var(--green);
}

.badge.danger {
  background: #ffedd5;
  color: var(--red);
}

.badge.muted {
  background: #eef2f7;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  background: #ffffff;
}

.button,
.icon-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.search {
  display: flex;
  gap: 8px;
  width: min(420px, 100%);
}

.actions {
  display: flex;
  gap: 7px;
}

.icon-button {
  min-width: 40px;
}

.danger-button {
  color: var(--red);
}

.settings-panel {
  max-width: 900px;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .main {
    margin-left: 0;
    padding: 20px;
  }

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

@media (max-width: 640px) {
  .topbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

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

  .search {
    width: 100%;
  }
}
