/* RISE ERP design system. Hand-written, no build step. Brand tokens match the marketing site. */
:root {
  --navy: #1E2A34; --steel: #2C3E4C; --teal: #0B2A38; --orange: #F04E23; --amber: #F58220; --gold: #FBB03B;
  --grad: linear-gradient(135deg, #F04E23, #F58220, #FBB03B);

  --bg: #F4F5F7; --surface: #FFFFFF; --surface-2: #FAFBFC; --heading: #1E2A34; --text: #3D4852; --muted: #6B7782;
  --line: #E3E7EB; --line-strong: #CBD2D9; --focus: rgba(240, 78, 35, .28);
  --ok: #157F4F; --ok-bg: #E4F5EC; --warn: #9A5B00; --warn-bg: #FFF2D9; --bad: #B42318; --bad-bg: #FDE8E6; --info: #1F5E7A; --info-bg: #E3F1F7;
  --shadow: 0 1px 2px rgba(30, 42, 52, .06), 0 8px 24px -12px rgba(30, 42, 52, .18);
  --radius: 8px; --sidebar: 252px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10181F; --surface: #18222B; --surface-2: #1D2933; --heading: #F1F4F6; --text: #C3CCD4; --muted: #8C99A5;
    --line: #283540; --line-strong: #3A4956; --focus: rgba(245, 130, 32, .4);
    --ok: #5DD6A0; --ok-bg: rgba(93, 214, 160, .12); --warn: #FBB03B; --warn-bg: rgba(251, 176, 59, .13); --bad: #FF9B85; --bad-bg: rgba(255, 120, 95, .13); --info: #7CC4E0; --info-bg: rgba(124, 196, 224, .12);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; color: var(--heading); font-weight: 700; line-height: 1.2; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; } h2 { font-size: 1.1rem; } h3 { font-size: .95rem; }
p { margin: 0; } a { color: var(--orange); text-decoration: none; } a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 3px; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--navy); color: #C9D2DA; display: flex; flex-direction: column; scrollbar-width: thin; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar-brand svg { height: 34px; width: auto; }
.sidebar-brand span { margin-left: auto; font-size: .62rem; font-weight: 700; letter-spacing: .16em; color: var(--navy); background: var(--grad); padding: 3px 7px; border-radius: 3px; }
.nav-group { padding: 16px 12px 4px; }
.nav-title { padding: 0 10px 6px; font-size: .66rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #7B8A97; }
.nav-link { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 6px; color: #C9D2DA; font-weight: 500; font-size: .9rem; }
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(240, 78, 35, .16); color: #fff; }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.nav-link .soon { margin-left: auto; font-size: .6rem; font-weight: 700; letter-spacing: .08em; color: #7B8A97; border: 1px solid rgba(255, 255, 255, .14); border-radius: 3px; padding: 0 5px; }
.nav-link.disabled { opacity: .55; pointer-events: none; }
.sidebar-foot { margin-top: auto; padding: 14px 20px; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #7B8A97; border-top: 1px solid rgba(255, 255, 255, .08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 28px; background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .spacer { flex: 1; }
.plant-switch { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.plant-switch label { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.plant-switch select { border: 0; background: transparent; color: var(--heading); font: inherit; font-weight: 600; padding: 4px 4px; max-width: 46vw; cursor: pointer; }
.plant-switch select:focus-visible { outline-offset: 4px; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px; border-radius: 999px; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 700; font-size: .8rem; }
.user-menu .who { line-height: 1.2; text-align: right; } .user-menu .who b { display: block; color: var(--heading); font-size: .85rem; }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 5px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--bg); text-decoration: none; }
.burger { display: none; border: 1px solid var(--line); background: var(--surface); color: var(--heading); border-radius: 6px; padding: 7px; cursor: pointer; }
.content { padding: 26px 28px 48px; max-width: 1480px; width: 100%; }

/* ---------- Page head, cards, stats ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.page-head .eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .68rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--orange); }
.page-head .eyebrow::before { content: ""; width: 22px; height: 7px; background: var(--grad); clip-path: polygon(0 100%, 28% 0, 100% 0, 72% 100%); }
.page-head p { margin-top: 4px; color: var(--muted); max-width: 70ch; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-body { padding: 18px; }
.grid { display: grid; gap: 18px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 18px; }
.stat { position: relative; overflow: hidden; padding: 16px 18px; }
.stat::after { content: ""; position: absolute; right: 0; top: 0; width: 26px; height: 26px; background: var(--grad); clip-path: polygon(0 0, 100% 0, 100% 100%); opacity: .9; }
.stat .label { font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat .value { margin-top: 4px; font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; color: var(--heading); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .value small { font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.stat .hint { margin-top: 2px; font-size: .8rem; color: var(--muted); }
.stat.ok .value { color: var(--ok); } .stat.warn .value { color: var(--warn); } .stat.bad .value { color: var(--bad); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; color: var(--heading); font-weight: 500; }

/* ---------- Buttons, badges, alerts ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--heading); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .15s, box-shadow .15s; }
.btn:hover { border-color: var(--orange); color: var(--orange); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { border-color: transparent; background: var(--grad); color: #fff; box-shadow: 0 6px 16px -8px rgba(240, 78, 35, .8); }
.btn-primary:hover { color: #fff; filter: brightness(1.06); border-color: transparent; }
.btn-danger { color: var(--bad); } .btn-danger:hover { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
.btn-sm { padding: 4px 9px; font-size: .8rem; border-radius: 5px; } .btn-icon { padding: 6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--grad); color: #fff; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 18px; border-radius: var(--radius); border: 1px solid; font-weight: 500; }
.alert.success { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
.alert.error { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
.alert.info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 35%, transparent); color: var(--info); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { position: sticky; top: 0; padding: 10px 14px; text-align: left; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; } .table tbody tr:hover td { background: var(--surface-2); }
.table th.right, .table td.right { text-align: right; } .table th.center, .table td.center { text-align: center; }
.table tr.group td { background: var(--bg); font-weight: 700; color: var(--heading); font-size: .8rem; letter-spacing: .04em; }
.table tr.total td { font-weight: 700; color: var(--heading); background: var(--surface-2); border-top: 2px solid var(--line-strong); }
.table td .btn + .btn, .table td form + .btn, .table td .btn + form { margin-left: 4px; } .table td form { display: inline; }
.table input[type=number], .table select { padding: 5px 8px; }
.empty { padding: 44px 18px; text-align: center; color: var(--muted); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; } .form-grid .wide { grid-column: 1 / -1; }
.field label, .label { display: block; margin-bottom: 5px; font-size: .8rem; font-weight: 600; color: var(--heading); }
.field .req { color: var(--orange); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=month], input[type=search], select, textarea { width: 100%; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--heading); font: inherit; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--focus); }
.field .help { margin-top: 4px; font-size: .78rem; color: var(--muted); } .field .error { margin-top: 4px; font-size: .8rem; font-weight: 500; color: var(--bad); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--heading); cursor: pointer; } .check input { width: 16px; height: 16px; accent-color: var(--orange); }
.form-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; } .toolbar input[type=search], .toolbar select { width: auto; min-width: 180px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 9px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-weight: 600; } .tabs a:hover { color: var(--heading); text-decoration: none; }
.tabs a.active { color: var(--orange); border-color: var(--orange); }

/* ---------- Meters ---------- */
.meter { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; background: var(--grad); } .meter i.over { background: var(--bad); }
.dept-row { display: grid; grid-template-columns: minmax(120px, 1.1fr) 2fr 150px; gap: 14px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); } .dept-row:last-child { border-bottom: 0; } .dept-row > :last-child { text-align: right; }

/* ---------- Org chart ---------- */
.org-root { display: flex; justify-content: center; margin-bottom: 26px; position: relative; }
.org-root::after { content: ""; position: absolute; left: 50%; bottom: -26px; width: 2px; height: 26px; background: var(--line-strong); }
.org-node { min-width: 250px; padding: 14px 18px; border-radius: var(--radius); background: var(--navy); color: #fff; text-align: center; box-shadow: var(--shadow); border-bottom: 3px solid var(--orange); }
.org-node small { display: block; color: var(--gold); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .64rem; } .org-node b { font-size: 1.02rem; }
.org-depts { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; padding-top: 18px; border-top: 2px solid var(--line-strong); }
.org-dept { overflow: hidden; } .org-dept header { padding: 12px 16px; background: var(--steel); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.org-dept header b { font-size: .92rem; } .org-dept ul { list-style: none; margin: 0; padding: 6px 0; }
.org-dept li { display: flex; align-items: center; gap: 10px; padding: 7px 16px; } .org-dept li + li { border-top: 1px dashed var(--line); }
.org-dept li.head { font-weight: 700; color: var(--heading); } .org-dept li .seats { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grade { font-size: .62rem; font-weight: 700; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 4px; }

/* ---------- Permission matrix ---------- */
.matrix td, .matrix th { padding: 7px 12px; } .matrix input { width: 16px; height: 16px; accent-color: var(--orange); }

/* ---------- Roadmap ---------- */
.roadmap { list-style: none; margin: 0; padding: 0; } .roadmap li { display: grid; grid-template-columns: 34px 1fr max-content; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); } .roadmap li:last-child { border: 0; }
.roadmap .no { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; background: var(--bg); font-weight: 800; color: var(--muted); } .roadmap li.live .no { background: var(--grad); color: #fff; }

/* ---------- Pagination ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); }
.pager nav { display: flex; gap: 4px; } .pager a, .pager span.page { min-width: 32px; padding: 5px 9px; text-align: center; border: 1px solid var(--line); border-radius: 5px; color: var(--text); font-weight: 600; font-size: .82rem; }
.pager a:hover { border-color: var(--orange); color: var(--orange); text-decoration: none; } .pager span.current { background: var(--navy); border-color: var(--navy); color: #fff; } .pager span.disabled { opacity: .45; }

/* ---------- Guest (login) ---------- */
.guest { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.guest-art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; color: #fff; background: radial-gradient(120% 90% at 15% 10%, #2C3E4C 0%, #1E2A34 45%, #121A21 100%); }
.guest-art::before { content: ""; position: absolute; inset: 0; background: var(--grad); clip-path: polygon(100% 34%, 100% 100%, 44% 100%); }
.guest-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(200deg, #FBB03B, #F04E23); opacity: .7; clip-path: polygon(100% 20%, 100% 26%, 38% 100%, 33% 100%); }
.guest-art > * { position: relative; z-index: 1; } .guest-art svg.logo { height: 54px; width: auto; align-self: flex-start; }
.guest-art h1 { color: #fff; font-size: clamp(2rem, 4vw, 3.2rem); text-transform: uppercase; letter-spacing: -.01em; line-height: 1; font-weight: 800; max-width: 12ch; }
.guest-art .tag { font-weight: 700; letter-spacing: .2em; text-transform: uppercase; font-size: .8rem; color: var(--gold); }
.guest-form { display: grid; place-items: center; padding: 32px; } .guest-form .box { width: 100%; max-width: 380px; }
.demo-logins { margin-top: 22px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); font-size: .8rem; } .demo-logins code { color: var(--heading); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main, .g3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .table-wrap > .table { min-width: 680px; }   /* wide tables scroll sideways instead of squeezing every cell */
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: min(var(--sidebar), 84vw); transform: translateX(-102%); transition: transform .25s ease; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5); }
  .burger { display: inline-grid; } .topbar { padding: 10px 16px; } .content { padding: 20px 16px 40px; }
  .user-menu .who { display: none; } .g2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .guest { grid-template-columns: 1fr; } .guest-art { min-height: 240px; padding: 28px; } .guest-art h1 { font-size: 1.8rem; }
  .dept-row { grid-template-columns: 1fr max-content; } .dept-row .meter { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 520px) { .g4 { grid-template-columns: minmax(0, 1fr); } .plant-switch label { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .sidebar, .topbar, .actions, .btn { display: none !important; } .shell { display: block; } .card { box-shadow: none; } }
