:root {
  --bg: #fff;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --fill: #f5f5f7;
  --canvas: #fff;
  --radius: 16px;
  --radius-control: 999px;
  --accent: #0066cc;
  --accent-press: #0055aa;
  --accent-soft: #e8f2ff;
  --ok: #1b7f4a;
  --ok-bg: #e8f6ee;
  --no: #c62828;
  --no-bg: #fdecea;
  --info: #0066cc;
  --info-bg: #e8f2ff;
  --danger: #c62828;
  --header-h: 70px;
  --page-pad-x: 20px;
  --page-pad-y: 16px;
  --row-h: 60px;
  --head-h: 52px;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #d2d2d7 transparent;
}

::selection {
  background: #d6e8fa;
  color: var(--fg);
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", sans-serif;
  font-size: 18px;
  line-height: 1.5;
  height: 100%;
}

html:has(body.is-app) {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

h1,
h2,
h3 {
  font-weight: 500;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 36px;
  line-height: 1.2;
  margin: 0;
}

h2 {
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 12px;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

.page-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 28px 28px;
  box-shadow: none;
}

.auth-mark {
  display: block;
  font-size: 12px;
  letter-spacing: 0.18em;
  font-weight: 600;
  margin-bottom: 28px;
}

.auth-card h1 {
  margin-bottom: 28px;
}

.auth-card .lead {
  color: var(--muted);
  margin: 0 0 28px;
  font-size: 14px;
}

.auth-card form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

input,
select,
textarea {
  border: 1px solid var(--line);
  background: #fff;
  padding: 11px 14px;
  min-height: 44px;
  outline: none;
  border-radius: var(--radius);
}

label input,
label select,
label textarea {
  width: 100%;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  caret-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 10px 16px;
  min-height: 44px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  font-weight: 600;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  transition: transform 140ms ease, background-color 140ms ease, filter 140ms ease;
}

.btn:hover {
  background: var(--accent-press);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 14px;
  gap: 6px;
}

.btn-block {
  width: 100%;
}

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
  box-shadow: none;
}

.btn-soft:hover {
  background: #d6e8ff;
  color: var(--accent-press);
}

.btn-ghost {
  background: var(--fill);
  color: var(--fg);
  border-color: transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--fill);
  color: var(--fg);
}

.btn-danger {
  background: var(--no);
  color: #fff;
  border-color: transparent;
}

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

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-control);
  padding: 6px 10px;
  min-height: 32px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 160ms ease, filter 160ms ease;
}

.btn-text:hover {
  background: var(--fill);
}

.btn-text:active:not(:disabled) {
  filter: brightness(0.96);
}

.btn-icon {
  width: 16px;
  height: 16px;
  flex: none;
  pointer-events: none;
}

.btn-icon-only {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  gap: 0;
  font-size: 0;
}

.btn-icon-only .btn-icon {
  width: 18px;
  height: 18px;
}

.btn-sm .btn-icon,
.btn-text .btn-icon {
  width: 15px;
  height: 15px;
}

.btn-icon-only.btn-sm .btn-icon {
  width: 18px;
  height: 18px;
}

.btn[disabled],
.btn-text:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.form-error {
  color: var(--no);
  font-size: 14px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--line);
  height: var(--header-h);
  flex: none;
}

.nav-inner {
  width: 100%;
  margin: 0;
  height: var(--header-h);
  padding: 0 var(--page-pad-x);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  letter-spacing: 0.12em;
  font-weight: 600;
  cursor: default;
}

.brand-sep {
  color: var(--line);
  letter-spacing: 0;
}

.brand-sub {
  letter-spacing: 0.18em;
  font-weight: 500;
}

.nav-links {
  display: flex;
  gap: 20px;
  min-width: 0;
  overflow-x: auto;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-control);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 160ms ease, color 160ms ease, filter 160ms ease;
}

.nav-links a .btn-icon {
  width: 16px;
  height: 16px;
}

.nav-links a:hover {
  background: var(--fill);
}

.nav-links a:active {
  filter: brightness(0.96);
}

.nav-links a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
}

.nav-user-name {
  font-weight: 500;
}

.nav-user-meta {
  color: var(--muted);
}

body.is-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: var(--page-pad-y) var(--page-pad-x) 28px;
}

body.is-app main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  padding-bottom: var(--page-pad-y);
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  min-height: 44px;
  flex: none;
}

.page-head p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  flex: none;
}

.stat {
  background: var(--bg);
  padding: 20px 18px;
}

.stat-value {
  font-size: 28px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.list-tools {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 16px;
  min-height: 56px;
  flex: none;
}

.list-tools > :first-child {
  border-top-left-radius: 15px;
  border-bottom-left-radius: 15px;
}

.list-tools > :last-child {
  border-top-right-radius: 15px;
  border-bottom-right-radius: 15px;
}

.tool-search {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 14px;
  border-right: 1px solid var(--line);
}

.tool-icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--muted);
}

.tool-search:focus-within .tool-icon {
  color: var(--fg);
}

.list-tools .tool-search input.search,
.perm-col-tools .tool-search input.search,
.tool-search input {
  border: 0;
  background: transparent;
  min-height: 52px;
  padding: 0;
  width: 100%;
  outline: none;
  box-shadow: none;
}

.tool-search input:focus,
.tool-select select:focus {
  outline: none;
}

.tool-search:focus-within,
.tool-select:focus-within {
  background: var(--fill);
}

.tool-clear {
  display: none;
  flex: none;
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

.tool-search.has-value .tool-clear {
  display: grid;
  place-items: center;
}

.tool-clear:hover {
  color: var(--fg);
}

.tool-select {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 118px;
  padding: 7px 34px 7px 14px;
  border-right: 1px solid var(--line);
}

.tool-select:last-child {
  border-right: 0;
}

.col-menu {
  position: relative;
  flex: none;
  display: flex;
  align-items: stretch;
  margin-left: auto;
  border-left: 1px solid var(--line);
  z-index: 20;
}

.col-menu-btn {
  border: 0;
  background: transparent;
  padding: 0 18px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.col-menu-btn:hover {
  background: var(--fill);
  color: var(--fg);
}

.col-menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 8px;
  z-index: 20;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgb(28 28 30 / 0.1);
  padding: 6px;
  overflow: hidden;
}

.col-menu-pop label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 15px;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.col-menu-pop label:hover {
  background: var(--fill);
}

.col-menu-pop input {
  width: 16px;
  height: 16px;
  min-height: 0;
  border-radius: 6px;
  accent-color: var(--accent);
}

.tool-select:has(select.field-hidden) {
  display: none;
}

.tool-caption {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
}

.tool-select select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  min-height: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

.tool-select::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--fg);
  border-bottom: 1.5px solid var(--fg);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.search {
  width: 260px;
  max-width: 100%;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  width: 100%;
}

