:root {
  --ink: #172033;
  --muted: #687386;
  --line: #dfe4ea;
  --soft: #f4f6f8;
  --paper: #ffffff;
  --brand: #1d244b;
  --accent: #fad21b;
  --green: #147d64;
  --red: #b4233a;
  --blue: #2563a9;
  --shadow: 0 10px 30px rgba(23, 32, 51, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #eef2f5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

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

.login-panel {
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: var(--accent);
  font-weight: 900;
}

.brand-title {
  margin: 0;
  color: var(--brand);
  font-size: 1.32rem;
  line-height: 1.1;
}

.brand-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: .92rem;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: #3d4757;
  font-size: .87rem;
  font-weight: 700;
}

.field-label {
  margin-bottom: 8px;
  color: #3d4757;
  font-size: .87rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd7e0;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 169, .12);
}

.stack {
  display: grid;
  gap: 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  background: var(--brand);
  color: #fff;
}

.topbar-inner {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
}

.topbar .brand-lockup {
  margin: 0;
}

.topbar .brand-mark {
  width: 38px;
  height: 38px;
  background: var(--accent);
  color: var(--brand);
}

.topbar .brand-title {
  color: #fff;
  font-size: 1.05rem;
}

.topbar .brand-subtitle {
  color: rgba(255, 255, 255, .68);
}

.nav {
  display: flex;
  align-items: stretch;
  gap: 4px;
  align-self: stretch;
}

.nav-item,
.nav-trigger {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  color: rgba(255, 255, 255, .84);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
}

.nav-item:hover,
.nav-trigger:hover,
.nav-item.active,
.nav-trigger.active {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.nav-group {
  position: relative;
}

.nav-menu {
  position: absolute;
  top: 100%;
  left: 0;
  display: none;
  min-width: 260px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu {
  display: grid;
}

.nav-menu a {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
}

.nav-menu a:hover {
  background: var(--soft);
}

.nav-menu small {
  color: var(--muted);
}

.userbar {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, .72);
  font-size: .9rem;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 22px auto 44px;
}

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

.eyebrow {
  color: var(--blue);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  color: var(--brand);
  font-size: clamp(1.55rem, 2.6vw, 2.2rem);
}

h2 {
  color: var(--brand);
  font-size: 1.1rem;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.toolbar input,
.toolbar select {
  min-height: 40px;
  border: 1px solid #cfd7e0;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 11px;
  outline: none;
}

.toolbar.compact {
  flex-wrap: nowrap;
  gap: 6px;
}

.toolbar.compact .button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: .82rem;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid #cfd7e0;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
}

.button:hover {
  background: var(--soft);
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.button.primary:hover {
  background: #111735;
}

.button.danger {
  border-color: rgba(180, 35, 58, .22);
  color: var(--red);
}

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

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

.metric {
  padding: 16px;
}

.metric-label {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.metric-value {
  margin-top: 6px;
  color: var(--brand);
  font-size: 1.65rem;
  font-weight: 850;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 16px;
}

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

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

.module-tile {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
}

.module-tile:hover {
  border-color: #bcc7d4;
}

.module-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.module-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.module-initials {
  background: var(--brand);
  color: var(--accent);
  font-weight: 900;
}

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

.form-grid .wide {
  grid-column: span 2;
}

.module-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.module-tab {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid #cfd7e0;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.module-tab:hover {
  background: var(--soft);
}

.module-tab.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

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

.months-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #cfd7e0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.choice input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 800;
}

.status-pill.ok {
  background: #e7f5ef;
  color: var(--green);
}

.status-pill.warn {
  background: #fff7d6;
  color: #7a5b00;
}

.status-pill.info {
  background: #e8f1fb;
  color: var(--blue);
}

.status-pill.off {
  background: #eef2f5;
  color: var(--muted);
}

.key-values {
  display: grid;
  gap: 10px;
}

.key-values div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.key-values div:last-child {
  border-bottom: 0;
}

.key-values strong {
  color: #3d4757;
}

.key-values span {
  color: var(--brand);
  font-weight: 800;
  text-align: right;
}

.link-box {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
}

.link-box code {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  overflow-wrap: anywhere;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

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

th {
  background: #f7f9fb;
  color: #4b5565;
  font-size: .78rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

td.wrap {
  min-width: 220px;
  white-space: normal;
}

.notice {
  display: none;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff7d6;
  color: #6d5200;
}

.notice.show {
  display: block;
}

.notice.error {
  background: #fde8ec;
  color: var(--red);
}

.notice.success {
  background: #e7f5ef;
  color: var(--green);
}

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

@media (max-width: 920px) {
  .topbar-inner,
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    width: 100%;
    min-height: 46px;
  }

  .metrics,
  .layout,
  .module-grid,
  .form-grid,
  .months-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .wide {
    grid-column: auto;
  }
}
