/* ==========================================================================
   lm unified design system — SINGLE source of truth for ALL surfaces.
   Loaded by EVERY template. No other CSS file is needed for shared styles.
   Theme: light + dark via data-theme. Brand: blue (#2563eb / #1d4ed8).
   Load order: 1. lm/theme.css  2. <app>/licence.css only
   ========================================================================== */

/* ---------------------------------------------------------------- Tokens -- */
:root {
  --brand-600: #2563eb; --brand-700: #1d4ed8; --brand-500: #3b82f6; --brand-400: #60a5fa;
  --bg: #f1f5f9; --surface: #ffffff; --surface-2: #f8fafc; --line: #e2e8f0; --line-strong: #cbd5e1;
  --ink: #0f172a; --ink-strong: #0b1220; --muted: #64748b; --muted-2: #94a3b8;
  --success: #059669; --ok: #059669; --success-bg: #ecfdf5; --success-line: #a7f3d0;
  --danger: #dc2626; --danger-bg: #fef2f2; --danger-line: #fecaca;
  --warn: #b45309; --warn-bg: #fffbeb; --warn-line: #fde68a;
  --radius: 12px; --radius-sm: 8px; --radius-lg: 16px; --shadow: none; --shadow-lg: none;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --panel: #ffffff; --accent: #2563eb; --accent-dark: #1d4ed8; --accent-soft: #eff6ff; --accent-ink: #ffffff;
}
body[data-theme="dark"], [data-theme="dark"] {
  --bg: #0b1220; --surface: #111c2e; --surface-2: #17243a;
  --line: #243247; --line-strong: #334155;
  --ink: #e2e8f0; --ink-strong: #f1f5f9; --muted: #94a3b8; --muted-2: #64748b;
  --success-bg: #0f2f23; --success-line: #14532d;
  --danger-bg: #2f1114; --danger-line: #7f1d1d;
  --warn-bg: #2b2411; --warn-line: #713f12;
  --ok: #34d399; --shadow: none; --shadow-lg: none; --panel: #111c2e;
  --accent: #3b82f6; --accent-dark: #60a5fa; --accent-soft: #172554; --accent-ink: #ffffff;
}

/* ---------------------------------------------------------------- Reset -- */
*, *::before, *::after { 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(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--ink-strong); letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }

