:root {
  --bg: #eef1f3;
  --surface: #ffffff;
  --surface-soft: #f7f8f9;
  --text: #20272d;
  --muted: #66717b;
  --line: #d9dee2;
  --line-strong: #b9c0c6;
  --graphite: #1c252b;
  --graphite-2: #26333b;
  --amber: #d98b13;
  --amber-dark: #a96305;
  --amber-soft: #fff2d8;
  --good: #287a4b;
  --good-soft: #e5f5ec;
  --warning: #a86500;
  --warning-soft: #fff1d2;
  --danger: #b33a33;
  --danger-soft: #fde9e7;
  --info: #275f8f;
  --shadow: 0 14px 34px rgba(25, 34, 40, .09);
  --radius: 5px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--text); background: var(--bg); }
body { font-size: 14px; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image:
    radial-gradient(circle at 15% 18%, transparent 0 34px, rgba(55,70,78,.10) 35px 36px, transparent 37px 70px, rgba(55,70,78,.07) 71px 72px, transparent 73px),
    radial-gradient(circle at 82% 72%, transparent 0 48px, rgba(55,70,78,.08) 49px 50px, transparent 51px 92px, rgba(55,70,78,.06) 93px 94px, transparent 95px),
    linear-gradient(rgba(65,77,84,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(65,77,84,.035) 1px, transparent 1px);
  background-size: 320px 260px, 420px 360px, 42px 42px, 42px 42px;
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 255px minmax(0, 1fr); position: relative; }
.sidebar { background: linear-gradient(180deg, #182127 0%, #202c33 70%, #151d22 100%); color: #eef3f5; min-height: 100vh; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 20; box-shadow: 8px 0 24px rgba(15, 22, 26, .12); }
.brand { display: flex; align-items: center; height: 88px; padding: 18px 22px; border-bottom: 1px solid rgba(255,255,255,.08); background-image: linear-gradient(135deg, rgba(217,139,19,.10), transparent 50%); }
.brand img { width: 100%; max-height: 50px; object-fit: contain; object-position: left center; }
.main-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-group-label { margin: 15px 10px 6px; color: #91a0a8; text-transform: uppercase; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.nav-link { min-height: 42px; padding: 7px 10px; margin: 3px 0; display: flex; align-items: center; gap: 10px; border-left: 3px solid transparent; color: #dce4e8; transition: .16s ease; }
.nav-link > span { width: 30px; height: 28px; display: grid; place-items: center; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); font-size: 10px; font-weight: 900; color: #eeb65c; }
.nav-link b { font-size: 13px; font-weight: 600; }
.nav-link:hover { background: rgba(255,255,255,.055); color: white; }
.nav-link.is-active { background: linear-gradient(90deg, rgba(217,139,19,.22), rgba(217,139,19,.04)); border-left-color: var(--amber); color: white; }
.nav-link.is-active > span { background: var(--amber); border-color: var(--amber); color: #1f2529; }
.sidebar-footer { padding: 14px 20px 18px; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 2px; }
.sidebar-footer small { color: #96a4ab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer strong { font-size: 13px; }
.sidebar-footer span { color: #e6b25f; font-size: 11px; }

.main-area { min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { min-height: 68px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 10px 24px; position: sticky; top: 0; z-index: 15; backdrop-filter: blur(10px); }
.menu-toggle { display: none; border: 1px solid var(--line); background: white; width: 38px; height: 38px; }
.system-title { display: grid; }
.system-title strong { font-size: 15px; }
.system-title span { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.topbar-actions time { color: var(--muted); font-size: 12px; min-width: 160px; text-align: right; }
.content-area { width: 100%; max-width: 1700px; margin: 0 auto; padding: 26px; flex: 1; }
.app-footer { padding: 12px 26px; background: var(--graphite); color: #b9c4ca; display: flex; justify-content: space-between; gap: 20px; font-size: 11px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.page-head h1 { margin: 2px 0 4px; font-size: 28px; line-height: 1.2; }
.page-head p { margin: 0; color: var(--muted); max-width: 800px; }
.eyebrow { color: var(--amber-dark); text-transform: uppercase; font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.panel { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid #c9d0d4; box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; border-radius: var(--radius); }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-head h2 { margin: 0 0 3px; font-size: 18px; }
.section-head p { margin: 0; color: var(--muted); font-size: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code { background: #edf0f2; padding: 2px 5px; border-radius: 3px; font-size: 12px; }

.btn { border: 1px solid var(--line-strong); background: white; color: var(--text); min-height: 38px; padding: 8px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; border-radius: 4px; transition: .15s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(28,37,43,.10); }
.btn-primary { background: linear-gradient(180deg, #e59a25, #cc7d07); color: #fff; border-color: #b66d04; text-shadow: 0 1px 1px rgba(0,0,0,.12); }
.btn-outline { background: #fff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #e5aaa5; }
.btn-small { min-height: 31px; padding: 5px 9px; font-size: 11px; }
.btn.disabled { pointer-events: none; opacity: .45; }
.inline-form { display: inline-flex; }

.alert { padding: 11px 14px; margin: 0 0 16px; border: 1px solid; border-left-width: 5px; background: white; }
.alert-success { color: var(--good); background: var(--good-soft); border-color: #a8d6ba; }
.alert-danger { color: var(--danger); background: var(--danger-soft); border-color: #e7aaa5; }
.alert-warning { color: var(--warning); background: var(--warning-soft); border-color: #e7c87d; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid label { display: grid; align-content: start; gap: 6px; color: #3e484f; font-size: 12px; font-weight: 700; }
.form-grid input, .form-grid select, .form-grid textarea, .filter-row input, .module-admin-card input { width: 100%; min-height: 40px; border: 1px solid var(--line-strong); background: white; padding: 8px 10px; border-radius: 3px; color: var(--text); outline: none; }
.form-grid textarea { min-height: 92px; resize: vertical; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .filter-row input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(217,139,19,.13); }
.form-wide { grid-column: 1 / -1; }
.form-two-cols { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 5px; }
.required { color: var(--danger); }
.checkbox-field { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-weight: 600; }
.checkbox-field input { width: 18px; min-height: auto; height: 18px; }
.compact-form { grid-template-columns: 1fr; }
.narrow-panel { max-width: 760px; }

.hero-dashboard { min-height: 175px; padding: 26px 30px; margin-bottom: 18px; display: flex; justify-content: space-between; align-items: center; gap: 30px; color: white; background:
  radial-gradient(circle at 80% 20%, rgba(217,139,19,.25), transparent 32%),
  repeating-radial-gradient(circle at 82% 60%, transparent 0 32px, rgba(255,255,255,.045) 33px 34px),
  linear-gradient(120deg, #19242a, #2b3941); border-left: 6px solid var(--amber); box-shadow: var(--shadow); }
.hero-dashboard h1 { margin: 3px 0 6px; font-size: 29px; }
.hero-dashboard p { margin: 0; color: #c9d4d9; }
.hero-dashboard .eyebrow { color: #f2b95d; }
.readiness-ring { width: 125px; height: 125px; border-radius: 50%; display: grid; place-items: center; align-content: center; background: radial-gradient(circle at center, #223038 57%, transparent 58%), conic-gradient(var(--amber) calc(var(--value) * 1%), rgba(255,255,255,.12) 0); flex: 0 0 auto; }
.readiness-ring strong { font-size: 27px; }
.readiness-ring span { width: 80px; text-align: center; color: #c8d3d8; font-size: 10px; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { background: white; border: 1px solid var(--line); border-top: 4px solid var(--info); padding: 15px 17px; box-shadow: 0 8px 18px rgba(25,34,40,.06); }
.metric-card span, .metric-card small { color: var(--muted); display: block; }
.metric-card strong { display: block; font-size: 28px; margin: 5px 0 1px; }
.metric-danger { border-top-color: var(--danger); }
.metric-warning { border-top-color: var(--amber); }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 18px; align-items: start; }
.alert-list { display: grid; gap: 7px; }
.alert-list a { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); background: var(--surface-soft); }
.alert-list a:hover { border-color: var(--amber); }
.alert-type { color: var(--amber-dark); font-size: 10px; text-transform: uppercase; font-weight: 900; }
.alert-list time { color: var(--muted); font-size: 11px; }
.shortcut-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.shortcut-card { border: 1px solid var(--line); padding: 11px; display: flex; align-items: center; gap: 9px; min-height: 56px; }
.shortcut-card:hover { border-color: var(--amber); background: var(--amber-soft); }
.shortcut-card span, .module-icon { width: 34px; height: 34px; display: grid; place-items: center; background: var(--graphite); color: #f2b95d; font-size: 10px; font-weight: 900; }
.shortcut-card strong { font-size: 12px; }

.registry-form-panel { border-top-color: var(--amber); }
.registry-tools { align-items: flex-end; }
.filter-row { display: flex; align-items: flex-end; gap: 8px; }
.filter-row label { display: grid; gap: 5px; font-size: 11px; font-weight: 700; }
.filter-row input { min-width: 240px; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel > .section-head { padding: 18px 20px 0; }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { background: #edf0f2; color: #3d474e; text-align: center; padding: 10px 9px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.data-table td { padding: 9px; border-bottom: 1px solid #e7eaec; vertical-align: middle; }
.data-table tbody tr:hover { background: #fffaf1; }
.id-cell { color: var(--muted); font-weight: 800; white-space: nowrap; }
.actions-cell { white-space: nowrap; text-align: right; }
.status-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 25px; padding: 3px 8px; border: 1px solid; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-good { color: var(--good); border-color: #9dceb1; background: var(--good-soft); }
.status-warning { color: var(--warning); border-color: #dfbd6b; background: var(--warning-soft); }
.status-danger { color: var(--danger); border-color: #e0a09b; background: var(--danger-soft); }
.status-neutral { color: #58636b; border-color: #c6cdd1; background: #edf0f2; }
.empty-cell, .empty-state { color: var(--muted); text-align: center; padding: 24px !important; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 14px 20px; }

.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin: -4px 0 16px; padding: 5px; border: 1px solid var(--line); background: white; }
.subnav a { padding: 8px 11px; font-size: 11px; font-weight: 700; color: var(--muted); }
.subnav a.is-active { background: var(--graphite); color: white; }
.admin-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.admin-card { background: white; border: 1px solid var(--line); border-left: 4px solid var(--amber); padding: 18px; display: flex; gap: 14px; box-shadow: var(--shadow); }
.admin-card > span { width: 42px; height: 42px; display: grid; place-items: center; background: var(--graphite); color: #f2b95d; font-weight: 900; }
.admin-card strong { font-size: 15px; }
.admin-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.module-admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.module-admin-card { padding: 16px; border: 1px solid var(--line); background: var(--surface-soft); transition: .15s ease; }
.module-admin-card.is-enabled { border-top: 4px solid var(--amber); background: white; }
.module-admin-card.is-disabled { opacity: .58; filter: grayscale(.35); }
.module-admin-card h3 { margin: 13px 0 4px; }
.module-admin-card p { color: var(--muted); min-height: 49px; font-size: 11px; }
.module-admin-card label { display: grid; gap: 5px; font-size: 10px; font-weight: 700; }
.module-card-top { display: flex; justify-content: space-between; align-items: center; }
.switch input { display: none; }
.switch span { display: block; width: 42px; height: 22px; background: #bac1c6; border-radius: 20px; position: relative; }
.switch span::after { content: ""; width: 16px; height: 16px; background: white; border-radius: 50%; position: absolute; top: 3px; left: 3px; transition: .18s; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--amber); }
.switch input:checked + span::after { transform: translateX(20px); }
.admin-roles-layout { grid-template-columns: 300px minmax(0, 1fr); }
.role-list { display: grid; gap: 5px; }
.role-list a { padding: 10px; border: 1px solid var(--line); display: grid; }
.role-list a.is-active { border-color: var(--amber); background: var(--amber-soft); }
.role-list small { color: var(--muted); margin-top: 2px; }
.permission-panel { overflow: hidden; }
.permission-matrix { overflow-x: auto; }
.permission-matrix td:not(:first-child) { text-align: center; }
.permission-matrix input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--amber-dark); }
.permission-extra { display: flex; flex-wrap: wrap; gap: 8px 12px; text-align: left; }
.permission-extra label { white-space: nowrap; font-size: 10px; }
.admin-permission-row { background: #fff8eb; }

.module-roadmap { min-height: 220px; display: flex; align-items: center; gap: 22px; border-top-color: var(--amber); }
.module-roadmap-icon { width: 82px; height: 82px; display: grid; place-items: center; flex: 0 0 auto; background: var(--graphite); color: #f0b455; font-weight: 900; font-size: 21px; }
.module-roadmap h2 { margin: 0 0 6px; }
.module-roadmap p { color: var(--muted); max-width: 760px; }
.roadmap-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.roadmap-tags span { border: 1px solid #d9bd82; background: var(--amber-soft); color: #87530b; padding: 4px 8px; font-size: 10px; font-weight: 700; }
.access-denied { max-width: 760px; margin: 50px auto; }
.map-layout { grid-template-columns: minmax(0, 1.5fr) minmax(300px, .5fr); }
.map-canvas { padding: 0; }
.map-grid-bg { min-height: 520px; display: grid; place-items: center; background-color: #e9edef; background-image: linear-gradient(rgba(42,60,68,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(42,60,68,.08) 1px, transparent 1px), repeating-radial-gradient(circle at 45% 46%, transparent 0 48px, rgba(42,60,68,.09) 49px 50px); background-size: 36px 36px, 36px 36px, auto; }
.map-empty { width: 300px; text-align: center; background: rgba(255,255,255,.92); border: 1px solid var(--line-strong); padding: 25px; box-shadow: var(--shadow); }
.map-empty strong { display: block; font-size: 44px; color: var(--amber-dark); }
.map-empty span { font-weight: 800; }
.map-empty p { color: var(--muted); font-size: 11px; }
.location-list { display: grid; gap: 6px; }
.location-list a { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); padding: 9px; }
.location-list small { display: block; color: var(--muted); }
.location-dot { width: 13px; height: 13px; background: var(--danger); border-radius: 50%; box-shadow: 0 0 0 4px var(--danger-soft); }
.warehouse-dot { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }

.login-body { min-height: 100vh; display: grid; place-items: center; background:
  radial-gradient(circle at 16% 18%, rgba(217,139,19,.20), transparent 28%),
  repeating-radial-gradient(circle at 75% 60%, transparent 0 38px, rgba(255,255,255,.035) 39px 40px),
  linear-gradient(125deg, #121b20, #2a3941); color: white; padding: 25px; }
.login-shell { width: min(980px, 100%); display: grid; grid-template-columns: 1.2fr .8fr; background: rgba(22,31,36,.82); border: 1px solid rgba(255,255,255,.11); box-shadow: 0 25px 70px rgba(0,0,0,.35); backdrop-filter: blur(10px); }
.login-brand { padding: 55px; display: flex; flex-direction: column; justify-content: center; min-height: 470px; background-image: linear-gradient(135deg, rgba(217,139,19,.08), transparent 60%); }
.login-brand img { width: min(390px, 100%); max-height: 90px; object-fit: contain; object-position: left center; margin-bottom: 35px; }
.login-brand h1 { font-size: 32px; max-width: 520px; margin: 0 0 12px; }
.login-brand p { color: #bcc9cf; max-width: 530px; }
.login-card { background: white; color: var(--text); padding: 42px; display: flex; flex-direction: column; justify-content: center; }
.login-card h1, .login-card h2 { margin: 5px 0 8px; }
.login-card > p, .login-card > small { color: var(--muted); }
.login-card > small { margin-top: 22px; }
.install-shell { grid-template-columns: .9fr 1.1fr; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .module-admin-grid, .admin-card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; width: 265px; transform: translateX(-105%); transition: .2s; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .menu-toggle { display: inline-grid; place-items: center; }
  .system-title { margin-right: auto; margin-left: 12px; }
  .topbar-actions time { display: none; }
  .dashboard-columns, .map-layout, .admin-roles-layout { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: auto; padding: 38px; }
  .login-brand h1 { font-size: 25px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 650px) {
  .content-area { padding: 16px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .form-grid, .form-two-cols { grid-template-columns: 1fr; }
  .form-wide { grid-column: auto; }
  .metric-grid, .module-admin-grid, .admin-card-grid, .shortcut-grid { grid-template-columns: 1fr; }
  .hero-dashboard { align-items: flex-start; flex-direction: column; }
  .filter-row { align-items: stretch; flex-direction: column; width: 100%; }
  .filter-row input { min-width: 0; }
  .registry-tools { align-items: stretch; flex-direction: column; }
  .topbar { padding: 9px 14px; }
  .app-footer { flex-direction: column; }
  .login-brand, .login-card { padding: 28px; }
}
