html {
  font-size: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: #202428;
  background: #f5f7fb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

a {
  color: inherit;
}

img,
svg,
video,
canvas,
table {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

textarea.rich-editor__source[hidden] {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 32px;
  padding: 0.25rem 1rem;
  border-radius: 6px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  vertical-align: middle;
}

.btn-primary {
  background: #26666f;
  border-color: #26666f;
}

.btn-primary:hover,
.btn-primary:focus {
  background: #1d535b;
  border-color: #1d535b;
}

.btn:focus,
.btn:active:focus,
.form-control:focus,
input:focus {
  box-shadow: 0 0 0 0.18rem rgba(38, 102, 111, 0.22);
  outline: none;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  color: #293241;
  background: #ffffff;
  padding: 22px 16px;
  border-right: 1px solid #e6ebf2;
}

.admin-sidebar__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-sidebar__close,
.admin-sidebar__toggle {
  display: none;
}

.admin-sidebar__toggle {
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 12px;
  white-space: nowrap;
}

.admin-sidebar__toggle-icon {
  display: inline-block;
  width: 18px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 -5px 0 currentColor;
}

.admin-backdrop {
  display: none;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  color: #fff;
  text-decoration: none;
}

.admin-brand:hover {
  color: #fff;
}

.admin-brand__mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  font-weight: 800;
}

.admin-brand small {
  display: block;
  color: #6b7280;
}

.admin-brand strong,
.admin-nav__item span,
.admin-topbar strong,
.page-heading h1,
.page-heading p,
.panel-heading h2,
.detail-list dt,
.detail-list dd,
.summary-card,
.activity-list span,
.activity-list time {
  overflow-wrap: anywhere;
}

.admin-nav {
  display: grid;
  gap: 4px;
}

.admin-nav__item {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 10px;
  border-radius: 6px;
  color: #4b5563;
  text-decoration: none;
  min-width: 0;
}

.admin-nav__item:hover,
.admin-nav__item.active {
  color: #1d4ed8;
  background: #eef4ff;
}

.admin-main {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid #e6ebf2;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  min-width: 0;
  flex-wrap: wrap;
}

.admin-topbar__center {
  flex: 1 1 420px;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.admin-topbar__profile {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.admin-topbar__language-form {
    display: flex;
    align-items: center;
    min-width: 170px;
}

.admin-topbar__language-select {
    min-width: 160px;
    min-height: 38px;
}

.admin-topbar__user {
    min-width: 0;
}

.admin-topbar__title strong {
  display: block;
  font-size: 1rem;
}

.admin-topbar__search {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: min(100%, 640px);
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: #f8fbff;
}

.admin-topbar__search-icon {
  width: 16px;
  height: 16px;
  border: 2px solid #94a3b8;
  border-radius: 999px;
  position: relative;
}

.admin-topbar__search-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: #94a3b8;
  transform: rotate(45deg);
}

.admin-topbar__search-input {
  border: 0 !important;
  background: transparent;
  min-height: 42px;
  padding: 0 !important;
  box-shadow: none !important;
}

.admin-topbar__search-kbd {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid #d5dbe3;
  border-radius: 8px;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 800;
  background: #fff;
  white-space: nowrap;
}

.topbar-label {
  display: block;
  color: #6c757d;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.admin-content,
.auth-content {
  padding: 28px;
  min-width: 0;
}

.admin-content {
  background: linear-gradient(180deg, #f5f7fb 0%, #f5f7fb 100%);
}

.auth-content {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.page-heading,
.status-panel,
.login-panel {
  max-width: none;
  width: 100%;
  min-width: 0;
}

.page-heading h1,
.status-panel h1,
.login-panel h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  line-height: 1.2;
}

.page-heading p,
.status-panel p {
  max-width: 760px;
  color: #5a6167;
}

.page-heading--with-actions,
.status-action-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  max-width: none;
  width: 100%;
}

.page-heading--stacked {
  align-items: center;
}

.page-heading--with-actions > *,
.status-action-panel > *,
.panel-heading > * {
  min-width: 0;
}

.page-heading--with-actions .btn,
.status-action-panel .btn {
  align-self: flex-start;
}

.action-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.action-row .btn,
.filter-actions .btn,
.admin-topbar .btn {
  min-width: 92px;
}

.rich-editor {
  overflow: hidden;
  border: 1px solid #d5dbe3;
  border-radius: 6px;
  background: #fff;
}

.rich-editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #e4e9f0;
  background: #f8fbff;
}

.rich-editor__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #d5dbe3;
  border-radius: 6px;
  color: #344054;
  background: #fff;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.rich-editor__button:hover,
.rich-editor__button:focus {
  color: #1d4ed8;
  border-color: #9fb5ff;
  background: #eef4ff;
}

.rich-editor__content {
  min-height: 180px;
  padding: 12px 14px;
  overflow: auto;
  outline: none;
  line-height: 1.55;
  white-space: normal;
  word-break: break-word;
  background: #fff;
}

.rich-editor__content:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
}

.rich-editor__content p {
  margin: 0 0 0.75rem;
}

.rich-editor__content p:last-child {
  margin-bottom: 0;
}

.field-preview-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #e4e9f0;
  border-radius: 6px;
  background: #f8fbff;
}

