/* ============================================================================
   SLD Gateway styling — clean, dark, engineering-aesthetic.
   ============================================================================ */
:root {
    --bg: #0f1216;
    --bg-2: #161b22;
    --panel: #1c232c;
    --line: #2a323d;
    --text: #e7eef7;
    --muted: #94a3b8;
    --accent: #4ea1ff;
    --accent-2: #2563eb;
    --ok: #16a34a;
    --warn: #d97706;
    --err: #ef4444;
    --shadow: 0 8px 30px rgba(0,0,0,.45);
    --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: rgba(255,255,255,.06); padding: 0 .3em; border-radius: 4px; font-size: .92em; }

/* ── Auth shell (login / register / install) ───────────────────────────── */
body.gw-auth {
    min-height: 100vh; display: grid; place-items: center;
    background: radial-gradient(900px 600px at 20% 0%, rgba(78,161,255,.10), transparent 60%),
                radial-gradient(900px 600px at 80% 100%, rgba(124,58,237,.08), transparent 60%),
                var(--bg);
    padding: 24px;
}
.gw-card {
    width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 28px 26px 22px; box-shadow: var(--shadow);
}
.gw-card--wide { max-width: 720px; }
.gw-card header { text-align: center; margin-bottom: 18px; }
.gw-logo {
    width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 14px;
    display: grid; place-items: center; font-size: 28px;
    background: linear-gradient(135deg, #1e3a8a, #4ea1ff);
}
.gw-card h1 { font-size: 20px; margin: 6px 0 4px; }
.gw-card h2 { font-size: 14px; text-transform: uppercase; color: var(--muted); letter-spacing: .08em; margin: 18px 0 6px; grid-column: 1 / -1; }
.gw-sub { color: var(--muted); font-size: 13px; margin: 0; }
.gw-foot { color: var(--muted); font-size: 12px; text-align: center; margin-top: 14px; }

form label { display: block; margin: 10px 0; }
form label > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select {
    width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
    border-radius: 8px; padding: 10px 12px; font: inherit; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(78,161,255,.18); }

button, .gw-primary.as-link {
    appearance: none; border: 0; cursor: pointer; font: inherit;
    background: var(--accent-2); color: white; padding: 11px 14px; border-radius: 8px;
    width: 100%; margin-top: 10px; font-weight: 600; letter-spacing: .01em;
    transition: filter .15s, transform .05s;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
.gw-primary { background: var(--accent-2); }
.gw-danger  { background: var(--err); }
.gw-mini    { width: auto; padding: 4px 10px; font-size: 12px; margin-top: 0; }

.gw-error { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35);
    color: #fecaca; padding: 10px 12px; border-radius: 8px; margin-bottom: 10px; font-size: 13px; }
.gw-ok    { background: rgba(22,163,74,.12); border: 1px solid rgba(22,163,74,.35);
    color: #bbf7d0; padding: 10px 12px; border-radius: 8px; margin-bottom: 10px; font-size: 13px; }
.gw-warn  { color: #fcd34d; }

/* Two-column form grid (install / add user). */
.gw-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.gw-grid2 .span2, .gw-grid2 > button { grid-column: 1 / -1; }

/* ── Admin shell ───────────────────────────────────────────────────────── */
body.gw-admin { padding: 0; }
.gw-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 22px; background: var(--bg-2); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
}
.gw-brand { font-weight: 700; letter-spacing: .02em; }
.gw-topbar nav { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 14px; }
.gw-topbar nav strong { color: var(--text); }

.gw-wrap { max-width: 1100px; margin: 22px auto; padding: 0 22px; display: grid; gap: 22px; }

.gw-panel { background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.gw-panel h2 { margin: 0 0 6px; font-size: 16px; }
.gw-panel > .gw-sub { margin-bottom: 14px; }
.gw-active { color: #bbf7d0; font-size: 13px; }
.gw-warn   { font-size: 13px; }

.gw-uploader { display: grid; gap: 10px; }
.gw-dropzone {
    display: grid; gap: 4px; place-items: center; text-align: center;
    border: 2px dashed var(--line); border-radius: var(--radius);
    padding: 28px 18px; cursor: pointer; transition: border-color .15s, background .15s;
    background: var(--bg-2);
}
.gw-dropzone:hover, .gw-dropzone.is-over { border-color: var(--accent); background: rgba(78,161,255,.06); }
.gw-dropzone input[type="file"] { display: none; }
.gw-dz-text { color: var(--muted); }
.gw-dz-file { color: var(--text); font-size: 12px; font-family: ui-monospace, monospace; }

.gw-inline { display: inline-block; margin-top: 12px; }
.gw-inline button { width: auto; }

.gw-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.gw-table th, .gw-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.gw-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.gw-table tr.is-active { background: rgba(22,163,74,.08); }
.gw-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.gw-active.gw-badge, .gw-badge.gw-active { background: rgba(22,163,74,.18); color: #bbf7d0; }
.gw-badge.gw-uploaded    { background: rgba(78,161,255,.15); color: #bfdbfe; }
.gw-badge.gw-rolled_back { background: rgba(217,119,6,.18); color: #fcd34d; }
.gw-badge.gw-failed      { background: rgba(239,68,68,.18); color: #fecaca; }

.gw-reset { display: inline-block; margin-left: 6px; }
.gw-reset[open] form { display: flex; gap: 6px; margin-top: 6px; }
.gw-reset input { width: 160px; padding: 4px 8px; font-size: 12px; }
.gw-add-user { margin-top: 14px; }
.gw-add-user[open] form { margin-top: 10px; }

/* User management ---------------------------------------------------------- */
.gw-users td        { vertical-align: top; }
.gw-users .gw-actions { white-space: nowrap; }
.gw-users .gw-actions form,
.gw-users .gw-actions details { display: inline-block; margin: 0 6px 4px 0; vertical-align: top; }
.gw-self            { background: rgba(56,189,248,0.06); }
.gw-pill {
    display: inline-block;
    padding: 1px 8px;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #0c4a6e;
    background: #bae6fd;
    border-radius: 999px;
    vertical-align: middle;
}
.gw-mini.gw-danger  { background: var(--err); color: #fff; }
.gw-mini[disabled]  { opacity: 0.45; cursor: not-allowed; }
