:root {
  --color-navy: #7c818a;
  --color-sidebar-border: rgba(255, 255, 255, 0.08);
  --color-sidebar-hover: rgba(255, 255, 255, 0.08);
  --color-sidebar-active: #db4040;
  --sidebar-width: 272px;
  --sidebar-width-collapsed: 76px;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #1f2937;
  background: #f3f4f6;
}
.wrapper {
  display: none;
  height: 100vh;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}
.wrapper.is-ready { display: flex; }
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-navy);
  color: #fff;
  flex-shrink: 0;
  transition: width 0.22s ease;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar.collapsed { width: var(--sidebar-width-collapsed); }
.sidebar-brand {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-sidebar-border);
  flex-shrink: 0;
  gap: 8px;
}
.sidebar-brand-text {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.sidebar.collapsed .sidebar-brand-text { display: none; }
.toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.toggle-btn:hover { background: rgba(255, 255, 255, 0.12); }
.sidebar-menu {
  display: flex;
  flex-direction: column;
  padding: 12px 0 16px;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-group { display: flex; flex-direction: column; gap: 2px; }
.sidebar-group--secondary {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--color-sidebar-border);
}
.sidebar-group-label {
  margin: 0 10px 4px;
  padding: 6px 12px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.sidebar.collapsed .sidebar-group-label { display: none; }
.menu-item {
  display: flex;
  align-items: center;
  margin: 0 10px;
  padding: 9px 12px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
}
.menu-item:hover { background: var(--color-sidebar-hover); color: #fff; }
.menu-item.active {
  background: var(--color-sidebar-active);
  color: #fff;
  font-weight: 600;
}
.menu-icon {
  margin-right: 10px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.menu-icon svg { width: 18px; height: 18px; display: block; fill: currentColor; }
.sidebar.collapsed .menu-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .menu-icon { margin-right: 0; }
.sidebar.collapsed .menu-item span:not(.menu-icon) { display: none; }
body:not(.is-admin) .menu-admin-only { display: none; }
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
  background: #f3f4f6;
}
.main-header {
  min-height: 56px;
  height: 56px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}
.main-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #1f2937;
}
.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}
#header-user {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1f2937;
}
#header-logout-btn {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 600;
  color: #dc2626;
  background: transparent;
  border: 1.5px solid #fecaca;
  border-radius: 12px;
  cursor: pointer;
}
#header-logout-btn:hover { background: #fef2f2; }
.header-icon-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7c818a;
  cursor: pointer;
}
.header-icon-btn:hover { color: #1f2937; background: #f3f4f6; }
.header-sep { width: 1px; height: 16px; background: #e5e7eb; }
#view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 24px 28px;
}
#auth-boot, #auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
}
#auth-boot[hidden], #auth-screen[hidden] { display: none !important; }
.auth-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 14px rgba(124,129,138,0.12);
  padding: 28px 24px;
}
.auth-card h2 { margin: 0 0 6px; font-size: 18px; font-weight: 800; color: #1f2937; text-align: center; }
.auth-card .auth-sub { margin: 0 0 20px; font-size: 12px; color: #6b7280; text-align: center; }
.auth-card label { display: block; font-size: 11px; font-weight: 700; color: #4b5563; margin-bottom: 4px; }
.auth-card input {
  width: 100%;
  height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
}
.auth-card .auth-error { color: #dc2626; font-size: 12px; text-align: center; margin-bottom: 10px; min-height: 16px; }
.auth-card .auth-submit {
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: #10b981;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.auth-card .auth-submit:hover { background: #059669; }
.registry-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.registry-toolbar__left, .registry-toolbar__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.registry-filter-ctl {
  height: 36px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  outline: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.registry-filter-ctl--search { width: 16rem; font-weight: 400; }
.avers-dd { position: relative; display: inline-flex; align-items: center; }
.avers-dd--field { display: block; width: 100%; }
.avers-dd__btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 36px;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  padding: 0 12px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.avers-dd__btn:hover { border-color: #cbd5e1; }
.avers-dd__btn:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.avers-dd.is-open .avers-dd__btn {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.avers-dd.is-disabled .avers-dd__btn {
  opacity: 0.55;
  cursor: not-allowed;
}
.avers-dd__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.avers-dd__chev { color: #94a3b8; font-size: 10px; flex-shrink: 0; }
.avers-dd__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 55;
  min-width: 100%;
  background: #fff;
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
  padding: 4px;
  max-height: 280px;
  overflow: auto;
  animation: aversDdIn 0.14s ease-out;
}
.avers-dd__menu--wide { min-width: 220px; right: auto; }
.avers-dd__menu[hidden] { display: none !important; }
@keyframes aversDdIn {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.avers-dd__item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  font-family: inherit;
}
.avers-dd__item:hover { background: #f8fafc; }
.avers-dd__item.is-on { background: #eff6ff; color: #1d4ed8; }
.field .avers-dd__btn {
  height: 40px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  border-color: #d1d5db;
  box-shadow: none;
}
.field .avers-dd__item { font-size: 13px; font-weight: 500; }
.registry-btn {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  cursor: pointer;
  text-decoration: none;
}
.registry-btn:hover { background: #f8fafc; }
.registry-btn--primary {
  border: 0;
  background: #10b981;
  color: #fff;
}
.registry-btn--primary:hover { background: #059669; }
.registry-btn--danger {
  border-color: #fecaca;
  color: #dc2626;
}
.registry-btn--danger:hover { background: #fef2f2; }
.panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 14px rgba(124,129,138,0.07), 0 1px 4px rgba(124,129,138,0.04);
  overflow: hidden;
}
.panel:has(.avers-dd) {
  overflow: visible;
}
.panel + .panel { margin-top: 16px; }
.panel-body { padding: 16px; }
.panel-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
}
.mon-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.mon-table th, .mon-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}
.mon-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #64748b;
  background: #fff;
}
.mon-table tbody tr:last-child td,
.mon-table tbody tr:last-child th {
  border-bottom: 0;
}
.mon-table tbody tr:hover { background: #f9fafb; }
.mon-table tbody tr[data-href] { cursor: pointer; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}
.chip-ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.chip-err { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.chip-warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.chip-muted { background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; }
.dot { width: 8px; height: 8px; border-radius: 9999px; display: inline-block; }
.dot-ok { background: #10b981; }
.dot-off { background: #d1d5db; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #4b5563;
  margin-bottom: 4px;
}
.field input, .field textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.field textarea { min-height: 80px; }
.secret-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}
.secret-box code {
  display: block;
  margin-top: 8px;
  word-break: break-all;
  font-size: 13px;
  color: #1f2937;
}
.muted { color: #6b7280; font-size: 12px; }
.empty { padding: 28px 16px; text-align: center; color: #6b7280; }
.error-banner { color: #dc2626; font-size: 13px; margin: 0 0 12px; }
.crumbs { font-size: 12px; color: #6b7280; margin-bottom: 12px; }
.crumbs a { color: #d81818; text-decoration: none; }
.ok-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 12px;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #6b7280;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: -1px;
}
.tab-btn:hover { color: #1f2937; }
.tab-btn.is-active { border-bottom-color: #d81818; color: #d81818; }
.tab-btn .tab-count { font-weight: 500; color: #9ca3af; margin-left: 6px; }
.tab-btn.is-active .tab-count { color: #d81818; }
.ok-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  display: inline-block;
  flex-shrink: 0;
}
.ok-dot--on { background: #22c55e; }
.ok-dot--off { background: #d1d5db; }
.company-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.entity-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}
.entity-link:hover { text-decoration: underline; }
.entity-sub {
  display: block;
  margin-top: 2px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 400;
}
.hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: #6b7280;
}
.card-meta { font-size: 13px; color: #4b5563; line-height: 1.5; }
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .registry-filter-ctl--search { width: 100%; }
}
