:root {
  --bg: #f3f6fa;
  --sidebar: #5f83aa;
  --surface: #ffffff;
  --surface-hover: #f5f6f7;
  --line: #e5e6eb;
  --line-strong: #c9cdd4;
  --text: #1f2329;
  --muted: #646a73;
  --muted-light: #8f959e;
  --primary: #5f83aa;
  --primary-dark: #4a719b;
  --primary-soft: #e6eef7;
  --danger: #d83931;
  --danger-soft: #fff0ef;
  --ok: #009a6e;
  --ok-soft: #e7f8f2;
  --pending: #b26b00;
  --pending-soft: #fff5df;
  --focus-ring: rgba(95, 131, 170, 0.28);
  --profile-accent: #2f8dff;
  --sidebar-text: rgba(255, 255, 255, 0.96);
  --sidebar-muted: rgba(233, 242, 251, 0.72);
  --sidebar-faint: rgba(220, 233, 246, 0.58);
  --sidebar-line: rgba(255, 255, 255, 0.18);
  --sidebar-panel: rgba(255, 255, 255, 0.14);
  --sidebar-panel-strong: rgba(255, 255, 255, 0.24);
  --sidebar-search: rgba(59, 93, 130, 0.42);
  --sidebar-search-border: rgba(39, 70, 107, 0.34);
  --topbar: #ffffff;
  --shadow-menu: 0 8px 24px rgba(31, 35, 41, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

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

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

button > svg,
.brand-mark svg,
.page-symbol svg,
.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.user-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--profile-accent);
  font-size: 13px;
}

.sidebar {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid rgba(64, 97, 134, 0.3);
  background: var(--sidebar);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
  padding: 18px 16px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 52px;
  padding: 0 8px 13px;
}

.brand-mark,
.page-symbol {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.brand h1 {
  margin: 0;
  color: var(--sidebar-text);
  font-size: 17px;
  font-weight: 650;
}

.brand p {
  margin: 1px 0 0;
  color: var(--sidebar-muted);
  font-size: 12px;
}

.sidebar-search {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  gap: 10px;
  border: 1px solid var(--sidebar-search-border);
  border-radius: 8px;
  background: var(--sidebar-search);
  color: var(--sidebar-text);
  box-shadow: inset 0 1px 2px rgba(21, 45, 78, 0.18);
  padding: 0 14px;
  text-align: left;
}

.sidebar-search:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(59, 93, 130, 0.5);
  color: #fff;
}

.sidebar-search span {
  flex: 1;
}

.sidebar-search kbd {
  border: 0;
  color: var(--sidebar-muted);
  font-family: inherit;
  font-size: 12px;
}

.nav-label {
  margin: 22px 10px 8px;
  color: var(--sidebar-faint);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  gap: 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  padding: 0 12px;
  text-align: left;
}

.nav-item:hover {
  background: var(--sidebar-panel);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-panel-strong);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nav-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  min-width: 20px;
  height: 20px;
  margin-left: auto;
  border-radius: 10px;
  background: #f54a45;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
}

.nav-badge:empty,
.nav-badge[data-count="0"] {
  display: none;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: var(--sidebar-panel);
  padding: 11px 10px;
}

.sidebar-profile strong,
.sidebar-profile span {
  display: block;
}

.sidebar-profile strong {
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 600;
}

.sidebar-profile span {
  margin-top: 1px;
  color: var(--sidebar-muted);
  font-size: 11px;
}

.main {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  padding: 13px 30px;
}

.page-heading {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.page-symbol {
  width: 38px;
  height: 38px;
  background: var(--primary);
}

.topbar h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
}

.topbar p {
  max-width: 760px;
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.primary-button,
.ghost-button,
.danger-button,
.ok-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 13px;
  white-space: nowrap;
}

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

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

.ghost-button {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--text);
}

.ghost-button:hover {
  border-color: #9da3ac;
  background: var(--surface-hover);
}

