body { background: #fafafa; }

.dashboard-table .project-name {
  font-weight: 400;
}

.dashboard-table .toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  font-size: 1.25rem;
  color: #0d6efd;
  text-decoration: none !important;
  transform: rotate(90deg);
}

.dashboard-table .project-row.is-expanded .toggle-icon,
.dashboard-table .toggle-icon.is-open {
  transform: rotate(-90deg);
}

.dashboard-table .ring-row {
  display: none;
  background-color: #fff;
}

.dashboard-table td,
.dashboard-table th {
  padding-top: 0.12rem;
  padding-bottom: 0.12rem;
}

.dashboard-table .ring-row.loading-row .loading-cell {
  opacity: 0.75;
}

.btn .spinner-border {
  margin-right: 0;
}

.dashboard-table tbody tr.project-row td {
  transition: background-color 0.18s ease;
}

.dashboard-table tbody tr.project-row:hover td,
.dashboard-table tbody tr.project-row:focus-visible td {
  background-color: rgba(13, 110, 253, 0.14) !important;
}

.dashboard-table tbody tr.project-row.no-row-hover:hover td,
.dashboard-table tbody tr.project-row.no-row-hover:focus-visible td {
  background-color: inherit !important;
}

.dashboard-table tbody tr.project-row:focus-visible {
  outline: none;
}

.dashboard-table .ring-row td {
  border-top: 1px solid rgba(13, 13, 13, 0.08) !important;
  border-bottom: 1px solid rgba(13, 13, 13, 0.08) !important;
}

.dashboard-table .details-btn {
  background-color: #fff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #0d6efd;
}

.dashboard-table .details-btn:hover,
.dashboard-table .details-btn:focus {
  background-color: #fff;
  color: #0a58ca;
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: none;
}

