:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --ink: #1f2b36;
  --muted: #6e7883;
  --line: #d7dde4;
  --primary: #2d3a46;
  --primary-dark: #202a34;
  --accent: #8ea6c8;
  --danger: #a44747;
  --ok: #2f7464;
  --warn: #9b6b2f;
  --radius: 8px;
  font-family: Montserrat, "Helvetica Neue", Arial, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: linear-gradient(135deg, #25313d 0%, #eef1f4 42%, #eef1f4 100%);
  color: var(--ink);
}

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

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: var(--primary);
}

.primary {
  border-color: #dce7f7;
  background: var(--primary);
  color: white;
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  background: var(--surface-2);
}

.danger {
  border-color: #efd2d2;
  background: #fff1f1;
  color: var(--danger);
}

.login-view {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
  gap: 32px;
  align-items: center;
  min-height: 100vh;
  padding: clamp(20px, 6vw, 72px);
  background: #2b3744;
  color: #edf4ff;
}

.login-view.is-hidden {
  display: none;
}

.login-brand {
  max-width: 760px;
}

.login-logo {
  display: block;
  width: min(420px, 82vw);
  margin-bottom: 58px;
  color: #edf4ff;
}

.logo-inline svg {
  display: block;
  width: 100%;
  height: auto;
}

.logo-inline svg path {
  fill: currentColor;
}

.login-brand h1 {
  margin: 0 0 14px;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.95;
  letter-spacing: 0;
}

.login-brand p {
  max-width: 560px;
  color: #b9c6d5;
  font-size: 18px;
  line-height: 1.5;
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 0.95);
  color: var(--ink);
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.22);
}

.login-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.login-card input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
}

.demo-accounts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-top: 8px;
}

.demo-accounts span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.demo-accounts button {
  min-height: 34px;
  padding: 6px;
  background: var(--surface-2);
  font-size: 12px;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}

.app-shell.is-hidden {
  display: none !important;
}

.sidebar {
  display: flex;
  flex-direction: column;
  position: relative;
  gap: 14px;
  padding: 16px;
  border-right: 1px solid #3b4856;
  background: #2b3744;
  color: #edf4ff;
}

.sidebar-toggle {
  align-self: flex-end;
  border-color: #556575;
  background: #2b3744;
  color: #edf4ff;
}

.layout-switcher {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  padding: 3px;
  border: 1px solid #4b5968;
  border-radius: 6px;
  background: #202a34;
}

.layout-option {
  display: grid;
  min-height: 30px;
  place-items: center;
  padding: 4px;
  border-color: transparent;
  border-radius: 4px;
  background: transparent;
  color: #aebdcb;
}

.layout-option:hover {
  border-color: #718292;
  color: #fff;
}

.layout-option.is-active {
  border-color: #dce7f7;
  background: #edf4ff;
  color: #2b3744;
}

.layout-option svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.sidebar-collapsed .sidebar {
  align-items: center;
  padding: 12px 8px;
}

.sidebar-collapsed .user-panel,
.sidebar-collapsed .sync-panel {
  display: none;
}

.sidebar-collapsed .brand {
  display: block;
  width: 40px;
  margin-top: 0;
}

.sidebar-collapsed .brand > div {
  display: none;
}

.sidebar-collapsed .sidebar-logo {
  display: none;
}

.sidebar-collapsed .sidebar-logo-mark {
  display: block;
}

.sidebar-collapsed .nav-tab {
  width: 48px;
  position: relative;
  justify-content: center;
  padding: 10px;
}

.sidebar-collapsed .nav-label {
  display: none;
}

.sidebar-collapsed .nav-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid #2b3744;
  color: white;
  font-size: 10px;
  line-height: 1;
}

.sidebar-collapsed .work-badge {
  color: white;
}

.sidebar-collapsed .revision-badge {
  color: #1f2b36;
}

.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.sidebar-collapsed .layout-switcher {
  grid-template-columns: 1fr;
  width: 40px;
}

.app-shell.menu-top {
  display: block;
}

