/* SSO — itpro360. Every color is a token; light on :root, dark via media query or data-theme. */
:root {
  color-scheme: light;
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #eef0f6; --text: #1b1e27; --muted: #555c6d;
  --border: #d3d7e2; --border-strong: #8a91a3;
  --accent: #3442c9; --accent-hover: #2a37ad; --accent-text: #ffffff; --accent-soft: #e7e9fc; --accent-soft-text: #2a37ad;
  --ok: #17703f; --ok-bg: #e2f3e9; --warn: #7d5100; --warn-bg: #fcefd2; --danger: #b42318; --danger-bg: #fde6e4;
  --focus: #3442c9; --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 4px 16px rgba(20, 24, 40, .05);
  --c1: #3442c9; --c2: #0e7c7b; --c3: #b25f00; --grid: #e3e6ee;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #15171e; --surface: #1e2129; --surface-2: #272a35; --text: #e7e9ef; --muted: #a5abba;
    --border: #353a47; --border-strong: #7d8496;
    --accent: #8e9bff; --accent-hover: #a9b3ff; --accent-text: #11131a; --accent-soft: #272c4d; --accent-soft-text: #c3caff;
    --ok: #74d69e; --ok-bg: #173022; --warn: #f0c35d; --warn-bg: #352a10; --danger: #ff8f85; --danger-bg: #3b1b19;
    --focus: #a9b3ff; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
    --c1: #8e9bff; --c2: #4fd1c5; --c3: #f0c35d; --grid: #2c303b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15171e; --surface: #1e2129; --surface-2: #272a35; --text: #e7e9ef; --muted: #a5abba;
  --border: #353a47; --border-strong: #7d8496;
  --accent: #8e9bff; --accent-hover: #a9b3ff; --accent-text: #11131a; --accent-soft: #272c4d; --accent-soft-text: #c3caff;
  --ok: #74d69e; --ok-bg: #173022; --warn: #f0c35d; --warn-bg: #352a10; --danger: #ff8f85; --danger-bg: #3b1b19;
  --focus: #a9b3ff; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
  --c1: #8e9bff; --c2: #4fd1c5; --c3: #f0c35d; --grid: #2c303b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 15px/1.55 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.12rem; margin: 0 0 .7rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 .8rem; }
code { font: .88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; overflow-wrap: anywhere; }
code.big { font-size: 1.05em; padding: .2em .5em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; justify-content: center; }
.mt { margin-top: 1rem; }
.nowrap { white-space: nowrap; }

/* header */
.site-header {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.02rem; }
.brand:hover { color: var(--text); }
.brand-icon { border-radius: 7px; display: block; }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav a { padding: .4rem .7rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-soft-text); }
.header-right { display: flex; align-items: center; gap: .6rem; }

/* theme switch */
.theme-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--surface); }
.theme-switch button {
  border: 0; background: transparent; color: var(--muted); width: 30px; height: 26px; border-radius: 999px; cursor: pointer; font-size: .95rem; line-height: 1;
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-soft-text); }