.field-preview-card__label {
  color: #334155;
  font-size: 0.82rem;
  font-weight: 800;
}

.field-preview-card__control .form-control,
.field-preview-card__control .checkbox-row {
  pointer-events: none;
  opacity: 0.9;
}

.template-field-preview-modal__list {
  display: grid;
  gap: 14px;
}

.template-field-preview-modal__item {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e4eaf2;
  border-radius: 14px;
  background: #fbfdff;
}

.template-field-preview-modal__control {
  display: grid;
  gap: 8px;
}

.template-field-preview-modal__label {
  font-weight: 700;
}

.template-form-preview {
  display: grid;
  gap: 18px;
}

.template-form-preview__section {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #e4eaf2;
  border-radius: 14px;
  background: #fbfdff;
}

.template-form-preview__section-header {
  display: grid;
  gap: 4px;
}

.template-form-preview__section-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.template-form-preview__section-header p {
  margin: 0;
  color: #68717a;
}

.template-form-preview__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.template-form-preview__field {
  display: grid;
  gap: 8px;
}

.template-form-preview__label {
  font-weight: 700;
}

.template-form-preview__control {
  display: grid;
  gap: 8px;
}

.template-form-preview__help,
.template-form-preview__meta-note {
  margin: 0;
  font-size: 0.88rem;
  color: #68717a;
}

.template-form-preview__meta {
  display: grid;
  gap: 8px;
}

.template-preview-checkbox {
  min-height: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: #8b4d2d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.summary-card {
  min-height: 156px;
  padding: 18px;
  border: 1px solid #dedbd5;
  border-radius: 8px;
  background: #fff;
  min-width: 0;
}

.summary-card__label {
  display: block;
  color: #657078;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.35rem;
}

.summary-card p {
  margin: 10px 0 0;
  color: #5e666d;
}

.summary-card--muted {
  background: #faf8f4;
}

.summary-card--muted strong {
  color: #74706a;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
  margin-top: 18px;
  min-width: 0;
}

.dashboard-panel {
  padding: 20px;
  border: 1px solid #e4eaf2;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.04);
  min-width: 0;
}

.toolbar-panel,
.data-panel,
.form-panel {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid #e4eaf2;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.04);
  min-width: 0;
}

.toolbar-panel--soft {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 0.35fr) minmax(160px, 0.35fr) auto;
  gap: 14px;
  align-items: end;
}

.filter-grid--compact {
  grid-template-columns: minmax(180px, 280px) auto;
}

.filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.admin-table {
  margin-bottom: 0;
  width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-table--clean th {
  background: #fafcff;
}

.admin-table th {
  color: #657078;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.admin-table th,
.admin-table td {
  vertical-align: top;
  word-break: break-word;
}

.admin-table th.admin-table__sortable {
  cursor: pointer;
  user-select: none;
}

.admin-table th.admin-table__sortable:focus {
  outline: 2px solid rgba(38, 102, 111, 0.28);
  outline-offset: -2px;
}

.admin-table thead th {
  padding: 14px 8px;
  color: #52606d;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: #f8fafc;
  border-bottom: 1px solid #dce4ef;
  vertical-align: middle;
}

.admin-table thead th:first-child {
  border-top-left-radius: 10px;
}

.admin-table thead th:last-child {
  border-top-right-radius: 10px;
}

.admin-table tbody td {
  padding: 16px 8px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: #fbfdff;
}

.admin-table tbody tr:last-child td {
  border-bottom-color: transparent;
}

.admin-table td.text-end,
.admin-table th.text-end {
  text-align: right;
}

.table-sort-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  line-height: 1.2;
}

.table-sort-link:hover,
.table-sort-link:focus {
  color: #1d4ed8;
  text-decoration: none;
}

.table-sort-indicator {
  display: inline-flex;
  align-items: center;
  color: #94a3b8;
  font-size: 1em;
  font-weight: 900;
  white-space: nowrap;
}

.table-sort-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #364045;
  background: #ece7dc;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: capitalize;
}