/* --------------------------------------------------------------- Buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 16px; font: inherit; font-weight: 600; font-size: 13px;
  color: #fff; background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  box-shadow: var(--shadow); cursor: pointer; text-decoration: none;
  transition: background-color .15s ease, transform .05s ease;
}
.btn:hover { background: linear-gradient(180deg, var(--brand-600), var(--brand-700)); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--line); }
.btn.btn-secondary { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.btn.btn-secondary:hover { background: var(--line); }
.btn.danger { background: linear-gradient(180deg, #ef4444, var(--danger)); }
.btn.danger:hover { background: linear-gradient(180deg, var(--danger), #b91c1c); }
.btn.btn-danger { background: linear-gradient(180deg, #ef4444, var(--danger)); color: #fff; border-color: transparent; }
.btn.btn-danger:hover { background: linear-gradient(180deg, var(--danger), #b91c1c); color: #fff; }
.btn.ok { background: linear-gradient(180deg, #34d399, var(--ok)); }
.btn.ok:hover { background: linear-gradient(180deg, var(--ok), #059669); }
.btn.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn.btn-block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }
.btn.ghost:hover { background: var(--surface-2); color: var(--brand-600); }
.btn-primary { background: linear-gradient(180deg, var(--brand-500), var(--brand-600)); color: #fff; border: 1px solid transparent; }
.btn-primary:hover { background: linear-gradient(180deg, var(--brand-600), var(--brand-700)); }
.linkbtn { background: none; border: none; color: var(--brand-600); cursor: pointer; font-size: 13px; padding: 0; }

/* ----------------------------------------------------------------- Cards -- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 18px;
}
.card h3 { margin-top: 0; }

/* ---------------------------------------------------------------- Tables -- */
table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
th {
  padding: 11px 14px; text-align: left; background: var(--surface-2);
  color: var(--muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
tr.filter-row th { padding: 6px 8px; }
tr.filter-row input { font-size: 12px; padding: 6px 8px; }

/* ---------------------------------------------------------------- Badges -- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--muted);
}
.badge.success { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.badge.danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.badge.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.badge-info { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.badge-ok { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.badge-error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.badge.lock { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }

/* ---------------------------------------------------------------- Forms -- */
[hidden] { display: none !important; }
label { display: block; margin: 14px 0 5px; font-size: 13px; font-weight: 600; color: var(--ink); }
input:not([type]), input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="email"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
input[type="file"] { font: inherit; font-size: 13px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand-600); }
.help { font-size: 11px; color: var(--muted); margin-top: 3px; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 3px; }
.errorlist { color: var(--danger); margin: 6px 0 0; padding-left: 18px; }

/* -------------------------------------------------------------- Messages -- */
.messages { list-style: none; margin: 0 0 18px; padding: 0; }
.messages li {
  padding: 11px 14px; margin-bottom: 8px; border-radius: var(--radius-sm);
  background: var(--success-bg); border: 1px solid var(--success-line);
  color: var(--success); font-size: 13px;
}
.messages li.error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.messages li.warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.messages li.success { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.messages li.info { background: var(--surface-2); border-color: var(--line); color: var(--brand-600); }

/* ========================================================== HEADER CARD -- */
.header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 24px; margin-bottom: 20px;
}
.header h1 { font-size: 20px; margin: 0; color: var(--ink-strong); letter-spacing: -.02em; }
.header h1::before {
  content: ""; display: inline-block; width: 9px; height: 20px; margin-right: 9px;
  vertical-align: -3px; border-radius: 3px; background: var(--accent);
}
.header .subtitle, .header .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.user-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Wrap (admin.html container) */
.wrap { max-width: 1280px; margin: 0 auto; padding: 28px 24px 48px; }

/* Row (admin.html flex layout) */
.row { display: flex; gap: 18px; align-items: flex-start; }

/* ============================================================= SIDEBAR -- */
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 12px;
  position: sticky; top: 20px;
  max-height: calc(100vh - 48px); overflow-y: auto; z-index: 10;
}
.sidebar .brand-mini {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px;
}
.sidebar .brand-mini .logo {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: #fff; font-weight: 800; font-size: 15px; display: grid; place-items: center;
}
.sidebar .brand-mini .word { color: var(--ink-strong); font-weight: 700; font-size: 13px; line-height: 1.15; }
.sidebar .brand-mini .word small {
  display: block; color: var(--muted); font-weight: 600;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
}
.sidebar h4 {
  text-transform: uppercase; letter-spacing: .09em; font-size: 10px;
  color: var(--muted); margin: 12px 10px 8px;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav-group-label {
  padding: 14px 10px 4px; font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.side-nav-group-label:first-child { padding-top: 4px; }

/* .side-link (workspace nav with icons) */
.side-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin: 1px 2px; border-radius: 8px;
  color: var(--ink); font-size: 13px; font-weight: 600;
  text-decoration: none; transition: background-color .12s, color .12s;
}
.side-link .ico { width: 18px; text-align: center; opacity: .8; }
.side-link:hover { background: var(--surface-2); color: var(--brand-600); text-decoration: none; }
.side-link.active { background: var(--surface-2); color: var(--brand-700); box-shadow: inset 3px 0 0 var(--brand-600); }
.side-link.active .ico { color: var(--brand-600); }

/* Bare links inside sidebar (admin.html) */
.sidebar a, .side-nav a, .a-nav {
  display: block; color: var(--brand-600); padding: 10px 12px;
  border-radius: 8px; font-size: 13px; font-weight: 600;
  text-decoration: none; margin-bottom: 2px; border: none;
  background: transparent; cursor: pointer; text-align: left; width: 100%; font-family: inherit;
}
.sidebar a:hover, .side-nav a:hover, .a-nav:hover { background: var(--accent-soft); color: var(--brand-700); }
.sidebar a.active, .side-nav a.active, .a-nav.active { background: var(--accent-soft); color: var(--brand-700); box-shadow: inset 3px 0 0 var(--brand-600); }

/* Sidebar separators + logout */
.side-sep, .sidebar-sep, .a-nav-sep { height: 1px; background: var(--line-strong); margin: 12px 0; border: none; }
.side-nav > .side-sep { width: 100%; }
.side-logout-form, .sidebar-logout-form, .a-logout-form { margin-top: 4px; padding: 2px; }
.sidebar-link-logout, button.side-link.side-last, button.a-nav.a-nav-logout {
  display: block; width: 100%; text-align: center; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.sidebar-link-logout:hover, button.side-link.side-last:hover, button.a-nav.a-nav-logout:hover {
  background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger);
}

/* Sidebar link styled as logout */
.side-link.side-logout { width: 100%; border: none; background: transparent; font: inherit; cursor: pointer; text-align: left; }
.side-link.side-logout:hover { color: var(--danger); background: var(--danger-bg); }

/* Layout: vertical sidebar + content card (workspace.html) */
.side-layout { display: flex; gap: 18px; align-items: flex-start; min-height: calc(100vh - 134px); }
.side-body { flex: 1; min-width: 0; }

/* Content card (admin and standalone) */
.content, .side-body, .a-content, .standalone-content {
  flex: 1; min-width: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 26px;
}

/* ============================================================== NAVBAR -- */
.navbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}
.shell-wrap > .navbar {
  left: max(24px, calc((100% - 1280px) / 2 + 24px));
  right: max(24px, calc((100% - 1280px) / 2 + 24px));
  border-radius: 0 0 var(--radius) var(--radius);
}
.navbar .brand { display: flex; align-items: center; gap: 11px; }
.navbar .brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: #fff; font-weight: 800; font-size: 16px; display: grid; place-items: center;
}
.navbar .brand .word { font-size: 14px; font-weight: 700; color: var(--ink-strong); line-height: 1.15; }
.navbar .brand .word small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .04em; }
.navbar .spacer { flex: 1; }
.navbar .right { display: flex; align-items: center; gap: 10px; }

.quota-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px;
}
.quota-chip .bar { width: 60px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.quota-chip .bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--brand-600)); }

.user-chip { display: flex; align-items: center; gap: 8px; }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center;
  text-transform: uppercase;
}
.user-chip .uname { font-size: 13px; font-weight: 600; color: var(--ink); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  cursor: pointer; font-size: 14px;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }

