/* ═══════════════════════════════════════════════════════════
   CERT Tools — Access Panel
   CI Design System v1.0
   Fonts: Gilroy (primary) + IBM Plex Mono (data only)
   ═══════════════════════════════════════════════════════════ */

/* ── CI Design tokens ───────────────────────────────────── */
:root {
  --ci-blue:        #006BA9;
  --ci-blue-dark:   #004F80;
  --ci-blue-tint:   #E6F1F8;
  --ci-ink:         #1A1A1A;
  --ci-surface:     #FFFFFF;
  --ci-bg:          #F5F7F9;
  --ci-border-soft: #EFEFEF;

  /* Section accent colours */
  --accent-registries:    #006BA9;
  --accent-calculations:  #0B6E4F;
  --accent-audit:         #1A3A5C;
  --accent-docs:          #4A4080;
  --accent-knowledge:     #7A5800;
  --accent-system:        #3D3D3A;

  /* Semantic */
  --ok:        #0B6E4F;
  --ok-dim:    #D4EAE0;
  --warn:      #7A5800;
  --warn-dim:  #F5ECD4;
  --danger:    #8C1A1A;
  --danger-dim:#F5D4D4;

  /* Backward compat aliases */
  --ink:   var(--ci-ink);
  --paper: var(--ci-surface);
  --line:  var(--ci-border-soft);
  --muted: #6B6B6B;

  /* Fonts */
  --font-ui:   'Gilroy', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --radius: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }

/* ── Gilroy font-face ───────────────────────────────────── */
@font-face { font-family: 'Gilroy'; font-weight: 300; font-display: swap;
  src: url('/static/fonts/Gilroy-Light.woff2') format('woff2'); }
