:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #f8fafb;
  --line: #dfe6e8;
  --line-strong: #c9d4d7;
  --text: #172126;
  --muted: #62717a;
  --primary: #0b7567;
  --primary-strong: #075d53;
  --primary-soft: #e7f4f1;
  --accent: #c77a28;
  --danger: #b83b35;
  --danger-soft: #f9e9e7;
  --shadow: 0 12px 30px rgba(24, 40, 48, 0.08);
  --radius: 8px;
  --header-height: 78px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(23, 33, 38, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(23, 33, 38, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, #f7f9fa 0%, #eef3f4 100%);
  background-size: 32px 32px, 32px 32px, auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(11, 117, 103, 0.22);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
}

.hidden {
  display: none !important;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 1200;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: var(--radius);
  color: #fff;
  background: #13272d;
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-140%);
  transition: transform 0.16s ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: 3px solid rgba(11, 117, 103, 0.28);
  outline-offset: 2px;
}

#adminAppShell > .subtitle,
#adminAppShell > #loginForm,
#adminAppShell > #authMessage,
#adminAppShell > .auth-hint,
.panel-tip,
.auth-hint,
.form-note {
  display: none !important;
}

.admin-shell {
  min-height: 100vh;
}

.shell-header,
.page-shell {
  width: calc(100% - 24px);
  max-width: none;
  margin: 0 12px;
}

.shell-header {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  color: #fff;
  background: #13272d;
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 19px;
  line-height: 1.25;
}

.header-actions,
.panel-head-actions,
.import-actions,
.audit-filter-actions,
.form-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header-actions {
  justify-content: flex-end;
}

.header-status-block {
  width: clamp(180px, 20vw, 280px);
  min-height: 42px;
  gap: 2px;
  padding: 6px 10px;
}

.header-status-block span,
.header-status-block strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-status-block strong {
  font-size: 13px;
  line-height: 1.25;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-strong);
  border: 1px solid rgba(11, 117, 103, 0.16);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.page-shell {
  display: grid;
  grid-template-columns: 204px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding-bottom: 36px;
}

.admin-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: grid;
  gap: 14px;
}