.menu-top .sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 165px auto minmax(320px, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 70px;
  padding: 9px 16px;
  border-right: 0;
  border-bottom: 1px solid #3b4856;
}

.menu-top .brand {
  display: block;
  width: 155px;
}

.menu-top .brand > div,
.menu-top .sidebar-logo-mark,
.menu-top .sidebar-toggle,
.menu-top .sync-panel,
.menu-top .user-panel > span,
.menu-top .user-panel > small {
  display: none;
}

.menu-top .sidebar-logo {
  display: block;
  width: 155px;
}

.menu-top .layout-switcher {
  width: 78px;
}

.menu-top .nav-tabs {
  display: flex;
  min-width: 0;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.menu-top .nav-tab {
  position: relative;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 7px 9px;
  white-space: nowrap;
}

.menu-top .nav-badge {
  min-width: 19px;
  height: 19px;
  margin-left: 2px;
  font-size: 10px;
}

.menu-top .user-panel {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  white-space: nowrap;
}

.menu-top .user-panel strong {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-top .user-panel button {
  min-height: 34px;
  margin: 0;
  padding: 5px 10px;
}

.menu-top .workspace {
  min-height: calc(100vh - 70px);
  padding-top: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  display: block;
  width: 190px;
  color: #edf4ff;
}

.sidebar-logo-mark {
  display: none;
  width: 40px;
  height: 36px;
  color: #edf4ff;
}

.brand {
  display: grid;
  align-items: start;
  gap: 8px;
}

.brand span,
.user-panel span,
.user-panel small,
.sync-panel,
.topbar p {
  color: var(--muted);
  font-size: 13px;
}

.sidebar .brand span,
.sidebar .user-panel span,
.sidebar .user-panel small,
.sidebar .sync-panel {
  color: #b9c6d5;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  padding: 10px 12px;
  text-align: left;
  border-color: #3b4856;
  background: #344250;
  color: #edf4ff;
}

.nav-icon,
.sidebar-toggle svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.nav-tab.is-active {
  border-color: #dce7f7;
  background: #edf4ff;
  color: #2b3744;
  font-weight: 700;
}

.nav-badge {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  margin-left: 6px;
  border-radius: 999px;
  background: #b73535;
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.nav-badge[hidden] {
  display: none;
}

.work-badge {
  background: #3274b8;
  color: white;
}

.revision-badge {
  background: #d39a24;
  color: #1f2b36;
}

.nav-tab[hidden] {
  display: none !important;
}

.user-panel {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #3b4856;
  border-radius: var(--radius);
  background: #344250;
}

.user-panel button {
  margin-top: 6px;
  border-color: #556575;
  background: #2b3744;
  color: #edf4ff;
}

.role-switcher select,
.filters input,
.filters select,
.form-grid input,
.form-grid select,
.catalog-form-grid input,
.catalog-form-grid select,
.catalog-form-grid textarea,
.items-table input,
.items-table select,
.bulk-panel select,
.items-table textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 8px 10px;
}

input[type="checkbox"] {
  width: 16px !important;
  height: 16px;
  min-height: 16px !important;
  margin: 0;
  padding: 0 !important;
  accent-color: var(--primary);
}

.items-table .row-select,
.items-table #selectAllItems {
  display: block;
  margin: 0 auto;
}

.checkline input[type="checkbox"] {
  flex: 0 0 16px;
}

.sync-panel {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.workspace {
  min-width: 0;
  padding: 22px;
  background: var(--bg);
}

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

.topbar h1 {
  margin: 0 0 4px;
  font-size: 28px;
  letter-spacing: 0;
}

.topbar p {
  margin: 0;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.column-settings-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.column-settings-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.filters,
.bulk-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px 220px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.table-frame {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

.registry-table {
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th + th,
td + td {
  border-left: 1px solid #e2e7eb;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7faf9;
  color: #40504c;
  font-size: 12px;
  text-transform: uppercase;
}

.registry-table th[draggable="true"] {
  position: relative;
  cursor: grab;
  user-select: none;
}

.registry-table th[draggable="true"]:active {
  cursor: grabbing;
}

.registry-table th[draggable="true"] {
  overflow: hidden;
  white-space: normal;
}

.column-header-label {
  display: inline-block;
  max-width: calc(100% - 28px);
  vertical-align: middle;
  overflow-wrap: anywhere;
  white-space: normal;
}

.column-grip {
  width: 14px;
  height: 14px;
  margin-left: 5px;
  vertical-align: middle;
  fill: currentColor;
  opacity: 0.45;
}

.registry-table th[draggable="true"]:hover .column-grip {
  opacity: 1;
}

.registry-column-resize {
  position: absolute;
  top: 5px;
  right: -4px;
  bottom: 5px;
  z-index: 5;
  width: 11px;
  cursor: col-resize;
}

.registry-column-resize::after,
.item-column-resize::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 2px;
  width: 3px;
  height: 20px;
  border-radius: 2px;
  background: #aeb9c4;
  box-shadow: 3px 0 0 #e2e7eb;
  transform: translateY(-50%);
  transition: background 120ms ease, box-shadow 120ms ease;
}

.registry-column-resize::before,
.item-column-resize::before {
  content: "↔";
  position: absolute;
  top: 50%;
  right: -4px;
  z-index: 1;
  width: 14px;
  height: 14px;
  border: 1px solid #b8c2cc;
  border-radius: 3px;
  background: #f7faf9;
  color: #526273;
  font-size: 10px;
  font-weight: 800;
  line-height: 12px;
  text-align: center;
  transform: translateY(-50%);
}

.registry-column-resize:hover::after,
.item-column-resize:hover::after,
.is-resizing-columns .registry-column-resize::after,
.is-resizing-columns .item-column-resize::after {
  background: #3d6288;
  box-shadow: 3px 0 0 #b5c8dc;
}

.registry-column-resize:hover::before,
.item-column-resize:hover::before,
.is-resizing-columns .registry-column-resize::before,
.is-resizing-columns .item-column-resize::before {
  border-color: #3d6288;
  background: #e3edf7;
  color: #284a6c;
}

.registry-filter-row th,
.item-filter-row th {
  top: 38px;
  padding: 4px;
  background: #edf3f1;
}

.registry-column-filter,
.item-column-filter {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 6px;
  background: white;
  color: var(--ink);
  font-size: 11px;
  text-transform: none;
}

.items-table .item-column-filter {
  min-height: 28px;
  padding: 4px 22px 4px 6px;
}

.registry-column-filter:focus,
.item-column-filter:focus {
  border-color: var(--primary);
  outline: 2px solid rgb(31 111 106 / 0.12);
}

tbody tr {
  cursor: pointer;
}

.registry-table tbody tr:nth-child(odd) td,
.items-table tbody tr:nth-child(odd):not(.is-completed-item) td {
  background: #ffffff;
}

.registry-table tbody tr:nth-child(even) td,
.items-table tbody tr:nth-child(even):not(.is-completed-item) td {
  background: #f1f5f7;
}

.registry-table tbody tr:hover td,
.items-table tbody tr:hover td {
  background: #e8f1f2;
}

.registry-table td {
  overflow: hidden;
  line-height: 1.3;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
}

.status {
  display: inline-block;
  max-width: 100%;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.registry-table td[data-column="status"] {
  white-space: nowrap;
}

.registry-table td[data-column="date"] {
  font-size: 13px;
  white-space: nowrap;
}

.registry-table td[data-column="responsible"] .assignee {
  display: inline-block;
  max-width: 100%;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.status.in_progress {
  background: #e6edf7;
  color: #314a6a;
}

.status.needs_revision {
  background: #fff2d9;
  color: var(--warn);
}

.status.done {
  background: #e2f1ed;
  color: var(--ok);
}

.status.sent,
.status.accepted,
.status.revision_requested,
.status.revision_approved {
  background: #edf0f3;
  color: #40504c;
}

.assignee {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.assignee.is-assigned {
  background: #e2f1ed;
  color: var(--ok);
}

.assignee.is-unassigned {
  background: #fff1f1;
  color: var(--danger);
}

.request-form {
  display: grid;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.people-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.person-card {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.person-card span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.person-card strong {
  font-size: 15px;
}

.person-card small {
  color: var(--muted);
  font-size: 13px;
}

.form-grid label,
.bulk-panel label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid input,
.form-grid select {
  min-height: 34px;
  padding: 6px 8px;
}

.form-checkline {
  align-self: end;
  padding-bottom: 10px;
}

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

.items-toolbar {
  min-height: 38px;
  flex-wrap: wrap;
}

.request-total-cost {
  padding: 5px 9px;
  border: 1px solid #c9d7d2;
  border-radius: 5px;
  background: #eaf3f0;
  color: var(--ok);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.items-toolbar div,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.items-frame {
  max-height: none;
}

.items-table {
  width: 100%;
  table-layout: fixed;
}

.item-filter-row th {
  position: static;
  top: auto;
  z-index: auto;
}

.items-table td {
  padding: 4px;
  white-space: normal;
}

.items-table tr.is-completed-item td {
  background: #f0f8f5;
}

.items-table tr.is-completed-item:nth-child(even) td {
  background: #e7f3ef;
}

.items-table tr.is-completed-item:hover td {
  background: #dceee8;
}

.items-table tr.is-completed-item .name-input,
.items-table tr.is-completed-item .spec-input {
  color: var(--ok);
}

.item-group {
  display: inline-flex;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e6edf7;
  color: #314a6a;
  font-size: 11px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.item-group.is-empty {
  background: #eef1f4;
  color: var(--muted);
  font-weight: 500;
}

.item-completed-toggle {
  display: grid;
  place-items: center;
}

.items-table .is-hidden-column {
  display: none;
}

.items-table th:nth-child(1),
.items-table td:nth-child(1) {
  padding-right: 2px;
  padding-left: 2px;
  text-align: center;
}

.items-table th:nth-child(2),
.items-table td:nth-child(2) {
  padding-right: 3px;
  padding-left: 3px;
  text-align: center;
}

.items-table input,
.items-table select {
  min-width: 0;
  min-height: 32px;
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 12px;
}

.average-cost {
  display: flex;
  min-height: 32px;
  align-items: center;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3f6f8;
  color: #40504c;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.items-table .name-input {
  min-width: 0;
}

.items-table .spec-input {
  min-width: 0;
}

.supplier-name-input.is-hidden {
  display: none;
}

.items-table th[data-item-column] {
  position: relative;
  overflow: visible;
  white-space: normal;
}

.item-header-label {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.item-column-resize {
  position: absolute;
  top: 7px;
  right: -3px;
  bottom: 7px;
  z-index: 3;
  width: 11px;
  cursor: col-resize;
}

.is-resizing-columns,
.is-resizing-columns * {
  cursor: col-resize !important;
  user-select: none;
}

.row-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.row-tools button,
.icon-button {
  display: inline-grid;
  width: 30px;
  min-height: 30px;
  place-items: center;
  padding: 0;
}

.row-tools svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.row-tools .delete-row {
  border-color: #efd2d2;
  color: var(--danger);
}

.row-tools button:disabled {
  cursor: default;
  opacity: 0.45;
}

.dashboard-grid,
.split-layout,
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.catalog-panel {
  padding: 0;
  border-radius: 6px;
}

.catalog-panel summary {
  min-height: 42px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.catalog-panel summary::-webkit-details-marker {
  display: none;
}

.catalog-panel summary::before {
  content: "+";
  margin-right: 8px;
  color: var(--muted);
  font-weight: 800;
}

.catalog-panel[open] summary::before {
  content: "-";
}

.catalog-panel .compact-list {
  padding: 0 10px 10px;
}

.export-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.export-columns label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.split-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.catalog-grid {
  grid-template-columns: 1fr;
  gap: 6px;
}

.catalog-panel .panel-head h2 {
  font-size: 15px;
}

.catalog-panel .catalog-add {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
}

.catalog-panel .compact-list {
  gap: 4px;
}

.catalog-panel .compact-item {
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 13px;
}

.catalog-panel .compact-item small {
  font-size: 12px;
}

.permissions-panel {
  margin-bottom: 14px;
}

.muted-note {
  color: var(--muted);
  font-size: 13px;
}

.permissions-grid {
  display: grid;
  grid-template-columns: 150px repeat(5, minmax(130px, 1fr));
  gap: 1px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.permissions-head,
.role-cell,
.permission-cell {
  min-width: 130px;
  padding: 10px;
  background: white;
}

.permissions-head {
  color: #40504c;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.role-cell {
  font-weight: 800;
}

.permission-cell {
  display: grid;
  gap: 7px;
}

.permission-cell label {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 13px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

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

.panel-head h2 {
  margin: 0;
}

.compact-list {
  display: grid;
  gap: 8px;
}

.compact-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius);
  background: #f7faf9;
}

.compact-item-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

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

.catalog-form-grid label,
.object-checks {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-field input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
}

.column-settings-dialog {
  width: min(920px, calc(100vw - 24px));
}

.column-settings-dialog .item-card {
  max-height: min(84vh, 820px);
  overflow: auto;
}

.column-settings-section {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.column-settings-section h3,
.column-role-section h4 {
  margin: 0 0 9px;
  font-size: 15px;
}

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

.column-checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  font-size: 13px;
}

.admin-column-access {
  margin: 6px 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.admin-column-access > summary {
  padding: 11px 12px;
  cursor: pointer;
  font-weight: 800;
}

.admin-column-access > p,
.column-role-section {
  margin-right: 12px;
  margin-left: 12px;
}

.column-role-section {
  margin-bottom: 14px;
  overflow: auto;
}

.column-role-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) repeat(3, 110px);
  gap: 1px;
  min-width: 520px;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  background: var(--line);
}

.column-role-head,
.column-role-name,
.column-role-cell {
  min-height: 34px;
  padding: 7px 8px;
  background: white;
}

.column-role-head {
  background: #edf3f1;
  color: #40504c;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.column-role-name {
  font-size: 12px;
}

.column-role-cell {
  display: grid;
  place-items: center;
}

.column-settings-actions {
  position: sticky;
  bottom: -16px;
  padding: 10px 0 0;
  background: white;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.catalog-form-grid .wide,
.object-checks {
  grid-column: 1 / -1;
}

.object-checks > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.object-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
}

dialog {
  width: min(720px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.28);
}

.item-card {
  padding: 16px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.dialog-head h2 {
  margin: 0;
}

.history {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.history-entry {
  padding: 10px;
  border-left: 3px solid var(--primary);
  background: #f7faf9;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: none;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #17211f;
  color: white;
  box-shadow: 0 12px 30px rgb(0 0 0 / 0.2);
}

.toast.is-visible {
  display: block;
}

@media (max-width: 980px) {
  .login-view {
    grid-template-columns: 1fr;
  }

  .mega-logo {
    margin-bottom: 28px;
  }

  .login-logo {
    margin-bottom: 28px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 4;
    gap: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .menu-top .sidebar {
    grid-template-columns: minmax(130px, 1fr) auto;
    padding: 8px 12px;
  }

  .menu-top .brand {
    grid-column: 1;
    grid-row: 1;
  }

  .menu-top .layout-switcher {
    grid-column: 2;
    grid-row: 1;
  }

  .menu-top .nav-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .menu-top .user-panel {
    display: none;
  }

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

  .nav-tab {
    padding: 9px 7px;
    text-align: center;
  }

  .sync-panel {
    display: none;
  }

  .workspace {
    padding: 14px;
  }

  .topbar,
  .items-toolbar,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .items-toolbar div,
  .form-actions {
    width: 100%;
  }

  .topbar-actions button,
  .items-toolbar button,
  .form-actions button {
    flex: 1;
  }

  .filters,
  .bulk-panel,
  .form-grid,
  .dashboard-grid,
  .split-layout,
  .catalog-grid,
  .catalog-form-grid,
  .object-checks > div,
  .people-details {
    grid-template-columns: 1fr;
  }

  .export-columns {
    grid-template-columns: 1fr;
  }

  .column-checklist {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: 23px;
  }
}