body.is-app main > .table-wrap,
body.is-app main > .table-split {
  flex: 1;
  min-height: 0;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  margin-top: 12px;
  min-height: 44px;
}

.pager-info {
  color: var(--muted);
  font-size: 14px;
}

.pager-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.is-app .table-wrap thead th {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 18px;
}

.table-split {
  display: flex;
  align-items: stretch;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  border: 0;
  overflow: hidden;
  background: transparent;
}

.table-split table {
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg);
}

.table-split .table-wrap {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
  min-width: 0;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 16px 0 0 16px;
  overflow: auto;
  background: #fff;
}

.table-actions-pane {
  flex: none;
  width: 112px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 0 16px 16px 0;
  overflow: hidden;
  background: #fff;
}

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

.table-split thead th,
.table-split tbody td {
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
}

.table-split thead th {
  height: var(--head-h);
  max-height: var(--head-h);
  overflow: hidden;
  white-space: nowrap;
}

.table-split tbody td {
  height: var(--row-h);
  max-height: var(--row-h);
}

.table-split tbody tr:last-child td {
  border-bottom: 1px solid var(--line);
}

.actions-table thead th {
  position: relative;
  z-index: 2;
  background: var(--bg);
  text-align: center;
}

.table-actions-pane thead {
  background: var(--bg);
}

.actions-table td {
  text-align: center;
  padding-left: 10px;
  padding-right: 10px;
}

.actions-table .row-actions {
  justify-content: center;
  flex-wrap: nowrap;
}

.js-cols {
  table-layout: fixed;
}

.js-cols thead th[data-col] {
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  padding-right: 52px;
}

.js-cols thead th[data-col].is-sort-asc,
.js-cols thead th[data-col].is-sort-desc {
  color: var(--info);
  background: var(--info-bg);
}

.th-sort {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
  opacity: 0.35;
  pointer-events: none;
}

.th-sort::before {
  content: "↕";
}

.js-cols thead th[data-col]:hover .th-sort {
  opacity: 0.7;
}

.js-cols thead th.is-sort-asc .th-sort,
.js-cols thead th.is-sort-desc .th-sort {
  opacity: 1;
  color: var(--info);
}

.js-cols thead th.is-sort-asc .th-sort::before {
  content: "▲";
}

.js-cols thead th.is-sort-desc .th-sort::before {
  content: "▼";
}

.th-clear {
  display: none;
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--info);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.js-cols thead th.is-sort-asc .th-clear,
.js-cols thead th.is-sort-desc .th-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.th-clear:hover {
  background: #fff;
}

.col-sort-clear {
  display: flex;
  width: 100%;
  margin: 0 0 6px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.col-sort-clear:disabled {
  color: var(--muted);
  cursor: default;
}

.col-sort-clear:not(:disabled):hover {
  background: var(--fill);
}

.js-cols thead th[data-col]::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 0;
  bottom: 10px;
  width: 2px;
  background: var(--line);
  pointer-events: none;
}

.js-cols thead th[data-col].is-dragging {
  opacity: 0.4;
}

.js-cols thead th[data-col].is-drop-left {
  box-shadow: inset 3px 0 0 var(--info);
}

.js-cols thead th[data-col].is-drop-right {
  box-shadow: inset -3px 0 0 var(--info);
}

.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
  touch-action: none;
}

.col-resizer:hover,
.col-resizer:active {
  background: rgb(21 101 192 / 0.18);
}

.js-cols td:not(.col-actions) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th,
td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
}

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

tbody tr:hover td:not(.is-locked) {
  background: var(--fill);
}

tbody tr.is-disabled td,
.actions-table tbody tr.is-disabled td {
  background: #f7f2f2;
  color: var(--muted);
}

tbody tr.is-disabled:hover td {
  background: #f0e6e6;
}

.name-off {
  text-decoration: line-through;
  text-decoration-color: var(--no);
}

.off-flag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: var(--radius-control);
  background: var(--no);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  vertical-align: middle;
}

tbody tr.is-selected td,
tbody tr.is-selected:hover td {
  background: var(--info-bg);
}

.tag {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 2px 9px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tag-ok {
  color: var(--ok);
  border-color: var(--ok);
  background: var(--ok-bg);
}

.tag-no {
  color: #fff;
  border-color: var(--no);
  background: var(--no);
  font-weight: 700;
}

.tag-info {
  color: var(--info);
  border-color: var(--info);
  background: var(--info-bg);
}

.tag-muted {
  border-color: var(--line);
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  white-space: nowrap;
}

.people-table td[data-col="name"] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.people-table th[data-col="name"] {
  width: 20%;
}

.people-table th[data-col="username"],
.people-table .col-user {
  width: 28%;
}

.people-table th[data-col="grade"],
.people-table .col-role {
  width: 120px;
}

.people-table.is-customers [data-col="grade"] {
  display: none;
}

.people-table th[data-col="status"],
.people-table .col-status {
  width: 92px;
}

.people-table th[data-col="created"],
.people-table th[data-col="updated"],
.people-table .col-time {
  width: 168px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.logs-table th[data-col="at"],
.logs-table td[data-col="at"] {
  width: 196px;
}

.logs-table th[data-col="actor"],
.logs-table td[data-col="actor"] {
  width: 180px;
}

.col-actions {
  width: 168px;
  text-align: right;
}

.col-no {
  width: 72px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
}

table[data-cols="catalog-products"] th[data-col="code"] {
  width: 140px;
}

table[data-cols="catalog-products"] th[data-col="status"] {
  width: 92px;
}

table[data-cols="catalog-products"] th[data-col="actions"] {
  width: 96px;
}

table[data-cols="catalog-features"] th[data-col="no"] {
  width: 72px;
}

table[data-cols="catalog-features"] th[data-col="group"] {
  width: 16%;
}

table[data-cols="catalog-features"] th[data-col="code"] {
  width: 140px;
}

table[data-cols="catalog-features"] th[data-col="default"] {
  width: 88px;
}

.col-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

#view-catalog .grid-2 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 20px;
}

.product-list {
  display: grid;
  gap: 16px;
}

.product-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 24px;
  align-items: start;
}

.product-block h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.feature-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  grid-column: 1 / -1;
}

.feature-list li {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.feature-code {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--muted);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  width: min(480px, calc(100% - 32px));
  background: #fff;
  box-shadow: 0 16px 40px rgb(28 28 30 / 0.16);
}

dialog.dialog-wide {
  width: min(840px, calc(100% - 32px));
}

