/* MIAM web UI standard: the LLM Manager look (startupteams/ai-software-project-framework docs/WEB_UI_STANDARD.md, ADR-0007).
   Source: startupteams/llm-manager-project-framework service/app/nav.py and its pages. Copy this file as-is;
   put service-only rules in a second file that uses the same CSS variables. Dark, like LLM Manager. */
:root { color-scheme: dark;
  --bg: #0d1117; --panel: #161b22; --nav: #010409; --line: #30363d; --line-soft: #21262d;
  --fg: #e6edf3; --fg-soft: #c9d1d9; --muted: #8b949e; --link: #58a6ff; --accent: #1f6feb;
  --go: #238636; --ok: #3fb950; --bad: #f85149; --warn: #d29922; --danger: #b62324; --side: 12rem; }
* { box-sizing: border-box; }
body { margin: 0; padding: 1.2rem 1.2rem 2.4rem; background: var(--bg); color: var(--fg); font: 14px/1.45 system-ui, sans-serif; }
body.app { padding-left: calc(var(--side) + 1.5rem); }
a { color: var(--link); }

/* Left-hand menu: one per service, same on every page (LLM Manager REQ-101). */
nav.side { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side); z-index: 40; overflow-y: auto;
  padding: 1rem .6rem; background: var(--nav); border-right: 1px solid var(--line); }
nav.side .brand { display: block; margin: 0 .4rem .9rem; color: var(--fg); font-weight: 700; font-size: .95rem; text-decoration: none; }
nav.side .brand small { display: block; color: var(--muted); font-weight: 400; font-size: .7rem; }
nav.side a.i { display: block; padding: .42rem .6rem; border-radius: 6px; color: var(--fg-soft); font-size: .85rem; text-decoration: none; }
nav.side a.i:hover { background: var(--panel); }
nav.side a.i.on { background: var(--accent); color: #fff; font-weight: 600; }
nav.side .sep { margin: 1rem .6rem .3rem; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }
nav.side .who { margin: 1rem .6rem 0; color: var(--muted); font-size: .72rem; }
nav.side .who button.link { font-size: inherit; }
@media (max-width: 800px) {
  body.app { padding: 3.6rem 1rem 2.4rem; }
  nav.side { bottom: auto; right: 0; width: auto; height: 2.8rem; display: flex; align-items: center; gap: .2rem;
    padding: .4rem; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  nav.side .brand small, nav.side .sep, nav.side .who { display: none; }
  nav.side .brand { margin: 0 .4rem; white-space: nowrap; }
  nav.side a.i { white-space: nowrap; padding: .3rem .5rem; }
}

/* Top of a page: title left, search or actions right. Tabs sit under it when a menu entry has sub-pages. */
.top { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.tabs { display: flex; gap: .3rem; margin: 0 0 .8rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: .4rem .8rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--fg); border-bottom-color: var(--accent); }
main { max-width: 1400px; }
h1 { font-size: 1.2rem; margin: .2rem 0 .4rem; }
h2 { font-size: 1rem; color: var(--link); margin: 1.2rem 0 .5rem; }
h2 .hint, h1 .hint { color: var(--muted); font-size: .75rem; font-weight: 400; }
h3 { font-size: .9rem; margin: .6rem 0 .2rem; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .8rem; margin: 0 0 .8rem; font-size: .85rem; }
.narrow { max-width: 360px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .8rem; }
.grid > .card { margin: 0; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .4rem 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: .4rem .5rem; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }

label { display: block; margin: .4rem 0; color: var(--muted); font-size: .78rem; }
label > input, label > select, label > textarea, label > .pw-field { margin-top: .2rem; }
input, select, textarea { width: 100%; padding: .45rem; background: var(--bg); color: var(--fg); border: 1px solid var(--line);
  border-radius: 6px; font: inherit; }
input[type="checkbox"], input[type="radio"] { width: auto; }
.row input, .row select { width: auto; }
textarea { min-height: 60px; font-family: ui-monospace, monospace; font-size: .78rem; }
pre, code.block { display: block; padding: .6rem; background: var(--bg); border-radius: 6px; overflow: auto; max-height: 300px; font-size: .72rem; }

/* Buttons: green = do it, gray = secondary, red = destructive, blue = run/start, link = text only. */
button { padding: .45rem .8rem; background: var(--go); color: #fff; border: 0; border-radius: 6px; cursor: pointer; font: inherit; font-weight: 600; }
button.primary { background: var(--go); }
button.gray { background: var(--line); }
button.blue { background: var(--accent); }
button.danger, button.red { background: var(--danger); }
button:disabled { background: var(--line); color: var(--muted); cursor: default; }
button.link { padding: 0; background: none; color: var(--link); font-weight: 400; }
form.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.badge { display: inline-block; padding: .1rem .5rem; background: var(--accent); color: #fff; border-radius: 10px; font-size: .7rem; }
.pill, .tag { display: inline-block; padding: 0 .45rem; border: 1px solid var(--line); border-radius: 10px; font-size: .7rem; }
.tag.ok { border-color: var(--ok); }
.ok { color: var(--ok); } .bad, .error { color: var(--bad); } .warn { color: var(--warn); } .muted { color: var(--muted); }
.error { font-weight: 600; }
.notice { color: var(--link); font-weight: 600; }
.soon { display: inline-block; padding: 0 .5rem; border: 1px solid var(--warn); border-radius: 10px; color: var(--warn); font-size: .7rem; white-space: nowrap; }
.modal { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: center; background: rgba(0,0,0,.6); }
.modal > .card { width: min(560px, 100% - 2rem); padding: 1.4rem; }

/* Version footer: deployed commit, fixed lower right, on every page (login included). */
footer.build { position: fixed; right: .8rem; bottom: .4rem; z-index: 41; padding: .1rem .4rem; border-radius: 4px;
  background: #0d1117cc; color: var(--muted); font-size: .72rem; }

/* Login: one centred card. */
body.login { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 1rem; }
body.login .card { width: 320px; max-width: 100%; padding: 2rem; margin: 0; }
body.login h1 { font-size: 1.1rem; margin: 0 0 1rem; }
body.login input { margin: .4rem 0; padding: .55rem; }
body.login button[type="submit"] { width: 100%; padding: .6rem; margin-top: .6rem; }
body.login .error { margin-top: .6rem; font-size: .85rem; font-weight: 400; white-space: pre-wrap; }
body.login .sub { margin-top: 1rem; color: var(--muted); font-size: .75rem; }

/* Password show/hide toggle (eyeball), same in every MIAM service. Only aria-pressed decides which icon shows. */
.pw-field { position: relative; display: block; }
span.pw-field > input[name] { width: 100%; padding-right: 3em; }
.pw-field > button.pw-eye { position: absolute; top: 50%; right: 0.25em; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center; width: 2em; height: 2em; min-width: 0;
  min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 4px; background: none; box-shadow: none;
  color: inherit; opacity: 0.65; cursor: pointer; line-height: 0; }
.pw-field > button.pw-eye:hover, .pw-field > button.pw-eye:focus-visible { opacity: 1; }
.pw-field > button.pw-eye:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.pw-eye svg { width: 1.2em; height: 1.2em; }
.pw-eye .pw-eye-off, .pw-eye[aria-pressed="true"] .pw-eye-on { display: none; }
.pw-eye[aria-pressed="true"] .pw-eye-off { display: inline; }
@media (max-width: 640px) { .pw-field > button.pw-eye { width: 44px; height: 44px; right: 0; } }