/* layout */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem; flex: 1; }
body.wide .container { max-width: 1280px; }
.card-page { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 2rem 1rem; display: flex; flex-direction: column; align-items: center; }
.brand-bare { margin-bottom: 1.2rem; font-size: 1.1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; min-width: 0; }
.card.narrow { width: 100%; max-width: 440px; }
.card-page > .card { width: 100%; }
.page-head { margin-bottom: 1.2rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-3 + .card, .grid-2 + section, .grid-3 + section { margin-top: 1rem; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.wrap { margin-top: 1rem; }
form.inline { display: inline; }

/* hero */
.hero { text-align: center; padding: 2rem 0 2.2rem; }
.hero-icon { border-radius: 18px; box-shadow: var(--shadow); margin-bottom: 1rem; }
.hero h1 { font-size: 2.1rem; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 620px; margin: 0 auto 1.4rem; }
details { border-top: 1px solid var(--border); padding: .6rem 0; }
details:last-child { border-bottom: 1px solid var(--border); }
summary { cursor: pointer; font-weight: 600; }
details p { margin: .5rem 0 0; color: var(--muted); }
.card details:first-of-type { margin-top: .4rem; }
details.small, details.mt { border: 0; padding: 0; }

/* forms */
.field { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; min-width: 0; }
.field > span { font-size: .9rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: .55rem .7rem; width: 100%; min-width: 0;
}
input:disabled { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; margin: 0; }
legend { font-weight: 600; padding: 0 .3rem; font-size: .9rem; }
.check { display: flex; gap: .55rem; align-items: flex-start; font-weight: 400; }
.check input { width: auto; margin-top: .25rem; accent-color: var(--accent); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .4rem .8rem; }
.seg { display: flex; gap: .4rem; flex-wrap: wrap; border: 0; padding: 0; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-block; padding: .45rem .9rem; border: 1px solid var(--border-strong); border-radius: 999px; }
.seg input:checked + span { background: var(--accent-soft); color: var(--accent-soft-text); border-color: var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  padding: .55rem 1rem; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-soft-text); }
.btn-danger { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--surface); }
.btn-sm { padding: .3rem .65rem; font-size: .85rem; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* alerts & badges */
.alert { border: 1px solid; border-radius: 10px; padding: .7rem .9rem; margin-bottom: 1rem; width: 100%; }
.card-page > .alert { max-width: 440px; }
.alert-info { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-soft-text); }
.alert-success { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.alert-warning { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.alert-danger { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.alert code { background: var(--surface); color: var(--text); }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.badge-accent { background: var(--accent-soft); color: var(--accent-soft-text); border-color: var(--accent); }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.table th, .table td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table.compact th, .table.compact td { padding: .35rem .5rem; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-warn td { background: var(--warn-bg); }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; }
dl.kv dt { font-weight: 600; } dl.kv dd { margin: 0; word-break: break-word; }

/* apps grid */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.app-tile {
  display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto; column-gap: .8rem; align-items: center;
  padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow);
}
.app-tile:hover { border-color: var(--accent); color: var(--text); }
.app-letter { grid-row: span 2; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-soft-text); font-weight: 800; font-size: 1.3rem; }
.app-name { font-weight: 700; }
.app-desc { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 2rem; }

/* admin */
.admin-head { margin-bottom: 1.2rem; }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-top: .6rem; }
.tabs a { padding: .5rem .85rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.section-title { margin-top: 1.2rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.tile-v { font-size: 1.6rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.tile-l { color: var(--muted); font-size: .84rem; }
.tile-warn { background: var(--warn-bg); border-color: var(--warn); } .tile-warn .tile-v, .tile-warn .tile-l { color: var(--warn); }
.tile-danger { background: var(--danger-bg); border-color: var(--danger); } .tile-danger .tile-v, .tile-danger .tile-l { color: var(--danger); }
.chart { width: 100%; height: 220px; display: block; }
.chart-legend { display: flex; gap: 1rem; font-size: .85rem; color: var(--muted); margin-bottom: .4rem; flex-wrap: wrap; }
.lg::before { content: ""; display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: .4rem; vertical-align: middle; }
.lg-1::before { background: var(--c1); } .lg-2::before { background: var(--c2); } .lg-3::before { background: var(--c3); }
.toolbar { margin-bottom: 1rem; } .toolbar input { max-width: 320px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; align-items: end; margin-bottom: 1rem; }
.danger-zone { border-color: var(--danger); }

/* MFA */
.qr-wrap { display: flex; justify-content: center; margin: .5rem 0 1rem; }
.qr { background: #ffffff; padding: 14px; border-radius: 10px; line-height: 0; border: 1px solid var(--border); }
.qr svg, .qr img { display: block; width: 200px; height: 200px; }
.secret { display: block; margin-top: .5rem; font-size: 1rem; letter-spacing: .05em; }
ol.codes { columns: 2; font-size: 1.05rem; padding-left: 1.6rem; margin: 0 0 1rem; }
ol.codes li { margin-bottom: .3rem; }

/* prose */
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.4rem; }
.prose li { margin-bottom: .35rem; }

/* footer */
.site-footer {
  display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; justify-content: center; padding: 1.2rem 1rem 1.6rem; color: var(--muted); font-size: .85rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.site-footer .theme-switch { margin-left: .5rem; }

@media (max-width: 640px) {
  .site-header { flex-wrap: wrap; padding: .6rem 1rem; gap: .5rem; }
  .nav { order: 3; flex-basis: 100%; }
  .header-right { margin-left: auto; }
  .hero h1 { font-size: 1.7rem; }
  .container { padding: 1rem 1rem 2rem; }
  ol.codes { columns: 1; }
}

/* v1.1.0: avatars, photo upload */
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--accent-soft); color: var(--accent-soft-text); font-weight: 700; flex: none; border: 1px solid var(--border); }
.avatar-sm { width: 30px; height: 30px; font-size: .85rem; }
.avatar-lg { width: 88px; height: 88px; font-size: 2rem; }
.header-avatar { display: inline-flex; border-radius: 50%; }
.header-avatar:hover .avatar { border-color: var(--accent); }
.photo-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.photo-actions { gap: .45rem; align-items: flex-start; }
.file-btn { cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.text-danger { color: var(--danger); }
.user-cell { display: flex; gap: .6rem; align-items: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.group-head { margin: .6rem 0 .3rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.narrow-ish { max-width: 640px; }

/* v1.4.0: account chooser */
.avatar-md { width: 44px; height: 44px; font-size: 1.1rem; }
.chooser h1 { margin-bottom: .2rem; }
.account-choice {
  display: flex; align-items: center; gap: .85rem; width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; padding: .75rem .9rem;
}
.account-choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.account-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-email { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-go { font-size: 1.5rem; color: var(--muted); line-height: 1; }
.account-other { border-style: dashed; }
.avatar-other { background: var(--surface-2); color: var(--muted); font-size: 1.4rem; font-weight: 400; }