.danger-button {
  border-color: #ffd2cf;
  background: var(--danger-soft);
  color: var(--danger);
}

.ok-button {
  border-color: #bfeadd;
  background: var(--ok-soft);
  color: var(--ok);
}

.view {
  display: none;
  min-height: calc(100vh - 78px);
  padding: 22px 30px 40px;
}

.view.active {
  display: block;
}

.identity-status {
  margin: 24px;
  border: 1px solid #d7dce5;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 18px 20px;
}

.identity-status[hidden] {
  display: none;
}

.app-shell:not([data-session-state="ready"]) [data-role="admin"] {
  display: none !important;
}

.app-shell[data-session-state="loading"] .topbar,
.app-shell[data-session-state="loading"] .view,
.app-shell[data-session-state="error"] .topbar,
.app-shell[data-session-state="error"] .view {
  display: none;
}

.app-shell[data-session-state="error"] .identity-status {
  border-left-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.my-requests-overview {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.my-requests-overview strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.my-requests-overview small {
  font-size: 13px;
}

.my-requests-list {
  border-top: 1px solid var(--line);
}

.my-request-row {
  display: grid;
  grid-template-columns: minmax(220px, 2.2fr) minmax(140px, 1.15fr) minmax(145px, 1.2fr) minmax(108px, 0.8fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 88px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  padding: 14px 12px;
}

.my-request-row:hover {
  background: #f7f9fb;
}

.my-request-row:focus {
  outline: 0;
}

.my-request-row:focus-visible {
  position: relative;
  z-index: 1;
  box-shadow: inset 0 0 0 2px var(--primary);
}

.my-request-main,
.my-request-meta,
.my-request-status {
  min-width: 0;
}

.my-request-main strong,
.my-request-main span,
.my-request-meta span,
.my-request-meta strong,
.my-request-status small {
  display: block;
}

.my-request-main strong,
.my-request-meta strong {
  overflow-wrap: anywhere;
}

.my-request-main strong {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 14px;
}

.my-request-main span,
.my-request-meta span,
.my-request-status small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.my-request-meta strong {
  margin-top: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
}

.my-request-status .tag {
  width: max-content;
  max-width: 100%;
}

.my-request-status small {
  margin-top: 5px;
}

.my-request-detail {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.my-request-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.my-request-actions .danger-button {
  min-height: 32px;
  padding: 0 12px;
}

.my-requests-empty {
  display: grid;
  min-height: 180px;
  place-content: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.my-requests-empty strong {
  color: var(--text);
  font-size: 16px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

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

.metric {
  position: relative;
  min-height: 112px;
  overflow: hidden;
  padding: 18px 18px 15px;
}

.metric::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  content: "";
}

.metric:nth-child(2)::after {
  background: #f5a623;
}

.metric:nth-child(3)::after {
  background: #00a870;
}

.metric:nth-child(4)::after {
  background: #7b61ff;
}

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

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 30px;
  font-weight: 650;
  line-height: 1.2;
}

.dashboard-grid,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.request-ui-text-panel {
  max-width: 900px;
}

.request-ui-text-panel .panel-head {
  align-items: flex-start;
}

.request-ui-text-panel .panel-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.request-ui-text-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.request-ui-text-form label {
  display: grid;
  gap: 7px;
}

.request-ui-text-form label.wide,
.request-ui-text-save {
  grid-column: 1 / -1;
}

.request-ui-text-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.request-ui-text-actions .text-button {
  min-height: auto;
  padding: 0;
  color: var(--primary-dark);
}

.request-ui-text-save {
  justify-content: space-between;
  align-items: center;
  margin-top: 0;
}

#requestUiTextStatus {
  margin: 0;
  color: var(--muted);
}

#requestUiTextStatus[data-tone="success"] {
  color: var(--ok);
}

#requestUiTextStatus[data-tone="danger"] {
  color: var(--danger);
}

.settings-tabs {
  display: flex;
  gap: 22px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.settings-tab {
  position: relative;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 2px;
  font-weight: 650;
}

.settings-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: transparent;
  content: "";
}

.settings-tab:hover {
  color: var(--text);
}

.settings-tab.is-active {
  color: var(--primary-dark);
}

.settings-tab.is-active::after {
  background: var(--primary);
}

.integration-settings-panel {
  max-width: 1400px;
}

.integration-settings-head,
.integration-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.integration-settings-head {
  margin-bottom: 18px;
}

.integration-settings-head > div {
  min-width: 0;
}

.integration-settings-head h3,
.integration-section-head h4 {
  margin: 0;
}

.integration-settings-head h3 {
  font-size: 18px;
}

.integration-settings-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.integration-settings-head p[data-tone="success"] {
  color: var(--ok);
}

.integration-settings-head p[data-tone="danger"] {
  color: var(--danger);
}

.integration-source-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.integration-source-row .ghost-button {
  min-height: 42px;
}

.integration-table-selects {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.integration-mapping-wrap {
  margin-top: 18px;
}

.integration-mapping-table {
  min-width: 900px;
  font-size: 13px;
}

.integration-mapping-table tbody th {
  color: var(--text);
  text-align: left;
}

.integration-mapping-table tbody th span,
.integration-mapping-table tbody th small {
  display: block;
}

.integration-mapping-table tbody th small {
  margin-top: 2px;
  color: var(--muted-light);
  font-size: 11px;
  font-weight: 400;
}

.integration-mapping-table select {
  min-width: 220px;
  min-height: 36px;
  background: #fff;
  padding-block: 5px;
}

.integration-role-row th {
  background: #f3f5f7;
  color: #40556b !important;
  font-size: 12px;
}

.integration-requirement {
  color: var(--muted);
  white-space: nowrap;
}

.integration-requirement[data-required="true"] {
  color: var(--danger);
  font-weight: 650;
}

.integration-check-result {
  max-width: 280px;
  color: var(--muted);
}

.integration-check-result[data-tone="passed"] {
  color: var(--ok);
}

.integration-check-result[data-tone="warning"] {
  color: var(--pending);
}

.integration-check-result[data-tone="failed"] {
  color: var(--danger);
}

.integration-action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.primary-button:disabled,
.ghost-button:disabled,
.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.integration-validation,
.integration-history {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.integration-section-head h4 {
  font-size: 15px;
}

.integration-validation-summary,
.integration-empty {
  margin: 10px 0 0;
  color: var(--muted);
}

.integration-validation [data-tone="passed"] {
  color: var(--ok);
}

.integration-validation [data-tone="warning"] {
  color: var(--pending);
}

.integration-validation [data-tone="failed"] {
  color: var(--danger);
}

.integration-validation ul {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
  padding-left: 20px;
}

.integration-history-wrap {
  margin-top: 10px;
}

.integration-history-wrap table {
  min-width: 760px;
}

.integration-active-mark {
  display: inline-block;
  margin-left: 8px;
  color: var(--ok);
  font-size: 12px;
  font-weight: 650;
}

.panel {
  padding: 18px;
}

@media (max-width: 1100px) {
  .integration-table-selects {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 720px) {
  .integration-source-row,
  .integration-table-selects {
    grid-template-columns: minmax(0, 1fr);
  }

  .integration-source-row .ghost-button,
  .integration-action-bar button {
    width: 100%;
  }

  .integration-action-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
}

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

.panel h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.activity-list {
  display: grid;
}

.activity-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.activity-item:first-child {
  padding-top: 2px;
}

.activity-item:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.activity-item strong {
  display: block;
  margin-bottom: 3px;
  font-weight: 600;
}

.activity-item span {
  color: var(--muted);
  font-size: 12px;
}

.flow {
  position: relative;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow li {
  display: flex;
  align-items: center;
  min-height: 34px;
  gap: 10px;
  color: #4e5661;
}

.flow span {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 650;
}

.category-library {
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

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

.category-library-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.category-library-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.archive-source-status {
  color: var(--primary);
  font-weight: 600;
}

.archive-source-status[data-tone="ok"] {
  color: var(--ok);
}

.archive-source-status[data-tone="danger"] {
  color: var(--danger);
}

.text-button {
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--primary);
  padding: 0 8px;
}

.text-button:hover {
  background: var(--primary-soft);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 240px));
  gap: 8px;
}

.category-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  min-width: 0;
  min-height: 70px;
  gap: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px;
  text-align: left;
}

.category-card:hover {
  border-color: #9db7f7;
  background: #f8faff;
}

.category-card.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary);
}

