.hidden {
  display: none !important;
}

.workspace-page {
  min-height: 100vh;
  padding: 16px;
  background: #f3f4f6;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workspace-page__nav {
  display: flex;
  justify-content: flex-start;
}

.workspace-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  padding: 24px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.workspace-card--wide {
  max-width: 1240px;
}

.workspace-card--flush {
  padding: 0;
  overflow: hidden;
}

.login-shell {
  min-height: 100vh;
  padding: 32px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.04), rgba(37, 99, 235, 0.08)),
    #f8fafc;
}

.login-panel {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.14);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-panel__brand {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.login-panel__mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #0f172a;
  color: #ffffff;
  font-weight: 700;
  flex: 0 0 auto;
}

.login-panel h1 {
  margin: 0;
  font-size: 1.55rem;
  color: #0f172a;
  line-height: 1.15;
}

.login-panel p {
  margin: 8px 0 0;
  color: #64748b;
  line-height: 1.45;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form__submit {
  width: 100%;
  justify-content: center;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.workspace-header__title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: #0f172a;
}

.workspace-header__subtitle {
  margin: 4px 0 0;
  color: #475569;
  font-size: 0.95rem;
  max-width: 720px;
}

.workspace-header__actions,
.workspace-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace-grid {
  display: grid;
  gap: 16px;
}

.workspace-grid--split {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.workspace-grid--columns-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.workspace-grid--columns-4 {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

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

.workspace-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.workspace-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1f2937;
}

.workspace-required {
  color: #dc2626;
  margin-left: 2px;
}

.workspace-input,
.workspace-field select,
.workspace-field input,
.workspace-field textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.95rem;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.workspace-input:focus,
.workspace-field select:focus,
.workspace-field input:focus,
.workspace-field textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
  outline: none;
}

.workspace-input--sm {
  padding: 6px 8px;
  font-size: 0.9rem;
}

.workspace-section {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workspace-section--flush {
  padding: 0;
  background: transparent;
  border: none;
}

.workspace-section__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
}

.workspace-section__help {
  font-size: 0.8rem;
  color: #64748b;
  margin: 6px 0 0;
}

.workspace-stat {
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  background: #ffffff;
  padding: 12px;
}

.workspace-stat span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.workspace-stat strong {
  display: block;
  overflow-wrap: anywhere;
  color: #0f172a;
  font-size: 1.1rem;
}

.workspace-alert {
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid transparent;
}

.workspace-alert--error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.workspace-alert--success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.workspace-alert--warning {
  background: #fefce8;
  border-color: #fde68a;
  color: #b45309;
}

.workspace-alert__title {
  margin: 0;
  font-weight: 600;
}

.workspace-alert__list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workspace-table-wrapper {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.workspace-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.workspace-table th {
  background: #f8fafc;
  text-align: left;
  font-weight: 600;
  color: #475569;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}

.workspace-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  color: #1f2937;
}

.workspace-table tr:last-child td {
  border-bottom: none;
}

.workspace-empty {
  text-align: center;
  padding: 36px 20px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: #64748b;
  font-size: 0.95rem;
}

.workspace-progress {
  width: 100%;
  height: 20px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.workspace-progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 0.15s ease-out;
}

.workspace-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workspace-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.75rem;
  font-weight: 600;
}

.workspace-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
}

.workspace-badge--positive {
  background: #dcfce7;
  color: #166534;
}

.workspace-badge--warning {
  background: #fff7ed;
  color: #c2410c;
}

.workspace-badge--accent {
  background: #dbeafe;
  color: #1d4ed8;
}

.workspace-badge--neutral {
  background: #eef2ff;
  color: #4338ca;
}

.workspace-inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.workspace-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
}

.workspace-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.workspace-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.workspace-text-muted {
  color: #64748b;
  font-size: 0.85rem;
}

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

.access-sidebar {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

.access-user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.access-user {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  background: #ffffff;
  color: #0f172a;
  text-decoration: none;
}

.access-user:hover,
.access-user.is-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.access-user.is-disabled {
  opacity: 0.58;
}

.access-user span,
.access-user small {
  color: #64748b;
  font-size: 0.82rem;
}

.access-user small {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.access-pill {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 600;
}

.access-pill--inactive {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.workspace-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

.workspace-dialog::backdrop {
  background: rgba(15, 23, 42, 0.36);
}

.workspace-dialog__panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: #ffffff;
}

.workspace-dialog__header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.access-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.access-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.access-heading > div {
  display: flex;
  flex-direction: column;
}

.access-radio-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: #334155;
  font-size: 0.9rem;
}

.access-radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.access-check-group {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #334155;
  font-size: 0.9rem;
}

.access-check-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.access-category-table {
  max-height: 430px;
  overflow: auto;
}

.import-review-fix-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  align-items: end;
}