dialog.confirm-dialog {
  position: fixed;
  z-index: 300;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.confirm-message {
  margin: 0;
  color: var(--fg);
  font-size: 16px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.scope-hint {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.scope-dialog .dialog-body {
  gap: 16px;
}

.scope-dialog-head {
  display: grid;
  gap: 12px;
}

.scope-dialog-head h1 {
  margin: 0;
}

.scope-summary {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--fill);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--fg);
}

.scope-tabs {
  display: flex;
  gap: 0;
  border-bottom: 0;
}

.scope-tab {
  border: 0;
  background: transparent;
  padding: 10px 16px;
  margin-bottom: -1px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.scope-tab.is-active {
  color: var(--info);
  border-bottom: 2px solid var(--info);
  font-weight: 600;
}

.scope-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-control);
  background: var(--info-bg);
  color: var(--info);
  font-size: 12px;
  font-weight: 700;
}

.scope-panel {
  min-height: 280px;
  max-height: min(56vh, 520px);
  overflow: auto;
}

.scope-pane {
  display: grid;
  gap: 14px;
  padding-top: 4px;
}

.scope-pane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.scope-pane-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  max-width: 420px;
}

.scope-all-note {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  color: var(--muted);
  font-size: 14px;
  background: var(--fill);
}

.scope-all-note.is-compact {
  padding: 10px 12px;
}

.scope-seg {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--fill);
}

.scope-seg button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  -webkit-tap-highlight-color: transparent;
  transition: background-color 160ms ease, color 160ms ease, filter 160ms ease;
}

.scope-seg button:active {
  filter: brightness(0.96);
}

.scope-seg button.is-active {
  background: #fff;
  color: var(--fg);
  box-shadow: none;
}

.scope-checklist {
  display: grid;
  gap: 10px;
}

.scope-check-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.scope-check-tools .scope-search {
  flex: 1;
  min-width: 180px;
}

.scope-check-count {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

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

.scope-check-list {
  border: 1px solid var(--line);
  max-height: min(42vh, 380px);
  overflow: auto;
  background: var(--bg);
}

.scope-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.scope-check-item:last-child {
  border-bottom: 0;
}

.scope-check-item:hover {
  background: var(--fill);
}

.scope-check-item input {
  width: 18px;
  height: 18px;
  min-height: 0;
  flex: none;
}

.scope-check-label {
  min-width: 0;
  line-height: 1.35;
}

.scope-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 12px;
}

.scope-search {
  width: 100%;
}

.scope-product-list {
  display: grid;
  gap: 10px;
}

.scope-product-extra {
  border: 1px solid var(--line);
  padding: 12px 14px;
  display: grid;
  gap: 10px;
  background: var(--bg);
}

.scope-product-extra-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
}

dialog::backdrop {
  background: rgb(15 40 80 / 0.38);
}

.dialog-body h1 {
  color: var(--info);
}

.dialog-body {
  padding: 24px;
  display: grid;
  gap: 14px;
}

.dialog-body input:disabled {
  background: var(--fill);
  color: var(--muted);
  cursor: default;
}

.password-panel {
  display: grid;
  gap: 14px;
}

#btn-reset-password,
.password-panel > .btn {
  justify-self: start;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

dialog.record-dialog {
  width: min(640px, calc(100% - 32px));
}

.record-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
  margin: 0;
  padding: 10px 12px;
  background: var(--fill);
  border: 1px solid var(--line);
  font-size: 14px;
}

.record-meta div {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.record-meta span {
  color: var(--muted);
  flex: none;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

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

.field-help {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.matrix-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.ums-matrix-wrap {
  background: var(--bg);
}

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

.matrix th {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 6;
}

.matrix thead tr:nth-child(2) th {
  top: 52px;
}

.matrix th.rw {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

.matrix .corner,
.matrix .user-col,
.matrix .feat-cell {
  position: sticky;
  left: 0;
  background: var(--bg);
  z-index: 3;
}

.matrix .corner {
  z-index: 8;
}

.matrix thead .feat-cell {
  z-index: 8;
}

.matrix .product-head {
  text-align: center;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
  background: var(--fill);
}

.matrix th.mod-split,
.matrix td.mod-split {
  border-left: 2px solid rgb(21 101 192 / 0.35);
}

.ums-matrix {
  border-collapse: separate;
  border-spacing: 0;
}

.ums-matrix thead {
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--bg);
}

.ums-matrix tbody {
  position: relative;
  z-index: 0;
}

.ums-matrix thead tr.ums-mod-row th {
  height: var(--head-h);
  padding-top: 0;
  padding-bottom: 0;
  vertical-align: middle;
}

.ums-matrix thead tr.ums-feat-row th {
  height: 44px;
  top: auto;
  padding-top: 0;
  padding-bottom: 0;
  vertical-align: middle;
}

.ums-matrix tbody tr:nth-child(even):not(.is-locked-grade):not(.is-locked-row) td:not(.is-locked) {
  background: #f8fafc;
}

#ums-extra-matrix tbody tr:nth-child(even):not(.is-locked-row) td:not(.is-locked) {
  background: transparent;
}

#ums-extra-matrix tbody.ums-person-block:nth-of-type(even) td:not(.is-locked) {
  background: #f8fafc;
}

.ums-matrix tbody tr:not(.is-locked-row):not(.is-locked-grade):hover td:not(.is-locked) {
  background: var(--info-bg);
}

#ums-extra-matrix tbody.ums-person-block:not(.is-locked-row):hover td:not(.is-locked) {
  background: var(--info-bg);
}

.ums-matrix .mod-head {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.ums-matrix .mod-head--people { background: #e3f2fd; }
.ums-matrix .mod-head--customers { background: #e8f5e9; }
.ums-matrix .mod-head--ums { background: #fff3e0; }
.ums-matrix .mod-head--catalog { background: #eceff1; }
.ums-matrix .mod-head--software { background: #ede7f6; }
.ums-matrix .mod-head--logs { background: #fce4ec; }

.ums-matrix .ums-feat-head {
  font-size: 12px;
  padding-top: 8px;
  padding-bottom: 8px;
  background: var(--bg);
}

.ums-matrix .ums-corner,
.ums-matrix .ums-person-cell,
.ums-matrix .ums-grade-cell {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg);
  background-clip: border-box;
  box-shadow: 6px 0 8px -8px rgb(28 28 30 / 0.35);
}

.ums-matrix thead th {
  position: relative;
  top: auto;
  z-index: 2;
  background-clip: border-box;
  box-shadow: 0 1px 0 var(--fg);
}

.ums-matrix thead .ums-corner {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 3;
  height: calc(var(--head-h) + 44px);
  vertical-align: middle;
  background: var(--bg);
  box-shadow: 6px 0 8px -8px rgb(28 28 30 / 0.35), 0 1px 0 var(--line);
}

#ums-extra-matrix tbody.ums-person-block:nth-of-type(even) .ums-person-cell,
#ums-grade-matrix tbody tr:nth-child(even):not(.is-locked-grade) .ums-grade-cell {
  background: #f8fafc;
}

#ums-extra-matrix tbody.ums-person-block:not(.is-locked-row):hover .ums-person-cell,
#ums-grade-matrix tbody tr:not(.is-locked-grade):hover .ums-grade-cell {
  background: var(--info-bg);
}

#ums-grade-matrix,
#ums-extra-matrix {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
}

#ums-grade-matrix th.rw,
#ums-grade-matrix td.rw-cell,
#ums-extra-matrix th.rw,
#ums-extra-matrix td.rw-cell {
  min-width: 52px;
  width: 52px;
  max-width: none;
  white-space: nowrap;
  vertical-align: middle;
  padding-top: 10px;
  padding-bottom: 10px;
}

#ums-extra-matrix td.rw-cell {
  vertical-align: top;
}

#ums-extra-matrix tbody.ums-person-block td {
  border-bottom: 1px solid var(--line);
}

