:root {
  --bg: #0a0e14;
  --bg-elevated: #0f1419;
  --surface: #141c2b;
  --surface-2: #1a2436;
  --border: #2a3750;
  --text: #e8eef6;
  --muted: #8b9cb3;
  --accent: #4b9dff;
  --accent-soft: rgba(75, 157, 255, 0.14);
  --accent-glow: rgba(75, 157, 255, 0.35);
  --accent-dim: #2d6bcc;
  --danger: #f07178;
  --ok: #3dd68c;
  --sidebar-w: 280px;
  --form-label-width: 11rem;
  --form-row-gap: 1rem;
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 900px 500px at 0% 0%, rgba(45, 107, 204, 0.18), transparent 55%),
    radial-gradient(ellipse 700px 450px at 100% 20%, rgba(61, 214, 140, 0.06), transparent 50%),
    linear-gradient(180deg, #0d1219 0%, var(--bg) 45%);
  z-index: -1;
}

.hidden {
  display: none !important;
}

/* —— App shell —— */
.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(175deg, #121a28 0%, #0c1018 55%, #0a0d14 100%);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.35);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.75rem 1.35rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(75, 157, 255, 0.35);
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-soft);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-ico {
  width: 1.25rem;
  text-align: center;
  opacity: 0.75;
  font-size: 0.85rem;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item.nav-item--sub {
  padding-left: 1.85rem;
  font-size: 0.88rem;
}

.input-mono {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
}

.sidebar-footer {
  padding: 1rem 1.1rem 1.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.session-block {
  margin-bottom: 0.75rem;
}

.session-user strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.95rem;
  word-break: break-all;
}

.role-pill {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ok);
  border: 1px solid rgba(61, 214, 140, 0.25);
}

.nav-logout {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-logout:hover {
  background: rgba(240, 113, 120, 0.12);
  color: var(--danger);
  border-color: rgba(240, 113, 120, 0.35);
}

.main-area {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 2rem 2.25rem 3rem;
}

/* —— Pages —— */
.page {
  display: none;
  animation: fadeIn 0.25s ease;
}

.page.page-active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.page-inner-narrow {
  max-width: 480px;
}

/* 窄页（登录、修改密码等）：标题区在上、卡片在下，标题相对卡片水平居中 */
.page-narrow-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.page-head-centered {
  text-align: center;
  width: 100%;
  margin-bottom: 1rem;
}

.page-head-centered h1 {
  margin: 0;
}

.page-head-centered .page-head-lead {
  margin: 0.4rem 0 0;
}

#page-login .form-login {
  width: 100%;
  box-sizing: border-box;
}

.page-inner-list {
  max-width: 1280px;
}

.list-page-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.list-page-layout.list-page-no-sidebar {
  grid-template-columns: 1fr;
}

.list-page-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.model-sidebar {
  position: sticky;
  top: 1rem;
  padding: 1.1rem 1.15rem;
  align-self: start;
  max-height: calc(100vh - 4rem);
  overflow: auto;
}

.model-sidebar-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 650;
}

.model-sidebar-lead {
  margin: 0 0 0.75rem;
}

.model-sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.model-sidebar-list li {
  margin: 0;
}

.model-sidebar-empty {
  padding: 0.5rem 0.15rem;
  line-height: 1.4;
}

.model-nav-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 0.35rem;
  padding: 0.55rem 0.65rem;
  text-align: left;
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.35;
  word-break: break-word;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.model-nav-item:hover {
  border-color: rgba(75, 157, 255, 0.45);
  background: rgba(75, 157, 255, 0.1);
}

.model-nav-item.model-nav-registered {
  border-left: 3px solid var(--accent);
  padding-left: calc(0.65rem - 2px);
}

.model-nav-item.model-nav-active {
  border-color: rgba(75, 157, 255, 0.55);
  background: rgba(75, 157, 255, 0.16);
  color: #fff;
}

@media (max-width: 900px) {
  .list-page-layout {
    grid-template-columns: 1fr;
  }

  .model-sidebar {
    position: static;
    max-height: none;
  }
}

.page-head {
  margin-bottom: 1.5rem;
}

