:root {
    /* Brand cyan */
    --brand-cyan:       #00B6E8;
    --brand-cyan-dark:  #0090BA;
    --brand-cyan-light: #E5F7FD;
    --brand-cyan-glow:  rgba(0, 182, 232, 0.30);

    /* Dark / ink */
    --ink:       #0B1220;
    --ink-soft:  #131C2C;
    --ink-line:  #1F2A3F;
    --ink-deep:  #060A12;

    /* Body text */
    --text:       #1F2937;
    --text-muted: #5B6470;
    --text-faint: #8E9BA9;

    /* Surfaces */
    --surface:      #FFFFFF;
    --surface-alt:  #F4F7FB;
    --surface-tint: #EDF3FA;
    --border:       #E5EAF0;
    --border-strong:#D2DAE3;

    /* Status */
    --success: #4DD17A;
    --warning: #FFB547;
    --danger:  #FF5C5C;

    /* Layout */
    --max: 1240px;
    --gutter: 24px;

    /* Radius */
    --radius-sm: 8px;
    --radius:    14px;
    --radius-lg: 20px;

    /* Shadow */
    --shadow-card:       0 1px 3px rgba(11,18,32,.04), 0 8px 24px rgba(11,18,32,.06);
    --shadow-card-hover: 0 1px 3px rgba(11,18,32,.06), 0 18px 40px rgba(11,18,32,.10);
    --shadow-glow:       0 8px 28px rgba(0,182,232,.30);

    /* Motion */
    --tx-fast: 150ms cubic-bezier(.2,.8,.2,1);
    --tx-base: 250ms cubic-bezier(.2,.8,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16.5px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01';
    color: var(--text);
    background: var(--surface);
    margin: 0;
}

code, .mono, [data-mono] {
    font-family: 'JetBrains Mono', ui-monospace, "Cascadia Code", monospace;
    font-size: 0.92em;
    font-feature-settings: 'liga' 0;
}

h1, h2, h3, h4, h5 {
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--ink);
    margin: 0 0 0.6em;
}
h1 { font-size: clamp(2.4rem, 5.2vw, 4.4rem); letter-spacing: -0.035em; line-height: 1.05; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.85rem); letter-spacing: -0.025em; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.05rem; }
p  { margin: 0 0 1em; }

a { color: var(--brand-cyan-dark); text-decoration: none; }
a:hover { color: var(--brand-cyan); text-decoration: underline; }

/* Layout primitives */
.container       { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section         { padding: 110px 0; }
.section--tight  { padding: 72px 0; }
.section--alt    { background: var(--surface-alt); }
.section--dark   { background: var(--ink); color: #E6EDF3; }
.section--dark h1, .section--dark h2, .section--dark h3 { color: #FFFFFF; }
.section--dark p { color: #B5C0CC; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 26px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.97rem;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all var(--tx-base);
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn .arr { transition: transform var(--tx-fast); }
.btn:hover .arr { transform: translateX(3px); }

.btn-primary { background: var(--brand-cyan); color: #fff; box-shadow: var(--shadow-glow); }
.btn-primary:hover { background: var(--brand-cyan-dark); color: #fff; box-shadow: 0 12px 32px var(--brand-cyan-glow); }

.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.22); }
.btn-ghost:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.5); color: #fff; }

.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-soft); color: #fff; }

.btn-light { background: #fff; color: var(--ink); border-color: var(--border); }
.btn-light:hover { background: var(--surface-alt); }

.btn-outline { background: transparent; color: var(--brand-cyan-dark); border-color: var(--brand-cyan); }
.btn-outline:hover { background: var(--brand-cyan); color: #fff; box-shadow: 0 6px 20px var(--brand-cyan-glow); }

.btn-sm { padding: 10px 18px; font-size: 0.9rem; }

/* Eyebrow */
.eyebrow {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 0.78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.14em;
    color: var(--brand-cyan);
    margin-bottom: 18px;
}
.eyebrow::before {
    content: ''; width: 28px; height: 2px;
    background: var(--brand-cyan);
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    transition: all var(--tx-base);
    position: relative;
    overflow: hidden;
}
.card:hover {
    border-color: rgba(0,182,232,.30);
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}
.card__icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand-cyan), var(--brand-cyan-dark));
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 22px;
    color: #fff;
    box-shadow: 0 6px 18px var(--brand-cyan-glow);
}
.card__icon svg { width: 24px; height: 24px; }

/* Forms */
.form-field label {
    display: block;
    font-size: 0.85rem; font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}
.form-field input, .form-field textarea, .form-field select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.97rem;
    color: var(--text);
    background: #fff;
    transition: border-color var(--tx-fast), box-shadow var(--tx-fast);
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
    outline: none;
    border-color: var(--brand-cyan);
    box-shadow: 0 0 0 4px rgba(0,182,232,.12);
}

/* Pulse dot */
.pulse-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(77,209,122,.18);
    animation: pulse 2.4s ease-in-out infinite;
    display: inline-block;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(77,209,122,.18); }
    50%      { box-shadow: 0 0 0 8px rgba(77,209,122,.06); }
}

