/* m3r hub — same design tokens as Olly, Tally and Sally.
 * Values are copied verbatim from those apps so the launcher does not feel
 * like a different product from the things it launches. */
:root {
  color-scheme: light;
  --page: #f8f2e6;
  --surface: #fffdf8;
  --cream: #fbefd5;
  --ink: #33281f;
  --ink-2: #5f5244;
  --muted: #94897a;
  --grid: #ece3d2;
  --baseline: #d9cdb6;
  --border: rgba(51, 40, 31, 0.10);
  --brand: #f4a259;
  --brand-hover: #ef9440;
  --brand-deep: #b96712;
  --series-1: #cf7419;
  --good: #1b9e4b;
  --good-soft: #e4f4e6;
  --good-text: #14713a;
  --danger: #ec221f;
  --amber-soft: #fdeeda;
  --amber-text: #9a5b0d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(51,40,31,.05), 0 6px 18px rgba(51,40,31,.06);
  --font-head: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", Calibri, "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #241e15; --surface: #31291d; --cream: #3f3423;
    --ink: #faf3e6; --ink-2: #dbcfb8; --muted: #a89a83;
    --grid: #473b27; --baseline: #60513a;
    --border: rgba(250, 243, 230, 0.13);
    --brand: #f4a259; --brand-hover: #f7b276; --brand-deep: #f6b06e;
    --series-1: #f4a259;
    --good: #3fbd68; --good-soft: #2b3d2c; --good-text: #74d696;
    --danger: #ff6157; --amber-soft: #46351d; --amber-text: #f0bd7f;
    --shadow: 0 1px 2px rgba(0,0,0,.20), 0 6px 20px rgba(0,0,0,.16);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #241e15; --surface: #31291d; --cream: #3f3423;
  --ink: #faf3e6; --ink-2: #dbcfb8; --muted: #a89a83;
  --grid: #473b27; --baseline: #60513a;
  --border: rgba(250, 243, 230, 0.13);
  --brand: #f4a259; --brand-hover: #f7b276; --brand-deep: #f6b06e;
  --series-1: #f4a259;
  --good: #3fbd68; --good-soft: #2b3d2c; --good-text: #74d696;
  --danger: #ff6157; --amber-soft: #46351d; --amber-text: #f0bd7f;
  --shadow: 0 1px 2px rgba(0,0,0,.20), 0 6px 20px rgba(0,0,0,.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
h1, h2, h3, .brand { font-family: var(--font-head); }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--ink); }
.hidden { display: none !important; }

/* ---------- centred card views (login, password change) ---------- */
.centre {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  width: 100%; max-width: 420px;
}
.card h1 { margin: 0 0 4px; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.card .sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }

.logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  color: #33281f; font-weight: 800; font-size: 13px; flex-shrink: 0;
}

label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--page); color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.btn {
  width: 100%; margin-top: 20px; padding: 11px 16px;
  background: var(--brand); color: #33281f;
  border: none; border-radius: 10px; font-weight: 700;
}
.btn:hover { background: var(--brand-hover); }
.btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--ink); }
.btn.small { width: auto; margin: 0; padding: 7px 12px; font-size: 13px; font-weight: 600; }
.btn.danger { background: transparent; border: 1px solid var(--border); color: var(--danger); }