#ums-extra-matrix tbody.ums-person-block:last-of-type td {
  border-bottom: 0;
}

.ums-matrix .rw-check {
  min-height: 22px;
}

.ums-matrix .rw-check input {
  width: 18px;
  height: 18px;
  background-size: 12px 12px;
}

#ums-grade-matrix .ums-grade-cell,
#ums-grade-matrix thead .feat-cell,
#ums-extra-matrix .ums-person-cell,
#ums-extra-matrix thead .feat-cell {
  text-align: left;
  min-width: 280px;
  width: 280px;
  max-width: 280px;
  vertical-align: middle;
  padding-top: 10px;
  padding-bottom: 10px;
}

#ums-extra-matrix .ums-person-cell {
  vertical-align: top;
}

.ums-grade-badge {
  display: grid;
  gap: 4px;
  padding: 4px 2px;
}

.ums-grade-badge.is-locked {
  opacity: 0.92;
}

.ums-grade-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 15px;
}

.ums-grade-note {
  color: var(--muted);
  font-size: 12px;
}

.ums-person {
  display: grid;
  gap: 8px;
  padding: 0;
}

.ums-person-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.ums-person-no {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  padding-top: 2px;
}

.ums-person-main {
  min-width: 0;
  flex: 1;
}

.ums-person-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ums-person-name {
  font-weight: 700;
  font-size: 15px;
}

.ums-person-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.ums-extra-hint {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 72rem;
}

.rw-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 100%;
}

#ums-extra-matrix .rw-stack {
  display: grid;
  grid-template-rows: 22px 18px;
  justify-items: center;
  align-items: center;
  justify-content: unset;
  min-height: 0;
  gap: 4px;
}

#ums-extra-matrix .rw-check {
  min-height: 22px;
  height: 22px;
}

.ums-mod-scope-slot {
  min-height: 18px;
  height: 18px;
  line-height: 1.2;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ums-scope-cell {
  text-align: center;
  vertical-align: top;
  padding: 0 6px 10px;
  border-top: 0;
}

.ums-mod-scope {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.ums-mod-scope:hover,
.ums-mod-scope.is-limited {
  color: var(--fg);
}

.ums-scope-default {
  color: var(--muted);
  font-size: 12px;
}

.ums-scope-link {
  border: 0;
  background: transparent;
  color: var(--info);
  font-size: 13px;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ums-scope-link:hover {
  color: var(--fg);
}

#ums-grade-matrix tr.is-locked-grade td,
#ums-grade-matrix tr.is-locked-grade .ums-grade-cell {
  background: repeating-linear-gradient(-45deg, #fafafa, #fafafa 5px, #ececec 5px, #ececec 6px);
}

.matrix td {
  text-align: center;
}

.matrix td.user-col {
  text-align: center;
}

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

.product-shell-bar {
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.product-shell-bar .code {
  letter-spacing: 0.28em;
  font-size: 12px;
  font-weight: 600;
}

.notice {
  border: 1px solid var(--info);
  border-radius: 12px;
  background: var(--info-bg);
  color: var(--info);
  padding: 16px 18px;
  margin-bottom: 20px;
  font-size: 14px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  overflow: visible;
  gap: 8px;
  border-bottom: 0;
  margin-bottom: 16px;
  flex: none;
}

.tabs button {
  background: transparent;
  border: 0;
  border-radius: var(--radius-control);
  padding: 8px 14px;
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted);
  -webkit-tap-highlight-color: transparent;
  transition: background-color 160ms ease, color 160ms ease, filter 160ms ease;
}

.tabs button:hover {
  background: var(--fill);
  color: var(--fg);
}

.tabs button:active {
  filter: brightness(0.96);
}

.tabs button.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.stack {
  display: grid;
  gap: 28px;
}

.source {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0 6px;
  margin-left: 8px;
}

.override-select {
  min-width: 120px;
}

.effective-on {
  font-weight: 600;
  color: var(--ok);
}

.matrix td.is-locked,
.ums-matrix td.is-locked,
.ums-matrix tbody tr:nth-child(even) td.is-locked,
.ums-matrix tbody tr.is-disabled td.is-locked,
#ums-extra-matrix tbody tr.is-disabled td.is-locked,
.ums-matrix tbody tr.is-locked-row td,
.ums-matrix tbody tr.is-locked-row td.ums-person-cell,
#ums-extra-matrix tbody tr.is-locked-row td.ums-person-cell,
#ums-extra-matrix tbody.is-locked-row td,
#ums-extra-matrix tbody.is-locked-row td.ums-person-cell {
  background: repeating-linear-gradient(-45deg, #fafafa, #fafafa 5px, #ececec 5px, #ececec 6px);
}

.matrix th.is-locked-head {
  background: #f3f3f3;
}

.rw-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.rw-icon {
  width: 16px;
  height: 16px;
}

.role-head {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.head-lock {
  width: 14px;
  height: 14px;
}

.rw-cell {
  padding: 0;
  text-align: center;
}

.rw-check {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin: 0;
  cursor: pointer;
}

.rw-check input {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1.5px solid #c7c7cc;
  background: #fff;
  border-radius: 6px;
  accent-color: var(--accent);
}

.rw-check input:checked {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M2.2 6.2l2.6 2.6 5-5.4'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
}

.rw-check input:disabled {
  opacity: 0.45;
}

.rw-cell.is-locked .rw-check {
  cursor: default;
}

.lucide {
  width: 16px;
  height: 16px;
  display: block;
  flex: none;
}

.matrix .group-row td {
  text-align: left;
  background: var(--fill);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.matrix th.is-sortable {
  cursor: pointer;
  user-select: none;
}

.matrix th.is-sort-asc .rw-head::after,
.matrix th.is-sort-desc .rw-head::after,
.matrix th.feat-cell.is-sort-asc::after,
.matrix th.feat-cell.is-sort-desc::after,
.matrix th.rw.is-sort-asc::after,
.matrix th.rw.is-sort-desc::after {
  content: "▲";
  display: block;
  font-size: 10px;
  color: var(--info);
  letter-spacing: 0;
  text-transform: none;
}

.matrix th.is-sort-desc .rw-head::after,
.matrix th.feat-cell.is-sort-desc::after,
.matrix th.rw.is-sort-desc::after {
  content: "▼";
}

.matrix .feat-cell {
  text-align: left;
  width: 240px;
  min-width: 220px;
  max-width: 320px;
}

#ums-extra-matrix th.rw.is-sort-asc::after,
#ums-extra-matrix th.rw.is-sort-desc::after {
  display: inline;
  margin-left: 4px;
}

#ums-extra-matrix tbody.is-disabled td:not(.is-locked),
#ums-extra-matrix tbody.is-disabled td.ums-person-cell {
  background: #f7f2f2;
}

#ums-extra-matrix tbody.is-disabled:hover td:not(.is-locked),
#ums-extra-matrix tbody.is-disabled:hover td.ums-person-cell {
  background: #f0e6e6;
}

.scope-tag {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--info);
  color: var(--info);
  background: var(--info-bg);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 2px 12px;
  text-align: left;
  white-space: nowrap;
}

.person-name {
  font-weight: 600;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.person-meta {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.mod-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 2px;
}

.mod-cell .feat-no,
.feat-cell .feat-no {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.matrix .feat-code {
  display: block;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: none;
  font-weight: 400;
}

.lock-note {
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
}

.field-hidden {
  display: none;
}

.page-head p {
  max-width: none;
}

.overview {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  overflow: auto;
  flex: 1;
}

.overview-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.overview-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 92px;
  background: var(--bg);
}

.overview-card:hover {
  background: var(--fill);
}

.overview-icon {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--info-bg);
  color: var(--info);
  display: flex;
  align-items: center;
  justify-content: center;
}

.overview-icon .lucide {
  width: 20px;
  height: 20px;
}

.overview-chevron {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.overview-card h2 {
  text-transform: none;
  letter-spacing: -0.02em;
  font-size: 18px;
  margin: 0 0 4px;
}

.overview-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.latest-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.latest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 0;
}

.latest-head h2 {
  margin: 0;
}

.latest-list {
  list-style: none;
  margin: 0;
  padding: 8px 0 10px;
}

.latest-list li {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
}

.latest-kind {
  display: inline-flex;
  justify-content: center;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.latest-kind.is-product {
  border-color: var(--info);
  color: var(--info);
  background: var(--info-bg);
}

.latest-kind.is-feature {
  color: var(--fg);
}

.latest-title {
  font-weight: 600;
}

.latest-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.latest-time {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.latest-empty {
  padding: 18px 20px 20px;
  color: var(--muted);
}

#latest-dialog-list {
  max-height: 60vh;
  overflow: auto;
  margin: 0 -8px;
}

#latest-dialog-list .latest-list {
  padding: 0;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  min-height: 240px;
  background: var(--bg);
}

.chart-card h2 {
  margin: 0 0 14px;
}

.chart-card-wide {
  grid-column: 1 / -1;
}

.donut-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
}