.status-pill--active {
  color: #14532d;
  background: #dcfce7;
}

.status-pill--enabled {
  color: #14532d;
  background: #dcfce7;
}

.status-pill--inactive {
  color: #475569;
  background: #e2e8f0;
}

.status-pill--disabled,
.status-pill--not_enabled,
.status-pill--deprecated,
.status-pill--locked {
  color: #475569;
  background: #e2e8f0;
}

.status-pill--suspended,
.status-pill--archived,
.status-pill--cancelled,
.status-pill--expired,
.status-pill--exceeded,
.status-pill--trial_expired {
  color: #7f1d1d;
  background: #fee2e2;
}

.status-pill--read_only {
  color: #713f12;
  background: #fef3c7;
}

.status-pill--warning {
  color: #713f12;
  background: #fef3c7;
}

.status-pill--ok,
.status-pill--unlimited {
  color: #14532d;
  background: #dcfce7;
}

.scope-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #42505a;
  background: #eef2f7;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: none;
  white-space: nowrap;
}

.scope-pill--platform {
  color: #7a2e0a;
  background: #fdebd6;
}

.scope-pill--shared {
  color: #0f5e65;
  background: #d9f1f2;
}

.scope-pill--organization {
  color: #2f5f2e;
  background: #def3de;
}

.scope-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.permission-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid #dedbd5;
  border-radius: 8px;
  background: #faf8f4;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.pagination-bar .btn {
  min-width: 88px;
}

.organization-detail-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.detail-list {
  display: grid;
  grid-template-columns: minmax(150px, 0.4fr) minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
  min-width: 0;
}

.detail-list dt {
  color: #657078;
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
}

.two-column-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.flag-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flag-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid #ebe6dc;
  min-width: 0;
}

.flag-list li:last-child {
  border-bottom: 0;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.checkbox-grid label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #fcfdff;
  font-weight: 700;
  line-height: 1.25;
  color: #263238;
}

.checkbox-grid input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: #26666f;
}

.checkbox-grid--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checkbox-grid--compact label {
  align-items: center;
  min-height: 60px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  font-weight: 700;
  line-height: 1.2;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: #26666f;
}

.checkbox-row input {
  width: auto;
}

.checkbox-row--card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #fcfdff;
  font-weight: 700;
  color: #263238;
}

.email-settings-toggle-grid {
  align-items: stretch;
}

.checkbox-list,
.stack-list {
  display: grid;
  gap: 8px;
}

.role-picker {
  position: relative;
}

.role-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-field__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-hint {
  display: block;
  margin-top: 8px;
  color: #68717a;
  font-size: 0.875rem;
}

.field-config-section {
  padding-top: 16px;
  border-top: 1px solid #ebe6dc;
}

.advanced-panel {
  padding: 14px 16px;
  border: 1px dashed #d4cec2;
  border-radius: 8px;
  background: #faf8f4;
}

.advanced-panel summary {
  cursor: pointer;
  font-weight: 700;
}

.form-builder-shell {
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid #dedbd5;
  border-radius: 8px;
  background: #fcfbf8;
}

.form-builder-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ebe6dc;
}

.form-builder-toolbar strong {
  display: block;
  margin-top: 4px;
}

.form-builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: 18px;
}

.form-builder-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: #fff;
}

.form-builder-palette,
.form-builder-sections,
.form-builder-rules__list {
  display: grid;
  gap: 12px;
}

.form-builder-canvas__drop-hint,
.form-builder-section__empty {
  padding: 14px;
  border: 1px dashed #c8c4bd;
  border-radius: 8px;
  color: #68717a;
  background: #faf8f4;
}

.form-builder-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e2ddd3;
  border-radius: 8px;
  background: #fff;
}

.form-builder-section__header {
  display: grid;
  gap: 12px;
}

