/* BluSign - same design system as BluPulse / BluAudit (dark default, light optional) */
:root {
  --bg: #060a14;
  --surface: rgba(255, 255, 255, .035);
  --surface-solid: #0e1526;
  --surface-2: rgba(255, 255, 255, .06);
  --border: rgba(255, 255, 255, .08);
  --border-2: rgba(255, 255, 255, .14);
  --text: #e8edf8;
  --text-2: #b4bed3;
  --muted: #7f8ba6;
  --accent: #4c8dff;
  --accent-2: #22d3ee;
  --violet: #9b7bff;
  --ok: #2fd47c;
  --warn: #f6b042;
  --crit: #ff5470;
  --info: #5ab8ff;
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, .55);
  --sidebar-w: 252px;
  --sidebar-bg: linear-gradient(180deg, rgba(14, 21, 38, .85), rgba(8, 13, 26, .9));
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* aliases used by page-level inline styles */
  --line: var(--border);
  --brand: var(--accent);
  --bad: var(--crit);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f1f4fa;
  --surface: rgba(255, 255, 255, .78);
  --surface-solid: #ffffff;
  --surface-2: rgba(15, 30, 70, .05);
  --border: rgba(15, 30, 70, .09);
  --border-2: rgba(15, 30, 70, .16);
  --text: #131b2e;
  --text-2: #3d4963;
  --muted: #6b7690;
  --accent: #2f6bf0;
  --accent-2: #0ab3d4;
  --ok: #17a85b;
  --warn: #d98a0b;
  --crit: #e5304f;
  --shadow: 0 10px 34px -14px rgba(25, 45, 100, .25);
  --sidebar-bg: rgba(255, 255, 255, .86);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text);
  background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased;
}
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(76, 141, 255, .20), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(155, 123, 255, .14), transparent 60%),
    radial-gradient(800px 500px at 50% 120%, rgba(34, 211, 238, .08), transparent 60%),
    var(--bg);
}
[data-theme="light"] .backdrop {
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(47, 107, 240, .12), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(124, 92, 230, .09), transparent 60%),
    var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 4px; line-height: 1.2; }
h2 { font-size: 16px; letter-spacing: -.01em; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 22px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); }