.donut-chart {
  position: relative;
  width: 168px;
  height: 168px;
}

.donut-svg {
  width: 168px;
  height: 168px;
  display: block;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-center strong {
  font-size: 28px;
  letter-spacing: -0.04em;
  font-weight: 600;
  line-height: 1;
}

.donut-center span {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.chart-legend li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 15px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-control);
}

.hbar-list {
  display: grid;
  gap: 12px;
}

.hbar-row {
  display: grid;
  grid-template-columns: minmax(72px, 28%) 1fr 48px;
  gap: 10px;
  align-items: center;
}

.hbar-label {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hbar-track {
  height: 14px;
  background: var(--fill);
  border: 0;
  border-radius: var(--radius-control);
  overflow: hidden;
}

.hbar-fill {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: var(--radius-control);
}

.hbar-value {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  text-align: right;
  color: var(--muted);
}

.modules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.modules-single {
  grid-template-columns: 1fr;
}

.module {
  background: var(--bg);
  padding: 28px 28px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
}

.module:hover {
  background: var(--fill);
}

.module h2 {
  text-transform: none;
  letter-spacing: -0.03em;
  font-size: 26px;
  margin: 0;
}

.module p {
  margin: 0;
  color: var(--muted);
  flex: 1;
}

.perm-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.perm-layout-3 {
  display: flex;
  grid-template-columns: none;
  min-height: 0;
  flex: 1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.pane-resizer {
  flex: none;
  width: 7px;
  margin: 0 -3px;
  cursor: col-resize;
  position: relative;
  z-index: 3;
  background: transparent;
}

.pane-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 1px;
  background: var(--line);
}

.pane-resizer:hover::before,
.pane-resizer:active::before {
  left: 2px;
  width: 3px;
  background: var(--info);
}

#view-software:not([hidden]),
#view-ums:not([hidden]),
#view-catalog:not([hidden]),
#ums-defaults:not([hidden]),
#ums-extras:not([hidden]) {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#view-catalog .grid-2 {
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

#view-catalog .grid-2 > section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#view-catalog .catalog-split {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

#view-catalog .catalog-split > [data-pane] {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

#view-catalog .catalog-split > [data-pane="projects"] {
  flex: 0 0 46%;
  width: 46%;
  min-width: 480px;
}

#view-catalog .catalog-split > [data-pane="features"] {
  flex: 1 1 auto;
  min-width: 360px;
}

#view-catalog .catalog-split > .pane-resizer {
  width: 16px;
  margin: 0;
  background: transparent;
}

#view-catalog .catalog-split > .pane-resizer::before {
  left: 7px;
  width: 1px;
  background: var(--line);
}

#view-catalog .catalog-split > .pane-resizer:hover::before,
#view-catalog .catalog-split > .pane-resizer:active::before {
  left: 6px;
  width: 3px;
  background: var(--info);
}

#view-catalog .table-wrap,
#view-catalog .table-split {
  flex: 1;
  min-height: 0;
}

#view-catalog .table-actions-pane {
  width: 112px;
}

.perm-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 0;
}

.perm-col[data-pane="projects"] {
  flex: 0 0 200px;
  width: 200px;
  min-width: 140px;
}

.perm-col[data-pane="people"] {
  flex: 0 0 260px;
  width: 260px;
  min-width: 160px;
}

.perm-col-main {
  flex: 1 1 auto;
  min-width: 280px;
}

.perm-layout-3 > .perm-col:last-child,
.perm-layout-3 > .perm-people:last-child,
.perm-layout-3 > .perm-detail:last-child {
  border-right: 0;
}

