/* MEKABEE CP console. Brand: navy #192b51, honey #e9b41d (from the MekaBee logo). Same-origin only (CSP). */
:root {
  --navy: #192b51; --honey: #e9b41d;
  --bg: #f4f5f8; --fg: #1a1f2b; --muted: #5f6675; --card: #ffffff; --line: #dfe2e9;
  --accent: #192b51; --accent-fg: #ffffff; --danger: #b3261e; --warn: #9a6b00; --ok: #1e7b34;
  --side: #192b51; --side-fg: #e8ecf5; --side-muted: #9fb0d0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151d; --fg: #e9ecf2; --muted: #a2a9b8; --card: #1a202b; --line: #2c3442;
    --accent: #e9b41d; --accent-fg: #192b51; --danger: #ff7a70; --warn: #f0c24b; --ok: #6fd28a;
    --side: #0d1a33; --side-fg: #e8ecf5; --side-muted: #8b9bbb;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", "Malgun Gothic", sans-serif; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
h3 { font-size: 14px; margin: 0 0 6px; color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; font-weight: normal; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- login */
.entry { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.entry .card { width: 100%; max-width: 420px; text-align: center; }
.entry h1 { font-size: 18px; color: var(--muted); font-weight: 600; margin: 4px 0 8px; }
.entry details { text-align: left; margin-top: 18px; }
.logo-v img { width: 180px; max-width: 70%; height: auto; display: block; margin: 8px auto 0; }

/* ---------------------------------------------------------------- shell: menu on the left, page on the right */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100%; }
.side { background: var(--side); color: var(--side-fg); display: flex; flex-direction: column; gap: 18px; padding: 20px 14px;
        position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; gap: 6px; padding: 0 6px; }
.logo-h { width: 150px; height: auto; display: block; }
.brand-sub { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--side-muted); }
.brand .badge { align-self: flex-start; color: var(--honey); border-color: rgba(233, 180, 29, 0.5); }
.menu { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.menu li { margin: 0; }
.menu a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px;
          color: var(--side-fg); text-decoration: none; font-weight: 500; border-left: 3px solid transparent; }
.menu a:hover { background: rgba(255, 255, 255, 0.06); }
.menu a[aria-current="page"] { background: rgba(233, 180, 29, 0.16); border-left-color: var(--honey); color: var(--honey); }
.count { min-width: 22px; padding: 0 7px; border-radius: 99px; font-size: 12px; text-align: center; background: var(--honey); color: var(--navy); font-weight: 700; }
.count.bad { background: #ff6b5e; color: #fff; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.side-foot button { background: transparent; color: var(--side-fg); border-color: rgba(255, 255, 255, 0.2); }
.side-foot button.link { border: none; color: var(--side-muted); }
.content { padding: 28px 32px 48px; max-width: 1100px; width: 100%; }

/* ---------------------------------------------------------------- cards, tiles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin: 0 0 16px; }
.card.danger { border-color: var(--danger); border-left-width: 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 0 0 16px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line);
        border-radius: 12px; border-top: 4px solid var(--line); color: var(--fg); text-decoration: none; }
.tile:hover { border-color: var(--accent); }
.t-label { font-size: 13px; color: var(--muted); }
.t-value { font-size: 22px; line-height: 1.3; }
.t-sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.tile.ok { border-top-color: var(--ok); }
.tile.warn { border-top-color: var(--honey); }
.tile.bad { border-top-color: var(--danger); }
.tile.bad .t-value { color: var(--danger); }

/* ---------------------------------------------------------------- controls */
input, select, button, .button { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
                                 background: var(--card); color: var(--fg); min-height: 40px; }
input, select { width: 100%; }
button, .button { cursor: pointer; text-align: center; text-decoration: none; display: inline-block; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button.stop, .button.stop { background: var(--danger); color: #fff; border-color: var(--danger); font-weight: 600; }
button.link { background: none; border: none; color: var(--accent); }
.wide { width: 100%; }
label { display: block; margin: 0; font-weight: 500; font-size: 14px; }
label input, label select { margin-top: 4px; font-weight: normal; }
form.stack { display: flex; flex-direction: column; gap: 12px; margin: 10px 0 0; max-width: 560px; }
form.stack button { align-self: flex-start; }
form.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 12px 0 0; }
form.grid .full { grid-column: 1 / -1; }
form.grid button { justify-self: start; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.buttons select { width: auto; }
.row { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.row select { width: auto; flex: none; }
.row input { flex: 1; min-width: 0; margin: 0; }
.prefix { font-family: ui-monospace, monospace; opacity: 0.7; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.card > label { margin: 10px 0 0; max-width: 360px; }

/* ---------------------------------------------------------------- lists, tables */
.items { list-style: none; padding: 0; margin: 6px 0; }
.items li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px;
            padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.items li:last-child { border-bottom: none; }
.items.compact li { padding: 6px 0; font-size: 13px; }
.items li button { padding: 6px 12px; min-height: 34px; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
pre { white-space: pre-wrap; word-break: break-all; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 12px; min-height: 3em; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }
.badge { font-size: 12px; padding: 2px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-weight: 500; }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.bad { color: var(--danger); border-color: var(--danger); }

/* messages float at the bottom so they are seen on any page */
.flash { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 10; max-width: min(640px, calc(100% - 32px));
         padding: 10px 16px; border-radius: 10px; background: var(--navy); color: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); }
.flash.error { background: var(--danger); }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--fg); max-width: 560px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(10, 16, 30, 0.55); }
dialog code { word-break: break-all; font-size: 13px; }

/* phone: an always-visible stop button (the side panel's one is hidden) */
.stopfab { display: none; position: fixed; right: 16px; bottom: 16px; z-index: 6; border-radius: 99px; padding: 12px 18px;
           box-shadow: 0 6px 20px rgba(179, 38, 30, 0.4); }

/* ---------------------------------------------------------------- phone: the menu becomes a bar on top */
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side, .content, .menu { min-width: 0; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; padding: 10px 12px; gap: 8px;
          display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand foot" "menu menu"; }
  .brand { grid-area: brand; }
  .menu { grid-area: menu; }
  .brand { flex-direction: row; align-items: center; gap: 10px; padding: 0; }
  .logo-h { width: 110px; }
  .brand-sub { display: none; }
  .menu { flex-direction: row; overflow-x: auto; gap: 4px; -webkit-overflow-scrolling: touch; }
  .menu a { white-space: nowrap; padding: 8px 12px; border-left: none; border-bottom: 3px solid transparent; }
  .menu a[aria-current="page"] { border-bottom-color: var(--honey); }
  .side-foot { grid-area: foot; flex-direction: row; margin: 0; gap: 4px; align-items: center; }
  .side-foot .button.stop { display: none; }
  .side-foot button { min-height: 32px; padding: 4px 10px; font-size: 13px; }
  .content { padding: 16px 16px 72px; }
  h1 { font-size: 20px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .t-value { font-size: 19px; }
  .split { grid-template-columns: 1fr; }
  form.stack button, form.grid button { width: 100%; }
  .stopfab { display: block; }
}

/* ---------------------------------------------------------------- break-glass page */
.card.bg { border-top: 4px solid var(--danger); }
.card.bg form.stack, .card.bg details { text-align: left; max-width: none; }
.result { text-align: left; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.code { font-family: ui-monospace, monospace; font-size: 24px; letter-spacing: 0.08em; text-align: center; padding: 12px;
        border: 2px dashed var(--honey); border-radius: 10px; user-select: all; }