.form-builder-section__dropzone {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed #c8c4bd;
  border-radius: 8px;
  background: #fcfbf8;
  min-height: 80px;
}

.form-builder-section__dropzone.is-dragover {
  border-color: #26666f;
  background: rgba(38, 102, 111, 0.06);
}

.form-builder-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e2ddd3;
  border-radius: 8px;
  background: #fff;
}

.form-builder-chip strong {
  display: block;
  font-size: 0.95rem;
}

.form-builder-chip span {
  display: block;
  color: #68717a;
  font-size: 0.84rem;
}

.form-builder-chip--palette {
  width: 100%;
  text-align: left;
  cursor: grab;
}

.form-builder-chip--field {
  cursor: grab;
}

.form-builder-rule-row {
  padding: 14px;
  border: 1px solid #e2ddd3;
  border-radius: 8px;
  background: #fff;
}

.form-builder-rules {
  margin-top: 18px;
}

.form-builder-rules__list {
  margin-top: 12px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.notification-variable-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.notification-variable-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid #dedbd5;
  border-radius: 6px;
  background: #fcfbf8;
}

.notification-variable-row__field {
  margin-bottom: 0;
}

.notification-variable-row__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.table-muted {
  color: #68717a;
  font-size: 0.875rem;
}

.user-table th {
  white-space: nowrap;
}

.user-table td {
  vertical-align: top;
}

.organization-user-actions {
  gap: 8px;
  align-items: center;
}

.organization-user-actions form {
  margin: 0;
}

.organization-user-actions .btn {
  min-width: 84px;
}

.empty-state--compact {
  padding: 14px 16px;
}

.role-picker__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid #c8c4bd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  list-style: none;
}

.role-picker__summary-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.role-picker__summary-label {
  font-weight: 700;
  line-height: 1.2;
  color: #1f2937;
}

.role-picker__summary-count {
  font-size: 0.82rem;
  line-height: 1.2;
  color: #6b7280;
}

.role-picker__summary::-webkit-details-marker {
  display: none;
}

.role-picker__chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid #5e666d;
  border-bottom: 2px solid #5e666d;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.role-picker[open] .role-picker__chevron {
  transform: rotate(225deg);
}

.role-picker__panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  width: min(560px, calc(100vw - 48px));
  min-width: 340px;
  padding: 14px;
  border: 1px solid #d9d4cb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
}

.role-picker__panel-header {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.role-picker__panel-header strong {
  font-size: 0.95rem;
  line-height: 1.2;
  color: #1f2937;
}

.role-picker__panel-header span {
  font-size: 0.82rem;
  line-height: 1.35;
  color: #6b7280;
}

.role-picker__search {
  margin-bottom: 10px;
}

.role-picker__list {
  display: grid;
  gap: 10px;
  max-height: 300px;
  overflow: auto;
}

.role-picker__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid #ece7de;
  border-radius: 6px;
  background: #fcfbf8;
  cursor: pointer;
}

.role-picker__checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #26666f;
  flex: 0 0 auto;
}

.role-picker__item-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.role-picker__item strong,
.role-picker__item small {
  display: block;
}

.role-picker__item small {
  color: #5e666d;
  line-height: 1.2;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.permission-grid--module {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.permission-module-list {
  display: grid;
  gap: 16px;
}

.permission-module-card {
  padding: 14px;
  border: 1px solid #dedbd5;
  border-radius: 8px;
  background: #fcfbf8;
}

.permission-module-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.permission-module-card__header small {
  display: block;
  color: #5e666d;
}

.permission-module-card__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.permission-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid #dedbd5;
  border-radius: 6px;
  background: #fcfbf8;
}

.permission-option input {
  width: auto;
  margin-top: 4px;
}

.permission-option span,
.permission-option strong,
.permission-option small {
  display: block;
}

.permission-option small {
  color: #5e666d;
}

.form-hint {
  display: block;
  margin-top: 6px;
  color: #5e666d;
  font-size: 0.88rem;
}

.license-editor-panel {
  margin-top: 18px;
  padding: 18px;
  background: #fcfbf8;
}

.license-limit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.license-limit-card {
  padding: 14px;
  border: 1px solid #dedbd5;
  border-radius: 8px;
  background: #fff;
}

.license-limit-card label,
.license-module-option strong {
  display: block;
  font-weight: 800;
}

.license-module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.license-module-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid #dedbd5;
  border-radius: 8px;
  background: #fff;
}

