/* Ordered legacy cascade part 03; preserve link order. */
/* Resource library refinement: a quiet file catalogue, not a card wall. */
#page-resources .resource-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--ds-border);
  border-bottom: 1px solid var(--ds-border);
}

#page-resources .resource-stats .metric {
  min-height: 94px;
  padding: 16px 18px;
  border: 0;
  border-right: 1px solid var(--ds-border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#page-resources .resource-stats .metric:first-child {
  border-left: 3px solid var(--ds-brand);
  background: var(--ds-brand-soft);
}

#page-resources .resource-stats .metric:last-child {
  border-right: 0;
}

#page-resources .resource-stats .metric strong {
  margin: 4px 0 2px;
  font-size: 25px;
}

#page-resources .resource-recent-section {
  margin-top: 18px;
}

#page-resources .resource-quick-access {
  gap: 0;
  border-top: 1px solid var(--ds-border);
  border-bottom: 1px solid var(--ds-border);
}

#page-resources .resource-quick-card {
  min-height: 74px;
  padding: 11px 14px;
  border: 0;
  border-right: 1px solid var(--ds-border);
  border-radius: 0;
  box-shadow: none;
}

#page-resources .resource-quick-card:last-child {
  border-right: 0;
}

#page-resources .resource-quick-card:hover {
  background: var(--ds-brand-soft);
  box-shadow: none;
  transform: none;
}

#page-resources .resource-file-icon,
#page-resources .resource-card-file-icon {
  width: 42px;
  height: 44px;
  border: 1px solid #e0e4ef;
  border-radius: 8px;
  background: var(--ds-surface-subtle);
  color: var(--ds-brand-strong);
}

#page-resources .resource-library-layout {
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 16px;
  margin-top: 18px;
}

#page-resources .resource-folder-panel,
#page-resources .resource-library-panel {
  border-radius: var(--ds-radius-card);
}

#page-resources .resource-folder-panel {
  padding: 16px;
}

#page-resources .resource-folder-list {
  display: grid;
  gap: 3px;
  margin-top: 8px;
}

#page-resources .resource-folder-item {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ds-text-secondary);
}

#page-resources .resource-folder-item:hover,
#page-resources .resource-folder-item.active,
#page-resources .resource-folder-row.active .resource-folder-item {
  background: var(--ds-brand-soft);
  color: var(--ds-brand-strong);
}

#page-resources .resource-library-panel {
  min-width: 0;
  padding: 18px;
}

#page-resources .resource-view-label {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ds-text-muted);
  padding: 0;
}

#page-resources .resource-toolbar {
  grid-template-columns: minmax(220px, 1.8fr) repeat(4, minmax(110px, .7fr)) auto;
  gap: 12px;
  margin: 14px 0 12px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

#page-resources .resource-toolbar input,
#page-resources .resource-toolbar select,
#page-resources .resource-toolbar button {
  min-height: 40px;
  height: 40px;
  margin: 0;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-control);
  background: var(--ds-surface);
}

#page-resources .resource-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--ds-border);
}

#page-resources .resource-card {
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 6px 13px;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--ds-border);
  border-radius: 0;
  background: transparent;
  padding: 14px 2px;
}

#page-resources .resource-card::before {
  display: none;
}

#page-resources .resource-card:hover {
  background: #fbfcff;
}

#page-resources .resource-card-file-icon {
  grid-row: 1 / span 5;
}

#page-resources .resource-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

#page-resources .resource-card h3 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

#page-resources .resource-meta-row {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#page-resources .resource-summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

#page-resources .resource-details {
  border-top: 1px solid #edf0f5;
  margin-top: 4px;
  padding-top: 6px;
}

#page-resources .resource-details summary {
  color: var(--ds-brand-strong);
  font-size: 12px;
}

#page-resources .resource-tags span,
#page-resources .resource-kind-badge,
#page-resources .resource-status {
  font-size: 10px;
}

#page-resources .resource-favorite-button {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ds-text-faint);
  font-size: 18px;
  line-height: 1;
}

#page-resources .resource-favorite-button.active {
  color: var(--ds-brand);
}

#page-resources .resource-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

#page-resources .resource-card-actions button,
#page-resources .resource-file-actions button {
  min-height: 30px;
  padding: 4px 7px;
  border-color: transparent;
  background: transparent;
  color: var(--ds-brand-strong);
  font-size: 12px;
}

#page-resources .resource-card-actions button:hover,
#page-resources .resource-file-actions button:hover {
  background: var(--ds-brand-soft);
}

#page-resources .resource-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #edf0f5;
}

#page-resources .resource-file-row > div:first-child {
  min-width: 0;
}

#page-resources .resource-file-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#page-resources .resource-file-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
}

#page-resources .resource-updated {
  color: var(--ds-text-faint);
}

.resource-upload-status {
  margin: 8px 0 0;
  color: var(--ds-text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.resource-upload-status[data-state="uploading"] { color: var(--ds-brand-strong); }
.resource-upload-status[data-state="success"] { color: var(--ds-success); }
.resource-upload-status[data-state="warning"] { color: var(--ds-warning); }
.resource-upload-status[data-state="error"] { color: var(--ds-danger); }

@media (max-width: 1180px) {
  #page-resources .resource-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #page-resources .resource-toolbar .search-input {
    grid-column: span 2;
  }

  #page-resources .resource-quick-card:nth-child(2n) {
    border-right: 0;
  }

  #page-resources .resource-quick-card:nth-child(n + 3) {
    border-top: 1px solid var(--ds-border);
  }
}

@media (max-width: 768px) {
  #page-resources .resource-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #page-resources .resource-library-layout {
    grid-template-columns: 1fr;
  }

  #page-resources .resource-folder-panel {
    position: static;
  }

  #page-resources .resource-folder-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #page-resources .resource-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #page-resources .resource-toolbar .search-input {
    grid-column: 1 / -1;
  }

  #page-resources .resource-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  #page-resources .resource-card-head,
  #page-resources .resource-updated {
    grid-column: 2;
  }

  #page-resources .resource-card-actions,
  #page-resources .resource-file-row,
  #page-resources .resource-details,
  #page-resources .resource-tags,
  #page-resources .resource-meta-row,
  #page-resources .resource-summary {
    grid-column: 2;
  }
}

@media (max-width: 430px) {
  #page-resources .resource-toolbar {
    grid-template-columns: 1fr;
  }

  #page-resources .resource-toolbar .search-input {
    grid-column: auto;
  }

  #page-resources .resource-folder-list {
    grid-template-columns: 1fr;
  }

  #page-resources .resource-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
  }

  #page-resources .resource-file-row {
    align-items: flex-start;
    flex-direction: column;
  }
}


#page-automation .automation-capabilities-panel {
  margin-bottom: 16px;
}

#page-automation #automationStats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#page-automation .automation-capabilities-panel > .panel-head {
  align-items: center;
}

#page-automation .automation-connection-status {
  color: var(--ds-text-muted);
  font-size: 11px;
  font-weight: 750;
}

#page-automation .automation-connection-status.ready {
  color: var(--ds-success);
}

#page-automation .automation-connection-status.inactive {
  color: var(--ds-warning);
}

#page-automation .agent-capability-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

#page-automation .agent-capability-card {
  display: grid;
  min-width: 0;
  gap: 9px;
  border-top: 2px solid var(--ds-border-strong);
  background: var(--ds-surface-subtle);
  padding: 14px;
}

#page-automation .agent-capability-card.available {
  border-top-color: var(--ds-brand);
}

#page-automation .agent-capability-card.inactive {
  border-top-color: var(--ds-warning);
}

#page-automation .agent-capability-card header,
#page-automation .agent-capability-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#page-automation .agent-capability-mark,
#page-automation .agent-capability-status,
#page-automation .automation-status-pill,
#page-automation .automation-rule-state,
#page-automation .automation-run-kind {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

#page-automation .agent-capability-mark,
#page-automation .automation-run-kind {
  background: var(--ds-surface-muted);
  color: var(--ds-text-faint);
  letter-spacing: .08em;
}

#page-automation .agent-capability-status.ready,
#page-automation .automation-rule-state.on,
#page-automation .automation-status-pill.applied,
#page-automation .automation-status-pill.approved,
#page-automation .automation-run-status.completed {
  background: var(--ds-success-soft);
  color: var(--ds-success);
}

#page-automation .agent-capability-status.inactive,
#page-automation .automation-rule-state.off,
#page-automation .automation-status-pill.pending,
#page-automation .automation-run-status.running {
  background: var(--ds-brand-soft);
  color: var(--ds-brand-strong);
}

#page-automation .automation-status-pill.rejected,
#page-automation .automation-run-status.failed {
  background: var(--ds-danger-soft);
  color: var(--ds-danger);
}

#page-automation .automation-run-status.drafted {
  background: var(--ds-warning-soft);
  color: var(--ds-warning);
}

#page-automation .automation-run-status.skipped,
#page-automation .automation-status-pill.acknowledged {
  background: var(--ds-surface-muted);
  color: var(--ds-text-muted);
}

#page-automation .agent-capability-card h3 {
  margin: 0;
  color: var(--ds-text);
  font-size: 15px;
}

#page-automation .agent-capability-card p {
  min-height: 48px;
  margin: 0;
  color: var(--ds-text-secondary);
  font-size: 12px;
  line-height: 1.6;
}

#page-automation .agent-capability-card dl,
#page-automation .agent-task-item dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

#page-automation .agent-capability-card dl > div,
#page-automation .agent-task-item dl > div {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 7px;
  min-width: 0;
}

#page-automation .agent-capability-card dt,
#page-automation .agent-task-item dt {
  color: var(--ds-text-faint);
  font-size: 10px;
}

#page-automation .agent-capability-card dd,
#page-automation .agent-task-item dd {
  overflow: hidden;
  margin: 0;
  color: var(--ds-text-secondary);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#page-automation .agent-capability-card footer {
  align-items: flex-end;
  border-top: 1px solid var(--ds-border);
  padding-top: 9px;
}

#page-automation .agent-capability-card footer > span {
  color: var(--ds-text-faint);
  font-size: 10px;
  line-height: 1.4;
}

#page-automation .agent-capability-card footer button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 10px;
}

#page-automation .automation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  align-items: start;
  gap: 16px;
}

#page-automation .automation-rules-panel,
#page-automation .automation-runs-panel {
  grid-column: 1 / -1;
}

#page-automation .automation-rules-panel > .panel-head {
  align-items: center;
}