.perm-col-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 14px;
  letter-spacing: 0.12em;
  border-bottom: 1px solid var(--line);
  background: var(--fill);
}

.perm-col-head > span {
  flex: none;
}

.search-inline {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 15px;
}

.search-inline:focus {
  outline: 2px solid var(--info);
  outline-offset: 0;
  border-color: var(--info);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.chip-row button {
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  padding: 6px 12px;
  min-height: 32px;
  font-size: 14px;
  line-height: 1.3;
  color: var(--muted);
  -webkit-tap-highlight-color: transparent;
  transition: background-color 160ms ease, color 160ms ease, filter 160ms ease;
}

.chip-row button:hover {
  background: var(--fill);
  color: var(--fg);
}

.chip-row button:active {
  filter: brightness(0.96);
}

.chip-row button.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.chip-sep {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  margin: 0 2px;
}

.grant-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 12px;
  margin: 0 0 4px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.grant-bar {
  align-items: flex-start;
  flex-wrap: wrap;
}

.grant-bar-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  flex: 1 1 280px;
}

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

.grant-bar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.grant-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.grant-closed-note {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--no);
  border-radius: 12px;
  background: var(--no-bg);
  color: var(--no);
  font-size: 14px;
}

.grant-person-status {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--info);
}

.grant-person-status.is-custom {
  color: #8a5a00;
}

.grant-person-status.is-off {
  color: var(--no);
}

.feat-flag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 0 6px;
  min-height: 18px;
  border: 1px solid var(--info);
  background: var(--info-bg);
  color: var(--info);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#grants-title {
  margin: 0;
  font-size: 20px;
}

.grant-open {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 12px;
  border: 1.5px solid var(--no);
  background: var(--no-bg);
  color: var(--no);
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  font-weight: 600;
  user-select: none;
  flex: none;
}

.grant-open.is-on {
  background: var(--ok);
  color: #fff;
  border-color: var(--ok);
}

.perm-col-tools {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.perm-col-tools .tool-search {
  border-right: 0;
  border-bottom: 1px solid var(--line);
}

.perm-col-tools .tool-search input.search {
  min-height: 44px;
}

.perm-col-tools .tool-select {
  border-right: 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.perm-col-tools .tool-select:last-child {
  border-bottom: 0;
}

.perm-empty {
  padding: 12px 14px;
  color: var(--muted);
}

.perm-people {
  border-right: 1px solid var(--line);
  overflow: auto;
  min-height: 0;
}

.grant-default-card {
  display: block;
  width: calc(100% - 16px);
  margin: 10px 8px 6px;
  text-align: left;
  border: 1px solid var(--accent) !important;
  border-bottom: 1px solid var(--accent) !important;
  border-radius: 12px;
  background: var(--info-bg) !important;
  padding: 14px 14px 12px !important;
  box-shadow: none;
}

.perm-people > button.grant-default-card.is-active {
  box-shadow: none;
}

.grant-default-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--info);
}

.grant-default-title {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
}

.grant-default-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.grant-people-label {
  padding: 10px 14px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.perm-col > .perm-people {
  border-right: 0;
  flex: 1;
}

.perm-col-main > .perm-detail {
  flex: 1;
  overflow: hidden;
}

.perm-person-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}

.perm-person-row.is-active,
.perm-people > button.is-active {
  background: var(--info-bg);
  box-shadow: inset 3px 0 0 var(--info);
}

.perm-person-row.is-disabled {
  background: #f7f2f2;
}

.perm-person-row.is-disabled.is-active {
  background: #f0e6e6;
}

.perm-person-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.name-line,
.account-kind,
.me-mark,
.kind-mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.me-mark,
.kind-mark {
  flex: none;
  color: var(--accent);
}

.account-kind {
  color: var(--muted);
}

.perm-person-name > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.perm-people button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 12px 14px;
}

.perm-person-row .perm-person {
  flex: 1;
  min-width: 0;
  border-bottom: 0;
  font-weight: 400;
}

.perm-person-row.is-active .perm-person {
  font-weight: 600;
}

.perm-people > button.is-active {
  font-weight: 600;
}

.perm-person-body {
  min-width: 0;
}

.perm-person-body > div:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.perm-person-row.is-closed .perm-person-body {
  color: var(--muted);
}

.perm-person-row.is-closed.is-active .perm-person-body {
  color: inherit;
}

.perm-people .open-tag {
  display: inline-flex;
  align-items: center;
  align-self: center;
  flex: none;
  width: auto;
  margin: 0 8px 0 0;
  padding: 4px 8px;
  border: 1px solid var(--ok);
  background: var(--ok);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
}

.perm-people .open-tag.is-off {
  background: var(--no-bg);
  color: var(--no);
  border-color: var(--no);
  font-weight: 600;
}

.perm-group-label {
  padding: 10px 14px 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--fill);
}

.perm-detail {
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#grants-form {
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

#grants-form:not([hidden]) {
  display: flex;
}

#grant-group-chips {
  flex: none;
}

#grant-groups {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 340px));
  justify-content: start;
  align-content: start;
  gap: 14px;
  padding: 12px 0 8px;
}

.grant-empty-note {
  grid-column: 1 / -1;
  margin: 8px 0 0;
}

.perm-product {
  margin-bottom: 32px;
}

.perm-product > h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

.perm-product > h3 .feat-code {
  display: inline;
  margin-left: 8px;
}

.perm-subgroup {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.perm-group-actions {
  display: flex;
  gap: 10px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.perm-group-actions .btn-text {
  font-size: 14px;
  padding: 6px 12px;
}

.perm-group-actions button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.perm-group {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.perm-group h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.perm-checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.perm-checks label,
.perm-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  min-height: 48px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 16px;
  color: var(--fg);
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--fill);
}

.perm-checks label:hover,
.perm-check:hover {
  background: #fff;
}

.perm-checks input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1.5px solid #c7c7cc;
  background: #fff;
  border-radius: 6px;
}

.perm-checks input:checked {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M2.2 6.2l2.6 2.6 5-5.4'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 13px 13px;
}

.perm-checks input:disabled {
  opacity: 0.35;
}

.perm-checks label:has(input:disabled) {
  cursor: default;
}

.perm-check-text {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: 6px;
  min-width: 0;
}

.perm-check-text .feat-no {
  grid-row: 1 / span 2;
  align-self: center;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.perm-check-text .feat-name {
  min-width: 0;
}

.perm-check-text .feat-code {
  grid-column: 2;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}

.feature-value-hint {
  margin: -8px 0 12px;
  font-size: 13px;
  line-height: 1.45;
}

.perm-json {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--fill);
}

.perm-json-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.perm-json .perm-check {
  padding: 0;
  border: 0;
  min-height: 0;
  background: transparent;
}