.admin-side-nav {
  position: sticky;
  top: 16px;
  width: 204px;
  max-width: 100%;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-nav-list {
  display: grid;
  gap: 6px;
}

.admin-nav-list a {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #27363d;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.admin-nav-list a:hover,
.admin-nav-list a:focus-visible {
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-color: rgba(11, 117, 103, 0.16);
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar-panel {
  padding: 16px;
}

.search-field,
.status-block,
.audit-filters label,
.chatgpt-config-form label,
.form-grid label,
.password-form label,
.inventory-grid label {
  display: grid;
  gap: 7px;
}

.search-field span,
.status-block span,
.audit-filters span,
.chatgpt-config-form span,
.form-grid span,
.password-form span,
.inventory-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-block {
  min-height: 58px;
  align-content: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.status-block strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  touch-action: manipulation;
}

input::placeholder {
  color: #8a989f;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(11, 117, 103, 0.52);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  min-height: 92px;
  display: grid;
  align-content: space-between;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-card strong {
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.list-panel,
.user-panel,
.audit-panel,
.chatgpt-config-panel,
.import-panel,
.account-panel {
  min-width: 0;
  padding: 14px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.summary-text {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.table-shell {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: auto;
  max-width: 100%;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.table-shell.compact {
  max-height: 430px;
}

.revogrid-table-shell {
  width: 100%;
  min-width: 0;
  height: min(66vh, 720px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.admin-revogrid {
  width: 100%;
  height: 100%;
  color: #1f2d34;
  font-family: Calibri, "Microsoft YaHei", Arial, sans-serif;
  font-size: 12px;
  --revo-grid-primary: #0b7567;
  --revo-grid-primary-transparent: rgba(11, 117, 103, 0.82);
  --revo-grid-header-bg: #f3f7f8;
  --revo-grid-header-color: #34444c;
  --revo-grid-header-border: #d8e2e5;
  --revo-grid-cell-border: #dfe8ea;
  --revo-grid-row-hover: rgba(11, 117, 103, 0.075);
  --revo-grid-focused-bg: rgba(11, 117, 103, 0.08);
  --revo-grid-row-headers-bg: #f3f7f8;
  --revo-grid-row-headers-color: #34444c;
}

.admin-revogrid .rgCell,
.admin-revogrid .rgHeaderCell {
  font-family: Calibri, "Microsoft YaHei", Arial, sans-serif;
  font-size: 12px;
}

.revogrid-row-checkbox {
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
  vertical-align: middle;
}

.revogrid-header-filter {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.revogrid-header-filter-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.revogrid-filter-button {
  position: relative;
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #5d6b72;
  cursor: pointer;
}

.revogrid-filter-button:hover,
.revogrid-header-filter.is-active .revogrid-filter-button {
  border-color: rgba(11, 117, 103, 0.25);
  background: rgba(11, 117, 103, 0.1);
  color: var(--primary-strong);
}

.revogrid-filter-glyph {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
}

.revogrid-filter-glyph::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 0;
  width: 8px;
  height: 5px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid currentColor;
}

.revogrid-filter-glyph::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 5px;
  width: 2px;
  height: 5px;
  border-radius: 1px;
  background: currentColor;
}

.revogrid-color-readonly {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fafb;
  color: var(--muted);
  font-weight: 700;
}

.grid-value-filter-menu {
  position: fixed;
  z-index: 1200;
  width: min(320px, calc(100vw - 16px));
  max-height: min(460px, calc(100vh - 16px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 22px 54px rgba(8, 17, 20, 0.18);
}

.grid-value-filter-title {
  min-width: 0;
  overflow: hidden;
  color: #223139;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-value-filter-search {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font-size: 13px;
}

.grid-value-filter-tools {
  display: flex;
  gap: 8px;
}

.grid-value-filter-tools button {
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #223139;
  background: #f7fafb;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.grid-value-filter-tools button:hover {
  border-color: rgba(11, 117, 103, 0.28);
  background: rgba(11, 117, 103, 0.08);
}

.grid-value-filter-list {
  min-height: 92px;
  max-height: 250px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.grid-value-filter-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 6px;
  color: #223139;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.grid-value-filter-option:hover {
  background: rgba(11, 117, 103, 0.08);
}

.grid-value-filter-option input {
  width: 14px;
  min-height: 14px;
  height: 14px;
  padding: 0;
}

.grid-value-filter-option-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-value-filter-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.grid-value-filter-empty {
  padding: 28px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.grid-value-filter-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.grid-value-filter-footer .compact-btn {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
}

.facilities-panel .table-shell,
.parts-panel .table-shell {
  max-height: 560px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  min-width: 760px;
}

.projects-panel table {
  min-width: max(100%, 1740px);
}

.projects-panel thead th {
  white-space: nowrap;
  overflow-wrap: normal;
}

.projects-panel th:nth-child(2),
.projects-panel td:nth-child(2) {
  width: 112px;
}

.projects-panel th:nth-child(3),
.projects-panel td:nth-child(3) {
  width: 108px;
}

.projects-panel th:nth-child(4),
.projects-panel td:nth-child(4),
.projects-panel th:nth-child(6),
.projects-panel td:nth-child(6),
.projects-panel th:nth-child(9),
.projects-panel td:nth-child(9),
.projects-panel th:nth-child(12),
.projects-panel td:nth-child(12),
.projects-panel th:nth-child(16),
.projects-panel td:nth-child(16) {
  width: 78px;
}

.projects-panel th:nth-child(5),
.projects-panel td:nth-child(5) {
  width: 172px;
}

.projects-panel th:nth-child(7),
.projects-panel td:nth-child(7),
.projects-panel th:nth-child(8),
.projects-panel td:nth-child(8),
.projects-panel th:nth-child(13),
.projects-panel td:nth-child(13) {
  width: 96px;
}

.projects-panel th:nth-child(10),
.projects-panel td:nth-child(10),
.projects-panel th:nth-child(11),
.projects-panel td:nth-child(11),
.projects-panel th:nth-child(15),
.projects-panel td:nth-child(15) {
  width: 90px;
}

.projects-panel th:nth-child(14),
.projects-panel td:nth-child(14) {
  width: 136px;
}

.projects-panel th:nth-child(17),
.projects-panel td:nth-child(17),
.projects-panel th:nth-child(18),
.projects-panel td:nth-child(18) {
  width: 140px;
}

.facilities-panel table {
  min-width: max(100%, 1080px);
}

.parts-panel table {
  min-width: max(100%, 1480px);
}

.audit-panel table {
  min-width: max(100%, 1120px);
}

.audit-panel th:nth-child(1),
.audit-panel td:nth-child(1) {
  width: 180px;
}

.audit-panel th:nth-child(2),
.audit-panel td:nth-child(2) {
  width: 130px;
}

.audit-panel th:nth-child(3),
.audit-panel td:nth-child(3),
.audit-panel th:nth-child(4),
.audit-panel td:nth-child(4),
.audit-panel th:nth-child(5),
.audit-panel td:nth-child(5) {
  width: 128px;
}

.audit-panel th:nth-child(6),
.audit-panel td:nth-child(6) {
  width: 86px;
}

.audit-panel th:nth-child(7),
.audit-panel td:nth-child(7) {
  width: auto;
}

th,
td {
  min-width: 0;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  color: #435159;
  background: #f3f7f8;
  font-size: 12px;
  font-weight: 800;
}

thead tr.table-filter-row th {
  top: 30px;
  z-index: 2;
  padding: 4px 5px;
  background: #fff;
  box-shadow: inset 0 -1px 0 var(--line);
}

.table-filter-row input,
.table-filter-row select {
  min-height: 26px;
  padding: 3px 5px;
  border-radius: 6px;
  font-size: 12px;
}

.date-range-filter {
  display: grid;
  grid-template-columns: minmax(118px, 1fr) minmax(118px, 1fr);
  gap: 6px;
}

.audit-panel .date-range-filter {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.audit-panel .date-range-filter input {
  padding-inline: 4px;
  font-size: 11px;
}

tbody tr:hover {
  background: rgba(11, 117, 103, 0.045);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.detail-cell {
  max-width: none;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
}

.empty-cell {
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
}

.primary-btn,
.secondary-btn,
.danger-btn,
.icon-btn,
.icon-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
}

.primary-btn:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
}

.secondary-btn {
  background: #fff;
  color: #223139;
  border: 1px solid var(--line-strong);
}

.secondary-btn:hover {
  border-color: rgba(11, 117, 103, 0.45);
  color: var(--primary-strong);
  transform: translateY(-1px);
}

.danger-btn {
  background: var(--danger-soft);
  color: var(--danger);
}

.danger-btn:hover {
  background: #f4d5d1;
}

.primary-btn:disabled,
.secondary-btn:disabled,
.danger-btn:disabled,
.icon-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.icon-btn {
  width: 44px;
  padding: 0;
  color: #334047;
  background: #f2f5f6;
  font-size: 24px;
}

.icon-action {
  width: 44px;
  padding: 0;
  color: #223139;
  background: #fff;
  border: 1px solid var(--line-strong);
}

.icon-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action:hover {
  color: var(--primary-strong);
  border-color: rgba(11, 117, 103, 0.45);
  transform: translateY(-1px);
}

.color-swatch {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(8, 17, 20, 0.12);
}

.compact-id {
  max-width: 170px;
  word-break: break-all;
  color: var(--muted);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-row.user-actions {
  flex-wrap: nowrap;
}

.user-action-col {
  width: 116px;
}

.icon-action.danger-icon {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(184, 59, 53, 0.2);
}

.icon-action.danger-icon:hover {
  color: #8f2c27;
  background: #f4d5d1;
  border-color: rgba(184, 59, 53, 0.42);
}

.hidden-import-inputs {
  display: none;
}

.audit-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.audit-filter-actions {
  justify-content: flex-end;
}

.import-summary,
.form-message,
.auth-message {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.form-message:empty,
.import-summary:empty,
.auth-message:empty {
  display: none;
}

.form-message.error,
.auth-message.error {
  color: var(--danger);
}

.settings-panel {
  padding: 16px;
}

.settings-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.settings-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.settings-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid rgba(11, 117, 103, 0.16);
}

.settings-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid rgba(11, 117, 103, 0.16);
  white-space: nowrap;
}

.status-pill:empty {
  display: none;
}

.chatgpt-config-form {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(280px, 0.34fr);
  gap: 14px;
  align-items: start;
}

.config-fields,
.settings-status-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.config-actions {
  justify-content: flex-start;
}

.config-status-card {
  min-height: 74px;
  display: grid;
  gap: 5px;
  align-content: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.config-status-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.config-status-card strong {
  font-size: 13px;
  line-height: 1.35;
  word-break: break-all;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.34fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.profile-identity-block {
  min-height: 108px;
  display: grid;
  gap: 8px;
  align-content: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.profile-identity-block span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-identity-block strong {
  font-size: 16px;
  line-height: 1.4;
  word-break: break-word;
}

.password-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.password-form .form-message,
.password-form .form-actions {
  grid-column: 1 / -1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 17, 20, 0.42);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 26px 70px rgba(8, 17, 20, 0.24);
}

.modal-card.narrow {
  width: min(720px, 100%);
}

.modal-head,
.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.modal-head {
  margin-bottom: 14px;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.form-grid,
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.full-span {
  grid-column: 1 / -1;
}

.checkbox-field {
  align-content: end;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.checkbox-inline input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.checkbox-inline span {
  color: var(--text);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .admin-side-nav {
    position: static;
    width: 100%;
  }

  .admin-nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .content-grid,
  .toolbar-panel {
    grid-template-columns: 1fr;
  }

  .audit-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chatgpt-config-form,
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell-header,
  .page-shell {
    width: calc(100% - 20px);
    margin: 0 10px;
  }

  .shell-header,
  .panel-head,
  .settings-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .header-actions,
  .panel-head-actions {
    justify-content: flex-start;
  }

  .header-status-block {
    width: 100%;
  }

  .stats-grid,
  .audit-filters,
  .chatgpt-config-form,
  .profile-layout,
  .form-grid,
  .password-form {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 78px;
  }

  .modal {
    padding: 12px;
  }

  .modal-card {
    max-height: calc(100vh - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
