/* Praxys IMS - base stylesheet. Plain CSS, no framework. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e3e6eb;
  --border-strong: #cdd2da;
  --text: #1c2430;
  --text-2: #586274;
  --text-3: #8a93a3;
  --accent: #0f766e;
  --accent-hover: #0b5f59;
  --accent-soft: #e6f4f2;
  --side: #14202e;
  --side-2: #1d2b3c;
  --side-text: #c8d1dd;
  --side-muted: #7f8ca0;
  --ok: #157f3b;   --ok-soft: #e7f5ec;
  --warn: #9a5b00; --warn-soft: #fdf3e1;
  --bad: #b42318;  --bad-soft: #fdecea;
  --info: #1d5fa8; --info-soft: #e8f1fb;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.25; font-weight: 600; }
h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0 0 .8em; }
code, .mono { font-family: var(--mono); font-size: 13px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.top-gap { margin-top: 16px; }
ul.plain { list-style: none; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* ---- Layout ---------------------------------------------------------- */
.env-banner { background: #b45309; color: #fff; text-align: center; font-size: 12.5px; font-weight: 600; padding: 5px 12px; letter-spacing: .02em; }
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex: none; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 14px 10px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; flex: none; }
.brand-mark.lg { width: 44px; height: 44px; font-size: 20px; border-radius: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { color: var(--side-muted); font-size: 11.5px; }
.company-switch { padding: 0 6px 10px; }
.company-switch select { width: 100%; background: var(--side-2); color: #fff; border-color: #2c3d52; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--side-muted); padding: 14px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--side-text); }
.nav-link:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav-link.is-active { background: var(--accent); color: #fff; }
.nav-link.is-soon { opacity: .5; cursor: default; }
.nav-link.is-soon:hover { background: none; color: var(--side-text); }
.nav-link em { margin-left: auto; font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; border: 1px solid var(--side-muted); border-radius: 4px; padding: 0 4px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.page-title { font-size: 17px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 20px; flex: 1; max-width: 1280px; width: 100%; }
.footer { padding: 12px 20px; color: var(--text-3); font-size: 12px; }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: 6px; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }

.user-menu { position: relative; }
.avatar-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 6px; color: var(--text); font: inherit; }
.avatar-btn:hover { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 24, 40, .12); min-width: 200px; padding: 6px; z-index: 20; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); text-decoration: none; }
.dd-head { padding: 6px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; }
.dd-head small { color: var(--text-3); }