.category-mark {
  display: grid;
  grid-row: 1 / 3;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 6px;
  background: #e8f0ff;
  color: #245bdb;
  font-size: 10px;
  font-weight: 700;
}

.category-card:nth-child(3n + 2) .category-mark {
  background: #e7f8f2;
  color: #00875f;
}

.category-card:nth-child(3n) .category-mark {
  background: #fff3e0;
  color: #a15c00;
}

.category-card strong,
.category-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-card strong {
  font-size: 12px;
  font-weight: 600;
}

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

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(200px, 1.15fr) 140px 160px minmax(200px, 1fr);
  flex: 1;
  gap: 9px;
}

.filter-field {
  min-width: 0;
}

.filter-field.is-hidden {
  display: none;
}

.filter-field span,
label > span {
  display: block;
  margin-bottom: 7px;
  color: #526071;
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d7dce5;
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--text);
  padding: 8px 12px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #b7c3d2;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(95, 131, 170, 0.13);
  outline: 0;
}

input[readonly] {
  background: #f3f6fa;
  color: var(--muted);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-light);
  opacity: 1;
}

select.is-placeholder {
  color: var(--muted-light);
}

select option {
  color: var(--text);
}

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

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

.archive-table-wrap {
  width: 100%;
  max-width: 100%;
  height: clamp(240px, calc(100vh - 270px), 640px);
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

#archiveLibraryTable {
  min-width: 1160px;
  font-size: 14px;
}