.msg { margin-top: 14px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.msg.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.msg.ok { background: var(--good-soft); color: var(--good-text); }
.msg.warn { background: var(--amber-soft); color: var(--amber-text); }

/* ---------- shell ----------
 * A flex column at least as tall as the viewport, with main taking the slack.
 * That is what keeps the footer on the bottom edge of a short page (the Apps
 * tab, typically) without position:fixed, which would overlap the last row of
 * a long table instead. Same arrangement as the three apps. */
.shell { display: flex; flex-direction: column; min-height: 100vh; }
/* width:100% is not redundant. `main` carries `margin: 0 auto`, and in a flex
 * column an auto cross-axis margin beats the default stretch — so without an
 * explicit width the element collapses to its content and the app tiles stack
 * in one narrow column down the middle of the page. */
.shell main { flex: 1; width: 100%; }

.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 0 28px; height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.spacer { flex: 1; }
.topnav { display: flex; gap: 4px; }
.topnav button {
  background: transparent; border: none; padding: 8px 14px;
  border-radius: 9px; color: var(--ink-2); font-weight: 600;
}
.topnav button.active { background: var(--cream); color: var(--brand-deep); }
.who { color: var(--muted); font-size: 14px; }

main { max-width: 1080px; margin: 0 auto; padding: 32px 28px 64px; }
main h2 { margin: 0 0 4px; font-size: 20px; }
main .sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

/* ---------- launcher tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.tile {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; transition: transform .12s ease, box-shadow .12s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(51,40,31,.07), 0 12px 28px rgba(51,40,31,.10); }
.tile .name { font-family: var(--font-head); font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.tile .tag { color: var(--muted); font-size: 14px; margin-top: 6px; }
.tile .role {
  display: inline-block; margin-top: 14px; padding: 3px 10px;
  background: var(--cream); color: var(--brand-deep);
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.tile.locked { opacity: .5; pointer-events: none; }
.tile.locked .role { background: var(--grid); color: var(--muted); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; background: var(--surface);
        border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: var(--cream); font-family: var(--font-head); font-size: 13px; color: var(--ink-2); }
tbody tr:last-child td { border-bottom: none; }
td select { padding: 6px 8px; border-radius: 8px; min-width: 118px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.on { background: var(--good-soft); color: var(--good-text); }
.pill.off { background: var(--grid); color: var(--muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 14px; font-size: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.grid4 { display: grid; grid-template-columns: 1.4fr .5fr 1.4fr 1fr; gap: 0 18px; }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

/* ---------- footer ---------- */
.app-foot {
  padding: 16px 28px 22px; margin-top: 8px;
  border-top: 1px solid var(--grid);
  color: var(--muted); font-size: 12.5px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center;
  text-align: center; font-family: var(--font-head);
}
.app-foot a { color: var(--brand-deep); text-decoration: none; }
.app-foot a:hover { text-decoration: underline; }
.app-foot .dotsep { opacity: .6; }

/* ---------- settings modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(24, 18, 12, .45);
  display: none; align-items: flex-start; justify-content: center;
  padding: 48px 16px; z-index: 50; overflow-y: auto;
}
.modal-back.visible { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px; width: 100%; max-width: 480px;
}
.modal h2 { margin: 0 0 18px; font-size: 19px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; }
.field { margin-bottom: 16px; }
.field > label:first-child { margin-top: 0; }
.field .sub { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* three-way theme switch, same control as the apps */
.seg { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button {
  flex: 1; background: transparent; border: none; padding: 8px 12px;
  color: var(--ink-2); font-size: 13px; font-weight: 600;
}
.seg button.active { background: var(--cream); color: var(--brand-deep); }

.about-box {
  display: grid; grid-template-columns: 84px 1fr;
  row-gap: 7px; column-gap: 14px;
  font-size: 12.5px; line-height: 1.45; align-items: baseline;
}
.about-box .ab-l { color: var(--muted); font-weight: 600; font-family: var(--font-head); }
.about-box .ab-v { color: var(--ink-2); }
.about-box strong { color: var(--ink); }
.about-box a { color: var(--brand-deep); text-decoration: none; }

.settings-foot {
  margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--grid);
  color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 6px;
  align-items: center; justify-content: center; text-align: center;
}
.settings-foot a { color: var(--brand-deep); text-decoration: none; }
.settings-foot .dotsep { opacity: .6; }

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--page); padding: 10px 18px;
  border-radius: 10px; font-size: 13.5px; z-index: 60; display: none;
}
#toast.show { display: block; }

@media (max-width: 700px) {
  .grid2, .grid3, .grid4, .field-row { grid-template-columns: 1fr; }
  main { padding: 22px 16px 48px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .who { display: none; }
}