/* ---- Cards, grids ---------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.flush { padding: 0; overflow-x: auto; }
.card.narrow { max-width: 480px; margin: 0 auto; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.stack > * + * { margin-top: 14px; }
.stack-sm > * + * { margin-top: 8px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar > p { margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input[type=search] { min-width: 260px; }

/* ---- Forms ----------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-weight: 600; font-size: 13px; color: var(--text); }
.hint { color: var(--text-3); font-size: 12px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 7px 10px; min-height: 36px; width: 100%;
}
.filters input, .filters select { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(15, 118, 110, .25); border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-2); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--accent); flex: none; }
.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 35%); padding: 18px 0 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 7px 14px; min-height: 36px;
  border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--bad); border-color: #f1b8b2; }
.btn-danger:hover { background: var(--bad-soft); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: wait; }
.link-btn { background: none; border: 0; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; padding: 0 0 0 10px; font-weight: 400; }

.role-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.pick { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 6px; padding: 9px 10px; cursor: pointer; }
.pick:hover { background: var(--surface-2); }
.pick span { display: flex; flex-direction: column; }
.pick small { color: var(--text-2); font-size: 12px; }
.pick input { margin-top: 2px; }
.pick.warn { border-color: #f3d7a6; background: var(--warn-soft); }

/* ---- Alerts, badges -------------------------------------------------- */
.alert { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; border: 1px solid; }
.alert-ok   { background: var(--ok-soft);   border-color: #b9e2c6; color: #0f5a2a; }
.alert-bad  { background: var(--bad-soft);  border-color: #f4c0ba; color: #8a1c12; }
.alert-warn { background: var(--warn-soft); border-color: #f1d49c; color: #6f4200; }
.alert-info { background: var(--info-soft); border-color: #bcd6f2; color: #164a83; }
.alert ul { margin: 0; }
.temp-pass { display: flex; flex-direction: column; gap: 6px; }
code.big { font-size: 20px; font-weight: 700; letter-spacing: .04em; background: #fff; padding: 4px 10px; border-radius: 6px; border: 1px dashed #8ccaa1; align-self: flex-start; user-select: all; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; line-height: 1.5; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: #eef0f3; color: var(--text-2); }

/* ---- Tables ---------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table thead th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); font-weight: 600; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.is-muted td { color: var(--text-3); }
.audit .changes { font-size: 12.5px; }
.audit del { color: var(--bad); }

/* ---- Permissions matrix ---------------------------------------------- */
.perm-head { display: flex; justify-content: space-between; align-items: baseline; }
.perm-module { border: 1px solid var(--border); border-radius: 6px; margin: 0 0 12px; padding: 4px 12px 8px; }
.perm-module legend { font-weight: 600; padding: 0 6px; }
.perm-table { width: 100%; border-collapse: collapse; }
.perm-table th { text-align: left; font-weight: 500; width: 260px; padding: 6px 8px 6px 0; vertical-align: top; color: var(--text); }
.perm-table td { padding: 4px 0; }
.perm-table tr + tr { border-top: 1px solid var(--surface-2); }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px 2px 6px; margin: 2px 4px 2px 0; cursor: pointer; font-size: 12.5px; }
.chip:has(input:checked) { background: var(--accent-soft); border-color: #9fd3cc; }
.chip input { width: 14px; height: 14px; }

/* ---- Dashboard ------------------------------------------------------- */
.hello h2 { font-size: 20px; margin-bottom: 2px; }
.hello { margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat-label { color: var(--text-2); font-size: 12.5px; }
.stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bulletins { list-style: none; margin: 0; padding: 0; }
.bulletins li { padding: 8px 0 8px 10px; border-left: 3px solid var(--border); margin-bottom: 8px; }
.bulletins li.is-high { border-left-color: var(--bad); }
.bulletins p { margin: 2px 0; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { padding: 4px 0 4px 24px; position: relative; color: var(--text-2); }
.checklist li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 11px; height: 11px; border: 1.5px solid var(--border-strong); border-radius: 3px; }
.checklist li.done { color: var(--text); }
.checklist li.done::before { background: var(--accent); border-color: var(--accent); }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 14px; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; }
.mini-log { list-style: none; margin: 0; padding: 0; }
.mini-log li { padding: 4px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.mini-log small { width: 100%; padding-left: 16px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }
.inline-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }

/* ---- Bare pages: login, installer, errors ---------------------------- */
body.bare { background: linear-gradient(160deg, #e9eef2 0%, #f4f5f7 60%); }
.bare-main { min-height: 100vh; padding: 40px 16px; }
.bare-alert { max-width: 400px; margin: 0 auto 14px; }
.login-wrap { display: grid; place-items: center; min-height: calc(100vh - 80px); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; box-shadow: 0 10px 30px rgba(16, 24, 40, .08); }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.login-brand h1 { margin: 0; font-size: 19px; }
.login-brand p { margin: 0; }
.login-card .stack { margin-bottom: 14px; }
.install { max-width: 760px; margin: 0 auto; }
.install > * + * { margin-top: 16px; }
.install-head { display: flex; gap: 14px; align-items: center; }
.install-head h1 { margin: 0; }
.install-head p { margin: 0; }
.checks { list-style: none; margin: 0; padding: 0; columns: 2; }
.checks li { padding: 2px 0; }
.checks li.ok { color: var(--ok); } .checks li.bad { color: var(--bad); font-weight: 600; }

/* ---- Small screens --------------------------------------------------- */
@media (max-width: 900px) {
  .grid-main { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .menu-btn { display: inline-flex; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; overflow-y: auto; }
  .sidebar.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .user-name { display: none; }
  .filters input[type=search] { min-width: 0; width: 100%; }
  .perm-table th { width: auto; display: block; padding-bottom: 0; }
  .perm-table td { display: block; }
  .checks { columns: 1; }
}
