/* SNConnectX admin-portal theme applied to the SecureConnect portal (visual only: no behaviour change).
   Loaded after app.css and remote.css, so it re-colours them through their own variables and overrides.
   Source of the look: SNConnectX apps/admin-portal (indigo brand, dark indigo rail, Inter, rounded cards, light/dark). */

:root {
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f1f3f9; --border: #e3e6ef; --text: #151826; --muted: #5d6479;
  --ok: #0f9d6b; --warn: #b7791f; --bad: #d23b4b;
  --brand-50: #eef2ff; --brand-100: #e0e7ff; --brand-500: #6366f1; --brand-600: #4f46e5; --brand-700: #4338ca;
  /* the names app.css / remote.css already use, pointed at the new palette */
  --blue: var(--brand-600); --blue-dark: var(--brand-700); --teal: #14b8a6;
  --navy: var(--text); --charcoal: var(--text); --line: var(--border); --bg-soft: var(--surface-2);
  --primary-color: var(--brand-600); --secondary-color: #1e1b4b; --text-color: var(--text); --muted-text-color: var(--muted);
  --border-color: var(--border); --background-color: var(--surface-2); --surface-color: var(--surface); --accent-color: var(--teal);
  --font-family: 'Inter', ui-sans-serif, system-ui, 'Segoe UI', Roboto, sans-serif;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 28px -16px rgba(16, 24, 40, .18);
  font-family: var(--font-family);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1018; --surface: #161924; --surface-2: #1d2130; --border: #2a2f42; --text: #e9ebf5; --muted: #9aa1b8;
    --ok: #35c68f; --warn: #e0b04a; --bad: #ff6b7a; color-scheme: dark;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 28px -16px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  --bg: #0e1018; --surface: #161924; --surface-2: #1d2130; --border: #2a2f42; --text: #e9ebf5; --muted: #9aa1b8;
  --ok: #35c68f; --warn: #e0b04a; --bad: #ff6b7a; color-scheme: dark;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 28px -16px rgba(0, 0, 0, .7);
}