.perm-json .perm-check:hover {
  background: transparent;
}

.perm-json .perm-check-text {
  flex: 1;
}

.json-input {
  width: 100%;
  min-height: 96px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  resize: vertical;
}

.json-input:disabled {
  opacity: 0.45;
}

.tag-json {
  border-color: #6a1b9a;
  color: #6a1b9a;
  background: #f3e5f5;
}

.tag-type {
  letter-spacing: 0.04em;
  text-transform: none;
  border-color: var(--line);
  color: var(--fg);
  background: var(--fill);
}

.toast-host {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 80;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #2c2c2e;
  color: #fff;
  padding: 12px 10px 12px 16px;
  font-size: 15px;
  line-height: 1.4;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgb(28 28 30 / 0.16);
}

.toast-text {
  flex: 1;
  min-width: 0;
}

.toast-close {
  flex: none;
  width: 28px;
  height: 28px;
  margin: -4px -2px 0 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 22px;
  line-height: 1;
  opacity: 0.88;
}

.toast-close:hover {
  opacity: 1;
  background: rgb(255 255 255 / 0.14);
}

.toast.is-error {
  background: var(--no);
  color: #fff;
  border: 0;
}

.toast.is-out {
  opacity: 0;
  transition: opacity 160ms ease;
}

@media (max-width: 1100px) {
  :root {
    --page-pad-x: 20px;
  }

  .perm-layout-3 {
    flex-direction: column;
  }

  .perm-col[data-pane="projects"],
  .perm-col[data-pane="people"] {
    flex: none;
    width: 100%;
    max-height: 220px;
  }

  .pane-resizer {
    display: none;
  }

  #view-catalog .catalog-split {
    flex-direction: column;
  }

  #view-catalog .catalog-split > [data-pane="projects"] {
    flex: none;
    width: 100%;
    min-width: 0;
    max-height: 280px;
  }

  #view-catalog .catalog-split > [data-pane="features"] {
    min-width: 0;
  }

  .chart-grid,
  .donut-wrap {
    grid-template-columns: 1fr;
  }

  #grant-groups {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (max-width: 820px) {
  .list-tools {
    flex-wrap: wrap;
  }

  .list-tools .tool-search {
    flex: 1 1 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .list-tools .tool-select {
    flex: 1 1 0;
  }

  .modules,
  .grid-2,
  .overview-links {
    grid-template-columns: 1fr;
  }

  .perm-layout-3 {
    flex-direction: column;
  }

  .nav-user-meta {
    display: none;
  }

  .stats,
  .product-block,
  .feature-list li {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 699px) {
  :root {
    --page-pad-x: 14px;
    --header-h: 60px;
  }

  h1 {
    font-size: 24px;
  }

  .perm-layout,
  .perm-layout-3 {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .perm-layout-3 {
    overflow: auto;
  }

  .perm-col {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 280px;
  }

  .perm-col-main {
    max-height: none;
    border-bottom: 0;
    min-height: 280px;
  }

  .perm-people {
    border-right: 0;
  }

  .page-head {
    flex-wrap: wrap;
  }

  .toast-host {
    top: calc(var(--header-h) + 8px);
  }
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.page-dashboard {
  background: #fff;
}

body.page-dashboard .app-header {
  background: #fff;
  border-bottom-color: var(--line);
}

body.page-dashboard main {
  background: transparent;
}

.import-dialog {
  max-height: calc(100vh - 48px);
}

.import-dialog .dialog-body {
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.dash-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  flex: none;
}

.dash-kicker {
  margin: 0 0 8px;
  color: var(--info);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.28em;
}

.dash-hero h1 {
  margin: 0;
  font-size: 28px;
}

.dash-hero p,
.dash-date {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

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

.dash-layout.has-feed {
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
}

.dash-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: none;
}

.dash-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
}

.dash-card-head h2 {
  margin: 0;
  font-size: 16px;
}

.dash-card-head a {
  color: var(--info);
  font-size: 14px;
  text-decoration: none;
}

.dash-card-head a:hover {
  text-decoration: underline;
}

.dash-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dash-layout.has-feed .dash-metrics {
  grid-template-columns: minmax(0, 1fr);
}

.dash-metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 16px;
  align-items: center;
  min-width: 0;
  padding: 16px 20px 18px;
  border-top: 1px solid var(--line);
  border-right: 0;
}

.dash-layout:not(.has-feed) .dash-metric {
  border-top: 0;
  border-right: 1px solid var(--line);
}

.dash-layout:not(.has-feed) .dash-metric:last-child {
  border-right: 0;
}

.dash-metric p,
.dash-metric span,
.dash-metric em {
  grid-column: 1;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
}

.dash-metric p {
  color: var(--fg);
  font-size: 15px;
  font-weight: 600;
}

.dash-metric strong {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.dash-metric em {
  display: block;
  margin-top: 6px;
}

.dash-meter {
  grid-column: 1 / -1;
  height: 6px;
  margin-top: 12px;
  background: var(--fill);
  overflow: hidden;
}

.dash-meter > span {
  display: block;
  height: 100%;
  width: var(--p);
  background: var(--info);
  border-radius: var(--radius-control);
}

.dash-watch {
  border-top: 1px solid var(--line);
}

.dash-people,
.dash-feed ul {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.dash-people li,
.dash-feed li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}

.dash-people strong,
.dash-feed strong {
  display: block;
  font-size: 16px;
}

.dash-people li > div > span,
.dash-feed li > div > span,
.dash-feed time,
.dash-clear,
.dash-more {
  color: var(--muted);
  font-size: 14px;
}

.dash-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.dash-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.dash-tag.is-off {
  color: var(--no);
  border-color: var(--no);
  background: var(--no-bg);
}

.dash-tag.is-closed {
  color: #8a5a00;
  border-color: #e2c48a;
  background: #fff7e8;
}

.dash-clear,
.dash-more {
  margin: 0;
  padding: 14px 20px 16px;
}

.dash-feed li > div {
  min-width: 0;
}

.dash-feed time {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.dash-date {
  margin: 0 0 6px;
  letter-spacing: 0.04em;
}

.dash-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.dash-links .overview-card {
  border-color: var(--line);
  background: #fff;
  box-shadow: none;
}

.dash-links .overview-card:hover {
  border-color: #b9cbe0;
  background: #fff;
}

.overview .stats {
  gap: 12px;
  background: transparent;
  border: 0;
}

.overview .stat {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: none;
  padding: 18px 18px 16px;
}

.overview .stat:nth-child(3n + 2) {
  border-top-color: #1b7f4a;
}

.overview .stat:nth-child(3n) {
  border-top-color: #c47d00;
}

.overview .stat-value {
  font-size: 34px;
  font-weight: 600;
}

.overview .chart-card,
.overview .latest-panel {
  background: #fff;
  border-color: var(--line);
  box-shadow: none;
}

.log-tools {
  flex-wrap: wrap;
  border-color: var(--line);
}

.tool-select.log-date {
  min-width: 158px;
  padding-right: 14px;
}

.tool-select.log-date::after {
  display: none;
}

.tool-select input[type="date"] {
  border: 0;
  min-height: 0;
  padding: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
}

.log-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 10px;
  flex: none;
}

.log-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--muted);
  min-height: 34px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 160ms ease, color 160ms ease, filter 160ms ease;
}