.grant-block.grant-disabled {
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

.clickable-row {
  cursor: default;
}

.layout-ring-link {
  text-decoration: underline;
}

.layout-ring-link:hover,
.layout-ring-link:focus {
  text-decoration: underline;
  color: #0a58ca;
}

.status-icon {
  font-size: 1rem;
  line-height: 1;
  vertical-align: middle;
}

.richtext-editor {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.richtext-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(180deg, rgba(248, 249, 250, 0.95), rgba(233, 236, 239, 0.95));
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  align-items: center;
}

.richtext-toolbar .btn,
.richtext-toolbar .form-select,
.richtext-toolbar .form-control-color {
  white-space: nowrap;
}

.richtext-toolbar .richtext-select {
  width: 150px;
}

.richtext-toolbar .richtext-size {
  width: 110px;
}

.richtext-toolbar .form-control-color {
  width: 42px;
  padding: 0.1rem;
  height: 32px;
}

.richtext-toolbar .btn-group > .btn {
  border-radius: 0.375rem;
}

.richtext-toolbar .btn-group > .btn:not(:last-child) {
  margin-right: 0;
}

.richtext-toolbar .btn-group-gap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.richtext-toolbar .toolbar-separator {
  width: 1px;
  height: 22px;
  background-color: rgba(0, 0, 0, 0.12);
  margin: 0 0.25rem;
}

.richtext-ruler {
  position: relative;
  height: 32px;
  background:
    repeating-linear-gradient(to right,
      rgba(33, 37, 41, 0.18) 0,
      rgba(33, 37, 41, 0.18) 1px,
      transparent 1px,
      transparent 12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.richtext-ruler::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(to right,
      rgba(33, 37, 41, 0.3) 0,
      rgba(33, 37, 41, 0.3) 1px,
      transparent 1px,
      transparent 60px);
  pointer-events: none;
}

.richtext-tab-marker {
  position: absolute;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid #0d6efd;
  transform: translateX(-50%);
  cursor: pointer;
  transition: border-top-color 0.15s ease, opacity 0.15s ease;
}

.richtext-tab-marker::after {
  content: "";
  position: absolute;
  top: -10px;
  left: -0.5px;
  width: 1px;
  height: 10px;
  background-color: rgba(13, 110, 253, 0.35);
}

.richtext-tab-marker.is-active {
  border-top-color: #6610f2;
}

.richtext-tab-marker.is-dragging {
  opacity: 0.85;
  cursor: grabbing;
}

.richtext-tab-marker.is-removing {
  border-top-color: #dc3545;
  opacity: 0.7;
}

.richtext-content {
  flex: 1 1 auto;
  padding: 1rem;
  overflow: auto;
  font-family: "Times New Roman", serif;
  font-size: 12pt;
  line-height: 1.4;
}

.richtext-content:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(13, 110, 253, 0.35);
}

.richtext-content p {
  margin-bottom: 0.75rem;
}

.richtext-content p:last-child {
  margin-bottom: 0;
}

.richtext-content .rt-tab {
  display: inline-block;
  min-width: 0;
  position: relative;
  border-bottom: 1px dotted rgba(108, 117, 125, 0.35);
  margin: 0 0.25rem;
  color: transparent;
  vertical-align: baseline;
  pointer-events: none;
  user-select: none;
}

.richtext-content .rt-tab::after {
  position: absolute;
  top: -0.9rem;
  left: 0;
  right: 0;
  margin: 0 auto;
  font-size: 0.65rem;
  color: rgba(73, 80, 87, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.richtext-content .rt-tab[data-tab="left"]::after {
  content: "";
}

.richtext-status-saving {
  color: #0d6efd !important;
}

.richtext-status-error {
  color: #dc3545 !important;
}

/* --- Layout template visual editor --- */
.no-spin::-webkit-outer-spin-button,
.no-spin::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.no-spin {
  -moz-appearance: textfield;
}

.layout-editor-stage-wrapper {
  width: 100%;
  max-width: 100%;
}

.layout-editor-stage {
  position: relative;
  width: 100%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.layout-editor-preview-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  transition: opacity 80ms ease-in-out;
  will-change: opacity;
}

.layout-editor-client-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 80ms ease-in-out;
  will-change: opacity;
}

.layout-editor-stage.client-preview-on .layout-editor-client-canvas {
  opacity: 1;
}

.layout-editor-stage.client-preview-hide-server .layout-editor-preview-img {
  opacity: 0;
}

.layout-editor-overlay {
  position: absolute;
  inset: 0;
}

.layout-editor-layer {
  position: absolute;
  box-sizing: border-box;
  outline: none;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}

.layout-editor-layer.is-hidden {
  opacity: 0.35;
}

.layout-editor-layer.is-locked {
  pointer-events: none;
  cursor: default;
}

.layout-editor-layer.is-selected {
  outline: 2px solid rgba(13, 110, 253, 0.95);
  background: rgba(13, 110, 253, 0.08);
}

.layout-editor-layer.is-selected.is-text {
  outline-style: dashed;
}

.layout-editor-layer.is-selected.is-locked {
  outline-color: rgba(108, 117, 125, 0.95);
  background: rgba(108, 117, 125, 0.08);
}

.layout-editor-layer.is-locked .layout-editor-layer-label {
  color: #495057;
}

.layout-editor-layer-label {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 100%;
  padding: 0.1rem 0.25rem;
  font-size: 0.75rem;
  line-height: 1.2;
  background: rgba(255, 255, 255, 0.85);
  color: #0b5ed7;
  border-bottom-right-radius: 0.35rem;
  pointer-events: none;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  display: none;
}

.layout-editor-layer.is-selected .layout-editor-layer-label {
  display: block;
}

.layout-editor-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #fff;
  border: 1px solid rgba(13, 110, 253, 0.95);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  display: none;
}

.layout-editor-layer.is-selected .layout-editor-handle {
  display: block;
}

.layout-editor-layer.is-selected.is-locked .layout-editor-handle {
  display: none;
}

.layout-editor-handle.handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.layout-editor-handle.handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.layout-editor-handle.handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.layout-editor-handle.handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }

.layout-editor-layer-item .layout-editor-drag-handle {
  cursor: grab;
  user-select: none;
  font-size: 1rem;
  line-height: 1;
}

.layout-editor-layer-item.dragging {
  opacity: 0.65;
}

.layout-editor-visibility-btn {
  padding: 0.1rem 0.25rem;
  line-height: 1;
}

.layout-editor-lock-btn {
  padding: 0.1rem 0.25rem;
  line-height: 1;
}

/* --- Layout entry WYSIWYG overlay editor --- */
.layout-wysiwyg-toolbar .btn,
.layout-wysiwyg-toolbar .form-select,
.layout-wysiwyg-toolbar .form-control {
  white-space: nowrap;
}

.layout-wysiwyg-toolbar .btn.btn-outline-secondary:hover,
.layout-wysiwyg-toolbar .btn.btn-outline-secondary:focus {
  color: #212529;
  background-color: rgba(108, 117, 125, 0.12);
  border-color: rgba(108, 117, 125, 0.5);
  box-shadow: none;
}

.layout-wysiwyg-toolbar .btn.btn-outline-secondary.active,
.layout-wysiwyg-toolbar .btn.btn-outline-secondary:active,
.layout-wysiwyg-toolbar .btn.btn-outline-secondary[aria-pressed="true"] {
  color: #fff;
  background-color: #495057;
  border-color: #495057;
}

.layout-wysiwyg-toolbar .btn-group > .btn:not(:first-child):not(:last-child) {
  border-radius: 0 !important;
}