#page-automation .automation-rules-panel > .panel-head select,
#page-automation .automation-runs-panel > .panel-head select {
  min-width: 140px;
}

#page-automation .automation-rule-list,
#page-automation .automation-run-list,
#page-automation .automation-suggestion-list,
#page-automation .anomaly-report-list,
#page-automation .agent-task-list {
  display: grid;
}

#page-automation .automation-rule-item,
#page-automation .automation-run-item,
#page-automation .automation-suggestion,
#page-automation .anomaly-item,
#page-automation .agent-task-item {
  min-width: 0;
  border-top: 1px solid var(--ds-border);
  padding: 13px 0;
}

#page-automation .automation-rule-item:first-child,
#page-automation .automation-run-item:first-child,
#page-automation .automation-suggestion:first-child,
#page-automation .anomaly-item:first-child,
#page-automation .agent-task-item:first-child {
  border-top: 0;
}

#page-automation .automation-rule-item > header,
#page-automation .automation-rule-item > footer,
#page-automation .automation-suggestion > header,
#page-automation .automation-suggestion > footer,
#page-automation .anomaly-item > header,
#page-automation .anomaly-item > footer,
#page-automation .agent-task-item > header,
#page-automation .agent-task-item > footer,
#page-automation .automation-run-item > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#page-automation .automation-rule-item .toggle-row {
  align-items: flex-start;
  min-width: 0;
}

#page-automation .automation-rule-item .toggle-row span {
  min-width: 0;
}

#page-automation .automation-rule-item .toggle-row strong,
#page-automation .automation-rule-item .toggle-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#page-automation .automation-rule-item .toggle-row strong {
  color: var(--ds-text);
  font-size: 13px;
}

#page-automation .automation-rule-item .toggle-row small {
  margin-top: 3px;
  color: var(--ds-text-muted);
  font-size: 11px;
}

#page-automation .automation-rule-item > header > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

#page-automation .automation-rule-spec {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 11px 0 9px 28px;
}

#page-automation .automation-rule-spec span {
  display: grid;
  gap: 3px;
  color: var(--ds-text-secondary);
  font-size: 11px;
}

#page-automation .automation-rule-spec b {
  color: var(--ds-text-faint);
  font-size: 10px;
  font-weight: 700;
}

#page-automation .automation-rule-item > footer {
  margin-left: 28px;
  color: var(--ds-text-faint);
  font-size: 10px;
}

#page-automation .automation-rule-item > footer strong {
  max-width: 60%;
  overflow: hidden;
  color: var(--ds-text-secondary);
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#page-automation .automation-suggestion > header > span:last-child,
#page-automation .anomaly-item > header > span,
#page-automation .agent-task-item > header > div > span:last-child {
  color: var(--ds-text-faint);
  font-size: 10px;
}

#page-automation .automation-suggestion > strong,
#page-automation .anomaly-item > header > strong,
#page-automation .agent-task-item > header > strong {
  display: block;
  margin-top: 6px;
  color: var(--ds-text);
  font-size: 13px;
}

#page-automation .automation-suggestion > p,
#page-automation .automation-suggestion > small,
#page-automation .anomaly-item > p,
#page-automation .agent-task-item > p,
#page-automation .automation-run-item > p {
  margin: 5px 0 0;
  color: var(--ds-text-secondary);
  font-size: 11px;
  line-height: 1.6;
}

#page-automation .automation-suggestion > small,
#page-automation .automation-run-item > small {
  display: block;
  color: var(--ds-text-faint);
  font-size: 10px;
}

#page-automation .automation-suggestion > footer,
#page-automation .anomaly-item > footer,
#page-automation .agent-task-item > footer {
  justify-content: flex-end;
  margin-top: 9px;
}

#page-automation .automation-suggestion > footer button,
#page-automation .anomaly-item > footer button,
#page-automation .agent-task-item > footer button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 10px;
}

#page-automation .anomaly-item {
  padding-left: 10px;
  border-left: 3px solid var(--ds-border);
}

#page-automation .anomaly-item.attention {
  border-left-color: var(--ds-warning);
  background: var(--ds-warning-soft);
  padding-left: 11px;
}

#page-automation .anomaly-item.risk {
  border-left-color: var(--ds-danger);
  background: var(--ds-danger-soft);
  padding-left: 11px;
}

#page-automation .anomaly-item.info {
  border-left-color: var(--ds-brand);
  background: var(--ds-brand-soft);
  padding-left: 11px;
}

#page-automation .anomaly-item > p b {
  display: inline-block;
  min-width: 38px;
  color: var(--ds-text);
  font-weight: 800;
}

#page-automation .agent-task-item.approved,
#page-automation .agent-task-item.handed_off {
  background: var(--ds-success-soft);
}

#page-automation .agent-task-item.rejected {
  opacity: .68;
}

#page-automation .agent-task-item dl {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
}

#page-automation .agent-task-item dl > div {
  grid-template-columns: 1fr;
  gap: 2px;
}

#page-automation .automation-run-item > header {
  align-items: center;
}

#page-automation .automation-run-item > header > div {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

#page-automation .automation-run-item > header strong {
  overflow: hidden;
  color: var(--ds-text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#page-automation .automation-run-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

#page-automation .automation-run-error {
  margin-top: 7px;
  border-left: 2px solid var(--ds-danger);
  background: var(--ds-danger-soft);
  padding: 7px 9px;
  color: var(--ds-danger);
  font-size: 10px;
  line-height: 1.5;
}

@media (max-width: 1080px) {
  #page-automation #automationStats,
  #page-automation .agent-capability-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  #page-automation .automation-layout {
    grid-template-columns: 1fr;
  }

  #page-automation .automation-rule-spec {
    grid-template-columns: 1fr;
    margin-left: 28px;
  }
}

@media (max-width: 620px) {
  #page-automation #automationStats,
  #page-automation .agent-capability-list {
    grid-template-columns: 1fr;
  }

  #page-automation .agent-capability-card p {
    min-height: 0;
  }

  #page-automation .automation-rule-item > header,
  #page-automation .automation-suggestion > header,
  #page-automation .anomaly-item > header,
  #page-automation .agent-task-item > header,
  #page-automation .automation-run-item > header {
    align-items: stretch;
    flex-direction: column;
  }

  #page-automation .automation-rule-item > header > div {
    justify-content: flex-start;
  }

  #page-automation .automation-rule-spec,
  #page-automation .automation-rule-item > footer {
    margin-left: 0;
  }

  #page-automation .automation-rule-item > footer {
    align-items: flex-start;
    flex-direction: column;
  }

  #page-automation .automation-rule-item > footer strong {
    max-width: 100%;
  }

  #page-automation .agent-task-item dl {
    grid-template-columns: 1fr;
  }

  #page-automation .automation-runs-panel > .panel-head select {
    width: 100%;
  }
}

/* Achievement wall: browse-first archive with isolated management controls. */
#page-honors {
  display: none;
  gap: 24px;
}

#page-honors.active {
  display: grid;
}

.achievement-page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.achievement-page-heading > div:first-child {
  display: grid;
  gap: 5px;
}

.achievement-page-heading .page-heading-note {
  max-width: 680px;
  margin: 0;
  color: var(--ds-text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.achievement-overview {
  display: grid;
  grid-template-columns: minmax(300px, 1.7fr) repeat(3, minmax(150px, 1fr));
  gap: 16px;
}

.achievement-overview article {
  display: grid;
  align-content: center;
  min-height: 132px;
  border: 1px solid #e4e8f2;
  border-radius: 16px;
  background: #fff;
  padding: 20px 22px;
}

.achievement-overview article > span,
.achievement-detail-facts span,
.achievement-story-section > span,
.achievement-sensitive-summary span {
  color: var(--ds-text-muted);
  font-size: 12px;
  font-weight: 700;
}

.achievement-overview article > strong {
  margin: 6px 0 2px;
  color: #2f3564;
  font-size: 28px;
  line-height: 1;
}

.achievement-overview article > p {
  margin: 5px 0 0;
  color: #7c849d;
  font-size: 13px;
}

.achievement-overview .achievement-overview-main {
  border-color: #dcdffd;
  background: linear-gradient(135deg, #f2f3ff, #e9ecff);
}

.achievement-overview .achievement-overview-main > span,
.achievement-overview .achievement-overview-main > strong {
  color: #5c60c7;
}

#page-honors .module-switch {
  width: min(720px, 100%);
  margin: 0;
}

#page-honors .module-switch button {
  min-height: 48px;
}

#page-honors .module-switch button small {
  display: inline-grid;
  min-width: 24px;
  min-height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #eef0f7;
  color: var(--ds-text-muted);
  padding: 0 7px;
}

#page-honors .module-switch button.active small {
  background: #e2e5ff;
  color: #5559bd;
}

.achievement-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.8fr) repeat(4, minmax(120px, 0.8fr)) auto;
  align-items: end;
  gap: 12px;
  padding: 16px 18px;
}

.achievement-toolbar label,
.achievement-batch-bar label,
.achievement-editor-body label {
  display: grid;
  gap: 6px;
  color: #4b526a;
  font-size: 12px;
  font-weight: 700;
}

.achievement-toolbar input,
.achievement-toolbar select,
.achievement-toolbar button,
.achievement-batch-bar select,
.achievement-batch-bar button {
  min-height: 42px;
}

.achievement-batch-bar {
  position: sticky;
  top: 76px;
  z-index: 8;
  display: flex;
  align-items: end;
  gap: 12px;
  border: 1px solid #d7daf9;
  border-radius: 14px;
  background: rgba(245, 246, 255, 0.96);
  padding: 12px 16px;
  box-shadow: 0 10px 24px rgba(62, 68, 139, 0.08);
  backdrop-filter: blur(10px);
}

.achievement-batch-bar > strong {
  align-self: center;
  margin-right: auto;
  color: #5559bd;
}

#honorStatus:empty {
  display: none;
}

#page-honors .honor-wall,
#page-honors .showcase-record-list {
  display: grid;
  min-width: 0;
  gap: 16px;
}

#page-honors .honor-wall.hidden,
#page-honors .showcase-record-list.hidden {
  display: none;
}

#page-honors .honor-section-grid {
  display: grid;
  grid-template-columns: repeat(var(--honor-columns), minmax(min(100%, 280px), 1fr));
  gap: 18px;
}