.log-range:hover {
  background: var(--fill);
  color: var(--fg);
}

.log-range:active {
  filter: brightness(0.96);
}

.log-range.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.log-summary {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  flex: none;
}

tbody tr.is-clickable {
  cursor: pointer;
}

.log-action {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: var(--fill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.log-action.is-create { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.log-action.is-update,
.log-action.is-grant { color: var(--info); border-color: var(--info); background: var(--info-bg); }
.log-action.is-delete,
.log-action.is-disable,
.log-action.is-close { color: var(--no); border-color: var(--no); background: var(--no-bg); }
.log-action.is-enable,
.log-action.is-open { color: #1b7f4a; border-color: #1b7f4a; background: var(--ok-bg); }

.log-hit {
  background: #fff3bf;
  color: inherit;
  padding: 0 1px;
}

.log-detail {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
}

.import-dialog {
  width: min(860px, calc(100% - 32px));
}

.import-head,
.import-rules-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.import-rules {
  border: 1px solid var(--line);
  background: var(--fill);
  padding: 12px 14px;
}

.import-rules pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.import-preview {
  margin: 0;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fff;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.5;
}

.import-preview.is-ok {
  border-color: var(--ok);
  background: var(--ok-bg);
}

.import-preview.is-error {
  border-color: var(--no);
  background: var(--no-bg);
  color: var(--no);
}

.json-input::placeholder {
  color: #8b93a0;
}

@media (max-width: 820px) {
  .dash-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .dash-date {
    margin: 0;
  }

  .dash-layout.has-feed,
  .dash-layout:not(.has-feed) .dash-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .dash-layout:not(.has-feed) .dash-metric,
  .dash-metric {
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .dash-layout:not(.has-feed) .dash-metric:first-child {
    border-top: 0;
  }

  .dash-people li,
  .dash-feed li {
    align-items: flex-start;
    flex-direction: column;
  }

  .dash-tags {
    justify-content: flex-start;
  }
}

input,
select,
textarea {
  border-color: var(--line);
  border-radius: var(--radius);
}

.list-tools .tool-search input,
.list-tools .tool-select select,
.tool-select select,
.search-inline {
  border-radius: 0;
}

.search-inline {
  border-radius: var(--radius-control);
}

dialog {
  border-radius: 16px;
  border-top-width: 1px;
  overflow: hidden;
}

.table-wrap,
.dash-card,
.import-rules,
.import-preview {
  border-radius: var(--radius);
}

.dash-meter,
.log-action,
.dash-tag,
.tag {
  border-radius: var(--radius-control);
}

.col-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 10px;
  padding: 0 14px;
  min-height: 36px;
  border-radius: var(--radius-control);
  background: transparent;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 160ms ease, filter 160ms ease;
}

.col-menu-btn:hover {
  background: var(--fill);
}

.col-menu-btn:active {
  filter: brightness(0.96);
}

.scope-tabs {
  gap: 8px;
  border-bottom: 0;
}

.scope-tab {
  border-radius: var(--radius-control);
  background: transparent;
  margin: 0;
  color: var(--muted);
}

.scope-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn-text,
  .tabs button,
  .chip-row button,
  .scope-seg button,
  .log-range,
  .nav-links a,
  .col-menu-btn {
    transition: none;
  }

  .btn:active,
  .btn-text:active,
  .tabs button:active,
  .chip-row button:active,
  .scope-seg button:active,
  .log-range:active,
  .nav-links a:active,
  .col-menu-btn:active {
    transform: none;
  }
}

@media (max-width: 820px) {
  html:has(body.is-app),
  body.is-app {
    height: auto;
    overflow: visible;
  }

  body.is-app {
    min-height: 100%;
  }

  body.is-app main {
    overflow: visible;
    flex: none;
  }

  .app-header,
  .nav-inner {
    height: auto;
  }

  .nav-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand user" "nav nav";
    gap: 8px 12px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .brand { grid-area: brand; }
  .nav-user { grid-area: user; }
  .nav-links {
    grid-area: nav;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-links a {
    font-size: 14px;
    padding: 7px 12px;
  }

  .nav-user {
    gap: 8px;
    min-width: 0;
  }

  .nav-user-name {
    max-width: 34vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
  }

  h1 { font-size: 28px; }

  .page-head,
  .toolbar,
  .toolbar-actions,
  .grant-bar-actions,
  .dialog-actions,
  .import-head,
  .import-rules-head {
    flex-wrap: wrap;
  }

  .page-head .btn,
  .toolbar .btn,
  .dialog-actions .btn {
    min-height: 40px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .btn {
    width: 100%;
  }

  .list-tools {
    border-radius: var(--radius);
  }

  .list-tools .col-menu {
    flex: 1 1 100%;
    margin-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    justify-content: flex-end;
  }

  .log-ranges {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .log-range { flex: none; }

  .matrix-wrap,
  .table-wrap,
  .table-split,
  #view-catalog .catalog-split,
  #view-catalog .catalog-split > [data-pane],
  .perm-layout,
  .perm-layout-3,
  .perm-col,
  .perm-col-main {
    flex: none;
    min-height: auto;
    max-height: none;
    width: 100%;
    min-width: 0;
    overflow: visible;
  }

  .matrix-wrap,
  .table-wrap,
  .table-split .table-wrap {
    overflow: auto;
  }

  .ums-matrix,
  .table-split .js-cols,
  .logs-table {
    min-width: 680px;
  }

  .table-split {
    align-items: stretch;
  }

  .table-actions-pane {
    width: 112px;
    margin-left: 0;
  }

  .actions-table .row-actions {
    gap: 6px;
  }

  .actions-table .btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    gap: 0;
    font-size: 0;
  }

  .actions-table .btn .btn-icon {
    width: 16px;
    height: 16px;
  }

  .form-grid,
  .record-meta {
    grid-template-columns: 1fr;
  }

  dialog,
  dialog.dialog-wide,
  dialog.record-dialog,
  dialog.confirm-dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
  }

  .dialog-body,
  .import-dialog .dialog-body,
  .scope-dialog .dialog-body {
    max-height: calc(100dvh - 16px);
    overflow: auto;
    padding: 16px;
  }

  .pager {
    flex-wrap: wrap;
  }
}