.lm-back {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff; text-decoration: none;
}
.lm-back:hover { background: linear-gradient(135deg, var(--brand-600), var(--brand-700)); color: #fff; text-decoration: none; }

/* Flat logout button (navbar, no gradient) */
.btn-logout-flat {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: 999px; border: 1px solid transparent;
  font-size: 12px; font-weight: 700;
  background: transparent; color: var(--muted); cursor: pointer;
  font-family: inherit; text-decoration: none; transition: none;
}
.btn-logout-flat:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.lm-back:hover { background: linear-gradient(135deg, var(--brand-600), var(--brand-700)); color: #fff; text-decoration: none; }

/* ============================================================ SHELL / PAGE HEAD -- */
.shell-wrap { max-width: 1280px; margin: 0 auto; padding: 28px 24px 48px; }
.shell-wrap:not(.standalone-shell) { padding-top: 12px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin: 26px 0 18px; flex-wrap: wrap;
}
.side-body > .page-head { margin-top: 0; }
.page-head h1 { margin: 0; font-size: 24px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.container { max-width: 1280px; margin: 0 auto; padding: 70px 24px 48px; }
.subtitle { color: var(--muted); font-size: 13px; margin: -8px 0 18px; }

/* Standalone shell (no sidebar) */
.standalone-shell { padding-top: 82px; }
.standalone-shell > .navbar {
  left: max(24px, calc((100% - 1280px) / 2 + 24px));
  right: max(24px, calc((100% - 1280px) / 2 + 24px));
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ============================================================== UTILITIES -- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); word-break: break-all; }
.dim { color: var(--muted); }
.nowrap { white-space: nowrap; }
code { font-family: var(--mono); }
.d-none { display: none !important; }
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: var(--accent-soft);
  border: 1px solid var(--brand-400); color: var(--brand-600);
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 16px; }
.stat-tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; }
.stat-tile .num { font-size: 26px; font-weight: 700; color: var(--ink-strong); letter-spacing: -.02em; }
.stat-tile .num-sm { font-size: 14px; font-weight: 700; color: var(--ink-strong); }
.stat-tile .lbl { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat .v { font-size: 22px; font-weight: 700; color: var(--ink-strong); }
.stat .k { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.lcm-admin-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 18px 0 20px; }
.lcm-admin-stat {
  display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 76px;
  padding: 15px 16px; border-radius: var(--radius); border-color: var(--line);
  background: var(--surface); box-shadow: var(--shadow); text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.lcm-admin-stat:hover { border-color: var(--brand-400); box-shadow: var(--shadow-md, var(--shadow)); transform: translateY(-1px); }
.lcm-admin-stat .stat-num { flex: 0 0 auto; color: var(--brand-600); font-size: 25px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.lcm-admin-stat .stat-label { min-width: 0; color: var(--muted); font-size: 12px; font-weight: 650; line-height: 1.3; }
.lcm-admin-stat.is-active .stat-num { color: var(--success); }
.lcm-admin-stat.is-limited .stat-num { color: var(--warning, var(--warn)); }
.lcm-admin-stat.is-disabled .stat-num { color: var(--danger); }
.lcm-admin-stat:not(a) { cursor: default; }

.row-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.row-tools .spacer { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.muted-2 { color: var(--muted-2); }

/* Logs action bar */
.logs-action-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0 10px; }
.logs-action-bar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logs-action-bar-right { display: flex; align-items: center; gap: 10px; }
.logs-search-form { margin-bottom: 0; }
.logs-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; }
.logs-count {
  display: inline-flex; align-items: center; padding: 4px 12px;
  border-radius: 999px; background: var(--accent-soft); color: var(--brand-600);
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.search-input {
  width: 260px; max-width: 100%; padding: 8px 12px; font-size: 13px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
.logs-perpage { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.logs-perpage select { padding: 7px 10px; font-size: 13px; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.logs-title-line { height: 1px; background: var(--line); margin: 12px 0 18px; }
.logs-search { width: 100%; box-sizing: border-box; padding: 9px 12px; font-size: 13px; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.logs-toolbar-split { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.logs-toolbar-left { display: flex; align-items: center; gap: 8px; }
.logs-toolbar-right { display: flex; align-items: center; gap: 8px; }
.logs-perpage-form { margin: 0; }

/* Pagination */
.pagination { display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding-top: 12px; color: var(--muted); }
.pagination a { color: var(--brand-600); font-weight: 600; }
.pagination .logs-page-info { font-size: 12px; font-weight: 600; color: var(--muted); }
.pagination-links { display: flex; gap: 8px; }
.pagination.logs-pag-right { justify-content: flex-end; }

/* ======================================================= SHARED UI POLISH -- */
/* Compact, flat controls with predictable sizing across apps and admin views. */
.btn,
.btn-primary,
.btn-secondary,
.btn-danger,
.tab-nav-btn,
.tab-btn {
  min-height: 34px;
  max-width: 100%;
  padding: 7px 12px;
  border-radius: 7px;
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  background-image: none;
}
.btn,
.btn-primary { background-color: var(--brand-600); }
.btn:hover,
.btn.btn-primary:hover,
.btn-primary:hover { background-color: var(--brand-700); background-image: none; }
.btn.secondary,
.btn.btn-secondary,
.btn.ghost {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
}
.btn.secondary:hover,
.btn.btn-secondary:hover,
.btn.ghost:hover { border-color: var(--line-strong); background: var(--line); color: var(--ink-strong); }
.btn.danger,
.btn.btn-danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn.danger:hover,
.btn.btn-danger:hover { border-color: #b91c1c; background: #b91c1c; color: #fff; }
.btn.ok { border-color: var(--success); background: var(--success); }
.btn-secondary { border-color: var(--line); background: var(--surface-2); color: var(--ink); }
.btn.btn-sm { min-height: 30px; padding: 5px 9px; font-size: 11px; }
.btn.btn-block { display: flex; width: 100%; }
.btn:focus-visible,
.tab-nav-btn:focus-visible,
.tab-btn:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.btn:disabled,
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Action rows must shrink and wrap instead of letting labels collide. */
.actions,
.row-actions,
.user-row-actions,
.groups-table .row-actions,
.logs-toolbar,
.logs-toolbar-left,
.logs-toolbar-right,
.logs-action-bar,
.logs-action-bar-left,
.logs-action-bar-right,
.u-toolbar,
.admin-list-toolbar,
.user-form-actions,
.group-form-actions,
.form-actions-bottom,
.pagination,
.pagination-links {
  min-width: 0;
  flex-wrap: wrap;
  row-gap: 7px;
}
.actions > *,
.row-actions > *,
.user-row-actions > *,
.groups-table .row-actions > *,
.logs-toolbar > *,
.logs-toolbar-left > *,
.logs-toolbar-right > *,
.logs-action-bar-left > *,
.logs-action-bar-right > *,
.pagination-links > * { min-width: 0; max-width: 100%; }
.actions form,
.row-actions form,
.user-row-actions form,
.groups-table .row-actions form { min-width: 0; margin: 0; }
.row-tools,
.logs-toolbar,
.logs-action-bar,
.logs-toolbar-split,
.files-toolbar,
.u-toolbar {
  min-width: 0;
  align-items: center;
  row-gap: 8px;
}
.row-tools > *,
.logs-toolbar > *,
.logs-toolbar-split > *,
.files-toolbar > * { min-width: 0; max-width: 100%; }
.card,
.content,
.side-body,
.a-content,
.standalone-content,
.admin-list-toolbar,
.admin-table-scroll { min-width: 0; }
.admin-list-toolbar h2,
.admin-list-heading,
.admin-list-heading > *,
.user-identity,
.group-identity,
.u-apps { overflow-wrap: anywhere; }
.user-row-actions,
.groups-table .row-actions { white-space: normal; }
.user-row-actions .btn { padding: 5px 9px; }
.sidebar,
.admin-nav,
.admin-nav > *,
.sidebar .side-nav > * { min-width: 0; }
.sidebar a,
.admin-nav a { overflow-wrap: anywhere; }
.lcm-admin-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.lcm-admin-stat { min-width: 0; padding: 12px 14px; border-radius: 10px; }
.lcm-admin-stat .stat-label { overflow-wrap: anywhere; }
.lcm-admin-stat:hover { transform: none; }
.grid { min-width: 0; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.grid > *,
.stat-grid > * { min-width: 0; }
.card { border-radius: 10px; box-shadow: none; }
.header { border-radius: 10px; box-shadow: none; }
.user-form-section,
.group-form-section { border-radius: 10px; box-shadow: none; }
.user-form-actions,
.group-form-actions { gap: 7px; }
.user-form-actions .btn,
.group-form-actions .btn { min-width: 0; }

@media (max-width: 900px) {
  .lcm-admin-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); }
  .u-toolbar { gap: 12px; }
}
@media (max-width: 600px) {
  .btn { min-height: 33px; padding: 7px 10px; }
  .btn.btn-sm { min-height: 29px; padding: 5px 8px; }
  .row-tools > .btn,
  .logs-toolbar > .btn,
  .logs-action-bar-left > .btn,
  .logs-action-bar-right > .btn { flex: 0 1 auto; }
  .user-form-actions,
  .group-form-actions { position: static; padding: 10px 0; }
  .lcm-admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tab panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-nav { display: flex; gap: 2px; margin-bottom: 20px; border-bottom: 2px solid var(--line); padding: 0; flex-wrap: wrap; }
.tab-nav-btn { padding: 10px 24px; font-size: 14px; font-weight: 700; cursor: pointer; border: none; background: var(--surface-2); color: var(--muted); border-radius: 6px 6px 0 0; transition: all .15s; letter-spacing: .02em; }
.tab-nav-btn:hover { color: var(--ink); background: var(--surface-2); }
.tab-nav-btn.active { color: var(--brand-600); background: var(--surface); box-shadow: 0 -2px 0 var(--brand-600) inset; }

/* Samples filter bar */
.samples-filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px 14px; margin: 0 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.samples-filter-bar .f-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-bottom: 10px; }
.samples-filter-bar label { display: flex; flex-direction: column; gap: 3px; margin: 0; font-size: 11px; font-weight: 600; color: var(--muted); }
.samples-filter-bar input, .samples-filter-bar select { width: auto; min-width: 120px; }
.samples-filter-bar.nowrap { flex-wrap: nowrap; align-items: center; }
.samples-filter-bar.nowrap .f-label { white-space: nowrap; padding-bottom: 0; }
.samples-filter-bar.nowrap input, .samples-filter-bar.nowrap select { flex: 1 1 0; width: 100%; min-width: 0; }

/* Table scroll + responsive */
.table-scroll { overflow-x: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; width: 100%; max-height: min(70vh, 600px); }
.table-scroll table { width: auto; min-width: 100%; border-collapse: collapse; }
.table-scroll td { vertical-align: middle; padding: 8px 10px; }
.table-scroll th { padding: 10px; white-space: nowrap; position: relative; }
.table-scroll code { font-size: 12px; }
.table-scroll td, .table-scroll th { white-space: nowrap; }
.table-scroll td .cell-inner, .table-scroll th .cell-inner { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-scroll .resizer { position: absolute; right: 0; top: 0; bottom: 0; width: 6px; cursor: col-resize; user-select: none; z-index: 1; }
.table-scroll .resizer:hover, .table-scroll .resizer.resizing { background: var(--brand-500); opacity: .4; }
.table-scroll .trunc { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; max-width: 100%; }
.table-responsive table { width: 100%; min-width: 720px; border-collapse: collapse; }
.table-responsive td { vertical-align: middle; }

/* pre.xml */
pre.xml { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 12px; line-height: 1.5; max-height: 500px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

/* Settings sections */
.settings-sections { display: flex; flex-direction: column; gap: 20px; max-width: 720px; }
.settings-section { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 20px 22px; }
.settings-section-head h3 { margin: 0; font-size: 15px; color: var(--ink-strong); letter-spacing: .02em; border-left: 3px solid var(--brand-500); padding-left: 10px; }
.settings-section .settings-form { max-width: 460px; }
.settings-form .form-group { margin-bottom: 12px; }
.settings-form label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.settings-form input { width: 100%; padding: 9px 12px; font-size: 13px; box-sizing: border-box; }
.settings-desc { margin: 6px 0 14px; font-size: 13px; color: var(--muted); }
.settings-section .btn { padding: 9px 18px; font-size: 13px; }
.settings-downloads { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 4px; }
.settings-download { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); padding: 16px 18px; }
.settings-download h4 { margin: 0 0 6px; font-size: 14px; color: var(--ink-strong); font-weight: 700; }
.settings-download .settings-desc { margin: 0 0 12px; }
.settings-download .btn { padding: 8px 14px; font-size: 12px; }

/* ========================================================= HOME PAGE -- */
.home-hero { margin-bottom: 28px; text-align: center; padding: 40px 20px; }
.home-hero h1 { font-size: 28px; margin: 0; color: var(--ink-strong); }
.vendor-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.vendor-logo {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: #fff; font-weight: 800; font-size: 18px; display: grid; place-items: center;
}
.vendor-head h2 { margin: 0; font-size: 17px; color: var(--ink-strong); }
.vendor-modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.module-tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.module-tile.locked { opacity: .6; }
.module-tile .tile-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.module-tile .tile-top strong { font-size: 14px; color: var(--ink-strong); }
.module-tile p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.module-tile .btn { margin-top: 6px; align-self: flex-start; }
.module-tile .btn[disabled] { opacity: .5; cursor: not-allowed; }
.module-tile.is-unavailable { background: var(--surface-2); }
.module-tile.is-unavailable .btn { display: none; }
.module-tile.is-web-blocked { border-style: dashed; }

/* LCM home launcher */
.standalone-content:has(.home-hero) { padding: 22px; }
.home-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  text-align: left; padding: 18px 22px; margin: 0 0 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(120deg, var(--accent-soft), var(--surface) 70%);
}
.home-hero-copy { min-width: 0; }
.home-eyebrow, .admin-page-kicker {
  margin: 0 0 3px; color: var(--brand-600); font-size: 10px;
  font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
}
.home-hero h1 { margin: 0; font-size: clamp(21px, 2.4vw, 27px); line-height: 1.15; }
.home-intro { margin: 5px 0 9px; color: var(--muted); font-size: 13px; }
.home-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 11px; }
.home-meta-item { display: inline-flex; align-items: center; gap: 7px; }
.home-meta-item strong { color: var(--ink-strong); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 2px var(--success-bg); }
.home-admin-link { flex-shrink: 0; white-space: nowrap; }
.standalone-content:has(> .vendor-box) { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 22px; }
.standalone-content:has(> .vendor-box) .vendor-box { margin-bottom: 0; padding: 14px; min-width: 0; }
.vendor-head { gap: 10px; margin: 0 0 11px; padding: 0 0 10px; border-bottom: 1px solid var(--line); }
.vendor-logo { width: 34px; height: 34px; border-radius: 9px; font-size: 15px; }
.vendor-title h2 { margin: 0 0 1px; font-size: 15px; }
.vendor-title .muted { font-size: 11px; }
.vendor-modules { grid-template-columns: repeat(auto-fill, minmax(min(100%, 245px), 1fr)); gap: 10px; }
.module-tile { min-height: 0; padding: 12px 13px; gap: 6px; transition: border-color .15s, background-color .15s; }
.module-tile:not(.is-unavailable):hover { border-color: var(--brand-400); background: var(--surface-2); }
.module-tile .tile-top { justify-content: space-between; }
.module-tile .tile-top strong { font-size: 13px; }
.module-tile p { flex: 1; font-size: 12px; }
.module-tile .btn { margin-top: 2px; padding: 7px 11px; font-size: 12px; }
.module-tile.is-unavailable { opacity: .72; }

/* Unified admin user/group lists */
.u-toolbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  margin: 0 0 20px; padding: 2px 2px 18px; border-bottom: 1px solid var(--line);
}
.admin-list-heading { min-width: 0; }
.admin-list-heading h1 { margin: 0; font-size: 27px; }
.admin-list-heading > p { margin: 5px 0 0; font-size: 13px; }
.u-facts { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.fact {
  display: inline-flex; align-items: baseline; gap: 7px; min-width: 112px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink-strong);
}
.fact strong { font-size: 18px; line-height: 1; }
.fact em { color: var(--muted); font-size: 11px; font-style: normal; font-weight: 600; }
.fact.ok strong { color: var(--success); }
.fact.warn strong { color: var(--warn); }
.fact.danger strong { color: var(--danger); }
.badge.u-b-admin { background: var(--accent-soft); border-color: var(--line); color: var(--brand-700); }
.badge.u-b-staff { background: var(--surface-2); color: var(--muted); }
.badge.st-active, .badge.st-permanent { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.badge.st-limited { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.badge.st-disabled { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.user-form-page { max-width: 1120px; margin: 0 auto; }
.group-form-page { max-width: 1120px; margin: 0 auto; }
.admin-page-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 0 0 18px; padding: 2px 2px 16px; border-bottom: 1px solid var(--line);
}
.admin-page-heading h1 { margin: 0; font-size: 26px; }
.admin-page-heading p { margin: 5px 0 0; font-size: 13px; }
.user-edit-username {
  padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--ink-strong); font-size: 12px; font-weight: 700;
}
.user-form { display: grid; gap: 16px; }
.user-form .msg-error { margin: 0; }
.user-form-section { margin: 0; padding: 20px; }
.user-form-section-head {
  display: flex; align-items: flex-start; gap: 11px; margin: 0 0 18px;
  padding: 0 0 14px; border-bottom: 1px solid var(--line);
}
.user-form-step {
  display: grid; place-items: center; flex: 0 0 27px; height: 27px;
  border-radius: 50%; background: var(--accent-soft); color: var(--brand-600);
  font-size: 12px; font-weight: 800;
}
.user-form-section-head h2 { margin: 0; font-size: 16px; }
.user-form-section-head p { margin: 3px 0 0; font-size: 12px; }
.user-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.user-form-grid-settings { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; }
.user-form-grid-access { grid-template-columns: minmax(0, 1fr) minmax(260px, .8fr); align-items: start; }
.user-form-field { min-width: 0; }
.user-form-field > .form-label, .user-form-field > label.form-label,
.user-form-field > div.form-label { display: block; margin: 0 0 6px; font-size: 12px; }
.user-form-field input:not([type="checkbox"]):not([type="radio"]),
.user-form-field select { display: block; width: 100%; }
.user-form-field .errorlist { font-size: 12px; }
.field-help { margin-top: 5px; font-size: 11px; line-height: 1.45; }
.user-form-check { display: flex; align-items: center; min-height: 39px; }
.user-form-check label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }
.user-form-grid-settings .user-form-setting-check { display: block; min-height: 0; }
.user-form-setting-check > .form-label { display: block; margin: 0 0 6px; font-size: 12px; }
.user-form-setting-check > label { min-height: 38px; }
.user-form-check input, .user-form-option > input { margin: 0; }
.user-form-check .muted { font-size: 12px; font-weight: 400; }
.user-form-option {
  display: flex; align-items: flex-start; gap: 10px; padding: 13px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.user-form-grid-settings > .user-form-option { align-self: end; min-height: 66px; }
.user-form-option > input { flex: 0 0 auto; margin-top: 4px; }
.user-form-option .form-label { margin: 0; font-size: 12px; }
.user-form-empty {
  padding: 13px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--muted); font-size: 12px;
}
.user-group-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.user-group-list > label {
  display: flex; align-items: center; gap: 9px; min-height: 42px; margin: 0; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: 12px; cursor: pointer;
}
.user-group-list > label:has(input:checked) { border-color: var(--brand-400); background: var(--accent-soft); color: var(--brand-700); }
.user-group-list input { margin: 0; }
.user-home-options { display: grid; gap: 14px; }
.user-app-settings { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.user-app-settings-heading h3 { margin: 0; font-size: 14px; }
.user-app-settings-heading p { margin: 3px 0 14px; font-size: 12px; }
.user-app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 10px; }
.user-app-card { min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.user-app-card.off { opacity: .58; }
.user-app-card .app-head { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-bottom: 10px; }
.user-app-card .app-head strong { color: var(--ink-strong); font-size: 13px; }
.user-app-card .app-head .muted { font-size: 11px; }
.user-app-card .cap-body { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.user-app-card .cap-label { margin: 0; font-size: 11px; color: var(--muted); }
.user-app-card .cap-body input[type="number"] { width: 110px; padding: 7px 9px; }
.user-app-card .cap-body .settings-cell { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; color: var(--ink); }
.user-app-card .cap-body .settings-cell input { margin: 0; }
.user-form-actions {
  position: sticky; bottom: 0; z-index: 3; display: flex; justify-content: flex-end; gap: 9px;
  margin-top: 2px; padding: 12px 0; border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
}
.group-form { display: grid; gap: 16px; }
.group-form-section { margin: 0; padding: 20px; }
.group-form-section-head { display: flex; align-items: flex-start; gap: 11px; margin: 0 0 18px; padding: 0 0 14px; border-bottom: 1px solid var(--line); }
.group-form-section-head h2 { margin: 0; font-size: 16px; }
.group-form-section-head p { margin: 3px 0 0; font-size: 12px; }
.group-form-name { max-width: 520px; }
.group-form-name .form-label { display: block; margin: 0 0 6px; font-size: 12px; }
.group-form-name input { display: block; width: 100%; }
.group-form-name .errorlist { font-size: 12px; }
.group-app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 370px), 1fr)); gap: 12px; }
.group-app-card { min-width: 0; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); transition: border-color .15s ease, background .15s ease, opacity .15s ease; }
.group-app-card:not(.off) { border-color: var(--brand-400); background: var(--surface); }
.group-app-card.off { opacity: .65; }
.group-app-card .app-head { display: flex; align-items: flex-start; gap: 11px; margin: 0 0 13px; cursor: pointer; }
.group-app-card .app-head > input { flex: 0 0 auto; margin: 3px 0 0; }
.group-app-card .app-head > span { display: grid; gap: 3px; min-width: 0; }
.group-app-card .app-head strong { color: var(--ink-strong); font-size: 13px; }
.group-app-card .app-head .muted { font-size: 11px; line-height: 1.45; }
.group-app-card .cap-body { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.group-app-card .cap-label { margin: 0; color: var(--muted); font-size: 11px; }
.group-app-card .cap-body input[type="number"] { width: 120px; padding: 7px 9px; }
.group-app-card .cap-body .settings-cell { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; cursor: pointer; }
.group-app-card .cap-body .settings-cell input { margin: 0; }
.group-form-actions { position: sticky; bottom: 0; z-index: 3; display: flex; justify-content: flex-end; gap: 9px; margin-top: 2px; padding: 12px 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); }
.admin-list-card { padding: 0; overflow: hidden; }
.admin-list-toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  padding: 18px 20px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.admin-list-toolbar h2 { margin: 0; font-size: 16px; }
.admin-list-toolbar p { margin: 3px 0 0; font-size: 12px; }
.admin-search-wrap { display: flex; align-items: center; gap: 10px; min-width: min(330px, 45%); }
.admin-search-wrap input { min-width: 0; }
.u-count { flex-shrink: 0; font-size: 12px; white-space: wrap; }
.admin-table-scroll { max-width: 100%; }
.u-table, .groups-table { border: 0; border-radius: 0; }
.u-table { width: 100%; min-width: 0; table-layout: fixed; }
.admin-table-scroll .groups-table { width: 100%; min-width: 0; table-layout: fixed; }
.u-table th { white-space: normal; }
.u-table th, .groups-table th { padding: 12px 14px; background: var(--surface-2); }
.u-table td, .groups-table td { padding: 13px 14px; }
.u-table th:nth-child(1) { width: 19%; }
.u-table th:nth-child(2) { width: 13%; }
.u-table th:nth-child(3) { width: 15%; }
.u-table th:nth-child(4) { width: 34%; }
.u-table th:nth-child(5) { width: 19%; }
.u-table td { overflow-wrap: anywhere; }
.u-table th:nth-child(-n+4), .u-table td:nth-child(-n+4) { text-align: left; }
.u-table .user-identity { min-width: 0; }
.user-identity strong, .group-identity strong { color: var(--ink-strong); font-size: 13px; }
.user-identity .muted { margin-top: 2px; font-size: 11px; overflow-wrap: anywhere; }
.user-identity-type { margin-top: 3px; }
.user-identity-type .badge { padding: 2px 7px; font-size: 10px; }
.user-validity { margin-top: 4px; font-size: 11px; white-space: nowrap; }
.user-row-actions { white-space: nowrap; }
.u-tag {
  display: inline-flex; margin: 2px 3px 2px 0; padding: 3px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--brand-700); font-size: 11px; font-weight: 600;
}
.u-apps { min-width: 0; }
.app-line {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 4px 0;
}
.app-line + .app-line { border-top: 1px solid var(--line); }
.app-heading { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 7px; }
.app-name { color: var(--ink-strong); font-size: 12px; font-weight: 700; }
.app-cap { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.app-ch { color: var(--brand-600); font-size: 11px; font-weight: 600; }
.user-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-width: 0; }
.user-row-actions .btn { padding: 6px 9px; font-size: 11px; }
.user-row-actions form { display: inline-flex; margin: 0; }
.groups-table th { white-space: normal; }
.groups-table th:nth-child(1) { width: 22%; }
.groups-table th:nth-child(2) { width: 48%; }
.groups-table th:nth-child(3) { width: 10%; }
.groups-table th:nth-child(4) { width: 20%; }
.groups-table td { overflow-wrap: anywhere; }
.groups-table .group-identity, .groups-table .apps-cell { min-width: 0; }
.app-cap-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 4px 0; }
.app-cap-line + .app-cap-line { border-top: 1px solid var(--line); }
.app-cap-line strong { font-size: 12px; }
.app-cap-line .muted { font-size: 11px; }
.groups-table .row-actions { white-space: normal; }
.groups-table .row-actions > * { display: inline-flex; }
.groups-table .row-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.groups-table .row-actions form { display: inline-flex; margin: 0; }
.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;
}

