/* Climate Heroes shell - the shell's own pages, and the base every dashboard
   gets by linking  <link rel="stylesheet" href="/shell/shell.css">

   Colours come ONLY from the Climate Heroes design system: tokens.css is an
   exact copy of climate-heroes-design-system/css/tokens.css, imported here so
   any page linking this file gets the palette. Light theme only - there is no
   dark mode, by design (white page, blue text). test_shell.py fails if the
   copy drifts from the design folder or a page uses a colour outside it.

   The design system's components (.ch-panel, .ch-logo, .ch-meter ...) are a
   separate file: <link rel="stylesheet" href="/shell/ch/components.css">,
   and its behaviours <script src="/shell/ch/helpers.js"></script>. */
@import url("/shell/ch/tokens.css");

* { box-sizing: border-box; }
body.shell { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 var(--font); }
.shell a { color: var(--accent); }
.shell :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* top bar on shell pages */
.shell-top { display: flex; align-items: center; gap: 16px; padding: 12px 24px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.shell-top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.shell-top nav a { color: var(--ink-2); text-decoration: none; padding: 5px 10px; border-radius: var(--radius-sm); font-size: 14px; }
.shell-top nav a[aria-current="page"], .shell-top nav a:hover { background: var(--accent-soft); color: var(--ink); }
.shell-who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.shell-who form { margin: 0; }

main.shell-main { max-width: 1080px; margin: 0 auto; padding: 28px 24px 56px; }
a.ch-logo { display: block; }                      /* the logo is the link home */
.shell .ch-sub { text-align: center; }               /* the line under a centred title */
.shell h1, .shell h2, .shell h3 { color: var(--ink); }
.shell h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
.shell h2 { font-size: 16px; margin: 28px 0 10px; }
.shell .sub { color: var(--ink-2); margin: 0 0 22px; font-size: 14px; }
.muted { color: var(--ink-3); }

/* home cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none;
  transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card h3 { margin: 0; font-size: 16px; }
.card .ext { color: var(--ink-3); font-weight: 400; }
.card p { margin: 0; color: var(--ink-2); font-size: 14px; }
.card .meta { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; align-items: center;
  font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.empty-state { padding: 28px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-2); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.building { color: var(--warn); background: var(--warn-soft); }
.pill.error { color: var(--bad); background: var(--bad-soft); }
.pill.empty { color: var(--ink-2); background: var(--idle-soft); }   /* idle grey is too faint as 12px text */

/* forms and buttons */
.shell label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }
.shell input, .shell select { font: inherit; min-height: 38px; padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--page); color: var(--ink); max-width: 100%; }
.btn { font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.small { font-size: 12.5px; padding: 4px 9px; }
.btn:disabled { opacity: .55; cursor: default; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > div { min-width: 160px; }
.notice { padding: 10px 14px; border-radius: var(--radius-sm); margin: 0 0 18px; font-size: 14px; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.err { background: var(--bad-soft); color: var(--bad); }

/* People page: roles and what each can view */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 14px; }
.role-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px; }
.role-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.role-head h3 { margin: 0; font-size: 16px; }
.role-head .muted { font-size: 12.5px; }
.role-fixed { margin: 0; color: var(--ink-2); font-size: 14px; }
.role-checks { display: flex; flex-direction: column; gap: 6px; }
.shell .role-checks label.check { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--ink); cursor: pointer; }
.role-checks input[type=checkbox] { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--accent); }
.role-foot { display: flex; gap: 8px; align-items: center; margin-top: auto; padding-top: 4px; }
.role-foot form { margin: 0; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.shell table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.shell th { text-align: left; font-weight: 600; color: var(--ink-2); background: var(--surface-2);
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.shell td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.shell tr:last-child td { border-bottom: none; }
.shell td.num, .shell th.num { text-align: right; font-variant-numeric: tabular-nums; }
.shell td form { display: inline; }

/* sign-in */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px; width: 100%; max-width: 360px; }
.login .ch-brand { margin-bottom: 16px; }
.login h1 { text-align: center; }
.login .sub { text-align: center; }
.login input { width: 100%; margin-bottom: 14px; }
.login .btn { width: 100%; padding: 10px; }
.login-alt { text-align: center; margin: 14px 0 0; font-size: 14px; }
.add-direct { margin-top: 12px; }
.add-direct summary { cursor: pointer; color: var(--ink-2); font-size: 14px; }
.add-direct[open] summary { margin-bottom: 12px; }

@media (max-width: 640px) {
  .shell-top { padding: 10px 16px; flex-wrap: wrap; }
  .shell-who { margin-left: 0; width: 100%; }
  main.shell-main { padding: 20px 16px 40px; }
}