.achievement-card {
  position: relative;
  min-width: 0;
  overflow: visible;
  border-color: #e3e7f1;
  border-radius: 16px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(42, 48, 76, 0.045);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.achievement-card:hover,
.achievement-card:focus-visible,
.achievement-card:focus-within {
  border-color: #cfd3f8;
  box-shadow: 0 14px 32px rgba(61, 65, 133, 0.11);
  transform: translateY(-2px);
}

.achievement-card:focus-visible {
  outline: 3px solid rgba(101, 105, 209, .28);
  outline-offset: 3px;
}

.achievement-card.is-pinned {
  border-left: 3px solid #696dd3;
}

.achievement-card.is-dragging {
  opacity: .55;
}

.achievement-card.is-managing {
  cursor: grab;
}

.achievement-card .certificate-frame {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-color: #e5e8f0;
  border-radius: 12px;
  background: #f8f9fc;
}

.achievement-card .certificate-preview-btn,
.achievement-card .certificate-image,
.achievement-card .certificate-placeholder {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.achievement-card .certificate-image {
  aspect-ratio: auto;
  object-fit: contain;
}

.certificate-private {
  align-content: center;
  gap: 6px;
  background: linear-gradient(145deg, #f5f6fa, #eceef6);
}

.certificate-private > span {
  color: #7378c9;
  font-size: 26px;
}

.certificate-private > strong {
  color: #4e546b;
}

.certificate-private > small {
  color: #8b91a6;
}

.honor-card-top {
  min-height: 30px;
  justify-content: flex-start;
}

.achievement-kind-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: #eef0ff;
  color: #5c60c7;
  font-weight: 900;
}

.honor-type-pill {
  border-color: #e0e3ec;
  background: #f8f9fb;
}

.achievement-state-badge,
.achievement-featured-badge,
.showcase-story-meta b {
  border-radius: 999px;
  background: #eef0ff;
  color: #5d61c4;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
}

.achievement-state-badge {
  margin-left: auto;
}

.honor-public-info {
  gap: 9px;
  padding: 2px 2px 4px;
}

.honor-public-info > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.achievement-card-date {
  color: #7b8299;
  font-size: 12px;
  font-weight: 700;
}

.honor-public-info h4,
.showcase-story-content h3 {
  overflow: hidden;
  margin: 0;
  color: #292f46;
  font-size: 17px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.honor-public-info > p {
  overflow: hidden;
  margin: 0;
  color: #697187;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.achievement-card-actions {
  position: absolute;
  z-index: 6;
  top: 52px;
  right: 22px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
}

.achievement-card:hover .achievement-card-actions,
.achievement-card:focus-within .achievement-card-actions,
.honor-manage-mode .achievement-card-actions {
  opacity: 1;
  pointer-events: auto;
}

.achievement-card-actions > button,
.achievement-more-menu > summary {
  display: grid;
  min-width: 48px;
  min-height: 38px;
  place-items: center;
  border: 1px solid #dfe2ee;
  border-radius: 10px;
  background: rgba(255, 255, 255, .95);
  color: #4f566e;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 5px 15px rgba(41, 47, 70, .1);
  list-style: none;
}

.achievement-more-menu {
  position: relative;
}

.achievement-more-menu > summary::-webkit-details-marker {
  display: none;
}

.achievement-more-menu > div {
  position: absolute;
  z-index: 9;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: 170px;
  gap: 4px;
  border: 1px solid #e1e4ec;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
  box-shadow: 0 16px 36px rgba(36, 42, 68, .16);
}

.achievement-more-menu > div button {
  justify-content: flex-start;
  min-height: 38px;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.achievement-select-control {
  position: absolute;
  z-index: 7;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  border: 1px solid #dfe2ee;
  border-radius: 10px;
  background: #fff;
  padding: 5px 9px;
  box-shadow: 0 5px 15px rgba(41, 47, 70, .08);
}

.achievement-select-control input {
  width: 18px;
  height: 18px;
}

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

.showcase-record-card {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(220px, 1.2fr);
  gap: 16px;
  padding: 14px;
}

.showcase-story-cover {
  min-width: 0;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  background: #f5f6fb;
}

.showcase-media-item {
  display: grid;
  gap: 7px;
  margin: 0;
}

.showcase-media-item.cover,
.showcase-media-item.cover img,
.showcase-media-item.cover video {
  width: 100%;
  height: 100%;
}

.showcase-media-item.cover img,
.showcase-media-item.cover video {
  object-fit: cover;
}

.showcase-media-item img,
.showcase-media-item video {
  display: block;
  max-width: 100%;
  border-radius: 12px;
  background: #11131b;
}

.showcase-media-item figcaption {
  color: #737a90;
  font-size: 12px;
}

.showcase-private-media,
.showcase-cover-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 180px;
  align-content: center;
  justify-items: center;
  gap: 7px;
  background: linear-gradient(145deg, #f0f1ff, #e8eaf9);
  color: #5e63bf;
  padding: 18px;
  text-align: center;
}

.showcase-cover-placeholder > span {
  font-size: 30px;
}

.showcase-cover-placeholder small,
.showcase-private-media span {
  color: #777e98;
}

.showcase-story-content {
  display: grid;
  align-content: center;
  min-width: 0;
  gap: 10px;
}

.showcase-story-meta,
.showcase-story-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.showcase-story-meta > span,
.showcase-story-facts > span {
  color: #72798f;
  font-size: 12px;
}

.showcase-story-result {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #525a72;
  font-size: 14px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.achievement-detail-drawer {
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 24px);
  margin-left: auto;
  border-radius: 18px 0 0 18px;
}

.achievement-detail-body {
  display: grid;
  gap: 18px;
}

.achievement-detail-hero .certificate-frame {
  overflow: hidden;
  max-height: 440px;
  border-radius: 14px;
  background: #f6f7fb;
}

.achievement-detail-hero .certificate-image {
  max-height: 440px;
  object-fit: contain;
}

.achievement-detail-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.achievement-detail-facts article,
.achievement-sensitive-summary > div {
  display: grid;
  gap: 5px;
  border: 1px solid #e4e7ef;
  border-radius: 12px;
  background: #fafbfc;
  padding: 12px;
}

.achievement-detail-facts strong,
.achievement-sensitive-summary strong {
  overflow-wrap: anywhere;
  color: #30364c;
  font-size: 14px;
}

.achievement-story-section {
  display: grid;
  gap: 7px;
  border-left: 3px solid #d8daf8;
  padding-left: 14px;
}

.achievement-story-section p {
  margin: 0;
  color: #4f566d;
  line-height: 1.75;
  white-space: pre-wrap;
}

.achievement-sensitive-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

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

.showcase-detail-gallery .showcase-media-item:first-child:nth-last-child(odd) {
  grid-column: 1 / -1;
}

.achievement-association-groups {
  display: grid;
  gap: 10px;
}

.achievement-association-groups > div {
  display: grid;
  gap: 7px;
}

.achievement-association-groups p {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
}

.achievement-association-groups p span {
  border-radius: 999px;
  background: #f0f1fb;
  color: #555b85;
  padding: 6px 10px;
}

.achievement-detail-empty {
  display: grid;
  gap: 4px;
  border: 1px dashed #d5d9e5;
  border-radius: 12px;
  color: #7b8298;
  padding: 16px;
}

.achievement-detail-empty strong {
  color: #4a5168;
}

.achievement-editor-modal {
  width: min(940px, calc(100vw - 32px));
}

.achievement-editor-body {
  display: grid;
  gap: 16px;
}

.achievement-editor-body .form-row {
  align-items: start;
}

.achievement-sensitive-fields,
.achievement-link-editor,
.achievement-media-editor {
  display: grid;
  gap: 12px;
  border: 1px solid #e4e7f0;
  border-radius: 14px;
  background: #fafbfe;
  padding: 16px;
}

.achievement-sensitive-fields > div:first-child,
.achievement-link-editor > div:first-child,
.achievement-media-editor > div:first-child {
  display: grid;
  gap: 3px;
}

.achievement-sensitive-fields > div:first-child span,
.achievement-link-editor > div:first-child span,
.achievement-media-editor > div:first-child span {
  color: #747b91;
  font-size: 12px;
}

.showcase-association-grid {
  overflow: visible;
}

.showcase-association-field {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 7px;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}

.showcase-association-label {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.showcase-association-label small {
  color: #8a91a6;
  font-size: 11px;
  font-weight: 600;
}

.showcase-association-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.showcase-multi-select {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 8px;
}

.showcase-multi-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  width: 100%;
  min-height: 44px;
  gap: 7px;
  border: 1px solid #d7dced;
  border-radius: 11px;
  background: #fff;
  color: #263248;
  padding: 0 13px;
  text-align: left;
  box-shadow: 0 1px 2px rgb(16 24 40 / 3%);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.showcase-multi-trigger > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.showcase-multi-trigger:hover:not(:disabled) {
  border-color: #b8c1df;
  background: #fdfdff;
}

.showcase-multi-trigger:focus-visible,
.showcase-multi-select.is-open .showcase-multi-trigger {
  outline: none;
  border-color: #6865e8;
  box-shadow: 0 0 0 3px rgb(104 101 232 / 14%);
}

.showcase-multi-trigger:disabled {
  cursor: not-allowed;
  background: #f5f6fa;
  color: #9299aa;
}

.showcase-multi-count {
  min-width: 25px;
  border-radius: 999px;
  background: #eeefff;
  color: #5552d8;
  padding: 3px 7px;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.showcase-multi-chevron {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  margin: -4px 2px 0 3px;
  transform: rotate(45deg);
  transition: transform 160ms ease, margin 160ms ease;
}

.showcase-multi-select.is-open .showcase-multi-chevron {
  margin-top: 4px;
  transform: rotate(225deg);
}

.showcase-multi-panel {
  position: absolute;
  z-index: 8;
  top: 51px;
  right: 0;
  left: 0;
  max-height: 248px;
  overflow: auto;
  border: 1px solid #d9deed;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
  box-shadow: 0 14px 34px rgb(35 43 77 / 14%);
}

.showcase-multi-panel[hidden] {
  display: none;
}

.showcase-multi-option {
  display: grid !important;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  min-height: 38px;
  gap: 9px !important;
  border-radius: 8px;
  padding: 9px 10px;
  color: #35405a !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  cursor: pointer;
}

.showcase-multi-option:hover {
  background: #f5f6ff;
}

.showcase-multi-option:has(input:focus-visible) {
  outline: 2px solid #7673ea;
  outline-offset: -2px;
}

.showcase-multi-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #605ce4;
}

.showcase-multi-option span {
  line-height: 1.45;
}

.showcase-multi-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.showcase-multi-tags[hidden] {
  display: none;
}

.showcase-multi-tag {
  display: inline-grid;
  grid-template-columns: minmax(0, auto) 20px;
  align-items: center;
  max-width: 100%;
  border: 1px solid #dfe1f6;
  border-radius: 999px;
  background: #f3f3ff;
  color: #4f4ca9;
  padding: 3px 3px 3px 9px;
  font-size: 11px;
  font-weight: 700;
}

.showcase-multi-tag > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.showcase-multi-tag button {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #6f6cab;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.showcase-multi-tag button:hover,
.showcase-multi-tag button:focus-visible {
  background: #dedffd;
  color: #3e3b9a;
  outline: none;
}

.showcase-multi-empty {
  margin: 0;
  color: #8990a3;
  padding: 12px;
  text-align: center;
}

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

.achievement-check-grid .inline-check {
  display: flex;
  min-height: 40px;
  align-items: center;
}

.showcase-media-draft-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.showcase-media-draft-list > article {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid #e2e5ed;
  border-radius: 11px;
  background: #fff;
  padding: 8px;
}

.showcase-media-draft-list img,
.showcase-media-draft-list video {
  width: 64px;
  height: 52px;
  border-radius: 7px;
  object-fit: cover;
  background: #12141d;
}

.showcase-media-draft-list > article > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.showcase-media-draft-list strong,
.showcase-media-draft-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.showcase-media-draft-list span,
.showcase-media-draft-list > p {
  color: #7a8196;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .achievement-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .achievement-search-field {
    grid-column: span 2;
  }

  #page-honors .honor-section-grid,
  .showcase-story-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .showcase-record-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #page-honors {
    gap: 16px;
  }

  .achievement-page-heading,
  .achievement-batch-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .achievement-page-heading .page-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .achievement-page-heading .page-actions .primary {
    grid-column: 1 / -1;
  }

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

  .achievement-overview article {
    min-height: 112px;
    padding: 16px;
  }

  .achievement-overview .achievement-overview-main {
    grid-column: 1 / -1;
  }

  #page-honors .module-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #page-honors .module-switch button {
    min-width: 0;
    padding: 9px 6px;
  }

  .achievement-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .achievement-search-field {
    grid-column: 1 / -1;
  }

  .achievement-toolbar > button {
    grid-column: 1 / -1;
  }

  #page-honors .honor-section-grid,
  .showcase-story-grid,
  .achievement-detail-facts,
  .achievement-sensitive-summary,
  .showcase-detail-gallery {
    grid-template-columns: 1fr;
  }

  .showcase-detail-gallery .showcase-media-item:first-child:nth-last-child(odd) {
    grid-column: auto;
  }

  .achievement-detail-drawer {
    width: 100%;
    max-height: min(90vh, 820px);
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
  }

  .achievement-check-grid,
  .showcase-media-draft-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .achievement-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .achievement-overview .achievement-overview-main {
    grid-column: 1 / -1;
  }

  .achievement-toolbar {
    grid-template-columns: 1fr;
  }

  .achievement-search-field,
  .achievement-toolbar > button {
    grid-column: auto;
  }

  #page-honors .honor-section-grid,
  .showcase-story-grid {
    grid-template-columns: 1fr;
  }

  .achievement-card-actions {
    top: 50px;
    right: 18px;
  }

  .achievement-page-heading .page-actions {
    grid-template-columns: 1fr;
  }

  .achievement-page-heading .page-actions .primary {
    grid-column: auto;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden],
.hidden {
  display: none !important;
}

html {
  background: var(--admin-bg);
}

body {
  overflow-x: hidden;
  background: var(--admin-bg);
  color: var(--admin-ink);
  letter-spacing: 0;
}

body.nav-open {
  overflow: hidden;
}

button,
.button-link {
  min-height: 40px;
  border-color: var(--admin-line);
  border-radius: 9px;
  background: var(--admin-surface);
  color: var(--ds-text-secondary);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

button:hover,
.button-link:hover {
  border-color: #bfc5d2;
  background: var(--ds-surface-subtle);
}

button.primary,
.button-link.primary {
  border-color: var(--admin-primary);
  background: var(--admin-primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08), 0 3px 8px rgba(70, 95, 255, 0.18);
}

button.primary:hover,
.button-link.primary:hover {
  border-color: var(--admin-primary-dark);
  background: var(--admin-primary-dark);
}

button.danger {
  border-color: #fecdca;
  color: var(--admin-danger);
}

button:focus-visible,
.button-link:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(70, 95, 255, 0.2);
  outline-offset: 2px;
}

input,
textarea,
select {
  min-height: 42px;
  border-color: var(--admin-line-strong);
  border-radius: 9px;
  background: var(--admin-surface);
  color: var(--admin-ink);
  padding: 9px 12px;
}

textarea {
  min-height: 92px;
}

input::placeholder,
textarea::placeholder {
  color: var(--ds-text-faint);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 4px rgba(70, 95, 255, 0.12);
}

label {
  color: var(--ds-text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.todo-check {
  position: relative;
}

.todo-check input {
  width: 22px;
  min-height: 0;
  height: 22px;
  padding: 0;
}

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

.app-nav {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  width: 272px;
  height: 100vh;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  border-right: 1px solid var(--admin-line);
  background: var(--admin-surface);
  padding: 22px 16px 18px;
  box-shadow: none;
}

.brand {
  gap: 11px;
  padding: 0 6px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(145deg, #6378ff, #3546d3);
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(70, 95, 255, 0.22);
}

.brand strong {
  color: var(--ds-text);
  font-size: 15px;
  font-weight: 700;
}

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

.workspace-chip {
  min-height: 40px;
  border: 1px solid var(--ds-brand-soft-strong);
  border-radius: 10px;
  background: var(--ds-brand-soft);
  color: #4d5bb7;
  padding: 0 12px;
}

.status-dot {
  background: var(--admin-success);
  box-shadow: 0 0 0 4px rgba(18, 183, 106, 0.12);
}

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

.nav-section {
  display: grid;
  gap: 5px;
}

.nav-section-label {
  display: block;
  margin: 0 10px 4px;
  color: var(--ds-text-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-btn {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ds-text-secondary);
  font-weight: 600;
  padding: 0 11px;
  box-shadow: none;
}

.nav-btn:hover {
  background: var(--ds-surface-muted);
  color: #1d2939;
}

.nav-btn.active {
  background: var(--admin-primary-soft);
  color: var(--admin-primary-dark);
  font-weight: 700;
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border-radius: 7px;
  background: var(--ds-surface-muted);
  color: var(--ds-text-muted);
}

.nav-btn.active .nav-icon {
  background: #dfe4ff;
  color: var(--admin-primary-dark);
}

.nav-foot {
  margin-top: auto;
  border: 1px solid var(--admin-line);
  border-radius: 11px;
  background: var(--admin-surface-soft);
  padding: 12px;
}

.nav-foot strong {
  color: var(--ds-text-secondary);
}

.nav-foot span {
  color: var(--admin-muted);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(16, 24, 40, 0.42);
  backdrop-filter: blur(2px);
}

.app-main {
  min-width: 0;
  margin-left: 272px;
}

.workspace-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--admin-line);
  background: rgba(255, 255, 255, 0.92);
  padding: 12px 32px;
  backdrop-filter: blur(16px);
}

.workspace-heading {
  margin-right: auto;
}

.workspace-heading span {
  color: var(--admin-muted);
  font-size: 12px;
}

.workspace-heading strong {
  color: var(--ds-text);
  font-size: 18px;
}

.workspace-heading strong::before {
  display: none;
}

.workspace-tools {
  gap: 14px;
  color: var(--admin-muted);
}

.workspace-avatar {
  width: 34px;
  height: 34px;
  border: 0;
  background: var(--admin-primary-soft);
  color: var(--admin-primary-dark);
}

.mobile-nav-toggle {
  display: none;
  width: 42px;
  flex: 0 0 42px;
  padding: 0;
  font-size: 20px;
}

.page,
#page-home {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px 32px 48px;
}

.page-heading,
.page-heading-centered {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr);
  min-height: auto;
  align-items: start;
  justify-items: center;
  margin-bottom: 22px;
  text-align: center;
}

.page-heading > .eyebrow,
.page-heading > h2,
.page-heading > .page-heading-note {
  grid-column: 2;
}

.page-heading h2 {
  color: var(--ds-text);
  font-size: clamp(26px, 2.4vw, 34px);
  letter-spacing: -0.03em;
}

.page-heading .eyebrow {
  color: var(--admin-primary);
}

.page-actions {
  position: static;
  grid-column: 3;
  grid-row: 1 / span 3;
  align-self: center;
  justify-self: end;
  margin-left: auto;
  transform: none;
}

.panel,
.home-overview > .panel,
.home-profile-panel,
.kb-layout,
.exam-paper,
.review-paper,
.annual-section {
  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
  box-shadow: var(--admin-shadow);
}

#page-home .panel,
#page-home .home-profile-panel,
#page-home .carousel-shell,
#page-home .home-command-bar {
  border-radius: 16px;
}

.panel,
.home-overview > .panel {
  padding: 20px;
}

.panel-head {
  margin-bottom: 16px;
}

.panel-head h2 {
  color: #1d2939;
  font-size: 16px;
}

.panel-head span {
  color: var(--admin-muted);
}

.home-overview {
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 22px;
}

.home-profile-panel {
  min-height: 0;
  border-color: #dfe4ff;
  background: linear-gradient(135deg, #ffffff 0%, #f7f8ff 100%);
  padding: 26px;
}

.home-copy h2 {
  color: var(--ds-text);
  font-size: clamp(34px, 4vw, 52px);
}

.hero-lead,
.home-copy p,
.muted {
  color: var(--admin-muted);
}

.chip {
  border: 1px solid #dfe4ff;
  background: #f4f6ff;
  color: #4554b8;
}

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.metric {
  min-height: 106px;
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  background: var(--admin-surface);
  padding: 16px;
  box-shadow: none;
}

.metric span,
.metric small {
  color: var(--admin-muted);
}

.metric strong {
  color: var(--ds-text);
}

.table-toolbar {
  gap: 10px;
  border-radius: 10px;
  background: var(--admin-surface-soft);
  padding: 10px;
}

.inventory-layout {
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
}

.inventory-side {
  position: sticky;
  top: 94px;
  align-self: start;
}

.inventory-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
}

.inventory-table {
  min-width: 980px;
}

.inventory-table th {
  background: var(--ds-surface-subtle);
  color: var(--ds-text-secondary);
  font-size: 12px;
  text-transform: none;
}

.inventory-table td {
  border-color: var(--ds-border);
}

.inventory-table input,
.inventory-table select {
  min-height: 36px;
  border-color: transparent;
  background: transparent;
  padding: 6px 8px;
}

.inventory-table input:hover,
.inventory-table select:hover,
.inventory-table input:focus,
.inventory-table select:focus {
  border-color: var(--admin-line-strong);
  background: #ffffff;
}

.inventory-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--admin-line);
  background: var(--ds-surface-subtle);
  padding: 12px;
}

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

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

.inventory-pagination button {
  min-height: 34px;
}

.resource-library-panel {
  min-width: 0;
  margin-top: 0;
}

.resource-library-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.resource-folder-panel {
  position: sticky;
  top: 86px;
}

.resource-folder-head {
  align-items: center;
}

.resource-folder-head .icon-btn {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.resource-folder-list {
  display: grid;
  gap: 7px;
}

.resource-folder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  border-radius: 10px;
}

.resource-folder-row.active {
  background: var(--ds-brand-soft);
}

.resource-folder-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--ds-text-secondary);
  text-align: left;
  padding: 8px 10px;
}