.import-review-fix-form--compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.import-review-fix-form__actions {
  justify-content: flex-start;
}

.workspace-note {
  font-size: 0.8rem;
  color: #64748b;
}

.workspace-note--error {
  color: #b91c1c;
}

.import-source-create {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #f8fafc;
}

.import-source-create__actions {
  margin-top: 8px;
  justify-content: flex-start;
}

.workspace-sticky {
  position: sticky;
  top: 16px;
  z-index: 10;
}

.history-page__surface {
  box-shadow: none;
}

.history-page__hero {
  position: relative;
  padding: 18px 20px 24px;
  margin: -4px -4px 0;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.history-page__hero::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 8px;
  height: 1px;
  background: #dbe4f0;
}

.history-page__eyebrow {
  margin: 0 0 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #475569;
  font-weight: 700;
}

.history-page__title {
  letter-spacing: -0.02em;
}

.history-page__hero-actions {
  align-items: stretch;
  gap: 12px;
}

.history-page__stat {
  min-width: 112px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #dbe4f0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.history-page__stat strong {
  font-size: 1.15rem;
  color: #0f172a;
}

.history-page__stat span {
  font-size: 0.76rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.history-filters {
  background: #f8fafc;
  border-color: #d9e4f2;
  border-radius: 16px;
}

.history-stream {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.history-entry {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.history-entry__rail {
  position: relative;
  padding: 16px 0 0 18px;
}

.history-entry__rail::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  bottom: -18px;
  width: 2px;
  background: #cbd5e1;
}

.history-entry:last-child .history-entry__rail::before {
  bottom: 50%;
}

.history-entry__dot {
  position: absolute;
  left: -3px;
  top: 18px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #0f172a;
  border: 4px solid #eef2ff;
}

.history-entry--restore .history-entry__dot {
  background: #1d4ed8;
}

.history-entry--add_member .history-entry__dot,
.history-entry--create .history-entry__dot {
  background: #166534;
}

.history-entry--remove_member .history-entry__dot {
  background: #c2410c;
}

.history-entry__when {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.15;
  text-wrap: balance;
}

.history-entry__who {
  margin-top: 8px;
  font-size: 0.82rem;
  color: #64748b;
  max-width: 140px;
}

.history-entry__card {
  position: relative;
  border: 1px solid #dbe4f0;
  border-radius: 18px;
  padding: 18px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.history-entry__card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: #cbd5e1;
}

.history-entry--restore .history-entry__card::before {
  background: #2563eb;
}

.history-entry--add_member .history-entry__card::before,
.history-entry--create .history-entry__card::before {
  background: #15803d;
}

.history-entry--remove_member .history-entry__card::before {
  background: #c2410c;
}

.history-entry__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.history-entry__identity {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-entry__slug {
  font-size: 1.02rem;
  font-weight: 700;
  color: #111827;
}

.history-entry__context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #64748b;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.history-entry__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-entry__note {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid rgba(226, 232, 240, 0.92);
}

.history-entry__changes {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.history-entry__change {
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100%;
}

.history-entry__change--category {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.history-entry__change--added {
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.history-entry__change--removed {
  background: #fff7ed;
  border-color: #fed7aa;
}

.history-entry__change--restore {
  background: #dbeafe;
  border-color: #bfdbfe;
}

.history-entry__change-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #64748b;
  font-weight: 700;
}

.history-entry__change strong {
  color: #0f172a;
}

.history-entry__flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: #0f172a;
}

.history-entry__arrow {
  color: #64748b;
  font-weight: 700;
}

.history-entry__token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-entry__token {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #334155;
  font-size: 0.78rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .workspace-card {
    padding: 20px;
  }

  .workspace-header__title {
    font-size: 1.5rem;
  }

  .workspace-section {
    padding: 14px;
  }

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

  .access-sidebar {
    position: static;
    max-height: none;
  }

  .history-entry {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .history-entry__rail {
    padding: 0 0 0 22px;
  }

  .history-entry__rail::before {
    bottom: 0;
  }

  .history-entry:last-child .history-entry__rail::before {
    bottom: 0;
  }

  .history-entry__dot {
    top: 2px;
  }

  .history-entry__header {
    flex-direction: column;
  }

  .history-page__hero {
    padding: 16px 16px 22px;
  }

  .history-page__hero::after {
    left: 16px;
    right: 16px;
  }

  .history-page__hero-actions {
    width: 100%;
  }

  .history-page__stat {
    flex: 1 1 120px;
  }

  .history-entry__changes {
    grid-template-columns: 1fr;
  }
}
