/* O3 Memories admin: dark pitch-green, an engine colour bar on every engine page (green E14, orange-red E11) */
:root {
  --bg: #07110C; --side: #0A1610; --card: #0E1B14; --field: #0A1610; --fg: #F2F5EF; --body: #B7C3BA; --muted: #9FAEA3;
  --gold: #3BE37F; --gold-hi: #7DF0AB; --gold-ink: #06210F; --green: #2EE87A; --red: #FF6B5E; --orange: #F59E50;
  --line: rgba(255,255,255,0.08); --grid: rgba(255,255,255,0.06);
  --e14: #3BE37F; --e11: #FF5A36; --eng: var(--gold);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, 'Segoe UI', Roboto, sans-serif; }
a { color: var(--gold); }
button, input, select, textarea { font: inherit; }
.muted { color: var(--muted); }
.err { color: var(--red); }
.ok { color: var(--green); }
[hidden] { display: none !important; }

/* ---- brand (top of the sidebar, as admin14) */
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 6px; color: var(--fg); text-decoration: none;
  font: 700 20px/1 Oswald, system-ui, sans-serif; letter-spacing: .3px; }
.brand b { color: var(--gold); font-weight: 700; }
.brand small { display: block; margin-top: 5px; color: var(--muted); font: 600 11px/1 system-ui, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: .12em; text-transform: uppercase; }
.ic { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--body); background: transparent;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; text-decoration: none; }
.btn:hover { color: var(--fg); border-color: rgba(255,255,255,0.25); }
.btn.pri { color: var(--gold-ink); background: var(--gold); border-color: var(--gold); font-weight: 700; }
.btn.pri:hover { background: var(--gold-hi); }
.btn.bad { color: var(--red); border-color: rgba(255,107,94,.4); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { font-size: 12px; padding: 3px 9px; }
.mbtn { display: none; }

/* ---- layout: the sidebar (brand, groups of pages, user + logout) as admin14 */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column;
  background: var(--side); border-right: 1px solid var(--line); padding: 18px 12px 14px; }
/* only the list scrolls: brand on top and user + logout at the bottom stay in view */
.nav { flex: 1; min-height: 0; overflow-y: auto; margin-right: -8px; padding-right: 8px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.14) transparent; }
.nav::-webkit-scrollbar { width: 6px; } .nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 3px; }
/* engine picker card */
.engpick { position: relative; margin: 12px 0 4px; }
.engbtn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; text-align: left; cursor: pointer;
  color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.engbtn:hover { border-color: rgba(255,255,255,0.2); }
.engbtn:focus-visible, .engmenu button:focus-visible, .grp-t:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.ebox { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: #07110C;
  font: 700 13px/1 Oswald, system-ui, sans-serif; }
