:root {
  --stratum-blue: #2e8aeb;
  --stratum-blue-hover: #2577d4;
  --stratum-blue-soft: rgba(46, 138, 235, 0.1);
  --stratum-green: #3ec469;
  --stratum-yellow: #f5c518;
  --stratum-red: #ef4444;
  --stratum-dark: #1c1c1c;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #374151;
  --muted: #6b7280;
  --sidebar-width: 240px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--stratum-dark);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

a {
  color: var(--stratum-blue);
}

code,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

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

/* Shell ------------------------------------------------------------------ */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--sidebar-width);
  height: 100vh;
  padding: 24px 12px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.sidebar-logo {
  display: block;
  padding: 0 12px 28px;
}
.sidebar-logo img {
  display: block;
  height: 24px;
  width: auto;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item:hover {
  background: var(--bg);
}
.nav-item.active {
  background: var(--stratum-blue-soft);
  color: var(--stratum-blue);
}
.nav-item + .nav-item,
.nav-sub + .nav-item {
  margin-top: 4px;
}
.nav-sub {
  display: flex;
  flex-direction: column;
  padding: 4px 0 8px 40px;
}
.nav-sub a {
  padding: 5px 0;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.nav-sub a:hover,
.nav-sub a.current {
  color: var(--stratum-dark);
}
.nav-sub a.current {
  font-weight: 600;
}

.sidebar-foot {
  padding: 12px 12px 0;
  border-top: 1px solid var(--border);
}
.sidebar-foot:empty {
  display: none;
}
.nav-user {
  margin: 0 0 6px;
  overflow: hidden;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.nav-signout {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.nav-signout:hover {
  color: var(--stratum-dark);
}

.main {
  flex: 1;
  min-width: 0;
}
.main-top {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(247, 248, 250, 0.92);
  backdrop-filter: blur(8px);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 440px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
}
.search:focus-within {
  border-color: var(--stratum-blue);
  box-shadow: 0 0 0 3px rgba(46, 138, 235, 0.18);
}
.search svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}
.search input {
  flex: 1;
  min-width: 0;
  padding: 9px 0;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
}
.search kbd {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
}

.content {
  max-width: 1200px;
  padding: 28px 32px 64px;
}

.page-head {
  margin-bottom: 8px;
}
.page-head h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.page-head p {
  margin: 0;
  max-width: 680px;
  color: var(--muted);
}

.category {
  margin-top: 32px;
  scroll-margin-top: 90px;
}
.category > h2 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.no-results {
  margin-top: 40px;
  color: var(--muted);
}

/* Application tiles ------------------------------------------------------- */

.tiles {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 240px));
  gap: 16px;
}

.tile {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition:
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}
.tile:hover {
  border-color: var(--border-strong);
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.1);
}

.tile-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 16px;
  color: inherit;
  text-align: center;
  text-decoration: none;
}
.tile-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 13px;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.12);
}
.tile-category {
  margin-bottom: 2px;
  color: var(--stratum-blue);
  font-size: 11px;
  font-weight: 600;
}
.tile-body h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}
.tile-body p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.tile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--border);
}
.tile-actions > * {
  padding: 10px 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.tile-actions > * + * {
  border-left: 1px solid var(--border);
}
.tile-actions a:hover {
  background: var(--bg);
}
.tile-actions .is-primary {
  color: var(--stratum-blue);
}
.tile-actions .is-disabled {
  color: #b6bbc4;
  cursor: not-allowed;
}
.tile-actions > :first-child {
  border-bottom-left-radius: 10px;
}
.tile-actions > :last-child {
  border-bottom-right-radius: 10px;
}

/* Technical page ---------------------------------------------------------- */

.tech-app {
  margin-bottom: 20px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  scroll-margin-top: 90px;
}

.tech-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.tech-icon {
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.12);
}
.tech-title {
  flex: 1;
  min-width: 200px;
}
.tech-title h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.tech-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.tech-buttons {
  display: flex;
  gap: 8px;
}

.pill {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s;
}
.pill-tinted {
  background: var(--stratum-blue-soft);
  color: var(--stratum-blue);
}
.pill-tinted:hover {
  background: rgba(46, 138, 235, 0.18);
}
.pill-solid {
  background: var(--stratum-blue);
  color: #fff;
}
.pill-solid:hover {
  background: var(--stratum-blue-hover);
}

.tech-summary {
  margin: 14px 0 0;
  max-width: 820px;
  color: var(--text);
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0 32px;
}
.tech-block {
  margin-top: 22px;
}
.tech-block h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
}

.kv {
  margin: 0;
}
.kv > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--border);
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  color: var(--text);
}
.kv a {
  text-decoration: none;
}
.kv a:hover {
  text-decoration: underline;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  padding: 8px 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}
td a {
  text-decoration: none;
}
td a:hover {
  text-decoration: underline;
}
.muted-link {
  color: var(--muted);
}
.cell-note {
  max-width: 420px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.status-ok::before {
  background: var(--stratum-green);
}
.status-bad::before {
  background: var(--stratum-red);
}
.status-busy::before {
  background: var(--stratum-yellow);
}
.status-idle::before {
  background: #c4c8cf;
}

/* Sign-in and simple pages ------------------------------------------------ */

body.centred {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 12vh 16px 32px;
}
.centred-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.centred-logo {
  display: block;
  height: 29px;
  width: auto;
  margin-bottom: 28px;
}
.centred-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
}
.centred-card > p {
  margin: 0 0 20px;
}
.login-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}
.login-form input[type="password"] {
  width: 100%;
  margin-bottom: 16px;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font: inherit;
}
.login-form input[type="password"]:focus {
  outline: none;
  border-color: var(--stratum-blue);
  box-shadow: 0 0 0 3px rgba(46, 138, 235, 0.18);
}
.login-form .error {
  margin: -6px 0 14px;
  color: var(--stratum-red);
}
.button {
  width: 100%;
  padding: 11px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--stratum-blue);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.button:hover {
  background: var(--stratum-blue-hover);
}
.centred-card > .error {
  color: var(--stratum-red);
}
/* Microsoft's sign-in button guidelines: light theme, four-square logo, #5e5e5e text. */
.button-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 41px;
  border: 1px solid #8c8c8c;
  background: #fff;
  color: #5e5e5e;
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.button-microsoft:hover {
  background: #f3f3f3;
}

/* Narrow screens: the sidebar becomes a top bar ---------------------------- */

@media (max-width: 860px) {
  .shell {
    flex-direction: column;
  }
  .sidebar {
    position: static;
    flex: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    width: 100%;
    height: auto;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-logo {
    padding: 0;
  }
  .sidebar-nav {
    display: flex;
    flex: 1;
    gap: 4px;
    overflow: visible;
  }
  .nav-item + .nav-item,
  .nav-sub + .nav-item {
    margin-top: 0;
  }
  .nav-sub {
    display: none;
  }
  .sidebar-foot {
    padding: 0;
    border: 0;
  }
  .main-top {
    padding: 12px 16px;
  }
  .content {
    padding: 20px 16px 48px;
  }
  .tech-app {
    padding: 18px;
  }
  .kv > div {
    grid-template-columns: 110px 1fr;
  }
}