.layout-wysiwyg-toolbar .btn-group > .btn:first-child:not(:last-child) {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.layout-wysiwyg-toolbar .btn-group > .btn:last-child:not(:first-child) {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

.layout-wysiwyg-toolbar .btn.is-mixed {
  border-style: dashed;
  background-color: rgba(108, 117, 125, 0.2);
  color: #212529;
}

.layout-wysiwyg-toolbar .btn.is-mixed:hover,
.layout-wysiwyg-toolbar .btn.is-mixed:focus {
  background-color: rgba(108, 117, 125, 0.28);
  color: #212529;
}

.layout-wysiwyg-stage-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.5rem;
  background: linear-gradient(180deg, #f8f9fa 0%, #eef1f4 100%);
  padding: 0.75rem;
}

.layout-wysiwyg-stage {
  position: relative;
  margin: 0 auto;
  width: fit-content;
  max-width: 100%;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  background: #fff;
}

.layout-wysiwyg-stage > img {
  display: block;
  max-width: min(100%, 1200px);
  width: auto;
  height: auto;
  border-radius: 0.35rem;
}

#layout-wysiwyg-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#layout-wysiwyg-wrap-debug-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.layout-wysiwyg-field {
  position: absolute;
  box-sizing: border-box;
  border: 0;
  border-radius: 0;
  background: transparent;
  pointer-events: auto;
}

.layout-wysiwyg-field.is-active {
  border: 0;
  box-shadow: none;
  background: transparent;
}

.layout-wysiwyg-field-content {
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0.3rem 0.4rem;
  line-height: 1.2;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
  background: transparent;
}

.layout-wysiwyg-field-content:empty::before {
  content: attr(data-placeholder);
  color: rgba(33, 37, 41, 0.45);
  pointer-events: none;
}

.layout-wysiwyg-field-content.is-single-line {
  white-space: nowrap;
}

.layout-wysiwyg-field-content.is-single-line br {
  display: none;
}

.layout-wysiwyg-wrap-float {
  display: none;
  pointer-events: none;
  user-select: none;
  line-height: 0;
  font-size: 0;
}

.layout-wysiwyg-field-content.has-photo-wrap > .layout-wysiwyg-wrap-float {
  display: block;
}

.layout-wysiwyg-field-content.has-photo-wrap > .layout-wysiwyg-wrap-float.is-left {
  float: left;
  clear: left;
}

.layout-wysiwyg-field-content.has-photo-wrap > .layout-wysiwyg-wrap-float.is-right {
  float: right;
  clear: right;
}

.layout-wysiwyg-field-content .layout-wysiwyg-tab {
  display: inline-block;
  min-width: 1px;
  vertical-align: baseline;
  pointer-events: none;
}

.layout-wysiwyg-field-content p,
.layout-wysiwyg-field-content div,
.layout-wysiwyg-field-content blockquote,
.layout-wysiwyg-field-content h1,
.layout-wysiwyg-field-content h2,
.layout-wysiwyg-field-content h3,
.layout-wysiwyg-field-content h4,
.layout-wysiwyg-field-content h5,
.layout-wysiwyg-field-content h6 {
  margin: 0;
  padding: 0;
}

.layout-wysiwyg-field-content.is-single-line p,
.layout-wysiwyg-field-content.is-single-line div,
.layout-wysiwyg-field-content.is-single-line ul,
.layout-wysiwyg-field-content.is-single-line ol,
.layout-wysiwyg-field-content.is-single-line li,
.layout-wysiwyg-field-content.is-single-line h1,
.layout-wysiwyg-field-content.is-single-line h2,
.layout-wysiwyg-field-content.is-single-line h3,
.layout-wysiwyg-field-content.is-single-line h4,
.layout-wysiwyg-field-content.is-single-line h5,
.layout-wysiwyg-field-content.is-single-line h6 {
  display: inline;
  margin: 0;
  padding: 0;
}

.layout-wysiwyg-field-content table {
  border-collapse: collapse;
  width: auto;
  max-width: 100%;
}

.layout-wysiwyg-field-content td,
.layout-wysiwyg-field-content th {
  border: 1px solid rgba(33, 37, 41, 0.4);
  padding: 0.2rem 0.35rem;
  min-width: 2.2rem;
}

.layout-wysiwyg-loading {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  left: auto;
  bottom: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0.4rem 0.55rem;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  pointer-events: none;
  z-index: 5;
}

.layout-wysiwyg-loading.is-hidden {
  display: none;
}

.layout-wysiwyg-ruler-marker {
  position: absolute;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 11px solid #0d6efd;
  transform: translateX(-50%);
  cursor: grab;
}

.layout-wysiwyg-ruler-marker.is-left {
  border-top-color: #0d6efd;
}

.layout-wysiwyg-ruler-marker.is-center {
  border-top-color: #198754;
}

.layout-wysiwyg-ruler-marker.is-right {
  border-top-color: #fd7e14;
}

.layout-wysiwyg-ruler-marker.is-dragging {
  opacity: 0.75;
  cursor: grabbing;
}
