:root {
  --bg: #f3f2ef;
  --surface: #ffffff;
  --line: #d6d9dc;
  --text: #1f2328;
  --muted: #667085;
  --blue: #0a66c2;
  --blue-dark: #004182;
  --danger: #b42318;
  --warn: #b54708;
  --success: #067647;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(200px, 560px) auto;
  gap: 16px;
  align-items: center;
  height: 56px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--blue);
  font-weight: 700;
  font-size: 20px;
}

.top-search input,
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.user-menu {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.sidebar {
  position: sticky;
  top: 76px;
  height: calc(100vh - 96px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.sidebar a {
  display: block;
  padding: 11px 12px;
  border-radius: 6px;
  color: #344054;
  font-weight: 600;
}

.sidebar a:hover {
  background: #eef3f8;
  text-decoration: none;
  color: var(--blue);
}

.content {
  min-width: 0;
}

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

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

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
}

.login-panel h1,
.page-head h1,
.profile-head h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.15;
}

.login-panel p,
.page-head p,
.profile-head p,
.empty,
span {
  color: var(--muted);
}

.page-head,
.profile-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

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

.profile-actions,
.quick-actions,
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.settings-actions {
  margin-top: 14px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  padding: 14px;
  color: var(--text);
}

.stat strong {
  display: block;
  margin: 4px 0;
  font-size: 28px;
}

.stat small,
.stat span {
  color: var(--muted);
}

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

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

.panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

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

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

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-weight: 600;
}

.wide {
  grid-column: 1 / -1;
}

.check,
.check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check input,
.check-list input {
  width: auto;
}

.check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  padding: 8px 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--blue-dark);
  text-decoration: none;
}

.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.ghost {
  background: #fff;
  color: var(--danger);
  border-color: #f1b4ad;
}

.ghost:hover {
  background: #fff4f2;
}

.filters,
.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.filters > * {
  flex: 1 1 140px;
}

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

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

th,
td {
  padding: 11px 9px;
  border-bottom: 1px solid #eef0f2;
  text-align: left;
  vertical-align: top;
}

th {
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
}

.feed {
  display: grid;
  gap: 10px;
}

.feed-item {
  display: block;
  border-bottom: 1px solid #eef0f2;
  padding-bottom: 10px;
  color: var(--text);
}

.feed-item p {
  margin: 5px 0;
  color: #344054;
}

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

.chip,
.pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid #b7d4f0;
  border-radius: 999px;
  padding: 6px 10px;
  background: #eef6ff;
  color: #175cd3;
}

.pill.warn {
  background: #fff7ed;
  border-color: #fed7aa;
  color: var(--warn);
}

.chip-form {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  min-height: 24px;
  width: 24px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  border-color: var(--line);
}

.flash {
  margin-bottom: 12px;
  border-radius: 6px;
  padding: 11px 12px;
  background: #eef6ff;
  border: 1px solid #b7d4f0;
}

.flash.error {
  background: #fff1f3;
  border-color: #fecdd3;
  color: var(--danger);
}

.flash.success {
  background: #ecfdf3;
  border-color: #abefc6;
  color: var(--success);
}

.flash.warning {
  background: #fffaeb;
  border-color: #fedf89;
  color: var(--warn);
}

.hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
    height: auto;
    padding: 12px;
  }

  .shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .sidebar {
    position: static;
    height: auto;
    display: flex;
    overflow-x: auto;
  }

  .sidebar a {
    white-space: nowrap;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .page-head,
  .profile-head {
    display: block;
  }

  .profile-actions {
    margin-top: 12px;
  }
}
