:root {
  color: #20242b;
  background: #f4f1ea;
  font-family: "Avenir Next", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(32, 36, 43, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(32, 36, 43, 0.035) 1px, transparent 1px),
    #f4f1ea;
  background-size: 28px 28px;
}

button,
input {
  font: inherit;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 18px;
  background: #242722;
  color: #f6f0e6;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  background: #bfd46f;
  color: #20242b;
  font-weight: 800;
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 2px;
  color: #b8bdae;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  border: 0;
  padding: 11px 12px;
  background: transparent;
  color: #d6d9cb;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: #33382f;
  color: #ffffff;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.label {
  color: #6f7568;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar .label {
  color: #aeb5a1;
}

code {
  display: inline-block;
  max-width: 100%;
  padding: 4px 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar code {
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #edf3d3;
}

.main {
  min-width: 0;
  padding: 24px clamp(18px, 4vw, 42px) 42px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
  line-height: 1.25;
}

#pageSubtitle {
  margin-top: 6px;
  color: #6d7469;
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.health {
  padding: 7px 10px;
  background: #ffffff;
  border: 1px solid #d8d4c8;
  color: #6d7469;
  font-size: 12px;
}

.health.ok {
  border-color: #9db760;
  color: #526529;
}

.health.error {
  border-color: #d9826f;
  color: #9b3e2e;
}

.button {
  height: 34px;
  border: 1px solid #23272e;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

.button.primary {
  background: #23272e;
  color: #ffffff;
}

.button.secondary,
.button.ghost {
  background: #ffffff;
  color: #23272e;
}

.button.danger {
  border-color: #9b3e2e;
  background: #fff8f3;
  color: #9b3e2e;
}

.text-button {
  border: 0;
  background: transparent;
  color: #526529;
  cursor: pointer;
  font-weight: 700;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #d8d4c8;
}

.metric {
  min-height: 112px;
  padding: 16px;
}

.metric-label {
  color: #6d7469;
  font-size: 12px;
  font-weight: 700;
}

.metric-value {
  margin-top: 18px;
  color: #20242b;
  font-size: 36px;
  line-height: 1;
  font-weight: 800;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 14px;
}

.panel {
  padding: 16px;
}

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

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

.hint {
  color: #7b8175;
  font-size: 12px;
}

.release-current {
  min-height: 122px;
}

.release-version {
  font-size: 34px;
  font-weight: 800;
}

.release-meta {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: #636a60;
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.status.active,
.status.success {
  background: #e6efc7;
  color: #526529;
}

.status.disabled,
.status.failed,
.status.expired {
  background: #f7d9d1;
  color: #9b3e2e;
}

.status.warning,
.status.unbound,
.status.missing {
  background: #f6e4b7;
  color: #855a12;
}

.create-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) 88px 112px minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 5px;
  color: #51584f;
  font-size: 12px;
  font-weight: 700;
}

input {
  height: 34px;
  width: 100%;
  border: 1px solid #cfcabd;
  padding: 0 10px;
  background: #fffefa;
  color: #20242b;
  outline: none;
}

input:focus {
  border-color: #7d9148;
  box-shadow: 0 0 0 2px rgba(191, 212, 111, 0.28);
}

.search {
  max-width: 280px;
}

.generated {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.generated-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  background: #f7f4ec;
  border: 1px solid #ddd6c4;
}

.code-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-panel {
  padding-bottom: 8px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 13px;
}

th {
  padding: 10px 8px;
  color: #71776c;
  border-bottom: 1px solid #d8d4c8;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
}

td {
  padding: 12px 8px;
  border-bottom: 1px solid #ebe6d9;
  vertical-align: top;
}

tbody tr:hover {
  background: #faf7ef;
}

.mono {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.muted {
  color: #7b8175;
}

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

.small-button {
  min-height: 28px;
  border: 1px solid #c9c4b7;
  padding: 0 8px;
  background: #fffefa;
  color: #23272e;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.small-button.warn {
  border-color: #cf9b4e;
  color: #855a12;
}

.small-button.danger {
  border-color: #d9826f;
  color: #9b3e2e;
}

.event-list {
  display: grid;
  gap: 8px;
}

.event-item {
  display: grid;
  grid-template-columns: 118px 108px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #ebe6d9;
  font-size: 12px;
}

.event-item:last-child {
  border-bottom: 0;
}

.release-help {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.release-help > div {
  padding: 12px;
  background: #f7f4ec;
  border: 1px solid #ddd6c4;
}

.empty {
  color: #7b8175;
  text-align: center;
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.login-shell {
  width: min(420px, calc(100vw - 28px));
}

.login-card {
  padding: 28px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d8d4c8;
}

.login-brand {
  margin-bottom: 26px;
  color: #20242b;
}

.login-card h1 {
  margin-bottom: 8px;
}

.login-card p {
  margin-bottom: 20px;
  color: #6d7469;
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form .button {
  width: 100%;
}

.login-error {
  min-height: 18px;
  margin-top: 12px;
  color: #9b3e2e;
  font-size: 13px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: block;
    padding: 12px;
  }

  .brand,
  .sidebar-foot {
    display: none;
  }

  .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }

  .metric-grid,
  .overview-grid,
  .release-help {
    grid-template-columns: 1fr;
  }

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

  .create-form .button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 16px 12px 28px;
  }

  .topbar {
    display: grid;
  }

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