#archiveLibraryTable thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f7f8fa;
  box-shadow: inset 0 -1px 0 var(--line);
}

#archiveLibraryTable thead th.archive-action-column {
  z-index: 4;
}

.archive-action-column {
  position: sticky;
  right: 0;
  z-index: 2;
  width: 104px;
  min-width: 104px;
  border-left: 1px solid var(--line);
  background: #f7f8fa;
}

td.archive-action-column {
  z-index: 1;
  background: #fff;
}

tbody tr:hover td.archive-action-column {
  background: #f8faff;
}

.archive-maintain-button {
  min-height: 32px;
  border: 1px solid #b8c4d1;
  border-radius: 6px;
  background: #fff;
  color: #40556b;
  padding: 0 12px;
  font-weight: 650;
}

.archive-maintain-button:hover {
  border-color: #6f8eaa;
  background: #f2f6f9;
  color: #27445f;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f8fa;
  color: #4e5661;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

td {
  background: #fff;
  color: #373c43;
}

tbody tr:hover td {
  background: #f8faff;
}

tbody tr.row-highlight td {
  background: #eef5fc;
  box-shadow: inset 0 1px 0 rgba(95, 131, 170, 0.18), inset 0 -1px 0 rgba(95, 131, 170, 0.18);
}

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

.approval-row {
  cursor: pointer;
}

.approval-row:focus {
  outline: 0;
}

.approval-row:focus-visible td {
  background: #eef5fc;
  box-shadow: inset 0 1px 0 rgba(95, 131, 170, 0.28), inset 0 -1px 0 rgba(95, 131, 170, 0.28);
}

.table-actions {
  min-width: 78px;
  white-space: nowrap;
}

.table-action-button {
  min-height: 30px;
  padding: 0 10px;
}

.table-action-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 4px;
  background: #f0f1f2;
  color: #4e5661;
  padding: 1px 7px;
  font-size: 12px;
  white-space: nowrap;
}