.license-module-option input {
  width: auto;
  margin-top: 4px;
}

.license-module-option small {
  display: block;
  margin-top: 4px;
  color: #5e666d;
}

.license-module-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid #dedbd5;
  border-radius: 8px;
  background: #fff;
}

.license-module-card strong,
.license-module-card small {
  display: block;
}

.license-module-card small {
  margin-top: 4px;
  color: #5e666d;
}

.license-limit-value {
  margin-top: 8px;
  font-size: 1.2rem;
  font-weight: 800;
}

.license-unknown-limits {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #ebe6dc;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  min-width: 0;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.2rem;
}

.panel-timestamp {
  color: #6c757d;
  font-size: 0.85rem;
  white-space: nowrap;
}

.health-list {
  display: grid;
  gap: 12px;
}

.health-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: #fcfbf8;
}

.health-item strong,
.health-item span {
  display: block;
}

.health-item span {
  color: #5e666d;
}

.health-item p {
  margin: 6px 0 0;
  color: #5e666d;
}

.status-dot {
  width: 11px;
  height: 11px;
  margin-top: 6px;
  border-radius: 999px;
  background: #9da3a6;
}

.status-dot--good {
  background: #238636;
}

.status-dot--warning {
  background: #b7791f;
}

.status-dot--danger {
  background: #c2410c;
}

.status-dot--neutral {
  background: #6c757d;
}

.stacked-form,
.filter-grid,
.filter-grid--compact,
.action-row,
.pagination-bar {
  min-width: 0;
}

.activity-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-list li {
  display: grid;
  gap: 3px;
  padding: 12px 0;
  border-bottom: 1px solid #ebe6dc;
}

.activity-list li:last-child {
  border-bottom: 0;
}

.activity-list span,
.activity-list time,
.empty-state p {
  color: #5e666d;
}

.empty-state {
  padding: 18px;
  border: 1px dashed #cfc8bb;
  border-radius: 8px;
  background: #faf8f4;
}

.empty-state p {
  margin: 6px 0 0;
}

.page-heading__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.table-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.form-field--inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-row--end {
  justify-content: flex-end;
}

.workflow-builder {
  gap: 20px;
}

.workflow-builder__section {
  padding: 16px;
  border: 1px solid #e3ded3;
  border-radius: 8px;
  background: #fff;
}

.workflow-builder__section + .workflow-builder__section {
  margin-top: 16px;
}

.workflow-builder__trigger {
  padding-top: 8px;
}

.workflow-builder__palette {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.workflow-builder__palette-card {
  display: grid;
  gap: 4px;
  align-content: start;
  min-height: 88px;
  padding: 14px;
  border: 1px dashed #cbbfae;
  border-radius: 8px;
  background: #faf8f3;
  text-align: left;
  cursor: grab;
}

.workflow-builder__palette-card strong {
  font-size: 0.95rem;
}

.workflow-builder__palette-card span {
  color: #68717a;
  font-size: 0.9rem;
}

.workflow-builder__notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #d9e6fb;
}

.workflow-builder__notice--info {
  background: #f5f8ff;
  color: #2a4f88;
}

.workflow-builder__rows {
  display: grid;
  gap: 14px;
  min-height: 74px;
}

.workflow-builder__rows--dragover {
  padding: 8px;
  border: 1px dashed #5880c4;
  border-radius: 8px;
  background: #f5f8ff;
}

.workflow-builder__row {
  padding: 14px;
  border: 1px solid #ddd6c8;
  border-radius: 8px;
  background: #fefefe;
}

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

.workflow-builder__row-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef3fb;
  color: #274b7a;
  font-size: 0.85rem;
  font-weight: 700;
}

.workflow-builder__empty {
  padding: 12px 14px;
  border: 1px dashed #d8d0c2;
  border-radius: 8px;
  background: #faf8f3;
  color: #6b5f4c;
  margin-bottom: 14px;
}

.workflow-builder__definition-preview {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid #e3ded3;
  border-radius: 8px;
  background: #fff;
}

.workflow-builder__definition-preview summary {
  cursor: pointer;
  font-weight: 600;
}

.info-card {
  padding: 16px;
  border: 1px solid #e3ded3;
  border-radius: 8px;
  background: #fff;
}