.ebox.sm { width: 22px; height: 22px; border-radius: 6px; font-size: 11px; }
.et { flex: 1; min-width: 0; line-height: 1.25; }
.et b { display: block; font-size: 14px; }
.et small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.engbtn .ud { color: var(--muted); }
.engmenu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; padding: 4px; background: #13241A;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.engmenu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--body); font-size: 14px; text-align: left; cursor: pointer; }
.engmenu button:hover, .engmenu button:focus-visible { background: rgba(255,255,255,0.06); color: var(--fg); }
.engmenu button[aria-selected=true] { color: var(--fg); font-weight: 600; }
.engmenu .ok2 { margin-left: 4px; color: var(--gold); }
.st { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: #55625a; }
.st.up { background: var(--green); } .st.down { background: var(--red); }
.engmenu .st { margin-left: auto; }
/* foldable groups: 'General setting', then the picked engine */
.grp-t { display: flex; align-items: center; gap: 7px; width: 100%; margin-top: 12px; padding: 6px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; cursor: pointer; }
.grp-t:hover { color: var(--fg); }
.grp-t .emark { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.grp-t .chev2 { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
  stroke-linejoin: round; transition: transform .15s; }
.grp-t[aria-expanded=false] .chev2 { transform: rotate(-90deg); }
.nav > a:first-child { margin-top: 8px; }
.nav a, .nav .soon { display: flex; align-items: center; gap: 10px; margin: 1px 0; padding: 7px 10px; border-radius: 8px;
  color: var(--body); font-size: 14px; text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,0.04); color: var(--fg); }
.nav a.on { background: rgba(59,227,127,0.12); color: var(--fg); font-weight: 600; }
.nav a.on .ic { color: var(--eng); }
.eng-e11 .nav a.on { background: rgba(255,90,54,0.12); }
.nav a:focus-visible, .mbtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.nav .soon { color: var(--muted); opacity: .55; cursor: default; }
.nav .soon small { font-size: 12px; white-space: nowrap; }
.cnt { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #1a0705;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.cnt:empty { display: none; }
.side-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 14px; padding: 12px 8px 0;
  border-top: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 8px; color: var(--body); font-size: 13px; }
.who .role { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: #44524a; color: var(--fg); text-transform: uppercase; }
.who .role.admin { background: var(--gold); color: var(--gold-ink); }
.out { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--body); background: transparent;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.out:hover { color: var(--fg); border-color: rgba(255,255,255,0.25); }
.main { min-width: 0; padding: 0 28px 48px; }
.engbar { height: 4px; margin: 0 -28px 18px; background: transparent; }
.engbar.e14 { background: var(--e14); }
.engbar.e11 { background: var(--e11); }
.eng-e14 { --eng: var(--e14); }
.eng-e11 { --eng: var(--e11); }
.shead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 34px; margin: 0 0 14px; }
.shead h1 { margin: 0; font-size: 20px; font-weight: 700; }
.shead h1 .eng { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-right: 8px; vertical-align: 3px; color: #111; }
.shead h1 .eng.e14 { background: var(--e14); } .shead h1 .eng.e11 { background: var(--e11); }
.shead .sub { color: var(--muted); font-weight: 400; font-size: 13px; }
.banner { margin: 0 0 14px; padding: 9px 12px; border-radius: 10px; font-size: 13px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); }
.banner.e11 { border-color: rgba(255,90,54,.45); background: rgba(255,90,54,.08); color: #FFC7B8; }
.banner.warn { border-color: rgba(245,158,80,.45); background: rgba(245,158,80,.08); }
.banner.bad { border-color: rgba(255,107,94,.45); background: rgba(255,107,94,.08); color: #FFB4AC; }

/* ---- cards, tiles, tables */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tile .k { color: var(--muted); font-size: 13px; }
.tile .v { font-size: 28px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .s { color: var(--body); font-size: 13px; }
.tile.eng { border-top: 3px solid var(--eng); }
.tile.hero .v { font-size: 40px; line-height: 1.15; }
@media (min-width: 640px) { .tile.hero { grid-column: span 2; } }
.btn.refresh { vertical-align: 3px; margin-left: 6px; }
.btn.refresh .ic { width: 14px; height: 14px; }
.btn.refresh.busy .ic { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.refresh.busy .ic { animation: none; } }
#upd { color: var(--muted); font-size: 13px; font-weight: 400; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 16px; }
.card:first-child { margin-top: 0; }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card h3 { margin: 14px 0 8px; font-size: 14px; color: var(--body); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid2 > .card { margin-top: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
table.nowrap td, table.nowrap th { white-space: nowrap; }
tr.click { cursor: pointer; } tr.click:hover td { background: rgba(255,255,255,0.03); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; }
.tag { font-size: 11px; color: #07110C; background: var(--green); border-radius: 6px; padding: 1px 6px; margin-left: 4px; white-space: nowrap; }
.tag.run { background: var(--orange); color: #2a1505; } .tag.bad { background: var(--red); color: #1a0705; }
.tag.off { background: #44524a; color: var(--fg); } .tag.e14 { background: var(--e14); } .tag.e11 { background: var(--e11); color: #fff; }
.badge { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 8px; white-space: nowrap; }
.st-new { background: var(--red); color: #1a0705; } .st-doing { background: var(--orange); color: #2a1505; }
.st-done { background: var(--green); color: #07110C; } .st-ignored { background: #44524a; color: var(--fg); }
.pager { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; flex-wrap: wrap; }
.pager select, .pager button { font-size: 13px; color: var(--body); background: var(--field); border: 1px solid var(--line); border-radius: 7px; padding: 3px 9px; }
.pager button { cursor: pointer; } .pager button:disabled { opacity: .4; cursor: default; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 10px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { font-size: 13px; color: var(--body); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.filters button.on { color: var(--gold-ink); background: var(--gold); border-color: var(--gold); font-weight: 600; }
.eng-e11 .filters button.on { color: #fff; background: var(--e11); border-color: var(--e11); }
input[type=search], input[type=text], input[type=number], input[type=url], select, textarea {
  color: var(--fg); background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 14px; }
input[type=search] { min-width: 240px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--eng); }
textarea { width: 100%; resize: vertical; }
textarea.code { font: 12px/1.45 ui-monospace, Consolas, monospace; min-height: 220px; }
.form { display: grid; grid-template-columns: max-content 1fr; gap: 8px 12px; align-items: center; max-width: 640px; }
.form label { color: var(--body); font-size: 13px; }
.form .full { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note { color: var(--muted); font-size: 13px; margin-top: 12px; }
.chart { position: relative; height: 180px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--grid); }
.bar { flex: 1; position: relative; height: 100%; display: flex; align-items: flex-end; }
.bar i { display: block; width: 100%; background: var(--eng); border-radius: 3px 3px 0 0; }
.bar:hover i { opacity: .75; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 6px; }
.pbar { display: inline-block; width: 90px; height: 6px; border-radius: 3px; background: var(--grid); vertical-align: middle; margin-right: 8px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--green); }
.log { font: 12px/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; max-height: 60vh; overflow: auto;
  background: #050c08; border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: var(--body); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.alert { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; font-size: 14px; }
.alert.bad { background: rgba(255,107,94,.10); color: #FFB4AC; } .alert.warn { background: rgba(245,158,80,.10); color: #FFD3AA; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 50; max-width: 420px; padding: 10px 14px; border-radius: 10px;
  background: #13241A; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 14px; }
.toast.bad { border-color: rgba(255,107,94,.5); color: #FFB4AC; }
img.icon { width: 32px; height: 32px; object-fit: contain; border-radius: 4px; background: #06100b; vertical-align: middle; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 14px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; color: var(--body); padding: 8px 14px; cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--fg); border-bottom-color: var(--eng); font-weight: 600; }
dialog { background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 14px; padding: 18px; width: min(760px, 94vw); }
dialog::backdrop { background: rgba(0,0,0,.6); }
pre.json { font: 12px/1.4 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; margin: 4px 0; color: var(--body); max-height: 260px; overflow: auto; }

/* ---- issues / support / chat (as admin14) */
.ilist { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.irow { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--line); font-size: 13px; cursor: pointer; min-height: 40px; }
.irow:first-child { border-top: 0; }
.irow:hover { background: rgba(255,255,255,0.03); }
.irow .id { color: var(--fg); font-weight: 700; width: 40px; flex: none; }
.irow .who2 { color: var(--muted); width: 140px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.irow .tx { flex: 1; min-width: 0; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.irow .when { color: var(--muted); width: 84px; flex: none; text-align: right; }
.iss { border-top: 1px dashed var(--line); padding: 6px 14px 12px 52px; background: rgba(59,227,127,0.04); }
.iss .msg { margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.iss .pics { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.iss .pics img { height: 110px; border-radius: 6px; border: 1px solid var(--line); }
.iss .acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.iss .acts input { flex: 1; min-width: 180px; }
.sc-wrap { display: grid; grid-template-columns: minmax(240px, 330px) 1fr; padding: 0; min-height: 420px; }
.sc-list { border-right: 1px solid var(--line); max-height: 70vh; overflow-y: auto; }
.sc-item { display: block; width: 100%; text-align: left; color: var(--body); background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; cursor: pointer; }
.sc-item:hover { background: rgba(255,255,255,0.03); } .sc-item.on { background: rgba(59,227,127,0.10); }
.sc-item .top2 { display: flex; gap: 8px; align-items: baseline; }
.sc-item .p { color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-item .w { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.sc-item .c { color: var(--muted); font-size: 12px; }
.sc-item .l { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.sc-right { display: flex; flex-direction: column; min-width: 0; }
.sc-thread { flex: 1; display: flex; flex-direction: column; max-height: 62vh; overflow-y: auto; padding: 12px 16px; gap: 8px; }
.sc-msg { max-width: 75%; padding: 8px 11px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; background: rgba(255,255,255,0.06); align-self: flex-start; }
.sc-msg.me { align-self: flex-end; background: var(--gold); color: var(--gold-ink); }
.sc-msg .t { display: block; margin-top: 4px; font-size: 11px; opacity: .7; }
.sc-reply { display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); }
.sc-reply textarea { flex: 1; }

/* ---- login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(900px 500px at 15% -10%, rgba(46,232,122,0.10), transparent 60%),
              radial-gradient(800px 500px at 110% 110%, rgba(255,90,54,0.08), transparent 60%), var(--bg); }
.login-box { width: 100%; max-width: 400px; }
.login-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 22px; }
.login-brand img { width: 52px; height: 52px; border-radius: 12px; }
.login-brand b { display: block; font: 700 22px/1.1 Oswald, system-ui, sans-serif; text-transform: uppercase; }
.login-brand b span { color: var(--gold); }
.login-brand small { color: var(--muted); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; }
.login-form { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 26px 22px 22px; display: flex; flex-direction: column; gap: 8px; }
.login-form h1 { margin: 0; font-size: 20px; }
.login-form .sub { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.login-form label { font-size: 13px; color: var(--body); font-weight: 600; }
.login-form input[type=text], .login-form input[type=password] { height: 44px; font-size: 16px; }
.login-form .check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 6px 0 10px; }
.login-form .go { height: 46px; border: 0; border-radius: 10px; background: var(--gold); color: var(--gold-ink); font-weight: 700; font-size: 16px; cursor: pointer; }
.login-form .go:disabled { opacity: .6; }
.msg { display: none; padding: 10px 12px; border-radius: 10px; font-size: 14px; background: rgba(255,107,94,0.10); border: 1px solid rgba(255,107,94,0.35); color: #FFB4AC; }
.msg.show { display: block; }

@media (max-width: 860px) {
  .app { display: block; }
  .side { position: static; height: auto; overflow: visible; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 8px 10px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { order: 1; flex: 1; padding: 0; font-size: 18px; }
  .side-foot { display: contents; }
  .side-foot .who { order: 2; } .side-foot .out { order: 3; }
  .engpick { order: 4; flex-basis: 100%; margin: 0; }
  .mbtn { order: 5; flex-basis: 100%; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600;
    color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; text-align: left; }
  .mbtn .ic { color: var(--eng); } .mbtn .chev { margin-left: auto; color: var(--muted); transition: transform .15s; }
  .side.open .mbtn .chev { transform: rotate(180deg); }
  .nav { order: 6; flex-basis: 100%; display: none; overflow: visible; margin-right: 0; padding: 0 6px 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
  .side.open .nav { display: block; }
  .main { padding: 0 16px 40px; } .engbar { margin: 0 -16px 14px; }
  .sc-wrap { grid-template-columns: 1fr; } .sc-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .form { grid-template-columns: 1fr; }
  input[type=search] { min-width: 0; width: 100%; }
  .irow { flex-wrap: wrap; } .irow .tx { flex-basis: 100%; order: 5; }
}
@media (max-width: 420px) { .side-foot .who #me { display: none; } }