/* ======================================================== ADMIN EXTRAS -- */
.admin-shell { display: flex; gap: 18px; align-items: flex-start; max-width: 1360px; margin: 0 auto; padding: 22px 24px 44px; min-height: 100vh; }
.admin-shell .sidebar { position: sticky; top: 20px; }
.a-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.a-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  position: sticky; top: 14px; z-index: 5; flex-wrap: wrap;
}
.a-topbar .crumb { font-size: 13px; color: var(--muted); font-weight: 500; }
.a-topbar .crumb b { color: var(--ink-strong); font-weight: 600; }
.a-topbar .spacer { flex: 1; }
.a-topbar a.btn, .a-topbar button.btn { padding: 7px 12px; font-size: 12px; }
.a-content h1 { margin-top: 2px; }
.a-content .hint { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.a-user-chip { display: flex; align-items: center; gap: 8px; }
.a-user-chip .a-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; flex-shrink: 0;
  text-transform: uppercase;
}
.a-user-chip .a-uname { color: var(--ink-strong); font-size: 13px; font-weight: 600; }

/* ============================================================ FLAT DESIGN -- */
.navbar .logo, .sidebar .logo, .header .logo, .brand-mini .logo,
.a-brand .a-logo, .a-logo, .logo,
.a-avatar, .user-chip .avatar, .avatar,
.btn:hover, .btn.btn-primary:hover, .btn-primary:hover,
.btn-secondary:hover, .btn.secondary:hover {
  box-shadow: none; transform: none;
}