/* page */
html { background: var(--bg); }
body { color: var(--text); font-size: 14.5px;
  background: radial-gradient(900px 380px at 85% -8%, color-mix(in srgb, var(--brand-500) 16%, transparent), transparent 70%),
    radial-gradient(700px 320px at 0% 0%, color-mix(in srgb, #14b8a6 8%, transparent), transparent 70%), var(--bg);
  background-attachment: fixed; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
h1 { font-size: 1.75rem; line-height: 2.1rem; font-weight: 700; letter-spacing: -.02em; }
main > h1, main > .toolbar h1, .adminmain > .toolbar h1 { color: var(--text); }
main > .sub, main > .toolbar .sub, .adminmain > .toolbar .sub { color: var(--muted); }
.sub { color: var(--muted); }

/* shell: dark indigo rail + translucent top bar */
.app-shell { display: flex; min-height: 100svh; }
.rail { position: sticky; top: 0; align-self: flex-start; height: 100svh; width: 256px; flex: none; z-index: 30; display: flex; flex-direction: column; gap: 6px;
  padding: 12px; overflow-y: auto; color: #fff; background: linear-gradient(185deg, #1e1b4b 0%, #312e81 55%, #3730a3 100%); }
.rail .brand { display: block; padding: 4px 8px 16px; background: none; border: 0; }
.rail .brand img { height: 30px; width: auto; display: block; }
.rail .nav { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 0; flex: 1; }
.rail .nav a { display: flex; align-items: center; gap: .7rem; padding: .5rem .75rem; border-radius: 10px; font-size: .875rem; font-weight: 400;
  color: rgba(224, 231, 255, .78); text-decoration: none; transition: background-color .12s, color .12s; }
.rail .nav a svg { color: #a5b4fc; flex: none; }
.rail .nav a:hover { color: #fff; background: rgba(255, 255, 255, .09); }
.rail .nav a.active, .rail .nav a.active:hover { color: #fff; font-weight: 600; background: linear-gradient(90deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .08)); box-shadow: inset 3px 0 0 #a5b4fc; }
.rail .nav a.active svg { color: #fff; }
.rail .nav a:focus-visible, .rail .brand:focus-visible { outline: 2px solid #c7d2fe; }
.rail-foot { margin: 8px 8px 0; font-size: .72rem; color: rgba(199, 210, 254, .6); }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 24px; min-height: 62px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); box-shadow: none; }
.topgrow { flex: 1; }
.railbtn { display: none; }
main { width: 100%; max-width: 1440px; margin: 0 auto; padding: 24px; }
@media (max-width: 639px) { main { padding: 16px 16px 24px; } .topbar { padding-left: 16px; padding-right: 16px; } }
main > .sub, main > .toolbar .sub { font-size: .875rem; }
main > .sub { margin: 0 0 20px; }

/* top-bar controls */
.refreshbtn, .topbar .refreshbtn { margin: 0; width: 36px; height: 36px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.refreshbtn:hover, .topbar .refreshbtn:hover { background: var(--surface-2); border-color: var(--border); color: var(--brand-600); }
.topbar .who, .topbar .who strong { color: var(--text); }
.userbtn, .topbar .userbtn { background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 2px 12px; }
.topbar .userbtn:not(:disabled):hover, .topbar .userbtn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.topbar .userbtn:not(:disabled):active { background: var(--surface-2); color: var(--text); }
.umenu { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.umenu, .umenu strong, .umenu div, .topbar .who .umenu, .topbar .who .umenu strong, .topbar .who .umenu div { color: var(--text); }
.umenu .umuser, .umenu .umlabel, .topbar .who .umenu .umuser, .topbar .who .umenu .umlabel { color: var(--muted); }
.umenu button:not(:disabled):hover { background: var(--surface-2); color: var(--text); border: 0; }

/* cards, tiles */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); letter-spacing: .04em; }
.stat .value { color: var(--text); font-weight: 700; }
.stat .value.blue { color: var(--brand-600); } .stat .value.teal { color: #0d9488; }
.golink:hover { background: var(--surface-2); border-color: var(--brand-500); }
.golink:hover *, .golink:active *, .golink:hover .value, .golink:hover .hint { color: inherit !important; }
.golink:hover .value.blue { color: var(--brand-600) !important; } .golink:hover .value.teal { color: #0d9488 !important; }
.golink:active { background: var(--surface-2); border-color: var(--brand-600); }
.dashgraph:hover { box-shadow: var(--shadow); }
.bar .fill { background: linear-gradient(180deg, var(--brand-500), var(--teal)); }
.bar.cur .fill { background: linear-gradient(180deg, var(--brand-700), var(--brand-500)); }
.keybox { background: var(--surface-2); border-color: var(--brand-500); }

/* buttons and fields */
button, .btn { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 15px; font-size: .85rem; font-weight: 600; }
button:not(:disabled):hover, .btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
button:not(:disabled):active, .btn:active { background: var(--surface-2); border-color: var(--border); color: var(--text); }
button.primary, .btn.primary { background: linear-gradient(135deg, #4f46e5, #6366f1); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .65); }
button.primary:not(:disabled):hover, .btn.primary:hover { background: linear-gradient(135deg, #4338ca, #4f46e5); border-color: transparent; color: #fff; }
button.primary:not(:disabled):active, .btn.primary:active { background: linear-gradient(135deg, #3730a3, #4338ca); border-color: transparent; color: #fff; }
button.small { padding: 4px 10px; font-size: .78rem; }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
label { color: var(--text); font-size: .8rem; }
input[type=text], input[type=password], input[type=number], input[type=month], input[type=date], input[type=search], select, textarea,
.ra-filters input, .ra-filters select { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 25%, transparent); }
.ra-filters label { color: var(--muted); }
.msg.err { background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
.msg.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
.msg.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }

/* tables */
table { font-size: .85rem; font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: 600; font-size: .72rem; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
tr:hover td, tr.ra-click:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
tfoot td { background: var(--surface) !important; border-top: 2px solid var(--border); }
.tablewrap.listscroll thead th { background: var(--surface); box-shadow: 0 1px 0 var(--border); }
th.sortable:hover, th.sortable:active, th.sorted { color: var(--brand-600); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }

/* pills / badges */
.pill { background: color-mix(in srgb, var(--brand-500) 14%, transparent); color: var(--brand-700); font-size: .75rem; }
.pill.teal { background: color-mix(in srgb, #14b8a6 16%, transparent); color: #0d9488; }
.pill.red { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.pill.amber { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill.gray { background: var(--surface-2); color: var(--muted); }
.umenu .pill { color: var(--brand-700); }
:root[data-theme="dark"] .pill, :root[data-theme="dark"] .umenu .pill { color: #c7d2fe; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill, :root:not([data-theme="light"]) .umenu .pill { color: #c7d2fe; } }

/* tabs: segmented pills */
.tabs { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 4px; gap: 4px; }
.tabs button { border-radius: 10px; color: var(--muted); font-size: .85rem; padding: 7px 15px; background: transparent; border: 0; }
.tabs button:not(.on):hover { background: transparent; color: var(--text); }
.tabs button:not(.on):active { background: transparent; color: var(--text); }
.tabs button.on, .tabs button.on:hover, .tabs button.on:active { background: var(--surface); color: var(--brand-700); box-shadow: 0 1px 3px rgba(16, 24, 40, .14); }
:root[data-theme="dark"] .tabs button.on { color: #c7d2fe; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs button.on { color: #c7d2fe; } }
.tabs button .pill, .tabs button.on .pill, .tabs button:hover .pill, .tabs button:active .pill { background: color-mix(in srgb, var(--brand-500) 16%, transparent); color: inherit; }

/* administration sub-menu (inside a page) */
.sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; top: 80px; box-shadow: var(--shadow); }
.sidebar a { color: var(--muted); font-weight: 500; }
.sidebar a:hover { background: var(--surface-2); color: var(--text); }
.sidebar a:active { background: var(--surface-2); color: var(--text); }
.sidebar a.active { background: color-mix(in srgb, var(--brand-500) 14%, transparent); color: var(--brand-700); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand-500); }
:root[data-theme="dark"] .sidebar a.active { color: #c7d2fe; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sidebar a.active { color: #c7d2fe; } }
.sidebar .side-title { color: var(--muted); }
.sidebar a.parent.has-active { color: var(--text); }

/* dialogs */
.modal-back { background: rgba(14, 16, 24, .55); }
.modal { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }

/* Remote Support */
.chat-head, .ra-viewer .viewer-bar { background: #1e1b4b; }
.cmsg.out, .chat-send { background: var(--brand-600); }

/* sign-in: split layout */
.login-split { display: grid; min-height: 100svh; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-start; padding: 40px; color: #fff;
  background: linear-gradient(145deg, #312e81 0%, #4338ca 55%, #6366f1 100%); }
.login-brand::after { content: ""; position: absolute; right: -96px; bottom: -128px; width: 384px; height: 384px; border-radius: 50%; background: rgba(255, 255, 255, .05); pointer-events: none; }
.login-brand > div { margin-top: calc(30vh - 84px); }
.login-brand .lb-logo { height: 44px; width: auto; align-self: flex-start; }
.login-brand h2 { margin: 0; white-space: nowrap; font-size: clamp(1.5rem, 2.4vw, 1.875rem); line-height: 1.25; font-weight: 600; letter-spacing: -.02em; }
.login-brand ul { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 16px; }
.login-brand li { display: grid; gap: 0; padding-left: 32px; position: relative; }
.login-brand li::before { content: ""; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c7d2fe' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E"); }
.login-brand li strong { font-weight: 500; }
.login-brand li span { font-size: .875rem; color: rgba(224, 231, 255, .8); }
.login-brand .lb-foot { margin: auto 0 0; padding-top: 32px; line-height: 16px; font-size: .75rem; color: rgba(224, 231, 255, .7); }
.login-side { display: flex; align-items: flex-start; justify-content: center; padding: 64px 32px 24px; }
@media (min-width: 1024px) { .login-side { padding-top: 30vh; } }
.login-card { max-width: 384px; background: transparent; border: 0; box-shadow: none; padding: 0; }
.login-card .lc-logo { display: none; height: 38px; width: auto; margin: 0 0 20px; }
.login-card h1 { text-align: left; font-size: 1.5rem; line-height: 2rem; letter-spacing: -.02em; font-weight: 600; margin: 0; }
.login-card .sub { text-align: left; margin: 4px 0 24px; font-size: .875rem; }
.login-card .sub { line-height: 20px; }
.login-card .field { margin: 0 0 12px; }
.login-card .field + .field { margin-bottom: 20px; }
.login-card .field label { display: block; margin: 0 0 4px; font-size: 12px; line-height: 16px; font-weight: 600; }
.login-card .field input { box-sizing: border-box; height: 39px; width: 100%; }
.login-card button.primary { box-sizing: border-box; width: 100%; height: 42px; padding: 0 10px; }
.login-brand li strong { line-height: 24px; }
.login-brand li span { line-height: 20px; }
@media (max-width: 1023px) {
  .login-split { grid-template-columns: 1fr; } .login-brand { display: none; }
  .login-card .lc-logo { display: block; }
}

/* narrow windows: the rail becomes a drawer */
@media (max-width: 1023px) {
  .rail { position: fixed; left: 0; top: 0; transform: translateX(-102%); transition: transform .2s; }
  .rail.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .railbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border-radius: 8px; }
  .topbar { padding: 10px 16px; }
  main { padding: 16px 16px 24px; }
}
@media (prefers-reduced-motion: reduce) { .rail { transition: none; } }

/* remote desktop session is full window, and printing keeps the plain white page */
body.ra-session .rail, body.ra-session .topbar { display: none; }
@media print {
  .rail, .topbar { display: none !important; }
  .app-shell { display: block; }
  :root:root:root { --bg: #fff; --surface: #fff; --surface-2: #f6f7fb; --border: #e3e6ef; --text: #151826; --muted: #5d6479; color-scheme: light; }
  html, body { background: #fff !important; }
  main { padding: 0; }
}
