.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 28px 18px 20px;
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 20px;
  font-weight: 750;
  min-width: 0;
}
.brand > img {
  object-fit: contain;
}
.brand .theme-toggle {
  margin-left: auto;
}
.company {
  font-size: 12px;
  color: var(--muted);
  padding: 12px 0 30px;
  overflow-wrap: anywhere;
}
nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 5px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 550;
}
nav a:hover {
  background: var(--subtle);
  color: var(--ink);
}
nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--subtle);
  box-shadow: inset 3px 0 var(--accent);
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 24px;
  font-size: 13px;
  border-top: 1px solid var(--line);
}
.sidebar-bottom > div {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.sidebar-bottom > span {
  font-size: 11px;
  display: block;
  color: var(--muted);
  margin: 3px 0 12px;
}
.sidebar-bottom button {
  padding-left: 0;
}
.workspace {
  min-width: 0;
}
.topbar {
  height: 70px;
  border-bottom: 1px solid var(--line);
  padding: 0 36px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
}
.breadcrumb {
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
}
.breadcrumb span {
  margin: 0 10px;
  opacity: 0.5;
}
.breadcrumb strong {
  color: var(--ink);
  font-weight: 500;
}
.connection {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.connection.online:before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #299f70;
  border-radius: 50%;
  margin-right: 7px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}
.page-heading > div {
  min-width: 0;
}
main {
  padding: 32px 36px 48px;
  max-width: 1600px;
  margin: auto;
}
.mobile-only {
  display: none;
}
dialog {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  width: min(920px, calc(100vw - 40px));
  max-height: calc(100dvh - 48px);
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: #091b2677;
  backdrop-filter: blur(2px);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 {
  font-size: 19px;
  overflow-wrap: anywhere;
}
.modal-content {
  padding: 24px 26px;
  overflow: auto;
  max-height: calc(100dvh - 200px);
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 26px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.modal-content > .error:empty {
  display: none;
}
.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}
.quick-actions button {
  min-height: 48px;
  justify-content: flex-start;
  padding: 12px 18px;
}
.quick-actions button img {
  width: 20px;
  height: 20px;
}
.mobile-backdrop {
  display: none;
}
@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  main {
    padding: 28px 24px;
  }
  .topbar {
    padding: 0 24px;
  }
  .stats {
    gap: 16px;
  }
  .stat strong {
    font-size: 20px;
  }
}
@media (max-width: 760px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 245px;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vmax #0006;
  }
  .mobile-only {
    display: inline-flex;
  }
  .topbar {
    padding: 0 16px;
    height: 60px;
  }
  .breadcrumb {
    font-size: 11px;
  }
  .breadcrumb span {
    margin: 0 5px;
  }
  .connection {
    font-size: 10px;
  }
  main {
    padding: 24px 16px 36px;
  }
  h1 {
    font-size: 22px;
  }
  .page-heading {
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 22px;
  }
  .page-heading .actions {
    justify-content: flex-end;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 16px;
    padding: 20px 0;
  }
  .stat strong {
    font-size: 21px;
  }
  .fields,
  .two-columns {
    grid-template-columns: minmax(0, 1fr);
  }
  .column-panel + .column-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 24px 0 0;
  }
  .toolbar {
    gap: 10px;
  }
  .toolbar .search {
    max-width: none;
    min-width: 100%;
  }
  .toolbar label {
    flex: 1;
  }
  .detail-summary {
    gap: 10px;
  }
  .detail-summary strong {
    font-size: 17px;
  }
  .quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .quick-actions button {
    font-size: 12px;
    padding: 12px;
    min-height: 56px;
  }
  .steps {
    gap: 12px;
    font-size: 12px;
  }
  .steps b {
    width: 22px;
    height: 22px;
  }
  dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }
  .modal-header {
    padding: 16px;
  }
  .modal-header h2 {
    font-size: 17px;
  }
  .modal-content {
    padding: 18px 16px;
    max-height: calc(100dvh - 170px);
  }
  .modal-footer {
    padding: 12px 16px;
  }
  .modal-footer button {
    flex: 1;
  }
  .pager {
    justify-content: space-between;
  }
  td,
  th {
    padding: 10px 12px;
  }
  .toast {
    right: 16px;
    bottom: 16px;
  }
  .tabs {
    gap: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