.resource-folder-item:hover,
.resource-folder-item.active,
.resource-folder-row.active .resource-folder-item {
  background: var(--ds-brand-soft);
  color: var(--admin-primary-dark);
}

.resource-folder-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-folder-item > span:last-child {
  color: var(--admin-muted);
  font-size: 12px;
}

.resource-folder-icon {
  color: #667eea;
  transform: rotate(90deg);
}

.resource-folder-actions {
  display: flex;
  gap: 2px;
  padding-right: 5px;
}

.resource-folder-actions button {
  width: 27px;
  min-height: 27px;
  border: 0;
  background: transparent;
  color: var(--ds-text-muted);
  padding: 0;
}

.resource-panel-head {
  margin-bottom: 14px;
}

.resource-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 190px) minmax(170px, 210px);
  margin-bottom: 18px;
}

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

.resource-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--admin-line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 5px 14px rgba(16, 24, 40, 0.04);
  padding: 18px;
}

.resource-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--admin-primary);
  content: "";
}

.resource-kind-installer::before {
  background: var(--ds-brand);
}

.resource-kind-material::before {
  background: var(--ds-success);
}

.resource-kind-problem::before {
  background: var(--ds-warning);
}

.resource-card-head,
.resource-meta-row,
.resource-tags,
.resource-card-actions,
.resource-file-row,
.resource-attachment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.resource-card-head,
.resource-file-row,
.resource-attachment-meta {
  justify-content: space-between;
}

