/* NetFoundry MCP Connect. Design tokens from ezziti's style.css. */

:root {
    --brand-primary: #0066FF;
    --brand-primary-hover: #0052cc;
    --brand-secondary: #00489f;
    --brand-secondary-hover: #003d82;
    --color-danger: #dc2626;
    --color-danger-hover: #b91c1c;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-tertiary: #6b7280;
    --text-muted: #9ca3af;
    --bg-page: #f9fafb;
    --bg-white: #ffffff;
    --bg-subtle: #f3f4f6;
    --bg-divider: #e5e7eb;
    --border-card: #d1d5db;
    --border-divider: #e5e7eb;
    --border-dark: #9ca3af;
    --radius: 5px;
    --radius-lg: 7px;
    --radius-pill: 9999px;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-nav: 0 1px 2px rgba(0,0,0,0.04);
    --height-nav: 56px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --text-primary: #e5e7eb;
        --text-secondary: #d1d5db;
        --text-tertiary: #9ca3af;
        --text-muted: #6b7280;
        --bg-page: #0a0a0a;
        --bg-white: #141414;
        --bg-subtle: #1e1e1e;
        --bg-divider: #2a2a2a;
        --border-card: #2a2a2a;
        --border-divider: #222222;
        --border-dark: #444444;
        --shadow-card: 0 1px 3px rgba(0,0,0,0.3);
        --shadow-nav: 0 1px 2px rgba(0,0,0,0.2);
    }
}

* { box-sizing: border-box; }
html { font-family: 'Inter', system-ui, -apple-system, sans-serif; font-size: 15px; }
body { margin: 0; background: var(--bg-page); color: var(--text-primary); line-height: 1.5; }
a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace; font-size: 0.9em; }
pre { background: var(--bg-subtle); border: 1px solid var(--border-divider); border-radius: var(--radius); padding: 0.75rem 1rem; overflow-x: auto; }

/* Layout */
.topbar { height: var(--height-nav); background: var(--bg-white); border-bottom: 1px solid var(--border-divider); box-shadow: var(--shadow-nav);
          display: flex; align-items: center; padding: 0 1.25rem; gap: 1rem; }
.topbar .brand { font-weight: 600; color: var(--text-primary); }
.topbar .tenant { color: var(--text-tertiary); }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--text-secondary); font-size: 0.9rem; }
.shell { display: flex; min-height: calc(100vh - var(--height-nav)); }
.sidenav { width: 220px; padding: 1rem 0; border-right: 1px solid var(--border-divider); background: var(--bg-white); flex-shrink: 0; }
.sidenav a { display: block; padding: 0.5rem 1.25rem; color: var(--text-secondary); }
.sidenav a:hover { background: var(--bg-subtle); text-decoration: none; }
.sidenav a.active { background: #e0ecff; color: var(--brand-secondary); font-weight: 500; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sidenav a.active { background: #1a2a44; color: #93c5fd; } }
main { flex: 1; padding: 1.5rem 2rem; max-width: 1100px; }
@media (max-width: 720px) { .shell { flex-direction: column; } .sidenav { width: auto; display: flex; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border-divider); } main { padding: 1rem; } }

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; }
.muted { color: var(--text-tertiary); }
.small { font-size: 0.85rem; }

/* Cards and tables */
.card { background: var(--bg-white); border: 1px solid var(--border-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--bg-white); border: 1px solid var(--border-card); border-radius: var(--radius-lg); padding: 1rem; }
.stat .n { font-size: 1.8rem; font-weight: 600; }
.stat .l { color: var(--text-tertiary); font-size: 0.85rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border-divider); vertical-align: top; }
th { color: var(--text-tertiary); font-weight: 500; font-size: 0.85rem; }
tr:last-child td { border-bottom: 0; }

/* Forms */
form.stack > * { display: block; margin-bottom: 0.9rem; }
label { display: block; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
input[type=text], input[type=url], input[type=password], input[type=number], select, textarea {
    width: 100%; max-width: 520px; padding: 0.5rem 0.65rem; font: inherit; color: var(--text-primary);
    background: var(--bg-white); border: 1px solid var(--border-card); border-radius: var(--radius); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-primary); outline-offset: 0; border-color: var(--brand-primary); }
.hint { color: var(--text-tertiary); font-size: 0.8rem; margin-top: 0.2rem; }
.btn { display: inline-block; padding: 0.5rem 0.9rem; font: inherit; font-weight: 500; border-radius: var(--radius); border: 1px solid var(--border-card);
       background: var(--bg-white); color: var(--text-primary); cursor: pointer; }
.btn:hover { background: var(--bg-subtle); text-decoration: none; }
.btn.primary { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.btn.primary:hover { background: var(--brand-primary-hover); }
.btn.danger { color: var(--color-danger); border-color: var(--color-danger); }
.btn.danger:hover { background: var(--color-danger); color: #fff; }
.btn.small { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
.actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* Status */
.pill { display: inline-block; padding: 0.1rem 0.55rem; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 600; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.bad { background: #fee2e2; color: #991b1b; }
.pill.warn { background: #ffedd5; color: #9a3412; }
.pill.off { background: var(--bg-subtle); color: var(--text-tertiary); }
.flash { padding: 0.6rem 0.9rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.95rem; }
.flash.ok { background: #dcfce7; color: #166534; }
.flash.err { background: #fee2e2; color: #991b1b; }
.grid-check { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.5rem; }

/* Tabs */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border-divider); margin: 0.75rem 0; }
.tab { font: inherit; font-weight: 500; padding: 0.4rem 0.8rem; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-tertiary); cursor: pointer; margin-bottom: -1px; }
.tab.active { color: var(--brand-secondary); border-bottom-color: var(--brand-primary); }
.tab:hover { color: var(--text-primary); }
.login-box { max-width: 26rem; margin: 5rem auto; }
.error-box { border-left: 4px solid var(--color-danger); }
.error-box h1 { margin-top: 0.25rem; }

/* Help drawer, the ezziti pattern: a ? beside a heading opens a topic in a
   right-hand drawer. */
.help-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%;
             border: 1px solid var(--border-card); background: var(--bg-subtle); color: var(--text-tertiary); font: 600 0.7rem/1 inherit;
             font-family: inherit; cursor: pointer; vertical-align: middle; margin-left: 6px; padding: 0; }
.help-icon:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.help-drawer { position: fixed; top: 0; right: 0; width: 380px; max-width: 90vw; height: 100vh; background: var(--bg-white);
               border-left: 1px solid var(--border-card); box-shadow: -4px 0 24px rgba(0,0,0,0.1); transform: translateX(100%);
               transition: transform 0.25s ease; z-index: 1100; display: flex; flex-direction: column; }
.help-drawer-open { transform: translateX(0); }
.help-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-card); }
.help-drawer-header h3 { margin: 0; font-size: 1rem; }
.help-drawer-close { background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--text-tertiary); padding: 0 4px; line-height: 1; }
.help-drawer-close:hover { color: var(--text-primary); }
.help-drawer-body { padding: 1.25rem; overflow-y: auto; flex: 1; font-size: 0.9rem; line-height: 1.6; color: var(--text-secondary); }
.help-drawer-body p { margin: 0 0 0.75rem; }
.help-drawer-body ul { margin: 0 0 0.75rem; padding-left: 1.25rem; }
.help-drawer-body li { margin-bottom: 0.4rem; }
.help-drawer-overlay { display: none; position: fixed; inset: 0; z-index: 1099; }
.help-drawer-overlay-open { display: block; }