/* ============================================================ RESPONSIVE -- */
@media (max-width: 900px) {
  body { font-size: 13px; }
  .navbar { flex-wrap: wrap; padding: 12px 14px; }
  .row, .side-layout { flex-direction: column; align-items: stretch; }
  .sidebar { width: 100%; position: static; max-height: none; display: flex; flex-direction: column; }
  .sidebar .side-nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .side-nav > .side-sep { flex: 0 0 1px; width: 1px; height: 28px; align-self: center; margin: 0 4px; }
  .sidebar > .sidebar-sep { flex: 0 0 100%; width: 100%; height: 1px; margin: 6px 0; }
  .sidebar .side-nav a.side-link {
    display: flex;
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
    align-items: center;
  }
  .sidebar .side-nav-group-label { flex-basis: 100%; }
  .sidebar .brand-mini { display: none; }
  .side-body { width: 100%; padding-left: 0; }
  .content, .side-body, .a-content, .standalone-content { padding: 22px 18px; }
  .shell-wrap, .wrap, .container { padding: 14px 12px 32px; }
  .admin-shell { flex-direction: column; padding: 14px 12px 32px; }
  .admin-shell .sidebar { position: static; }
  .a-main { width: 100%; }
  .a-topbar { position: static; }
  .a-content { padding: 18px 16px; }
  .vendor-modules { grid-template-columns: 1fr; }
  .standalone-content:has(> .vendor-box) { padding: 14px; grid-template-columns: 1fr; }
  .home-hero { align-items: flex-start; flex-direction: column; gap: 10px; padding: 16px 18px; }
  .u-toolbar { align-items: stretch; flex-direction: column; }
  .u-toolbar > .btn { align-self: flex-start; }
  .admin-list-toolbar { align-items: stretch; flex-direction: column; }
  .admin-search-wrap { min-width: 0; width: 100%; }
  .user-form-grid-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-form-grid-access { grid-template-columns: 1fr; }
  .lcm-admin-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .content, .side-body, .a-content, .standalone-content { min-width: 0; padding: 16px 12px; }
  .side-layout, .side-body, .tab-panel, .card, form { min-width: 0; max-width: 100%; }
  .sidebar { min-width: 0; }
  .sidebar .side-nav { min-width: 0; gap: 4px; }
  .sidebar .side-nav a.side-link { padding: 8px 10px; font-size: 12px; }
  .navbar { gap: 8px; }
  .navbar .right { flex-wrap: wrap; justify-content: flex-end; }
  .btn { max-width: 100%; }
  input, select, textarea { max-width: 100%; }
  pre, code, .mono { overflow-wrap: anywhere; }
  img, video, iframe { max-width: 100%; }
}
@media (max-width: 768px) {
  .settings-downloads { grid-template-columns: 1fr; }
  .standalone-content:has(> .vendor-box) { padding: 10px; }
  .home-hero { gap: 8px; padding: 13px 14px; margin-bottom: 10px; }
  .home-hero h1 { font-size: 21px; }
  .home-intro { margin: 4px 0 7px; font-size: 12px; }
  .standalone-content:has(> .vendor-box) .vendor-box { margin-bottom: 0; padding: 11px; }
  .vendor-head { margin-bottom: 9px; padding-bottom: 8px; }
  .vendor-modules { gap: 8px; }
  .module-tile { padding: 11px; }
  .fact { min-width: calc(50% - 5px); }
  .admin-list-heading h1 { font-size: 24px; }
  .admin-list-toolbar { padding: 15px; }
  .user-form-section { padding: 16px; }
  .user-form-grid, .user-form-grid-settings { grid-template-columns: 1fr; }
  .admin-page-heading { align-items: flex-start; flex-direction: column; }
  .lcm-admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .lcm-admin-stat { min-height: 68px; padding: 12px; gap: 9px; }
  .lcm-admin-stat .stat-num { font-size: 22px; }
  .admin-table-scroll { overflow: visible; }
  .u-table { display: block; table-layout: auto; background: transparent; }
  .u-table thead { display: none; }
  .u-table tbody { display: grid; gap: 10px; }
  .u-table tbody tr { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); }
  .u-table tbody tr:hover td { background: transparent; }
  .u-table td { display: grid; grid-template-columns: minmax(92px, 30%) minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); text-align: left !important; }
  .u-table td:last-child { border-bottom: 0; }
  .u-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
  .u-table td[colspan] { display: block; }
  .u-table td[colspan]::before { content: none; }
  .user-row-actions { justify-content: flex-start; }
  .admin-table-scroll.table-responsive { overflow-x: visible; }
  .groups-table { display: block; table-layout: auto; background: transparent; }
  .groups-table thead { display: none; }
  .groups-table tbody { display: grid; gap: 10px; }
  .groups-table tbody tr { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); }
  .groups-table tbody tr:hover td { background: transparent; }
  .groups-table td { display: grid; grid-template-columns: minmax(92px, 30%) minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); text-align: left; }
  .groups-table td:last-child { border-bottom: 0; }
  .groups-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
  .groups-table td[colspan] { display: block; }
  .groups-table td[colspan]::before { content: none; }
  .groups-table .row-actions { justify-content: flex-start; }
}