.resource-kind-badge,
.resource-status,
.resource-meta-row span,
.resource-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  background: var(--ds-brand-soft);
  color: #3448c5;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
}

.resource-status.open {
  background: #fff7ed;
  color: var(--ds-warning);
}

.resource-status.resolved {
  background: var(--ds-success-soft);
  color: var(--ds-success);
}

.resource-card h3 {
  margin: 0;
  color: var(--admin-ink);
  font-size: 18px;
  line-height: 1.4;
}

.resource-meta-row,
.resource-tags,
.resource-card-actions {
  flex-wrap: wrap;
}

.resource-meta-row span,
.resource-tags span {
  min-height: 23px;
  background: var(--ds-surface-muted);
  color: var(--ds-text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.resource-summary,
.resource-details-content,
.resource-solution p {
  margin: 0;
  color: var(--ds-text-secondary);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.resource-details {
  border-top: 1px solid var(--ds-border);
  border-bottom: 1px solid var(--ds-border);
  padding: 10px 0;
}

.resource-details summary {
  cursor: pointer;
  color: var(--ds-text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.resource-details-content {
  margin-top: 10px;
  font-size: 13px;
}

.resource-solution {
  margin-top: 12px;
  border-radius: 10px;
  background: var(--ds-surface-subtle);
  padding: 12px;
}

.resource-solution.resolved {
  background: var(--ds-success-soft);
}

.resource-solution.open {
  background: #fff7ed;
}

.resource-solution strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ds-text-secondary);
  font-size: 13px;
}

.resource-file-row {
  border-radius: 10px;
  background: #f8f9fc;
  padding: 10px 12px;
}

.resource-file-row > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.resource-file-row strong {
  overflow: hidden;
  color: var(--ds-text-secondary);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-file-row span,
.resource-updated {
  color: var(--ds-text-faint);
  font-size: 11px;
}

.resource-card-actions {
  margin-top: auto;
}

.resource-card-actions button {
  min-height: 34px;
}

.resource-updated {
  display: block;
}

.resource-empty-state {
  grid-column: 1 / -1;
  min-height: 260px;
}

.resource-modal-panel {
  width: min(820px, 100%);
}

.resource-modal-body {
  display: grid;
  gap: 14px;
}

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

.resource-form-row:first-child {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.resource-problem-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  align-items: end;
  gap: 12px;
}

.resource-attachment-box {
  display: grid;
  gap: 9px;
  border: 1px dashed var(--ds-border-strong);
  border-radius: 12px;
  background: var(--ds-surface-subtle);
  padding: 14px;
}

.resource-attachment-meta {
  color: var(--ds-text-secondary);
  font-size: 13px;
}

.timetable-stats {
  margin-bottom: 18px;
}

.timetable-panel {
  overflow: hidden;
}

.timetable-toolbar {
  display: grid;
  grid-template-columns: auto minmax(190px, 240px) minmax(220px, 1fr);
  align-items: end;
  gap: 14px;
  margin-bottom: 18px;
}

.timetable-week-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timetable-week-select-label {
  display: grid;
  gap: 5px;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 700;
}

.timetable-term-meta {
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.timetable-term-meta strong {
  color: var(--admin-ink);
}

.timetable-term-meta span {
  color: var(--admin-muted);
  font-size: 12px;
}

.timetable-week-grid {
  display: grid;
  grid-template-columns: 58px repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border-top: 1px solid var(--admin-line);
  border-left: 1px solid var(--admin-line);
  border-radius: 12px;
  background: #ffffff;
}

.timetable-grid-corner,
.timetable-day-head {
  min-width: 0;
  border-right: 1px solid var(--admin-line);
  border-bottom: 1px solid var(--admin-line);
  background: var(--ds-surface-subtle);
  padding: 9px 5px;
  text-align: center;
}

.timetable-grid-corner {
  display: grid;
  place-items: center;
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 700;
}

.timetable-day-head {
  display: grid;
  gap: 1px;
}

.timetable-day-head strong {
  color: var(--ds-text-secondary);
  font-size: 13px;
}

.timetable-day-head span {
  color: var(--ds-text-faint);
  font-size: 11px;
}

.timetable-day-head.is-today {
  background: var(--ds-brand-soft);
}

.timetable-day-head.is-today strong,
.timetable-day-head.is-today span {
  color: #3448c5;
}

.timetable-time-axis {
  position: relative;
  height: var(--timetable-grid-height);
  border-right: 1px solid var(--admin-line);
  border-bottom: 1px solid var(--admin-line);
  background: var(--ds-surface-subtle);
}

.timetable-time-axis span {
  position: absolute;
  top: var(--tick-top);
  right: 8px;
  color: var(--ds-text-faint);
  font-size: 10px;
  transform: translateY(-7px);
}

.timetable-day-lane {
  position: relative;
  height: var(--timetable-grid-height);
  min-width: 0;
  border-right: 1px solid var(--admin-line);
  border-bottom: 1px solid var(--admin-line);
  background-color: #ffffff;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--timetable-hour-height) - 1px),
    var(--admin-line) calc(var(--timetable-hour-height) - 1px),
    var(--admin-line) var(--timetable-hour-height)
  );
}

.timetable-day-lane.is-today {
  background-color: #fafbff;
}

.timetable-course {
  position: absolute;
  top: var(--course-top);
  right: 4px;
  left: 4px;
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 2px;
  width: calc(100% - 8px);
  height: var(--course-height);
  min-height: 0;
  overflow: hidden;
  border-width: 1px 1px 1px 4px;
  border-radius: 8px;
  padding: 6px;
  text-align: left;
}

.timetable-course:hover {
  filter: brightness(0.98);
}

.timetable-course-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 3px;
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  padding-right: 28px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.timetable-course-title:hover {
  text-decoration: underline;
}

.timetable-course-title span {
  flex: 0 0 auto;
}

.timetable-course-edit {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 25px;
  min-height: 23px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  font-size: 0;
  padding: 0;
}

.timetable-course-edit::after {
  font-size: 13px;
  content: "⋯";
}

.timetable-course strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.timetable-course span,
.timetable-course small {
  overflow: hidden;
  font-size: 10px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timetable-color-blue {
  --timetable-course-color: var(--ds-brand);
  border-color: #8098f9;
  background: var(--ds-brand-soft);
  color: #2538a8;
}

.timetable-color-green {
  --timetable-course-color: var(--ds-success);
  border-color: #6ce9a6;
  background: var(--ds-success-soft);
  color: var(--ds-success);
}

.timetable-color-purple {
  --timetable-course-color: var(--ds-brand);
  border-color: #bdb4fe;
  background: #f4f3ff;
  color: #5925dc;
}

.timetable-color-orange {
  --timetable-course-color: var(--ds-warning);
  border-color: #fec84b;
  background: #fffaeb;
  color: var(--ds-warning);
}

.timetable-color-red {
  --timetable-course-color: #f04438;
  border-color: #fda29b;
  background: #fef3f2;
  color: var(--ds-danger);
}

.timetable-color-cyan {
  --timetable-course-color: #06aed4;
  border-color: #67e3f9;
  background: #ecfdff;
  color: #0e7090;
}

.timetable-empty-state {
  min-height: 180px;
  margin-top: 16px;
}

.timetable-mobile-view {
  display: none;
}

.timetable-settings-panel {
  margin-top: 18px;
}

.timetable-learning-hub {
  margin-top: 18px;
}

.timetable-learning-panel {
  display: grid;
  gap: 18px;
  overflow: hidden;
}

.timetable-learning-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.timetable-learning-head > div:first-child {
  display: grid;
  gap: 4px;
}

.timetable-learning-head h2,
.timetable-learning-head p {
  margin: 0;
}

.timetable-learning-head h2 {
  color: var(--admin-ink);
  font-size: 22px;
}

.timetable-learning-head p {
  max-width: 680px;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.65;
}

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

.timetable-learning-actions button {
  min-height: 36px;
  padding: 7px 12px;
}

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

.timetable-learning-bento {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 14px;
}

.timetable-learning-section,
.timetable-learning-tasks {
  min-width: 0;
  border: 1px solid var(--admin-line);
  border-radius: 14px;
  background: #ffffff;
  padding: 16px;
}

.timetable-learning-section .panel-head,
.timetable-learning-tasks .panel-head {
  margin-bottom: 12px;
}

.timetable-learning-focus {
  background: linear-gradient(150deg, #ffffff, #f4f3ff);
}

.timetable-learning-tasks {
  overflow: auto;
}

.timetable-learning-tasks table {
  min-width: 880px;
}

.timetable-settings-panel > summary {
  cursor: pointer;
  color: var(--ds-text-secondary);
  font-weight: 700;
}

.timetable-settings-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.7fr) minmax(130px, 0.4fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
}

.timetable-settings-form label,
.course-modal-body label {
  display: grid;
  gap: 6px;
  color: var(--ds-text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.course-modal-panel {
  width: min(760px, 100%);
}

.course-modal-body {
  display: grid;
  gap: 14px;
}

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

.course-period-row {
  grid-template-columns: 1fr;
}

.course-period-row select {
  font-weight: 700;
}

.date-select-group {
  display: grid;
  grid-template-columns: minmax(96px, 1.25fr) minmax(66px, 1fr) minmax(66px, 1fr);
  gap: 7px;
  width: 100%;
}

.date-select-group.month-only {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.date-select-group select {
  min-width: 0;
}

.date-value-input {
  display: none !important;
}

.training-template-tools {
  display: grid;
  justify-content: flex-end;
  justify-items: end;
  gap: 6px;
}

.training-template-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.training-template-action-row .button-link,
.training-template-action-row button {
  display: inline-flex;
  min-height: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
}

.training-template-action-row .compact-upload {
  margin: 0;
}

.training-template-tools .save-status {
  justify-self: end;
  min-height: 18px;
  line-height: 18px;
}

.inventory-csv-modal-panel {
  width: min(520px, calc(100vw - 32px));
}

.inventory-csv-modal-body,
.inventory-csv-actions {
  display: grid;
  gap: 12px;
}

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

.inventory-csv-actions .upload-label,
.inventory-csv-actions button {
  width: 100%;
  min-height: 44px;
  justify-content: center;
}

.action-dialog-modal {
  z-index: 70;
}

.action-dialog-panel {
  width: min(470px, calc(100vw - 32px));
}

.action-dialog-body {
  display: grid;
  gap: 16px;
}

.action-dialog-message {
  margin: 0;
  color: var(--admin-ink);
  line-height: 1.7;
  white-space: pre-line;
}

.action-dialog-body label {
  display: grid;
  gap: 7px;
  color: var(--admin-ink);
  font-weight: 700;
}

.action-dialog-panel .modal-actions .danger {
  border-color: #fda29b;
  background: var(--ds-danger);
  color: #ffffff;
}

.training-template-status {
  margin: -6px 0 14px;
  color: var(--admin-muted);
  font-size: 12px;
}

.training-dynamic-fields {
  display: grid;
  gap: 2px;
}

.quiz-import-modal-panel {
  width: min(960px, 100%);
}

.practice-text-action {
  min-height: auto;
  width: fit-content;
  border: 0;
  background: transparent;
  color: var(--admin-primary);
  padding: 3px 0;
}

.course-form-main-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(150px, 0.6fr);
}

.course-week-rule-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.course-modal-action-spacer {
  flex: 1;
}

.timetable-mobile-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 16px;
}

.timetable-mobile-days button {
  display: grid;
  min-width: 0;
  gap: 1px;
  min-height: 58px;
  padding: 6px 2px;
  color: var(--ds-text-muted);
}

.timetable-mobile-days button span {
  font-size: 11px;
}

.timetable-mobile-days button strong {
  font-size: 14px;
}

.timetable-mobile-days button.is-today {
  border-color: #8098f9;
}

.timetable-mobile-days button.active {
  border-color: var(--admin-primary);
  background: var(--admin-primary);
  color: #ffffff;
}

.timetable-mobile-date-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.timetable-mobile-date-head span {
  color: var(--admin-muted);
  font-size: 12px;
}

.timetable-mobile-timeline {
  position: relative;
}

.timetable-mobile-timeline.has-courses::before {
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 66px;
  width: 1px;
  background: var(--admin-line);
  content: "";
}

.timetable-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 48px 12px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  width: 100%;
  min-height: 78px;
  border: 0;
  border-bottom: 1px solid var(--admin-line);
  border-radius: 0;
  background: transparent;
  padding: 13px 0;
  text-align: left;
}

.timetable-timeline-item:hover {
  background: var(--ds-surface-subtle);
}

.timetable-timeline-item time {
  color: var(--ds-text-muted);
  font-size: 12px;
}

.timetable-timeline-dot {
  z-index: 1;
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--timetable-course-color);
  box-shadow: 0 0 0 2px var(--timetable-course-color);
}

.timetable-timeline-content {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--admin-ink);
}

.timetable-mobile-course-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.timetable-mobile-course-head a,
.timetable-mobile-course-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--admin-ink);
  font-weight: 700;
}

.timetable-mobile-course-head a:hover {
  color: var(--admin-primary);
}

.timetable-mobile-course-head button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 9px;
  font-size: 11px;
}

