/* MationLabs Hub: brand tokens (Brand Guide) and layout. Dark is the default theme. */
:root {
  --bg: #2D2D2D;
  --surface: #383838;
  --surface-2: #404040;
  --line: #4A4A4A;
  --text: #FFFFFF;
  --text-2: #C9C9C9;
  --muted: #9E9E9E;
  --accent: #00E5C0;
  --accent-ink: #1E1E1E;
  --ok: #00E5C0;
  --warn: #F5B942;
  --bad: #FF6B6B;
  --radius: 12px;
  --gutter: 16px;
  --nav-h: 64px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F5F5F5;
  --surface: #FFFFFF;
  --surface-2: #EDEDED;
  --line: #DADADA;
  --text: #2D2D2D;
  --text-2: #404040;
  --muted: #6E6E6E;
  --accent: #00A88C;          /* darker teal for contrast on light backgrounds */
  --accent-ink: #FFFFFF;
  --ok: #00A88C;
  --warn: #B7791F;
  --bad: #C53030;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button { font: inherit; }
h1 { font-size: 1.25rem; font-weight: 700; margin: 0 0 12px; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.boot { padding: 40px var(--gutter); color: var(--muted); }

/* ---------- shell ---------- */
.shell { min-height: 100%; display: grid; grid-template-rows: auto auto 1fr auto; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) var(--gutter) 10px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar .logo { height: 26px; display: block; }
.topbar .logo-light { display: none; }
:root[data-theme="light"] .topbar .logo-dark { display: none; }
:root[data-theme="light"] .topbar .logo-light { display: block; }
.topbar .title { font-weight: 600; color: var(--text-2); white-space: nowrap; }
.topbar .spacer { flex: 1; }
.icon-btn {
  background: none; border: 1px solid var(--line); color: var(--text);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: inline-grid; place-items: center;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
  display: inline-grid; place-items: center; border: 0; cursor: pointer; text-decoration: none;
}
.banner { padding: 8px var(--gutter); font-size: .85rem; }
.banner.demo { background: var(--surface-2); color: var(--text-2); }
.banner.offline { background: var(--warn); color: #1E1E1E; }

main { padding: 16px var(--gutter) calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 1100px; width: 100%; margin: 0 auto; }

/* bottom navigation (phone) */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.bottomnav a, .sidenav a {
  color: var(--muted); text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .72rem;
}
.bottomnav a .ico { font-size: 1.15rem; line-height: 1; }
.bottomnav a.active, .sidenav a.active { color: var(--accent); }
.sidenav { display: none; }

/* desktop: side navigation */
@media (min-width: 1024px) {
  .shell { grid-template-columns: 220px 1fr; grid-template-rows: auto auto 1fr; }
  .topbar, .banner { grid-column: 1 / -1; }
  .bottomnav { display: none; }
  .sidenav {
    display: flex; flex-direction: column; gap: 2px; padding: 16px 8px;
    border-right: 1px solid var(--line); min-height: calc(100vh - 57px);
  }
  .sidenav a { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: .95rem; }
  .sidenav a:hover { background: var(--surface); }
  .sidenav a.active { background: var(--surface); }
  main { padding-bottom: 32px; }
}

/* ---------- components ---------- */
.grid { display: grid; gap: 12px; }
@media (min-width: 720px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; color: inherit; text-decoration: none; display: block;
}
a.card:hover { border-color: var(--accent); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card-head .chev { color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.kv .v { font-variant-numeric: tabular-nums; text-align: right; }
.neg { color: var(--bad); }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem;
  background: var(--surface-2); color: var(--text-2);
}
.tag.ok { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.tag.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.tag.bad { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 600; }
.check { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--accent); flex: none; }

.tabs { display: flex; gap: 6px; margin: 0 0 12px; overflow-x: auto; }
.tabs button { background: none; border: 1px solid var(--line); color: var(--text-2); padding: 6px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tabs button.active { border-color: var(--accent); color: var(--accent); }

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

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--gutter); }
.login .box { text-align: center; max-width: 340px; }
.login img { width: 96px; height: 96px; border-radius: 22px; }
.login h1 { margin: 16px 0 4px; }