.info-card strong {
  display: block;
  margin-top: 8px;
}

.muted {
  color: #68717a;
}

.code-block {
  margin: 0;
  padding: 12px;
  border-radius: 6px;
  background: #f7f4ee;
  white-space: pre-wrap;
  word-break: break-word;
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.pagination {
  display: flex;
  gap: 8px;
}

.login-shell {
  width: min(100%, 440px);
}

.login-panel {
  padding: 28px;
  border: 1px solid #dedbd5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(32, 36, 40, 0.08);
}

.stacked-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field label {
  font-weight: 700;
}

.form-field input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #c8c4bd;
  border-radius: 6px;
}

.form-field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #c8c4bd;
  border-radius: 6px;
}

.code-textarea,
.json-viewer {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
}

.json-panel {
  margin-top: 18px;
}

.json-viewer {
  overflow: auto;
  max-height: 420px;
  margin: 0;
  padding: 14px;
  border: 1px solid #ebe6dc;
  border-radius: 6px;
  color: #273036;
  background: #fcfbf8;
  white-space: pre-wrap;
}

.usage-meter {
  overflow: hidden;
  width: min(220px, 100%);
  height: 8px;
  margin-top: 7px;
  border-radius: 999px;
  background: #e7e2d8;
}

.usage-meter__bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #238636;
}

.usage-meter__bar--warning {
  background: #b7791f;
}

.usage-meter__bar--exceeded {
  background: #c2410c;
}

.field-validation-error,
.validation-summary {
  color: #b42318;
}

.validation-summary ul {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar__toggle {
    display: inline-flex;
  }

  .admin-sidebar__close {
    display: inline-flex;
  }

  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: min(88vw, 320px);
    padding: 14px;
    overflow-y: auto;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  }

  .admin-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1030;
    background: rgba(18, 24, 27, 0.52);
    backdrop-filter: blur(1px);
  }

  body.sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-columns {
    grid-template-columns: 1fr;
  }

  .filter-grid,
  .organization-detail-grid,
  .workflow-builder__palette,
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr;
  }

  .admin-topbar__center {
    order: 3;
    flex-basis: 100%;
    justify-content: stretch;
  }

  .admin-topbar__search {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .admin-content,
  .auth-content {
    padding: 18px;
  }

  .admin-topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 12px;
  }

  .admin-sidebar__toggle,
  .admin-sidebar__close {
    display: inline-flex;
  }

  .admin-sidebar__toggle {
    justify-self: start;
    min-width: 0;
    width: auto;
  }

  .admin-topbar > div {
    min-width: 0;
  }

  .admin-topbar form {
    justify-self: end;
    width: auto;
  }

  .admin-topbar .btn {
    min-width: 0;
  }

  .admin-topbar__profile {
    gap: 10px;
  }

  .admin-topbar__search {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .admin-topbar__search-kbd {
    display: none;
  }

  .admin-nav,
  .dashboard-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .page-heading--with-actions,
  .status-action-panel,
  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .checkbox-grid,
  .permission-grid,
  .form-grid-2,
  .form-grid-3,
  .form-grid-4,
  .license-limit-grid,
  .license-module-grid {
    grid-template-columns: 1fr;
  }

  .filter-actions,
  .action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-actions .btn,
  .action-row .btn,
  .action-row--end .btn,
  .pagination-bar .btn {
    width: 100%;
    min-width: 0;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .table-responsive {
    overflow-x: visible;
  }

  .admin-table {
    table-layout: fixed;
  }

  .admin-table thead th,
  .admin-table tbody td {
    padding: 12px 6px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .admin-table th,
  .admin-table td {
    vertical-align: top;
  }

  .table-sort-link {
    white-space: normal;
  }

  .table-sort-indicator {
    flex: 0 0 auto;
  }

  .admin-table td .action-row,
  .admin-table td .organization-user-actions,
  .admin-table td .btn {
    white-space: normal;
  }

  .admin-table td.text-end {
    text-align: left;
  }

  .admin-table td.text-end .action-row {
    justify-content: flex-start;
  }

  .user-table th,
  .user-table td {
    white-space: normal;
  }

  .panel-heading {
    flex-direction: column;
  }

  .panel-timestamp {
    white-space: normal;
  }

  .admin-sidebar {
    width: min(90vw, 330px);
  }
}