.link-tag {
  color: var(--primary-dark);
  text-decoration: none;
}

.link-tag:hover {
  text-decoration: underline;
}

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

.tag.pending {
  background: var(--pending-soft);
  color: var(--pending);
}

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

#requestView {
  background: #f7f9fc;
}

.form-layout {
  display: grid;
  max-width: 1280px;
  margin: 0 auto;
  gap: 18px;
}

.request-workspace {
  grid-template-columns: minmax(0, 980px);
  align-items: start;
  justify-content: center;
  width: 100%;
  max-width: 980px;
}

.request-main {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.form-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 28px rgba(31, 35, 41, 0.05);
  padding: 20px 22px 22px;
}

.form-panel .panel-head {
  margin-bottom: 16px;
  border-bottom: 1px solid #edf0f5;
  padding-bottom: 12px;
}

.form-panel .panel-head h3 {
  position: relative;
  padding-left: 12px;
}

.form-panel .panel-head h3::before {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--primary);
  content: "";
}

#requestView {
  background: #f7f8fa;
}

.request-category-panel {
  box-shadow: none;
  padding: 14px 18px;
}

.request-category-panel .panel-head {
  margin-bottom: 10px;
  padding-bottom: 9px;
}

.request-category-panel .panel-head h3 {
  font-size: 14px;
}

.request-category-panel .archive-type-options {
  gap: 10px;
}

.request-category-panel .archive-type-option {
  grid-template-columns: 32px minmax(0, 1fr);
  min-height: 68px;
  gap: 2px 10px;
  padding: 10px 13px;
}

.request-category-panel .archive-type-mark {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 10px;
}

.request-category-panel .archive-type-option small {
  font-size: 11px;
}

.initiator-card {
  padding: 22px;
}

.initiator-card .form-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: start;
  min-width: 0;
  width: 100%;
  gap: 18px 24px;
}

.initiator-card .form-grid > label,
.initiator-card .request-subject-field {
  min-width: 0;
  width: 100%;
}

.request-subject-field > label {
  display: block;
  margin-bottom: 7px;
  color: #526071;
  font-size: 13px;
  font-weight: 600;
}

.request-option-status {
  display: flex;
  min-height: 26px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.request-option-status[data-state="ready"] {
  display: none;
}

.request-option-status[data-state="error"] {
  color: var(--danger);
}

.request-option-status .text-button {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 0 4px;
}

.initiator-card #requestSubject {
  min-width: 0;
  width: 100%;
}

.initiator-card .license-choice-field {
  grid-column: 1;
  grid-row: 3;
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-self: stretch;
  background: #fafbfd;
  padding: 16px;
}

.initiator-card .license-choice-grid {
  min-height: 260px;
  max-height: none;
  flex: 1 1 auto;
}

.initiator-card .request-detail-fields {
  grid-column: 2;
  grid-row: 3;
  max-width: none;
  align-self: start;
  gap: 16px;
}

.initiator-card .watermark-field,
.initiator-card .purpose-field,
.initiator-card .approver-field,
.initiator-card .request-form-actions,
.initiator-card .request-submission-status {
  grid-column: 1 / -1;
}

.initiator-card .request-form-actions {
  margin-top: 2px;
}

@media (max-width: 920px) {
  .initiator-card .form-grid {
    grid-template-columns: 1fr;
  }

  .initiator-card .license-choice-field,
  .initiator-card .request-detail-fields {
    grid-column: 1;
    grid-row: auto;
  }
}

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

.request-detail-fields {
  display: grid;
  grid-column: 1 / -1;
  width: 100%;
  max-width: 360px;
  gap: 15px;
}

.license-choice-field {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.license-choice-field legend,
.approver-field > label {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.license-choice-field > small,
.approver-field > small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}

.license-type-search {
  width: 100%;
  margin-bottom: 10px;
}

.license-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 248px;
  gap: 8px;
  overflow: auto;
}