.timetable-timeline-content strong,
.timetable-timeline-content small {
  overflow-wrap: anywhere;
}

.timetable-timeline-content small {
  color: var(--ds-text-muted);
  font-size: 11px;
}

.timetable-mobile-empty {
  min-height: 220px;
}

.modal {
  z-index: 100;
  padding: 24px;
}

.modal-backdrop {
  background: rgba(16, 24, 40, 0.48);
  backdrop-filter: blur(3px);
}

.modal-panel {
  border: 1px solid var(--admin-line);
  border-radius: 16px;
  background: var(--admin-surface);
  box-shadow: 0 24px 48px rgba(16, 24, 40, 0.2);
}

.modal-head,
.modal-actions {
  border-color: var(--admin-line);
}

.modal-head h2 {
  color: var(--ds-text);
}

.admin-token-modal {
  width: min(480px, 100%);
}

.form-error {
  margin: 8px 0 0;
  color: var(--admin-danger);
  font-size: 13px;
}

#toast {
  right: 24px;
  bottom: 24px;
  border-radius: 10px;
  background: var(--ds-text);
  box-shadow: 0 16px 32px rgba(16, 24, 40, 0.2);
}

.workspace-heading {
  display: grid;
  gap: 3px;
}

.workspace-heading-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.workspace-motivation {
  margin: 0;
  color: var(--ds-text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.inventory-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.inventory-toolbar .search-input,
.inventory-toolbar > button {
  min-height: 44px;
  height: 44px;
  margin: 0;
}

.inventory-toolbar > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
}

.module-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(620px, 100%);
  margin: 0 auto 20px;
  border: 1px solid var(--admin-line);
  border-radius: 14px;
  background: #f8f9fc;
  padding: 6px;
}

.module-switch button {
  display: grid;
  min-height: 62px;
  align-content: center;
  gap: 3px;
  border-color: transparent;
  background: transparent;
  color: var(--ds-text-muted);
  box-shadow: none;
  text-align: left;
}

.module-switch button span {
  color: var(--ds-text-secondary);
  font-size: 14px;
  font-weight: 800;
}

.module-switch button small {
  font-size: 11px;
  font-weight: 500;
}

.module-switch button.active {
  border-color: #d8dcff;
  background: #ffffff;
  color: var(--admin-primary);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.1);
}

.module-switch button.active span {
  color: var(--admin-primary-dark);
}

.timetable-mode-view[hidden] {
  display: none !important;
}

.timetable-learning-hub {
  margin-top: 0;
}

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

  .inventory-layout {
    grid-template-columns: 1fr;
  }

  .inventory-side {
    position: static;
  }

  .inventory-category-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

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

  .timetable-toolbar {
    grid-template-columns: 1fr minmax(190px, 240px);
  }

  .timetable-term-meta {
    grid-column: 1 / -1;
    justify-items: start;
    text-align: left;
  }

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

  .timetable-settings-form button {
    grid-column: 1 / -1;
  }

  .timetable-learning-bento {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .app-nav {
    width: min(292px, calc(100vw - 48px));
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 16px 0 36px rgba(16, 24, 40, 0.16);
  }

  body.nav-open .app-nav {
    transform: translateX(0);
  }

  .app-main {
    width: 100%;
    margin-left: 0;
  }

  .mobile-nav-toggle {
    display: inline-grid;
    place-items: center;
  }

  .workspace-topbar {
    padding: 10px 22px;
  }

  .page,
  #page-home {
    padding-right: 22px;
    padding-left: 22px;
  }

  .nav-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }

  .nav-btn {
    width: 100%;
  }
}

@media (max-width: 680px) {
  .workspace-topbar {
    min-height: 64px;
    padding: 10px 14px;
  }

  .workspace-heading span,
  .workspace-tools > span:first-child {
    display: none;
  }

  .workspace-heading strong {
    font-size: 16px;
  }

  .workspace-heading-title > span,
  .workspace-motivation {
    display: none;
  }

  .module-switch {
    gap: 5px;
    padding: 5px;
  }

  .module-switch button {
    min-height: 50px;
    padding: 8px 10px;
    text-align: center;
  }

  .module-switch button small {
    display: none;
  }

  .page,
  #page-home {
    padding: 20px 14px 36px;
  }

  .page-heading,
  .page-heading-centered {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    text-align: center;
  }

  .page-actions {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
    margin-left: 0;
  }

  .resource-library-layout {
    grid-template-columns: 1fr;
  }

  .resource-folder-panel {
    position: static;
  }

  .date-select-group {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr);
  }

  .date-select-group.month-only {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .training-template-tools {
    width: 100%;
    justify-content: stretch;
    justify-items: stretch;
  }

  .training-template-action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .training-template-action-row .button-link,
  .training-template-action-row button {
    width: 100%;
    justify-content: center;
  }

  .inventory-csv-actions {
    grid-template-columns: 1fr;
  }

  .page-actions button,
  .page-actions .button-link {
    width: 100%;
  }

  .panel,
  .home-overview > .panel,
  .home-profile-panel {
    padding: 16px;
  }

  .metric-grid,
  .home-profile-panel .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .table-toolbar,
  .inventory-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .table-toolbar > *,
  .inventory-toolbar > * {
    width: 100%;
  }

  .resource-toolbar,
  .resource-form-row,
  .resource-form-row:first-child,
  .resource-problem-fields {
    grid-template-columns: 1fr;
  }

  .resource-file-row,
  .resource-attachment-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .resource-file-row button,
  .resource-attachment-meta button {
    width: 100%;
  }

  .timetable-week-view {
    display: none;
  }

  .timetable-mobile-view {
    display: block;
  }

  .timetable-toolbar,
  .timetable-settings-form,
  .course-form-row,
  .course-form-main-row,
  .course-week-rule-row {
    grid-template-columns: 1fr;
  }

  .timetable-learning-head {
    align-items: stretch;
    flex-direction: column;
  }

  .timetable-learning-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .timetable-learning-actions button {
    width: 100%;
  }

  .timetable-week-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .timetable-week-actions button {
    padding: 0 5px;
  }

  .timetable-settings-form button {
    grid-column: auto;
  }

  .course-modal-actions {
    flex-wrap: wrap;
  }

  .course-modal-action-spacer {
    display: none;
  }

  .course-modal-actions button {
    flex: 1;
  }

  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-panel {
    width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }

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

  .inventory-pagination-actions button {
    flex: 1;
  }

  #toast {
    right: 14px;
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }
}

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