/* App shell */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.app-sidebar {
    background: var(--ink);
    color: #B5C0CC;
    padding: 22px 16px;
    display: flex; flex-direction: column; gap: 28px;
    border-right: 1px solid var(--ink-line);
}
.app-sidebar__brand-wrap { padding: 4px 6px; }
.app-sidebar__brand {
    display: flex; align-items: center; gap: 10px;
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    padding: 4px 6px;
}
.app-sidebar__brand-sub {
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.16em;
    color: var(--text-faint);
    margin-top: 2px;
    padding: 0 6px;
}
.app-sidebar__footer {
    margin-top: auto;
    padding: 0 8px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #5C6378;
}

.app-nav { display: flex; flex-direction: column; gap: 2px; }
.app-nav__head {
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.16em;
    color: #5C6378;
    padding: 0 8px;
    margin-bottom: 8px;
}
.app-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 0.94rem;
    color: #B5C0CC;
    text-decoration: none;
    transition: background var(--tx-fast), color var(--tx-fast);
}
.app-nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.app-nav a.active {
    background: rgba(0,182,232,.12);
    color: var(--brand-cyan);
}
.app-nav a svg { width: 16px; height: 16px; flex-shrink: 0; }

.app-main { padding: 32px 40px; background: var(--surface-alt); min-width: 0; }

.app-topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    margin: -32px -40px 28px;
    padding: 14px 40px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    min-height: 56px;
}
.app-userchip__name {
    font-weight: 600;
    color: var(--ink);
    font-size: 0.92rem;
}
.app-userchip__action {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: none;
}
.app-userchip__action:hover { color: var(--brand-cyan-dark); text-decoration: underline; }

.app-main__head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap; gap: 12px;
}
.app-main__title { font-size: 1.75rem; margin: 0; }

/* Pills */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--surface);
}
.pill--ok    { background: rgba(77,209,122,.10); color: #1B7A3E; border-color: rgba(77,209,122,.3); }
.pill--warn  { background: rgba(255,181,71,.10); color: #B45309; border-color: rgba(255,181,71,.4); }
.pill--err   { background: rgba(255,92,92,.08);  color: #B33A3A; border-color: rgba(255,92,92,.3); }
.pill--info  { background: rgba(0,182,232,.08);  color: var(--brand-cyan-dark); border-color: rgba(0,182,232,.3); }

/* Key-value table (debug data, /healthz, connector listings) */
.kv-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kv-row { display: grid; grid-template-columns: 220px 1fr; gap: 16px; padding: 14px 22px; border-bottom: 1px solid var(--border); }
.kv-row:last-child { border-bottom: none; }
.kv-row__key {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}
.kv-row__val {
    font-size: 0.92rem;
    color: var(--ink);
    word-break: break-all;
}
.kv-row__val--ok { color: #1B7A3E; font-weight: 600; }
.kv-row__val--err { color: #B33A3A; font-weight: 600; }

/* Public hero — unauthenticated landing on / */
.public-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 140px);
    padding: 40px 24px;
}
.public-hero__inner {
    max-width: 560px;
    text-align: center;
}
.public-hero__title {
    font-size: clamp(2.6rem, 5.5vw, 4rem);
    line-height: 1.05;
    letter-spacing: -0.035em;
    margin-bottom: 18px;
}
.public-hero__lede {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: 36px;
    line-height: 1.5;
}
.public-hero__cta {
    font-size: 1rem;
    padding: 16px 32px;
}
.public-hero__note {
    margin-top: 28px;
    font-size: 0.85rem;
    color: var(--text-faint);
}
.public-hero__inner .eyebrow { display: inline-flex; }

/* Impersonation banner (MSP "acting as" client) */
.impersonation-banner {
    background: linear-gradient(135deg, var(--brand-cyan), var(--brand-cyan-dark));
    color: #fff;
    padding: 10px 24px;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,182,232,0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}
.impersonation-banner strong { font-weight: 700; }
.impersonation-banner__exit {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.18);
    color: #fff;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.25);
    cursor: pointer;
    transition: background var(--tx-fast);
    font-family: inherit;
}
.impersonation-banner__exit:hover { background: rgba(255,255,255,0.32); color: #fff; }

/* Mobile */
@media (max-width: 768px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar { padding: 16px; gap: 16px; }
    .app-nav { flex-direction: row; flex-wrap: wrap; }
    .app-main { padding: 24px 20px; }
    .app-topbar { margin: -24px -20px 24px; padding: 12px 20px; }
    .kv-row { grid-template-columns: 1fr; gap: 4px; padding: 12px 16px; }
}

/* Shared "back" button — used at the top of detail pages instead of the small text-only link. */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    background: var(--surface, white);
    margin-bottom: 14px;
    transition: border-color var(--tx-fast), color var(--tx-fast);
}
.btn-back:hover { border-color: var(--brand-cyan, #00B6E8); color: var(--brand-cyan, #00B6E8); }
