:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #d9dee7;
  --brand: #245bdb;
  --brand-dark: #1746aa;
  --danger: #b42318;
  --danger-bg: #fff1f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: #101828;
  color: #fff;
}

.topbar div:first-child {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.topbar span,
.userbar {
  color: #cbd5e1;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav {
  display: flex;
  gap: 4px;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
}

.nav a.active,
.nav a:hover {
  background: #eef4ff;
  color: var(--brand);
}

.page {
  width: min(1100px, calc(100% - 32px));
  margin: 24px auto 48px;
}

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

.panel + .panel {
  margin-top: 16px;
}

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

h1,
h2 {
  margin: 0;
  font-weight: 650;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

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

.button,
button,
input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
button:hover {
  background: var(--brand-dark);
}

.button-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.button-secondary:hover {
  background: #f2f4f7;
}

.button-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #f3c0bb;
}

.button-danger:hover {
  background: #ffe4e0;
}

.link-danger {
  color: #ffb4ab;
  text-decoration: none;
}

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

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  background: #f8fafc;
}

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

.actions form {
  margin: 0;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 8px;
}

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

.notice-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f3c0bb;
}

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

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

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

.login-box {
  width: min(380px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

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

  .page-head {
    flex-direction: column;
  }
}