#page-home .panel,
#page-home .home-profile-panel,
#page-home .carousel-shell,
#page-home .home-command-bar {
  border-radius: 16px;
}

@media (max-width: 768px) {
  #page-home .panel,
  #page-home .home-profile-panel,
  #page-home .carousel-shell,
  #page-home .home-command-bar {
    border-radius: 14px;
  }
}

/* Dashboard portal v4: profile banner + left context rail + daily workspace. */
#page-home .home-overview {
  display: block;
}

.home-profile-stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ds-border, var(--ds-border));
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(43, 50, 79, .06);
}

#page-home .home-profile-stage .carousel-shell {
  width: 100%;
  height: clamp(230px, 22vw, 320px);
  min-height: 230px;
  max-height: 320px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#page-home .home-profile-stage .carousel-caption {
  padding: 82px 28px 62px;
}

#page-home .home-profile-stage .carousel-caption span {
  display: inline-flex;
  width: max-content;
  min-height: 26px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 999px;
  background: rgba(20, 25, 43, .28);
  padding: 4px 10px;
  backdrop-filter: blur(8px);
}

#page-home .home-profile-stage .home-profile-panel {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(360px, 1.25fr) minmax(420px, .9fr);
  align-items: center;
  gap: 28px;
  min-height: 0;
  margin: -42px 28px 22px;
  border-color: rgba(223, 228, 255, .92);
  background: rgba(255, 255, 255, .97);
  padding: 20px 22px;
  box-shadow: 0 14px 36px rgba(31, 42, 91, .1);
  backdrop-filter: blur(14px);
}

#page-home .home-profile-identity {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

#page-home .profile-avatar-shell {
  width: 106px;
  height: 106px;
  border: 4px solid #ffffff;
  border-radius: 24px;
  box-shadow: 0 7px 20px rgba(52, 64, 84, .13);
}

#page-home .home-copy .eyebrow {
  margin: 0 0 5px;
}

#page-home .home-name-row {
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

#page-home .home-copy .home-name-row h2 {
  margin: 0;
  font-size: clamp(24px, 2.3vw, 32px);
  line-height: 1.15;
}

#page-home .home-copy .home-name-row > span {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  border-radius: 999px;
  background: var(--ds-brand-soft);
  color: var(--ds-brand);
  padding: 4px 9px;
  font-weight: 750;
}

#page-home .home-copy .hero-lead {
  max-width: 620px;
  margin: 7px 0 12px;
  color: var(--ds-text-muted);
  line-height: 1.55;
}

.home-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#page-home .home-profile-actions button {
  min-height: 36px;
}

#page-home .home-profile-panel .metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

#page-home .home-profile-panel .metric {
  min-height: 82px;
  align-content: center;
  border-color: #e8ebf2;
  background: #f8f9fc;
  padding: 10px;
  text-align: center;
}

#page-home .home-profile-panel .metric strong {
  font-size: 22px;
}

.carousel-manage {
  display: none;
}

body.workspace-manage-mode .carousel-manage {
  display: block;
}

.home-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  margin-top: 20px;
}

.home-dashboard-sidebar,
.home-dashboard-main {
  display: grid;
  min-width: 0;
  gap: 20px;
}

#page-home .home-dashboard-sidebar .panel,
#page-home .home-dashboard-main .panel {
  min-width: 0;
  grid-column: auto;
  min-height: 0;
  order: initial;
}

#page-home .home-command-bar {
  min-height: 84px;
  grid-column: auto;
  order: initial;
  border-radius: 16px;
}

#page-home .home-calendar-panel,
#page-home .home-reminders-panel,
#page-home .home-annual-panel {
  min-height: 0;
  padding: 18px;
}

#page-home .home-calendar-panel {
  border-top: 3px solid #6675ff;
}

#page-home .home-reminders-panel {
  border-top: 3px solid var(--ds-warning);
}

#page-home .home-annual-panel {
  border-top: 3px solid var(--ds-brand);
}

#page-home .home-calendar-weekdays,
#page-home .home-mini-calendar {
  gap: 4px;
}

#page-home .home-calendar-weekdays {
  margin-top: 14px;
}

#page-home .home-mini-calendar > button {
  min-width: 0;
  min-height: 40px;
  border-radius: 9px;
}

#page-home .home-mini-calendar > button.partial small {
  color: var(--ds-warning);
  font-weight: 750;
}

#page-home .home-mini-calendar > button.all-done::after {
  right: 2px;
  bottom: 2px;
  left: auto;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid var(--ds-success);
  border-radius: 50%;
  background: var(--ds-success-soft);
  color: var(--ds-success);
  content: "✓";
  font-size: 10px;
  font-weight: 900;
  transform: rotate(-10deg);
}

#page-home .home-calendar-legend {
  padding-top: 10px;
  border-top: 1px solid #f0f1f4;
}

#page-home .home-reminder-list {
  max-height: 315px;
  overflow: auto;
}

#page-home .home-reminder-item {
  min-height: 58px;
}

#page-home .home-annual-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

#page-home .home-annual-metrics article {
  min-height: 105px;
  padding: 12px;
}

#page-home .home-execution-panel {
  min-height: 454px;
  grid-column: auto;
  grid-template-columns: minmax(0, 1.75fr) minmax(270px, .95fr);
  order: initial;
}

#page-home .home-execution-main {
  padding: 20px;
}

#page-home .home-execution-list {
  max-height: 224px;
}

#page-home .home-brief-panel {
  padding: 20px;
}

#page-home .home-brief-list {
  gap: 9px;
}

#page-home .home-brief-list article {
  min-height: 68px;
  padding: 11px 12px;
}

#page-home .home-status-panel {
  grid-column: auto;
  order: initial;
}

#page-home .home-status-panel .panel-head,
#page-home .home-highlights-panel .panel-head {
  margin-bottom: 14px;
}

#page-home .today-panel-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#page-home .home-highlights-panel {
  display: block !important;
  grid-column: auto;
  order: initial;
}

#page-home .home-highlights-panel #openHighlightModalBtn {
  display: none;
}

body.workspace-manage-mode #page-home .home-highlights-panel #openHighlightModalBtn {
  display: inline-flex;
}

#page-home .home-highlights-panel .highlight-list {
  max-height: 286px;
}

@media (max-width: 1180px) {
  #page-home .home-profile-stage .home-profile-panel {
    grid-template-columns: 1fr;
  }

  #page-home .home-command-bar {
    align-items: center;
    flex-direction: row;
  }

  .home-dashboard-grid {
    grid-template-columns: 1fr;
  }

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

  #page-home .home-dashboard-sidebar .home-annual-panel {
    grid-column: 1 / -1;
  }

  #page-home .home-annual-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #page-home .home-profile-stage .carousel-shell {
    height: 240px;
    min-height: 240px;
  }

  #page-home .home-profile-stage .home-profile-panel {
    margin-right: 18px;
    margin-left: 18px;
  }

  #page-home .home-execution-panel {
    grid-template-columns: 1fr;
  }

  #page-home .home-brief-panel {
    border-top: 1px solid var(--ds-border);
    border-left: 0;
  }

  #page-home .today-panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .workspace-topbar :where(button, [role="button"]),
  .page :where(button, .button-link, summary, [role="button"]),
  .modal :where(button, .button-link) {
    min-height: 40px !important;
  }

  .workspace-topbar :where(.ui-icon-button, .mobile-nav-toggle),
  .page :where(.ui-icon-button, .icon-btn, button.ghost-btn),
  .modal :where(.ui-icon-button, .icon-btn, button.ghost-btn) {
    min-width: 40px;
  }

  .page :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea),
  .modal :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea) {
    min-height: 42px;
  }

}

@media (max-width: 768px) {
  #page-home .home-profile-stage {
    border-radius: 14px;
  }

  #page-home .home-profile-stage .carousel-caption {
    padding: 68px 18px 52px;
  }

  #page-home .home-profile-stage .home-profile-panel {
    margin: -30px 14px 14px;
    padding: 16px;
  }

  #page-home .home-profile-identity {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
  }

  #page-home .profile-avatar-shell {
    width: 88px;
    height: 88px;
    border-radius: 20px;
  }

  #page-home .home-profile-panel .metric-grid,
  #page-home .home-annual-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-dashboard-sidebar {
    grid-template-columns: 1fr;
  }

  #page-home .home-dashboard-sidebar .home-annual-panel {
    grid-column: auto;
  }

  #page-home .home-command-bar {
    align-items: stretch;
    flex-direction: column;
  }

  #page-home .home-command-actions {
    justify-content: flex-start;
  }

  #page-home .home-execution-date-tools {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  #page-home .home-profile-stage .carousel-shell {
    height: 190px;
    min-height: 190px;
  }

  #page-home .home-profile-stage .carousel-caption strong {
    font-size: 16px;
  }

  #page-home .home-profile-stage .carousel-caption small {
    display: none;
  }

  #page-home .home-profile-stage .home-profile-panel {
    margin-top: -24px;
  }

  #page-home .home-profile-identity {
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: start;
  }

  #page-home .profile-avatar-shell {
    width: 72px;
    height: 72px;
    border-radius: 18px;
  }

  #page-home .home-copy .home-name-row h2 {
    font-size: 22px;
  }

  #page-home .home-profile-actions,
  #page-home .home-command-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  #page-home .home-command-actions .primary {
    grid-column: 1 / -1;
  }

  #page-home .home-section-heading,
  #page-home .home-calendar-head {
    gap: 10px;
  }

  #page-home .home-execution-date-tools .daily-todo-date {
    order: -1;
    width: 100%;
  }

  #page-home .home-progress-summary {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  #page-home .home-progress-ring {
    width: 58px;
    height: 58px;
  }

  #page-home .today-panel-grid {
    grid-template-columns: 1fr;
  }
}