.license-choice {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  min-height: 42px;
  gap: 9px;
  border: 1px solid #e4e8ee;
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
}

.license-choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.license-choice.is-disabled {
  background: #f4f5f7;
  color: var(--muted);
  cursor: not-allowed;
}

.borrow-form-field {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.borrow-form-field legend {
  margin-bottom: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 40px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #f4f5f7;
}

.segmented-control label {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
  cursor: pointer;
}

.segmented-control label + label {
  border-left: 1px solid var(--line-strong);
}

.segmented-control input {
  position: absolute;
  opacity: 0;
}

.segmented-control span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 0 10px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 650;
}

.segmented-control label:has(input:checked) span {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.compact-metrics {
  margin-bottom: 18px;
}

.monitor-log-panel {
  margin-top: 18px;
}

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

.danger-icon {
  color: var(--danger);
}

.maintenance-mode {
  margin: 0 0 18px;
  border: 0;
  padding: 0;
}

.maintenance-mode legend {
  margin-bottom: 8px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 650;
}

.archive-attachments {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.attachment-retry-status {
  margin-top: 10px;
  border: 1px solid #e7ba68;
  border-radius: 6px;
  background: #fff8e8;
  color: #724c0d;
  padding: 10px 12px;
  line-height: 1.5;
}

.archive-attachments-head,
.archive-danger-zone,
.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.archive-attachments-head > div,
.archive-danger-zone > div {
  display: grid;
  gap: 3px;
}

.archive-attachments-head span,
.archive-danger-zone span,
.attachment-item span,
.attachment-empty {
  color: var(--muted);
  font-size: 12px;
}

.attachment-picker {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  cursor: pointer;
  border: 1px solid #b8c4d1;
  border-radius: 6px;
  background: #fff;
  color: #40556b;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 650;
}

.attachment-list,
.pending-attachment-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.attachment-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 9px 10px;
}

.attachment-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-remove {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--danger);
  padding: 4px 6px;
}

.archive-danger-zone {
  margin-top: 18px;
  border: 1px solid #f2c4c0;
  border-radius: 6px;
  background: #fff8f7;
  padding: 12px;
}

@media (max-width: 1180px) {
  #archiveLibraryTable {
    font-size: 13px;
  }
}

@media (max-width: 640px) {
  #archiveLibraryTable {
    font-size: 12px;
  }

  .archive-attachments-head,
  .archive-danger-zone {
    align-items: stretch;
    flex-direction: column;
  }
}

.license-choice input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.license-choice span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.field-empty {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  padding: 10px 2px;
  font-size: 13px;
}

.approver-field {
  position: relative;
  min-width: 0;
}

.approver-field > label {
  display: block;
  margin-bottom: 7px;
}

.approver-results {
  position: absolute;
  z-index: 20;
  top: 70px;
  right: 0;
  left: 0;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-menu);
  padding: 6px;
}

.approver-result {
  display: grid;
  width: 100%;
  min-height: 52px;
  gap: 3px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
  text-align: left;
}

.approver-result:hover,
.approver-result:focus-visible {
  background: var(--primary-soft);
}

.approver-result strong {
  font-size: 14px;
}

.approver-result span {
  color: var(--muted);
  font-size: 12px;
}

.watermark-field textarea {
  min-height: 110px;
  resize: vertical;
}

.watermark-field {
  grid-column: auto;
  width: 100%;
}

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

.archive-type-option {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  min-height: 84px;
  gap: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px 16px;
}