@font-face { font-family: 'Gilroy'; font-weight: 400; font-display: swap;
  src: url('/static/fonts/Gilroy-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Gilroy'; font-weight: 500; font-display: swap;
  src: url('/static/fonts/Gilroy-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Gilroy'; font-weight: 600; font-display: swap;
  src: url('/static/fonts/Gilroy-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Gilroy'; font-weight: 700; font-display: swap;
  src: url('/static/fonts/Gilroy-Bold.woff2') format('woff2'); }
@font-face { font-family: 'Gilroy'; font-weight: 800; font-display: swap;
  src: url('/static/fonts/Gilroy-ExtraBold.woff2') format('woff2'); }


/* ── Body ───────────────────────────────────────────────── */
body {
  font-family: var(--font-ui);
  font-weight: 400;
  color: var(--ci-ink);
  background: var(--ci-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────── */
.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR — CI Blue
   ══════════════════════════════════════════════════════════ */
.sidebar {
  width: 248px;
  min-width: 248px;
  flex-shrink: 0;
  background: var(--ci-blue);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  padding: 1.25rem 1.25rem .75rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: .5rem;
}
.sidebar-logo-text {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.3rem;
  color: #fff;
  letter-spacing: .02em;
}
.sidebar-logo-sub {
  font-family: var(--font-mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255,255,255,.6);
  margin-top: .15rem;
}

.sidebar-section { margin-bottom: .25rem; }
.sidebar-section--bottom {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.12);
  padding-top: .5rem;
  margin-bottom: .5rem;
}

.sidebar-section-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .65rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  padding: .6rem 1.25rem .2rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .42rem 1.25rem;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: .93rem;
  color: rgba(255,255,255,.82);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
}
.sidebar-link:hover {
  background: rgba(255,255,255,.10);
  color: #fff;
}
.sidebar-link--active {
  background: rgba(255,255,255,.15);
  color: #fff;
  font-weight: 600;
  border-left-color: #fff;
}

/* ══════════════════════════════════════════════════════════
   TOPBAR
   ══════════════════════════════════════════════════════════ */
.topbar {
  background: var(--ci-surface);
  border-bottom: 1px solid var(--ci-border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 52px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .93rem;
  color: var(--ci-ink);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-family: var(--font-ui);
  font-size: .82rem;
}
.topbar-login {
  color: var(--ci-ink);
  font-weight: 500;
  text-decoration: none;
}
.topbar-login:hover { color: var(--ci-blue); }
.topbar-logout {
  font-size: .78rem;
  color: var(--muted);
  text-decoration: none;
  padding: .2rem .6rem;
  border: 1px solid var(--ci-border-soft);
  border-radius: var(--radius);
  transition: color .12s, border-color .12s;
}
.topbar-logout:hover { color: var(--danger); border-color: var(--danger); }

/* ── Main content ───────────────────────────────────────── */
.main-wrap {
  flex: 1;
  margin-left: 248px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--ci-bg);
}
.content-body {
  padding: 2rem 2.25rem 3rem;
  overflow-x: auto;
  flex: 1;
}

/* ── Footer ─────────────────────────────────────────────── */
.foot {
  background: var(--ci-surface);
  border-top: 1px solid var(--ci-border-soft);
  text-align: center;
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: .1em;
  color: var(--muted);
  padding: .75rem 1rem;
  flex-shrink: 0;
}
.foot-sep { margin: 0 .5rem; }

/* ══════════════════════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ci-border-soft);
  flex-wrap: wrap;
}
.page-eyebrow {
  font-family: var(--font-mono);
  font-size: .6rem;
  letter-spacing: .14em;
  color: var(--muted);
  flex-shrink: 0;
}
.page-title {
  font-family: var(--font-ui);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ci-ink);
  flex: 1;
}

/* ══════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════ */
.alert {
  font-family: var(--font-ui);
  font-size: .85rem;
  padding: .65rem 1rem;
  border-left: 3px solid;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-weight: 500;
}
.alert--success { background: var(--ok-dim);    border-color: var(--ok);     color: var(--ok); }
.alert--error   { background: var(--danger-dim); border-color: var(--danger); color: var(--danger); }
.alert--warning { background: var(--warn-dim);   border-color: var(--warn);   color: var(--warn); }

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */
.btn {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .93rem;
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: all .15s;
  white-space: nowrap;
  letter-spacing: .01em;
}
.btn--primary {
  background: var(--ci-blue); color: #fff;
  border-color: var(--ci-blue);
}
.btn--primary:hover { background: var(--ci-blue-dark); border-color: var(--ci-blue-dark); }
.btn--secondary {
  background: var(--ci-surface); color: var(--ci-blue);
  border-color: var(--ci-blue);
}
.btn--secondary:hover { background: var(--ci-blue-tint); }
.btn--ghost {
  background: transparent; color: var(--muted);
  border-color: var(--ci-border-soft);
}
.btn--ghost:hover { border-color: var(--ci-blue); color: var(--ci-blue); }
.btn--full { width: 100%; justify-content: center; }

/* ══════════════════════════════════════════════════════════
   ROLE BADGE
   ══════════════════════════════════════════════════════════ */
.role-badge {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .62rem;
  letter-spacing: .08em;
  padding: .15rem .5rem;
  background: var(--ci-blue-tint);
  color: var(--ci-blue);
  border-radius: 100px;
  border: 1px solid var(--ci-blue);
}
.role-badge--user {
  background: var(--ci-bg);
  color: var(--muted);
  border-color: var(--ci-border-soft);
}

/* ══════════════════════════════════════════════════════════
   STATUS STAMP
   ══════════════════════════════════════════════════════════ */
.status-stamp {
  font-family: var(--font-mono);
  font-size: .6rem;
  letter-spacing: .1em;
  padding: .15rem .5rem;
  border-radius: 100px;
  border: 1px solid;
  display: inline-block;
  font-weight: 500;
}
.status-stamp--active  { color: var(--ok);     border-color: var(--ok);     background: var(--ok-dim); }
.status-stamp--blocked { color: var(--danger);  border-color: var(--danger); background: var(--danger-dim); }

/* ══════════════════════════════════════════════════════════
   TOOL GRID (dashboard)
   ══════════════════════════════════════════════════════════ */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.tool-card {
  background: var(--ci-surface);
  border: 1px solid var(--ci-border-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--ci-ink);
  display: flex;
  flex-direction: column;
  gap: .45rem;
  transition: border-color .15s, box-shadow .15s;
  position: relative;
  box-shadow: var(--shadow);
}
.tool-card:hover {
  border-color: var(--ci-blue);
  box-shadow: var(--shadow-md);
}
.tool-card__code {
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: .12em;
  color: var(--ci-blue);
}
.tool-card__label {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}
.tool-card__perms { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .15rem; }
.tool-card__arrow {
  position: absolute; right: 1.25rem; top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem; color: var(--ci-border-soft);
  transition: color .15s, transform .15s;
}
.tool-card:hover .tool-card__arrow { color: var(--ci-blue); transform: translateY(-50%) translateX(3px); }

.perm-tag {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .62rem;
  letter-spacing: .04em;
  padding: .12rem .5rem;
  border-radius: 100px;
}
.perm-tag--view  { background: var(--ci-blue-tint); color: var(--ci-blue); }
.perm-tag--edit  { background: var(--ok-dim); color: var(--ok); }
.perm-tag--issue { background: #D4EAE6; color: #0B5E4F; }
.perm-tag--tpl   { background: #EAD4EA; color: #6B2A6B; }

/* ══════════════════════════════════════════════════════════
   HEALTH GRID
   ══════════════════════════════════════════════════════════ */
.health-grid { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .5rem; }
.health-card {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem 1rem;
  background: var(--ci-surface);
  border: 1px solid var(--ci-border-soft);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: .82rem;
  font-weight: 500;
}
.health-card--ok  { border-color: var(--ok-dim); }
.health-card--err { border-color: var(--danger-dim); }
.health-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.health-card--loading .health-dot { background: var(--ci-border-soft); }
.health-card--ok      .health-dot { background: var(--ok); }
.health-card--err     .health-dot { background: var(--danger); }
.health-label { color: var(--ci-ink); }
.health-ms    { color: var(--muted); font-size: .75rem; margin-left: .2rem; font-family: var(--font-mono); }

/* ══════════════════════════════════════════════════════════
   REGISTRY TABLE
   ══════════════════════════════════════════════════════════ */
.registry-wrap {
  background: var(--ci-surface);
  border: 1px solid var(--ci-border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.registry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}
.registry-table thead tr {
  background: var(--ci-bg);
  border-bottom: 2px solid var(--ci-border-soft);
}
.registry-table th {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .68rem;
  letter-spacing: .08em;
  color: var(--muted);
  padding: .65rem .9rem;
  text-align: left;
  white-space: nowrap;
}
.registry-table td {
  padding: .55rem .9rem;
  border-bottom: 1px solid var(--ci-border-soft);
  vertical-align: middle;
}
.registry-table tbody tr:last-child td { border-bottom: none; }
.registry-table tbody tr:hover { background: var(--ci-bg); }
.row--inactive td { opacity: .45; }
.row--current td  { background: var(--ci-blue-tint); }

.cell--mono    { font-family: var(--font-mono); font-size: .8rem; }
.cell--center  { text-align: center; }
.cell--dim     { color: var(--muted); }
.cell--empty   { text-align: center; color: var(--muted); font-style: italic; padding: 2rem !important; }
.cell--actions { white-space: nowrap; text-align: right; }

/* Dot indicators */
.dot--view  { color: var(--ci-blue); }
.dot--edit  { color: var(--ok); }
.dot--issue { color: #0B5E4F; }
.dot--tpl   { color: #6B2A6B; }
.dot--none  { color: var(--ci-border-soft); }

/* Table header groups */
.th-group {
  text-align: center;
  border-bottom: 2px solid var(--ci-blue-tint);
  font-size: .62rem;
  letter-spacing: .08em;
  color: var(--ci-blue) !important;
}
.th-sub { text-align: center; font-size: .8rem; padding: .3rem .4rem !important; }

/* ── Action links ─────────────────────────────────────────*/
.action-link {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: .78rem;
  color: var(--ci-blue);
  text-decoration: none;
  padding: .15rem .4rem;
  border-radius: 4px;
  background: none; border: none; cursor: pointer;
  transition: background .12s;
}
.action-link:hover { background: var(--ci-blue-tint); }
.action-link--del { color: var(--danger); }
.action-link--del:hover { background: var(--danger-dim); }

/* Legend */
.legend { font-family: var(--font-ui); font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════ */
.edit-form { max-width: 760px; }

.form-section {
  background: var(--ci-surface);
  border: 1px solid var(--ci-border-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.form-section__title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .65rem;
  letter-spacing: .12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--ci-border-soft);
}

.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.field:last-child { margin-bottom: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.field-label {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .78rem;
  color: var(--ci-ink);
}
.field-hint {
  font-weight: 400;
  font-size: .75rem;
  color: var(--muted);
}
.field-input {
  background: var(--ci-surface);
  border: 1.5px solid var(--ci-border-soft);
  border-radius: var(--radius);
  padding: .52rem .75rem;
  font-family: var(--font-ui);
  font-size: .9rem;
  color: var(--ci-ink);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field-input--mono { font-family: var(--font-mono); font-size: .85rem; }
.field-input:focus {
  outline: none;
  border-color: var(--ci-blue);
  box-shadow: 0 0 0 3px var(--ci-blue-tint);
}

.checkbox-row { display: flex; flex-direction: column; gap: .6rem; }
.checkbox-label {
  display: flex; align-items: center; gap: .55rem;
  cursor: pointer; font-size: .88rem;
}
.checkbox-label input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--ci-blue); cursor: pointer; flex-shrink: 0;
}

/* ── Toggle switch ───────────────────────────────────────── */
.toggle-label { display: inline-flex; align-items: center; cursor: pointer; }
.toggle-label input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 36px; height: 20px;
  background: var(--ci-border-soft);
  border-radius: 10px; position: relative;
  transition: background .2s; flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: #fff; border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-label input:checked + .toggle-track { background: var(--ci-blue); }
.toggle-label input:checked + .toggle-track::after { transform: translateX(16px); }

.form-actions { display: flex; gap: .75rem; align-items: center; padding-top: .5rem; }

/* ── Permission matrix ───────────────────────────────────── */
.tool-perm-block {
  border: 1px solid var(--ci-border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: .75rem;
  background: var(--ci-surface);
}
.tool-perm-block:last-child { margin-bottom: 0; }
.tool-perm-header {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .9rem;
  background: var(--ci-bg);
  border-bottom: 1px solid var(--ci-border-soft);
  font-size: .85rem;
}
.tool-perm-name { color: var(--muted); font-size: .82rem; }
.perm-tool-code {
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: .1em;
  color: var(--ci-blue);
  background: var(--ci-blue-tint);
  border: 1px solid var(--ci-blue);
  padding: .1rem .4rem;
  border-radius: 4px;
}
.tool-perm-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), 1fr);
}
.perm-col {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  padding: .75rem .5rem;
  border-right: 1px solid var(--ci-border-soft);
}
.perm-col:last-child { border-right: none; }
.perm-col__label {
  font-family: var(--font-ui);
  font-size: .68rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════ */
.body--login {
  background: var(--ci-bg);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}
.login-split {
  display: flex;
  width: 100%;
  min-height: 100vh;
}
.login-left {
  width: 420px;
  flex-shrink: 0;
  background: var(--ci-blue);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 2.5rem;
}
.login-left-brand {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.5rem;
  color: #fff;
  letter-spacing: .02em;
}
.login-left-brand span { font-weight: 300; opacity: .7; }
.login-left-title {
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 2rem;
  color: #fff;
  line-height: 1.2;
  margin-top: 3rem;
}
.login-left-sub {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .1em;
  color: rgba(255,255,255,.5);
  margin-top: .75rem;
}
.login-left-foot {
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
}
.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: var(--ci-surface);
}
.login-card {
  width: 100%;
  max-width: 380px;
}
.login-card-eyebrow {
  font-family: var(--font-mono);
  font-size: .65rem;
  letter-spacing: .14em;
  color: var(--muted);
  margin-bottom: 1.5rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--ci-border-soft);
}
.login-card h2 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1.35rem;
  margin-bottom: 1.5rem;
  color: var(--ci-ink);
}
.login-card .field { margin-bottom: .9rem; }
.login-card .btn   { margin-top: .5rem; }

/* ══════════════════════════════════════════════════════════
   STATS & ACTIVITY
   ══════════════════════════════════════════════════════════ */
.stat-cards {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--ci-surface);
  border: 1px solid var(--ci-border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stat-card__title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .65rem;
  letter-spacing: .12em;
  color: var(--muted);
  padding: .6rem .9rem;
  background: var(--ci-bg);
  border-bottom: 1px solid var(--ci-border-soft);
}

.mini-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.mini-table th {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .65rem;
  letter-spacing: .08em;
  color: var(--muted);
  padding: .4rem .75rem;
  text-align: left;
  background: var(--ci-bg);
  border-bottom: 1px solid var(--ci-border-soft);
}
.mini-table td { padding: .4rem .75rem; border-bottom: 1px solid var(--ci-border-soft); }
.mini-table tbody tr:last-child td { border-bottom: none; }
.mini-table tbody tr:hover { background: var(--ci-bg); }

.section-label {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .65rem;
  letter-spacing: .12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: .6rem;
}

.action-badge {
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: .06em;
  padding: .12rem .45rem;
  border-radius: 100px;
  border: 1px solid;
  display: inline-block;
  white-space: nowrap;
  font-weight: 500;
}
.action-badge--login        { color: var(--ok);     border-color: var(--ok);     background: var(--ok-dim); }
.action-badge--logout       { color: var(--muted);   border-color: var(--ci-border-soft); background: var(--ci-bg); }
.action-badge--access       { color: var(--ci-blue); border-color: var(--ci-blue); background: var(--ci-blue-tint); }
.action-badge--user_create  { color: #0B5E4F; border-color: #0B5E4F; background: #D4EAE6; }
.action-badge--user_edit    { color: var(--warn);    border-color: var(--warn);    background: var(--warn-dim); }
.action-badge--user_delete  { color: var(--danger);  border-color: var(--danger);  background: var(--danger-dim); }
.action-badge--backup       { color: #4A4080; border-color: #4A4080; background: #EAE4F5; }
.action-badge--session_kill { color: var(--danger);  border-color: var(--danger);  background: var(--danger-dim); }
.action-badge--password_change { color: var(--muted); border-color: var(--ci-border-soft); background: var(--ci-bg); }

/* ══════════════════════════════════════════════════════════
   FILTER BAR
   ══════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--ci-surface);
  border: 1px solid var(--ci-border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filter-group { display: flex; flex-direction: column; gap: .3rem; }
.filter-input, .filter-select { width: 160px; }
.filter-bar .ci-filter-collapsible { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }

/* ══════════════════════════════════════════════════════════
   PROFILE / SESSIONS
   ══════════════════════════════════════════════════════════ */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }

.session-row {
  padding: .6rem 0; border-bottom: 1px solid var(--ci-border-soft);
  display: flex; flex-direction: column; gap: .2rem;
}
.session-row:last-child { border-bottom: none; }
.session-row--current {
  background: var(--ci-blue-tint); padding: .6rem .75rem;
  border-radius: var(--radius); border-bottom: none; margin-bottom: .5rem;
}
.session-meta { display: flex; align-items: center; gap: .5rem; }

/* ── Misc ────────────────────────────────────────────────── */
.section-divider { border: none; border-top: 1px solid var(--ci-border-soft); margin: 1.75rem 0; }
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty-state__icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state__text { font-size: 1.1rem; font-weight: 600; color: var(--ci-ink); }
.empty-state__sub  { font-size: .85rem; margin-top: .4rem; }

code {
  font-family: var(--font-mono); font-size: .8em;
  background: var(--ci-bg); border: 1px solid var(--ci-border-soft);
  padding: .05rem .35rem; border-radius: 4px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .content-body { padding: 1.25rem 1rem 2rem; }
  .two-col { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .login-left { width: 100%; min-height: 180px; justify-content: center; }
  .login-split { flex-direction: column; }
  .login-right { padding: 2rem 1.25rem; }
  .filter-input, .filter-select { width: 100%; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .ci-filter-collapsible { flex-direction: column; align-items: stretch; }

  .field-input { font-size: 16px; }

  .btn-sm, .action-link { min-width: 44px; min-height: 44px; }

  .sidebar-toggle {
    display: flex !important; align-items: center; justify-content: center;
    width: 36px; height: 36px; min-width: 44px; min-height: 44px; border: none; background: var(--ci-bg);
    border-radius: var(--radius); cursor: pointer; font-size: 18px; color: var(--muted);
    margin-right: .75rem; flex-shrink: 0;
  }

  .tool-grid { grid-template-columns: 1fr; }

  .registry-wrap table.table-cards thead,
  .stat-card table.table-cards thead { display: none; }
  table.table-cards, table.table-cards tbody, table.table-cards tr, table.table-cards td { display: block; width: 100%; }
  table.table-cards tr {
    border: 1px solid var(--ci-border-soft); border-radius: var(--radius);
    margin-bottom: 10px; padding: 4px 12px; background: var(--ci-surface);
  }
  table.table-cards td {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--ci-border-soft); text-align: right;
  }
  table.table-cards td:last-child { border-bottom: none; }
  table.table-cards td::before {
    content: attr(data-label); font-weight: 600; font-size: .65rem;
    text-transform: uppercase; color: var(--muted); text-align: left; flex-shrink: 0;
  }
  table.table-cards td[data-label=""]::before { display: none; }

  .ci-filter-toggle { display: flex !important; }
  .ci-filter-collapsible {
    max-height: 0; overflow: hidden; transition: max-height .25s ease;
  }
  .ci-filter-collapsible.open { max-height: 600px; }
}

.sidebar-toggle { display: none; }

.ci-filter-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  width: auto;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--ci-border-soft);
  background: var(--ci-surface);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
}