/* Sidebar v13: compact workspace navigation with a tablet icon rail. */
.app-nav {
  width: var(--ds-sidebar-width);
  gap: 12px;
  overflow: visible;
}

.nav-list {
  min-height: 0;
  flex: 1 1 auto;
  align-content: start;
  gap: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 2px 4px 0;
  scrollbar-color: #d8deea transparent;
  scrollbar-width: thin;
}

.nav-list::-webkit-scrollbar {
  width: 5px;
}

.nav-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #d8deea;
}

.workspace-chip[data-sync-tone="local"] .status-dot {
  background: #7a8699;
  box-shadow: 0 0 0 4px rgba(122, 134, 153, 0.12);
}

.workspace-chip[data-sync-tone="saving"] .status-dot {
  background: var(--ds-brand);
  box-shadow: 0 0 0 4px rgba(91, 92, 226, 0.12);
  animation: sidebar-sync-pulse 1.2s ease-in-out infinite;
}

.workspace-chip[data-sync-tone="synced"] .status-dot {
  background: var(--ds-success);
  box-shadow: 0 0 0 4px rgba(39, 155, 104, 0.12);
}

.workspace-chip[data-sync-tone="error"] .status-dot {
  background: var(--ds-danger);
  box-shadow: 0 0 0 4px rgba(196, 50, 43, 0.12);
}

@keyframes sidebar-sync-pulse {
  50% { opacity: 0.45; }
}

.nav-section-label:focus-visible {
  outline: 3px solid rgba(91, 92, 226, 0.18);
  outline-offset: 2px;
}

.nav-btn {
  position: relative;
  overflow: visible;
  padding-right: 10px;
  padding-left: 10px;
  text-align: left;
}

.nav-btn::before {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: -1px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--ds-brand);
  content: "";
  opacity: 0;
  transition: opacity 150ms ease;
}

.nav-btn.active::before {
  opacity: 1;
}

.nav-badge:not(.hidden) {
  display: grid;
  min-width: 20px;
  height: 20px;
  margin-left: auto;
  place-items: center;
  border-radius: 999px;
  background: #e9eaff;
  color: var(--ds-brand-strong);
  padding: 0 6px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.nav-workspace-menu {
  position: relative;
  flex: 0 0 auto;
}

.nav-workspace-trigger {
  display: grid;
  width: 100%;
  min-height: 52px;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border-color: var(--ds-border);
  border-radius: 12px;
  background: var(--ds-surface-subtle);
  padding: 7px 9px;
  color: var(--ds-text-secondary);
  text-align: left;
}

.nav-workspace-trigger:hover,
.nav-workspace-trigger[aria-expanded="true"] {
  border-color: #dfe2ff;
  background: var(--ds-brand-soft);
  color: var(--ds-brand-strong);
}

.nav-user-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: var(--ds-brand-soft-strong);
  color: var(--ds-brand-strong);
  font-size: 12px;
  font-weight: 800;
}

.nav-workspace-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.nav-workspace-copy strong,
.nav-workspace-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-workspace-copy strong {
  color: var(--ds-text);
  font-size: 13px;
}

.nav-workspace-copy small {
  color: var(--ds-text-muted);
  font-size: 12px;
}

.nav-workspace-more {
  color: var(--ds-text-muted);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.nav-workspace-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 120;
  display: grid;
  width: 260px;
  gap: 4px;
  border: 1px solid var(--ds-border);
  border-radius: 14px;
  background: var(--ds-surface);
  padding: 7px;
  box-shadow: 0 18px 42px rgba(16, 24, 40, 0.18);
}

.nav-workspace-popover > button {
  display: grid;
  width: 100%;
  min-height: 50px;
  height: auto;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border-color: transparent;
  padding: 7px 9px;
  color: var(--ds-text-secondary);
  text-align: left;
}

.nav-workspace-popover > button:hover,
.nav-workspace-popover > button:focus-visible {
  border-color: #edf0f6;
  background: var(--ds-surface-subtle);
}

.nav-workspace-popover > button > span:first-child {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: var(--ds-brand-soft);
  color: var(--ds-brand-strong);
}

.nav-workspace-popover > button > span:last-child {
  display: grid;
  gap: 1px;
}

.nav-workspace-popover strong {
  color: var(--ds-text);
  font-size: 13px;
}

.nav-workspace-popover small {
  color: var(--ds-text-muted);
  font-size: 12px;
}

.nav-workspace-popover .nav-workspace-exit {
  border-top: 1px solid var(--ds-border);
  border-radius: 0 0 9px 9px;
  margin-top: 3px;
  color: var(--ds-danger);
}

.nav-workspace-popover .nav-workspace-exit > span:first-child {
  background: var(--ds-danger-soft);
  color: var(--ds-danger);
}

body.nav-collapsed .app-nav {
  width: var(--ds-sidebar-collapsed);
  padding-right: 10px;
  padding-left: 10px;
}

body.nav-collapsed .app-main {
  margin-left: var(--ds-sidebar-collapsed);
}

body.nav-collapsed .brand {
  grid-template-columns: 1fr;
  justify-items: center;
}

body.nav-collapsed .brand > div:not(.brand-mark),
body.nav-collapsed .workspace-chip > span:last-child,
body.nav-collapsed .global-jump input,
body.nav-collapsed .nav-section-label,
body.nav-collapsed .nav-btn > span:not(.nav-icon):not(.nav-badge),
body.nav-collapsed .nav-workspace-copy,
body.nav-collapsed .nav-workspace-more {
  display: none;
}

body.nav-collapsed .workspace-chip,
body.nav-collapsed .global-jump,
body.nav-collapsed .nav-btn,
body.nav-collapsed .nav-workspace-trigger {
  width: 44px;
  min-height: 44px;
  justify-content: center;
  padding: 0;
}

body.nav-collapsed .global-jump {
  grid-template-columns: 1fr;
}

body.nav-collapsed .nav-list {
  gap: 5px;
  overflow-x: hidden;
}

body.nav-collapsed .nav-section {
  gap: 4px;
}

body.nav-collapsed .nav-section.collapsed .nav-btn {
  display: flex;
}

body.nav-collapsed .nav-badge:not(.hidden) {
  position: absolute;
  top: 2px;
  right: 1px;
  display: grid !important;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  font-size: 10px;
}

body.nav-collapsed .nav-workspace-menu {
  width: 44px;
}

body.nav-collapsed .nav-workspace-popover {
  right: auto;
  bottom: 0;
  left: calc(100% + 10px);
}

@media (min-width: 769px) and (max-width: 1024px) {
  .app-nav {
    width: var(--ds-sidebar-width);
    padding: 18px 12px 16px;
    transform: none;
    box-shadow: none;
  }

  .app-main {
    width: auto;
    margin-left: var(--ds-sidebar-width);
  }

  body.nav-collapsed .app-nav {
    width: var(--ds-sidebar-collapsed);
    padding-right: 10px;
    padding-left: 10px;
    transform: none;
    box-shadow: none;
  }

  body.nav-collapsed .app-main {
    width: auto;
    margin-left: var(--ds-sidebar-collapsed);
  }

  .nav-collapse-button,
  body.nav-collapsed .nav-collapse-button {
    display: grid;
  }

  .mobile-nav-toggle {
    display: none;
  }

  .nav-backdrop {
    display: none;
  }
}

@media (max-width: 768px) {
  .app-nav,
  body.nav-collapsed .app-nav {
    width: min(320px, calc(100vw - 32px));
    gap: 12px;
    padding: 18px 14px 16px;
    transform: translateX(-105%);
    box-shadow: 18px 0 44px rgba(16, 24, 40, 0.17);
  }

  body.nav-open .app-nav,
  body.nav-collapsed.nav-open .app-nav {
    transform: translateX(0);
  }

  .app-main,
  body.nav-collapsed .app-main {
    width: 100%;
    margin-left: 0;
  }

  .mobile-nav-toggle {
    display: inline-grid;
  }

  .nav-collapse-button,
  body.nav-collapsed .nav-collapse-button {
    display: none;
  }

  body.nav-collapsed .brand {
    grid-template-columns: 40px minmax(0, 1fr);
    justify-items: stretch;
  }

  body.nav-collapsed .brand > div:not(.brand-mark),
  body.nav-collapsed .workspace-chip > span:last-child,
  body.nav-collapsed .global-jump input,
  body.nav-collapsed .nav-section-label,
  body.nav-collapsed .nav-btn > span:not(.nav-icon),
  body.nav-collapsed .nav-workspace-more {
    display: initial;
  }

  body.nav-collapsed .brand > div:not(.brand-mark),
  body.nav-collapsed .nav-workspace-copy {
    display: grid;
  }

  body.nav-collapsed .workspace-chip,
  body.nav-collapsed .global-jump,
  body.nav-collapsed .nav-btn,
  body.nav-collapsed .nav-workspace-trigger,
  body.nav-collapsed .nav-workspace-menu {
    width: 100%;
    justify-content: flex-start;
  }

  body.nav-collapsed .workspace-chip,
  body.nav-collapsed .global-jump,
  body.nav-collapsed .nav-btn {
    padding-right: 9px;
    padding-left: 9px;
  }

  body.nav-collapsed .nav-workspace-trigger {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    padding: 7px 9px;
  }

  body.nav-collapsed .global-jump {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  body.nav-collapsed .nav-section.collapsed .nav-btn {
    display: none;
  }

  body.nav-collapsed .nav-badge:not(.hidden) {
    position: static;
    display: grid !important;
    min-width: 20px;
    height: 20px;
    margin-left: auto;
    padding: 0 6px;
    font-size: 11px;
  }

  .nav-workspace-popover,
  body.nav-collapsed .nav-workspace-popover {
    right: 0;
    bottom: calc(100% + 8px);
    left: 0;
    width: 100%;
  }
}

/* Page boundary guardrail: legacy module rules must not reveal inactive pages. */
.app-main > .page:not(.active) {
  display: none !important;
}

.app-main > .page.active {
  display: block;
}

.metric-grid:has(> :nth-child(4):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