.archive-type-option input {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.archive-type-mark {
  display: grid;
  grid-row: 1 / 3;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
}

.archive-type-option strong,
.archive-type-option small {
  min-width: 0;
  padding-right: 30px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-type-option strong {
  font-size: 14px;
  font-weight: 650;
}

.archive-type-option small {
  color: var(--muted);
  font-size: 12px;
}

.archive-type-option:has(input:checked) {
  border-color: var(--primary);
  background: #f3f6fa;
  box-shadow: 0 0 0 1px var(--primary), 0 10px 22px rgba(95, 131, 170, 0.12);
}

.archive-type-option.is-disabled {
  border-style: dashed;
  background: #f8fafc;
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.72;
}

.archive-type-option.is-disabled .archive-type-mark {
  background: #edf0f5;
  color: #7d8794;
}

.wide,
.purpose-field {
  grid-column: auto;
}

.archive-picker {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 0.55fr);
  gap: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.conditional.is-hidden {
  display: none;
}

.auto-match-note {
  margin-bottom: 12px;
  border: 1px solid rgba(95, 131, 170, 0.2);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  background: #f3f6fa;
  color: #4a6380;
  padding: 13px 14px;
}

.auto-match-note strong {
  display: block;
  margin-bottom: 4px;
  color: #335777;
  font-weight: 650;
}

.auto-match-note p {
  margin: 0;
  line-height: 1.7;
}

.purpose-field {
  display: block;
  width: 100%;
  margin-top: 2px;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.request-form-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}

.request-form-actions button {
  width: 100%;
}

.request-form-actions .primary-button.is-submitted {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
  opacity: 1;
}

.request-submission-status {
  grid-column: 1 / -1;
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.request-submission-status[data-tone="success"] {
  color: var(--ok);
}

.request-submission-status[data-tone="danger"] {
  color: var(--danger);
}

.settings-grid {
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  margin-bottom: 16px;
}

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

.rules-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 18px;
  color: #4e5661;
}

.integration-note {
  margin-bottom: 12px;
  border-left: 3px solid #f5a623;
  border-radius: 4px;
  background: #fff8e8;
  color: #805300;
  padding: 10px 12px;
  line-height: 1.6;
}

.integration-panel pre {
  margin: 0;
  overflow: auto;
  border-radius: 6px;
  background: #25272b;
  color: #f1f2f3;
  padding: 14px;
  font-size: 12px;
}

dialog {
  width: min(720px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-menu);
  padding: 22px;
}

dialog::backdrop {
  background: rgba(31, 35, 41, 0.42);
}

.search-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 52px));
  padding: 0;
  overflow: hidden;
}

