/* The platform's look: Poppins, grey ground, white cards, dark wine and the
   group's gold, pill controls. */
:root { --ground:#F4F3F6; --paper:#fff; --line:#E8E3E8; --ink:#1F1A1D; --muted:#6E6770; --wine:#5C2138; --wine-dark:#3F1626; --wine-soft:#F6EAF0; --gold:#DBAC69; --gold-dark:#AE782B; --ok:#2E7D4F; --ok-soft:#E7F4EC; --bad:#B23A2E; --bad-soft:#FBE9E7; --warn:#B7791F; --warn-soft:#FBF0D9; }
* { box-sizing: border-box; } html, body { height: 100%; }
/* The hidden attribute must beat every display rule below, or the sign-in
   card stays on screen above the board after signing in. */
[hidden] { display: none !important; }
body { margin:0; font:14px/1.5 Poppins, ui-sans-serif, system-ui, sans-serif; color:var(--ink); background:var(--ground); }
button { font: inherit; cursor: pointer; } input, select, textarea { font: inherit; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.btn { display:inline-flex; align-items:center; gap:6px; border:1px solid var(--line); background:var(--paper); color:var(--ink); border-radius:999px; padding:7px 14px; font-weight:500; }
.btn:hover { background: var(--wine-soft); color: var(--wine); border-color: var(--wine-soft); }
.btn.primary { background: var(--wine); color: #fff; border-color: var(--wine); } .btn.primary:hover { background: var(--wine-dark); }
.btn.small { padding: 4px 10px; font-size: 12px; } .btn.wide { width: 100%; justify-content: center; padding: 11px; }
.btn.danger { color: var(--bad); }
.lang { display:inline-flex; border:1px solid var(--line); border-radius:999px; padding:2px; background:var(--paper); }
.lang-btn { border:0; background:none; border-radius:999px; padding:3px 10px; font-size:12px; font-weight:600; color:var(--muted); letter-spacing:.05em; } .lang-btn.on { background: var(--wine); color:#fff; }
.eyebrow { text-align:center; font-size:11px; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:var(--gold); margin:0 0 6px; }
/* sign-in */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { position: relative; width: 100%; max-width: 440px; padding: 40px 32px 28px; border-radius: 16px; box-shadow: 0 12px 40px rgba(31,26,29,.06); }
.lang-top { position: absolute; right: 18px; top: 18px; }
.logo { display: flex; justify-content: center; margin-bottom: 26px; } .logo img { height: 56px; }
.login-card h1 { font-size: 22px; font-weight: 600; text-align: center; margin: 0; letter-spacing: -.01em; }
label { display:block; font-size:11px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); margin:14px 0 6px; }
input, select, textarea { width:100%; padding:10px 14px; border:1px solid #DDD6DC; border-radius:12px; background:#fff; color:var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--wine); outline-offset: 1px; border-color: var(--wine); }
.login-card .btn.wide { margin-top: 22px; }
.err { color: var(--bad); background: var(--bad-soft); padding: 9px 12px; border-radius: 12px; font-size: 13px; }
.ok { color: var(--ok); background: var(--ok-soft); padding: 9px 12px; border-radius: 12px; font-size: 13px; }
.foot { color: var(--muted); font-size: 12px; text-align: center; margin: 16px 0 0; }
/* app */
.topbar { display:flex; align-items:center; justify-content:space-between; gap:12px; height:56px; padding:0 16px; background:var(--paper); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:5; }
.brand { display:flex; align-items:center; gap:10px; font-weight:600; font-size:15px; } .brand img { height: 30px; width: 30px; } .brand em { font-style: normal; color: var(--gold-dark); }
.tabs { display: flex; gap: 4px; } .tab { border:0; background:none; padding:7px 12px; border-radius:999px; color:var(--muted); font-weight:500; } .tab.on { background: var(--wine-soft); color: var(--wine); }
.actions { display: flex; align-items: center; gap: 8px; }
.tab-panel { padding: 18px; max-width: 1400px; margin: 0 auto; }
.banner { display:flex; align-items:center; gap:10px; padding:14px 18px; border-radius:14px; background:var(--paper); border:1px solid var(--line); margin-bottom:16px; font-weight:600; flex-wrap:wrap; }
.banner .dot { width:12px; height:12px; border-radius:50%; background:var(--muted); } .banner.ok .dot { background: var(--ok); } .banner.bad .dot { background: var(--bad); }
.banner #check-now { margin-left: auto; }
.incidents { background: var(--bad-soft); border: 1px solid #F3C9C4; border-radius: 14px; padding: 10px 16px; margin-bottom: 16px; font-size: 13px; }
.env { margin-bottom: 20px; } .env h2 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin: 6px 0 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.stack h3 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; justify-content: space-between; }
.row { display:flex; align-items:center; gap:8px; padding:6px 0; border-top:1px solid var(--line); font-size:13px; } .row:first-of-type { border-top: 0; }
.row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .status { color: var(--muted); font-size: 12px; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A container row: the name and, under it, how long it has been in that state.
   The pill and the restart button sit to the right; nothing is ever cut off. */
.stack .row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-rows: auto auto; column-gap: 8px; row-gap: 1px; align-items: center; }
.stack .row .name { grid-column: 1; grid-row: 1; }
.stack .row .status { grid-column: 1; grid-row: 2; max-width: none; white-space: normal; }
.stack .row .pill { grid-column: 2; grid-row: 1 / span 2; }
.stack .row .btn { grid-column: 3; grid-row: 1 / span 2; }
.pill { display:inline-block; border-radius:999px; padding:1px 8px; font-size:11px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.kpi { font-size: 22px; font-weight: 600; margin: 4px 0; } .facts { font-size: 12px; color: var(--muted); } .facts b { color: var(--ink); font-weight: 500; }
.dbs { margin-top: 8px; } .dbs .row { padding: 3px 0; font-size: 12px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; } .toolbar select { width: auto; padding: 6px 10px; }
table.events { width: 100%; border-collapse: collapse; font-size: 13px; } table.events th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.events td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; } table.events td.msg { white-space: pre-wrap; word-break: break-word; }
table.events tr.error td { background: #FFF7F6; } table.events tr.warning td { background: #FFFBF3; }
.settings .card { margin-bottom: 14px; } .settings h2 { margin: 0 0 4px; font-size: 15px; } .grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
label.check { display:flex; align-items:center; gap:8px; text-transform:none; letter-spacing:0; font-size:13px; font-weight:400; color:var(--ink); } label.check input { width: auto; }
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
@media (max-width: 760px) { .tabs { order: 3; width: 100%; justify-content: center; } .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; } .banner #check-now { margin-left: 0; } }

/* The summary strip: the four numbers that matter, then the sections. */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.kpi-card .label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.kpi-card .value { font-size: 24px; font-weight: 600; line-height: 1.2; margin: 0; }
.kpi-card .sub { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.kpi-card.bad .value { color: var(--bad); } .kpi-card.ok .value { color: var(--ink); }
.section { margin-bottom: 22px; }
.section-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.section-head h2 { margin: 0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.section-head p { margin: 0; font-size: 12px; color: var(--muted); }
.card .desc { font-size: 12px; color: var(--muted); margin: -2px 0 10px; line-height: 1.4; }
.card h3 { margin: 0 0 6px; font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.facts.problem { color: var(--bad); margin-top: 6px; }
.env-name { font-size: 13px; font-weight: 600; color: var(--wine); margin: 4px 0 12px; }
.stack .row .pill:last-child { grid-column: 2 / span 2; justify-self: end; }

/* Role manager */
.roles-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.role-card { display: flex; flex-direction: column; gap: 8px; }
.role-card .role-head { display: flex; align-items: center; gap: 8px; }
.role-card .role-rank { font-size: 11px; font-weight: 700; color: var(--gold-dark); background: var(--wine-soft); border-radius: 999px; width: 22px; height: 22px; display: grid; place-items: center; flex-shrink: 0; }
.role-card h3 { flex: 1; margin: 0; font-size: 15px; }
.role-card .desc { margin: 0; }
.role-card .role-grants { font-size: 12px; color: var(--muted); }
.role-card .role-grants b { color: var(--ink); font-weight: 500; }
.role-card .role-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 6px; }
table.events td .btn.small { margin-right: 4px; }
.badge-unassigned { background: var(--warn-soft); color: var(--warn); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
#users-unassigned, #users-usage-note { margin: 0 0 14px; }
.table-scroll { overflow-x: auto; }
.table-scroll table.events { min-width: 760px; }

/* Modal editors (role / user) */
.modal { position: fixed; inset: 0; background: rgba(31,26,29,.45); display: grid; place-items: center; padding: 20px; z-index: 20; overflow-y: auto; }
.modal-card { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto; box-shadow: 0 20px 60px rgba(31,26,29,.25); }
.modal-card h2 { margin: 0 0 4px; font-size: 17px; }
.modal-card fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 14px 0 0; padding: 10px 14px 14px; }
.modal-card legend { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 6px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 10px; margin-top: 6px; }
.check-grid label.check { font-size: 12px; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.modal-actions .spacer { flex: 1; }
@media (max-width: 640px) { .modal { padding: 0; } .modal-card { max-width: none; height: 100%; max-height: none; border-radius: 0; } }

/* Two-step verification reveal: shown once, right after it is (re)set */
.totp-reveal { background: var(--wine-soft); border-radius: 12px; padding: 10px 14px; margin-top: 10px; }
.totp-reveal code { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: 13px; user-select: all; }
#uf-totp-status { margin: 4px 0; }
#uf-usage { background: var(--ground); border-radius: 10px; padding: 8px 12px; margin-top: 12px; line-height: 1.5; }

/* A masked secret (a model's API token) shown with a reveal toggle */
.token-mask { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--ground); border-radius: 6px; padding: 2px 8px; user-select: all; }
.role-grants .token-mask { margin-right: 6px; }
/* An input paired with a show/hide (or similar) button, filling the row */
.field-with-toggle { display: flex; gap: 8px; align-items: center; }
.field-with-toggle input { flex: 1; min-width: 0; }