.page-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.page-head.page-head-centered {
  margin-bottom: 1rem;
}

.page-head.page-head-centered h1 {
  margin: 0;
}

.panel-page .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.35rem 1.5rem 1.1rem;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.35rem 1.5rem 1.05rem;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.muted:empty {
  display: none;
  margin: 0;
}

.small {
  font-size: 0.8rem;
}

.subhead {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

/* —— Form rows —— */
.row {
  display: grid;
  grid-template-columns: var(--form-label-width) minmax(0, 1fr);
  column-gap: var(--form-row-gap);
  align-items: center;
  margin-bottom: 0.85rem;
}

/* 表单字段区：多行共用一个 grid，标签列 = 本区内最长标签；输入列等宽；与登录页同一套规则 */
.form-field-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: var(--form-row-gap);
  row-gap: 0.85rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.form-field-grid > label {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  justify-self: start;
}

.form-field-grid .input-with-toggle {
  width: 100%;
  min-width: 0;
}

.form-field-grid .input-with-toggle input {
  flex: 1 1 0;
}

.form-field-grid > input[type='text'],
.form-field-grid > input[type='password'],
.form-field-grid > input[type='file'] {
  width: 100%;
  min-width: 0;
}

.form-field-grid > select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.form-field-grid-span {
  grid-column: 1 / -1;
}

.form-field-grid-actions {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.form-field-grid-actions--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

.form-field-grid-actions .msg,
.form-field-grid-actions .err {
  flex-basis: 100%;
}

.form-field-subgrid-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  column-gap: var(--form-row-gap);
  align-items: center;
}

@supports not (grid-template-columns: subgrid) {
  .form-field-subgrid-row {
    grid-template-columns: max-content minmax(0, 1fr);
  }
}

.form-field-grid > .perms-block.form-field-grid-span {
  margin: 0;
}

.row > label:first-child {
  font-size: 0.85rem;
  color: var(--muted);
}

.row-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.input-with-toggle {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  min-width: 0;
}

.input-with-toggle input {
  flex: 1;
  min-width: 0;
}

/* 与「显示」同宽占位：纯文本行与同表单内密码行输入框等宽（勿用 disabled 占位，部分浏览器宽度与真按钮不一致） */
.btn-toggle-pw--spacer {
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

.btn-toggle-pw {
  flex-shrink: 0;
  padding: 0 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.btn-toggle-pw:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

input[type='text'],
input[type='password'],
select {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1rem;
}

input[type='file'] {
  font-size: 0.85rem;
  color: var(--muted);
}

.btn {
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-wide {
  width: 100%;
  margin-top: 0.35rem;
}

.btn.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  color: #fff;
  box-shadow: 0 4px 20px rgba(75, 157, 255, 0.25);
}

.btn.primary:disabled,
.btn.ghost:disabled,
.btn.danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(240, 113, 120, 0.45);
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

/* 客户管理：注册开关 — 与状态 pill 一致的「当前态」按钮 */
.btn.btn-registration-current {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn.btn-registration-current:disabled {
  opacity: 0.88;
  cursor: not-allowed;
}

/* 「关闭注册」为可点操作时与左侧按钮同尺寸 */
#btn-registration-off.btn.danger {
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
}

.btn.small {
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}

.btn.linkish {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}

.err {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.2em;
}

.msg {
  color: var(--ok);
  font-size: 0.85rem;
  min-height: 1.2em;
}

.err:empty,
.msg:empty {
  display: none;
  min-height: 0;
  margin: 0 !important;
}

.form-card > .btn-wide + .err {
  margin: 0.35rem 0 0;
}

/* 与 .row 第二列对齐；勿用于 .btn-wide（width:100% + margin-left 会向右溢出卡片） */
.card form > .btn.primary:not(.btn-wide),
.form-card > .btn.primary:not(.btn-wide) {
  margin-left: calc(var(--form-label-width) + var(--form-row-gap));
  margin-top: 0.35rem;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: var(--text);
  cursor: pointer;
}

.upload-model-card {
  margin-bottom: 0.25rem;
}

.upload-model-heading {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.upload-model-lead {
  margin: 0 0 1rem;
}

.row textarea,
.form-field-grid > textarea {
  width: 100%;
  min-width: 0;
  min-height: 4rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.fw-model-reg-desc {
  margin-top: 0.35rem;
  line-height: 1.45;
  word-break: break-word;
}

.fw-model-empty-row {
  padding: 0.85rem 0.75rem;
}

.filter-inputs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.filter-inputs input[type='text'],
.filter-inputs select {
  flex: 1;
  min-width: 10rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

table th:last-child,
table td.actions {
  min-width: 12rem;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 500;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.75rem;
  background: #1e2a3d;
  color: var(--ok);
}

.badge.off {
  color: var(--muted);
  background: #151c28;
}

.firmware-panels {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.fw-category-block {
  margin: 0;
}

.fw-category-head {
  margin-bottom: 0.85rem;
  padding: 0.35rem 0 0.15rem;
  border-bottom: 1px solid rgba(75, 157, 255, 0.2);
}

.fw-category-title {
  margin: 0 0 0.35rem;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #dbe7f7;
}

.fw-category-code-pill {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.12rem 0.5rem;
  border-radius: 6px;
  font-size: 0.78rem;
  background: rgba(75, 157, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(75, 157, 255, 0.28);
  vertical-align: middle;
}

.fw-category-lead {
  margin: 0.35rem 0 0;
  max-width: 52rem;
}

.fw-category-models {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding-left: 0.65rem;
  border-left: 3px solid rgba(75, 157, 255, 0.28);
}

.firmware-empty {
  margin: 0.5rem 0 0;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.fw-model-panel.card {
  border: 1px solid rgba(42, 55, 80, 0.9);
  border-radius: 18px;
  box-shadow:
    0 14px 48px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(255, 255, 255, 0.035) inset;
}

.fw-model-panel {
  padding: 0;
  overflow: hidden;
}

.fw-model-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.15rem;
  flex-wrap: wrap;
  padding: 1.15rem 1.5rem;
  background: linear-gradient(
    135deg,
    rgba(32, 44, 66, 0.98) 0%,
    rgba(22, 30, 46, 0.99) 48%,
    rgba(18, 26, 40, 0.96) 100%
  );
  border-bottom: 1px solid rgba(75, 157, 255, 0.14);
}

.fw-model-panel-title {
  min-width: 0;
}

.fw-model-name {
  margin: 0 0 0.25rem;
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.25;
  word-break: break-word;
  color: #f2f6fc;
}

.fw-model-panel-title .small {
  display: block;
  margin-top: 0.2rem;
  line-height: 1.45;
}

.fw-model-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
  flex-shrink: 0;
  align-items: center;
}

.btn-fw-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.2rem;
  border-radius: 11px;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition:
    box-shadow 0.2s ease,
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.btn-fw-action:hover {
  transform: translateY(-1px);
}

.btn-fw-action.solid {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #2d6bcc);
  box-shadow: 0 4px 18px rgba(75, 157, 255, 0.38);
}

.btn-fw-action.solid:hover {
  box-shadow: 0 6px 26px rgba(75, 157, 255, 0.48);
}

.btn-fw-action.outline {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.btn-fw-action.outline:hover {
  border-color: rgba(75, 157, 255, 0.45);
  background: rgba(75, 157, 255, 0.12);
}

.btn-fw-action.danger-outline {
  border: 1px solid rgba(240, 113, 120, 0.45);
  background: rgba(240, 113, 120, 0.08);
  color: #ffc9cc;
}

.btn-fw-action.danger-outline:hover {
  border-color: rgba(240, 113, 120, 0.75);
  background: rgba(240, 113, 120, 0.16);
  color: #fff;
}

.btn-fw-ico {
  font-size: 0.92rem;
  opacity: 0.92;
  line-height: 1;
}

.fw-model-panel .table-wrap {
  padding: 0.35rem 0.5rem 0.65rem;
}

.fw-model-panel .fw-seq {
  font-variant-numeric: tabular-nums;
  text-align: center;
  width: 3rem;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 0.45rem;
}

/* 固件列表操作列：三列栅格，「改版本」始终对齐；已是「最新」时用占位占住中间列 */
.actions.actions-grid {
  display: grid;
  grid-template-columns: max-content max-content max-content;
  justify-content: start;
  align-items: center;
  gap: 0.45rem;
}

.actions-grid .action-slot {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.action-align-dummy {
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

.grid-form .form-field-grid {
  margin-bottom: 0;
}

.perms-block {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.15);
}

.perms-block .models-ta {
  flex: 1 1 100%;
  width: 100%;
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.perms-block .models-ta > label,
.perms-block .models-ta .models-ta-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.perms-block .models-ta textarea {
  width: 100%;
  min-height: 4.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}

.perms-block .managed-normals-checkboxes {
  max-height: 14rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.25rem 0;
}

table td.user-actions {
  min-width: 9rem;
  text-align: right;
  vertical-align: middle;
}

table td.product-model-actions {
  min-width: 11rem;
  text-align: right;
  vertical-align: middle;
}

table td.product-model-actions .btn {
  margin-left: 0.35rem;
}

table td.product-model-actions .btn:first-child {
  margin-left: 0;
}

/* —— Modal —— */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(5, 9, 16, 0.78);
  backdrop-filter: blur(10px);
}

.modal-overlay.hidden {
  display: none !important;
}

.modal.panel {
  width: 100%;
  max-width: 420px;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.35rem 1.5rem 1.1rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.modal.panel.modal-elevated {
  position: relative;
  max-width: 460px;
  border-radius: 20px;
  padding: 1.35rem 1.5rem 1.05rem;
  border: 1px solid rgba(75, 157, 255, 0.22);
  background: linear-gradient(168deg, #1c2638 0%, #151f2e 42%, #121a28 100%);
  box-shadow:
    0 28px 96px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 48px rgba(75, 157, 255, 0.09);
}

.modal.panel.modal-elevated::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(90deg, var(--accent), #8b6bff);
}

.modal.panel.modal-elevated h3 {
  margin: 0 0 0.2rem;
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f5f8fc;
}

.modal.panel.modal-elevated .modal-lead {
  margin: 0.35rem 0 0.85rem;
  line-height: 1.55;
}

.modal-pill {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.22rem 0.7rem;
  border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid rgba(75, 157, 255, 0.38);
  color: #f0f5fc;
  font-weight: 650;
  font-size: 0.88rem;
}

.modal-model-readonly {
  margin: 0 0 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.modal.panel.modal-elevated.modal-upload-fw {
  max-width: 520px;
}

.modal.panel.modal-elevated.modal-edit-model {
  max-width: 480px;
}

.modal.panel.modal-elevated.modal-edit-user {
  max-width: 560px;
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.85rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal-primary-wide {
  min-width: 7.75rem;
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  }

  .sidebar-brand {
    flex: 1;
    min-width: 200px;
    border-bottom: none;
    padding: 1rem 1rem;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 2;
    padding: 0.5rem;
    gap: 0.25rem;
  }

  .nav-item {
    width: auto;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
  }

  .nav-item.active {
    box-shadow: inset 0 -3px 0 var(--accent);
  }

  .sidebar-footer {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem 1rem;
  }

  .nav-logout {
    width: auto;
    margin-left: auto;
  }

  .main-area {
    padding: 1.25rem 1rem 2rem;
  }
}

.audit-toolbar,
.customer-reg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.customer-reg-toolbar .badge {
  margin-left: 0.25rem;
}

.customer-mail-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.customer-mail-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text, #e8ecf0);
}

.customer-mail-form input[type='text'],
.customer-mail-form textarea {
  width: 100%;
  max-width: 40rem;
  box-sizing: border-box;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: var(--input-bg, rgba(0, 0, 0, 0.25));
  color: var(--text, #e8ecf0);
  font: inherit;
}

.customer-mail-form textarea {
  resize: vertical;
  min-height: 7rem;
  line-height: 1.45;
}

.customer-mail-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.customers-th-check,
.customers-td-check {
  width: 2.25rem;
  text-align: center;
  vertical-align: middle;
}

.customers-th-check input,
.customers-td-check input {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.audit-detail-cell {
  max-width: 28rem;
  vertical-align: top;
}

.audit-detail-pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 5.5rem;
  overflow: auto;
  color: var(--muted);
}