.search-dialog-panel {
  display: grid;
  max-height: inherit;
  min-height: 360px;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.search-dialog-head {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.search-dialog-head svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-dialog-head input {
  min-height: 44px;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 17px;
  font-weight: 600;
}

.search-dialog-head input:focus {
  box-shadow: none;
}

.search-dialog-meta {
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  padding: 9px 16px;
  font-size: 12px;
}

.search-results {
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.search-result {
  display: grid;
  width: 100%;
  min-height: 72px;
  gap: 5px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  text-align: left;
}

.search-result:hover,
.search-result:focus-visible {
  background: #f3f6fa;
}

.search-result strong {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.search-result p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.dialog-form h3 {
  margin: 0 0 18px;
  font-size: 18px;
}

.delete-warning {
  margin: 0 0 18px;
  border-left: 3px solid var(--danger);
  border-radius: 4px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 11px 12px;
  line-height: 1.7;
}

.rule-summary {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.rule-summary div {
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  background: #f5f7ff;
  padding: 10px 12px;
}

.request-detail-dialog {
  width: min(540px, calc(100vw - 28px));
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  overflow: hidden;
}

.request-detail-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.request-detail-head {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 18px 22px;
}

.request-detail-head span {
  color: var(--muted);
  font-size: 12px;
}

.request-detail-head h3 {
  margin: 4px 0 0;
  font-size: 20px;
}

.request-detail-head .icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0;
}

.request-detail-head .icon-button:hover {
  border-color: #afbdcc;
  background: #f3f6fa;
}

.request-detail-head .icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.request-detail-content {
  min-height: 0;
  overflow: auto;
  padding: 0 22px 28px;
}

.request-detail-section {
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
}

.request-detail-section:last-child {
  border-bottom: 0;
}

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

.request-detail-section-head h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.request-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
}

.request-detail-field {
  min-width: 0;
}

.request-detail-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.request-detail-value {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.request-detail-field:nth-child(5) {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .my-request-row {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    padding: 16px 0;
  }

  .my-request-meta {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: baseline;
    gap: 8px;
  }

  .my-request-meta strong {
    margin-top: 0;
  }

  .my-request-status {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .my-request-status small {
    margin-top: 0;
  }

  .my-request-detail {
    display: none;
  }

  .my-request-actions {
    justify-content: flex-start;
  }

  .request-detail-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-left: 0;
  }

  .request-detail-head,
  .request-detail-content {
    padding-left: 18px;
    padding-right: 18px;
  }

  .request-detail-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .request-detail-field:nth-child(5) {
    grid-column: auto;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 248px minmax(0, 1fr);
  }

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

  .settings-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  .request-workspace {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    overflow-y: auto;
    border-right: 1px solid rgba(64, 97, 134, 0.3);
    border-bottom: 0;
    padding: 16px 12px 12px;
  }

  .brand {
    min-width: 0;
    padding: 0 6px 12px;
  }

  .brand p {
    display: none;
  }

  .nav {
    display: grid;
    min-width: 0;
    gap: 4px;
  }

  .nav-item {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
  }

  .main {
    overflow: visible;
  }

  .topbar {
    top: 0;
  }

  .dashboard-grid,
  .settings-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

@media (max-width: 640px) {
  .app-shell {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .sidebar {
    height: 100vh;
    max-height: 100vh;
    padding: 12px 8px;
  }

  .brand {
    justify-content: center;
    min-width: 0;
    padding: 0 0 12px;
  }

  .brand > div:last-child {
    display: none;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .nav-item {
    justify-content: center;
    min-height: 38px;
    gap: 0;
    padding: 0;
  }

  .nav-item span {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .nav-badge {
    position: absolute;
    top: 5px;
    right: 7px;
    min-width: 16px;
    height: 16px;
    font-size: 10px;
    line-height: 16px;
  }

  .sidebar-search {
    justify-content: center;
    min-height: 38px;
    padding: 0;
  }

  .sidebar-search span,
  .sidebar-search kbd,
  .nav-label,
  .sidebar-profile div:last-child {
    display: none;
  }

  .sidebar-profile {
    justify-content: center;
    padding: 8px 0;
  }

  .topbar {
    top: 0;
    min-height: 68px;
    padding: 10px 14px;
  }

  .page-symbol {
    display: none;
  }

  .topbar h2 {
    font-size: 18px;
  }

  .topbar p {
    display: none;
  }

  .top-actions .ghost-button span {
    display: none;
  }

  .top-actions .ghost-button {
    width: 36px;
    min-width: 36px;
    padding: 0;
  }

  .view {
    min-height: calc(100vh - 126px);
    padding: 16px 14px 30px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

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

  .metric {
    min-height: 92px;
    padding: 13px;
  }

  .metric strong {
    font-size: 25px;
  }

  .form-grid,
  .archive-picker,
  .license-choice-grid {
    grid-template-columns: 1fr;
  }

  .initiator-card #requestSubject {
    max-width: 100%;
    width: 100%;
  }

  .request-detail-fields {
    max-width: none;
  }

  .archive-type-options {
    grid-template-columns: 1fr;
  }

  .wide,
  .purpose-field {
    grid-column: auto;
  }

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

  .toolbar-actions button,
  .form-actions button {
    width: 100%;
  }

  .request-form-actions {
    grid-template-columns: 1fr;
  }

  .request-ui-text-form {
    grid-template-columns: 1fr;
  }

  .request-ui-text-form label.wide,
  .request-ui-text-save {
    grid-column: auto;
  }

  .panel {
    padding: 14px;
  }

  .form-panel {
    padding: 16px;
  }

  dialog {
    padding: 18px;
  }
}