/* ---------- sidebar layout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 30;
  background: var(--sidebar-bg); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 20px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-text b { display: block; font-size: 18px; letter-spacing: -.02em; line-height: 1.1; }
.brand-text small { color: var(--muted); font-size: 11.5px; letter-spacing: .6px; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--text-2); font-weight: 500; transition: background .15s, color .15s;
}
.nav-item svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active {
  color: var(--text); background: linear-gradient(90deg, rgba(76, 141, 255, .22), rgba(76, 141, 255, .05));
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item.active svg { color: var(--accent); opacity: 1; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; display: flex; align-items: center; gap: 8px; }
.who { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.who span { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); font-size: 11.5px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--violet)); color: #fff; font-weight: 700;
}
.iconbtn {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); padding: 0; transition: background .15s, color .15s;
}
.iconbtn:hover { background: var(--border-2); color: var(--text); }
.iconbtn svg { width: 17px; height: 17px; }
.sidebar-foot form { margin: 0; display: contents; }
[data-theme="dark"] .ic-sun, [data-theme="light"] .ic-moon { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.content { max-width: 1180px; margin: 0 auto; padding: 30px 32px 80px; }
.mobilebar {
  display: none; position: sticky; top: 0; z-index: 20; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--sidebar-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-bottom: 1px solid var(--border);
}
.mobilebar b { letter-spacing: -.02em; }
.nav-scrim { display: none; }

/* ---------- cards, tables ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.danger-card { border-color: rgba(255, 84, 112, .35); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }

/* ---------- forms ---------- */
input[type=text], input[type=password], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 9px 12px; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
select option { background: var(--surface-solid); color: var(--text); }
textarea { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; min-height: 260px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 141, 255, .25); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; vertical-align: middle; }
td input[type=text], td input[type=number] { padding: 6px 9px; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.col-order { width: 84px; }
input[type=file] { padding: 7px 9px; }
label.l { display: block; font-weight: 600; font-size: 12.5px; color: var(--text-2); margin: 14px 0 5px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

/* ---------- buttons, badges, notices ---------- */
.btn {
  display: inline-block; border: 0; cursor: pointer; font: inherit; font-weight: 600; color: #fff;
  padding: 9px 16px; border-radius: 11px; text-decoration: none;
  background: linear-gradient(135deg, var(--accent), #3b6fe0); box-shadow: 0 6px 18px -8px rgba(76, 141, 255, .75);
  transition: transform .12s, filter .15s;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.sec { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-2); box-shadow: none; }
.btn.bad { background: linear-gradient(135deg, var(--crit), #d63a58); box-shadow: 0 6px 18px -8px rgba(255, 84, 112, .7); }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 9px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.b-ok { background: rgba(47, 212, 124, .14); color: var(--ok); }
.b-off { background: var(--surface-2); color: var(--muted); }
.b-warn { background: rgba(246, 176, 66, .16); color: var(--warn); }
.b-bad { background: rgba(255, 84, 112, .15); color: var(--crit); }
.flash { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.flash.ok { background: rgba(47, 212, 124, .10); border-color: rgba(47, 212, 124, .35); color: var(--ok); }
.flash.error { background: rgba(255, 84, 112, .10); border-color: rgba(255, 84, 112, .38); color: var(--crit); }
.keybox {
  background: linear-gradient(135deg, rgba(246, 176, 66, .12), rgba(246, 176, 66, .05));
  border: 1px solid rgba(246, 176, 66, .4); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 18px;
}
.keybox code { font-size: 20px; font-weight: 700; letter-spacing: 1px; padding: 3px 10px; color: var(--text); }
.logo-thumb { max-width: 96px; max-height: 60px; display: block; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 3px; }
.preview-frame { width: 100%; height: 340px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: #fff; }

/* ---------- auth (login / setup) ---------- */
body.auth { display: grid; place-items: center; align-content: center; gap: 28px; min-height: 100vh; padding: 24px; overflow-x: hidden; }
.auth-hero { text-align: center; }
.auth-hero svg { width: min(460px, 86vw); height: auto; overflow: visible; display: block; margin: 0 auto; }
.auth-hero h2 { margin: 6px 0 0; font-size: clamp(28px, 4vw, 40px); letter-spacing: -.03em; }
.auth-hero p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.sig-main, .sig-under { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1000; stroke-dashoffset: 1000; }
.sig-main { stroke-width: 3; filter: drop-shadow(0 0 8px rgba(76, 141, 255, .75)); animation: sig-main 7.5s ease-in-out infinite; }
.sig-under { stroke-width: 2.2; animation: sig-under 7.5s ease-in-out infinite; }
@keyframes sig-main {
  0% { stroke-dashoffset: 1000; opacity: 1; } 45% { stroke-dashoffset: 0; opacity: 1; }
  80% { stroke-dashoffset: 0; opacity: 1; } 93% { stroke-dashoffset: 0; opacity: 0; } 100% { stroke-dashoffset: 1000; opacity: 0; }
}
@keyframes sig-under {
  0%, 45% { stroke-dashoffset: 1000; opacity: 1; } 62% { stroke-dashoffset: 0; opacity: 1; }
  80% { stroke-dashoffset: 0; opacity: 1; } 93% { stroke-dashoffset: 0; opacity: 0; } 100% { stroke-dashoffset: 1000; opacity: 0; }
}
.auth-glow { position: fixed; border-radius: 50%; pointer-events: none; z-index: -1; filter: blur(10px); }
.auth-glow.a { width: 620px; height: 620px; left: -180px; top: -200px; background: radial-gradient(closest-side, rgba(76, 141, 255, .22), transparent); animation: glow-a 18s ease-in-out infinite alternate; }
.auth-glow.b { width: 560px; height: 560px; right: -160px; bottom: -200px; background: radial-gradient(closest-side, rgba(155, 123, 255, .2), transparent); animation: glow-b 22s ease-in-out infinite alternate; }
@keyframes glow-a { to { transform: translate(90px, 60px); } }
@keyframes glow-b { to { transform: translate(-80px, -70px); } }
@media (min-width: 1000px) {
  body.auth { grid-template-columns: minmax(0, 1fr) 440px; column-gap: 56px; max-width: 1160px; margin: 0 auto; width: 100%; }
}
.auth-card {
  width: min(420px, 100%); display: flex; flex-direction: column; gap: 6px; padding: 32px 30px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 22px; box-shadow: var(--shadow);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.auth-brand b { font-size: 21px; letter-spacing: -.02em; display: block; line-height: 1.1; }
.auth-brand small { color: var(--muted); }
.auth-card p { margin: 0 0 6px; color: var(--muted); }
.auth-card .btn { width: 100%; margin-top: 18px; padding: 11px 16px; text-align: center; }
.auth-card .flash { margin: 6px 0 0; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; width: 272px; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 80px rgba(0, 0, 0, .6); }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .5); }
  .main { margin-left: 0; }
  .mobilebar { display: flex; }
  .content { padding: 20px 16px 60px; }
  .two { grid-template-columns: 1fr; }
  h1 { font-size: 21px; }
  table { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .sig-main, .sig-under { stroke-dashoffset: 0 !important; opacity: 1 !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
