/**
 * Swallowtail project styles.
 */

.gallery-events-layout {
  display: grid;
  gap: 10px;
  align-items: stretch;
}

.gallery-events-layout:has(.gallery-events-pane:not([hidden])) {
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
}

.gallery-events-layout > .gallery-events-pane {
  align-self: stretch;
  height: 100%;
}

.gallery-events-layout > .gallery-grid {
  min-width: 0;
}

.gallery-events-layout + .gallery-pagination-controls {
  margin-top: 10px;
}

.gallery-header-controls + .gallery-events-layout {
  margin-top: 10px;
}

@media (max-width: 720px) {
  .gallery-events-layout:has(.gallery-events-pane:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }
}

/**
 * Swallowtail styles moved out of eelKit index.css.
 */

.main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  padding: 10px;
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  margin-bottom: 8px;
  position: relative;
  padding-right: 0;
}

.gallery-event-create-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1999;
}

.gallery-event-create-window {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 40px));
  padding: 18px 20px;
  border: 1px solid rgba(176, 190, 207, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  z-index: 2000;
}

.gallery-event-create-window h3 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.gallery-event-create-form {
  display: grid;
  gap: 14px;
}

.gallery-event-create-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.gallery-event-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.button.warn {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning);
}

.upload-token-access-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.upload-token-access-flags .checkbox-item {
  flex: 1 1 150px;
}

.raw-upload-form {
  align-items: stretch;
}

.raw-upload-dropzone {
  cursor: pointer;
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 132px;
}

.raw-upload-icon {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
}

.raw-upload-copy {
  display: grid;
  gap: 6px;
}

.raw-upload-copy strong {
  font-size: 1rem;
}

.raw-upload-copy span {
  color: var(--muted);
  line-height: 1.45;
}

.raw-upload-progress {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 700;
}

.raw-upload-progress.success {
  background: #ecfdf3;
  color: #166534;
}

.raw-upload-progress.error {
  background: #fef2f2;
  color: #991b1b;
}

.raw-upload-results {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.raw-upload-results h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.raw-upload-results ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.raw-upload-results li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.raw-upload-results li:first-child {
  border-top: 0;
}

.raw-upload-results li.success span {
  color: #166534;
}

.raw-upload-results li.error span {
  color: #991b1b;
}

.storage-location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.storage-settings-form {
  padding-bottom: 0;
}

.storage-settings-fieldset {
  margin-bottom: 10px;
  min-width: 0;
}

.storage-settings-row {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  overflow-x: auto;
  width: 100%;
}

.storage-settings-row label {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  margin: 0;
  white-space: nowrap;
}

.storage-settings-row input[type="number"] {
  width: 6.5rem;
}

.storage-location-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.storage-location-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.storage-location-head h3 {
  margin: 0;
  font-size: 1rem;
}

.storage-location-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.storage-location-metrics div {
  display: grid;
  gap: 3px;
}

.storage-location-metrics dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.storage-location-metrics dd {
  margin: 0;
  font-weight: 800;
}

.storage-location-path {
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.storage-summary-dashboard {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 360px);
  align-items: center;
  gap: 18px;
}

.storage-summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.storage-summary-metrics div {
  min-width: 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.storage-summary-metrics dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.storage-summary-metrics dd {
  margin: 4px 0 0;
  font-size: 1.25rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.storage-summary-chart {
  min-width: 0;
}

.service-status-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.service-status-panel {
  margin-bottom: 0;
}

.service-status-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.service-status-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.service-status-main strong,
.service-status-main span {
  overflow-wrap: anywhere;
}

.service-status-main span {
  color: var(--muted);
  font-size: 0.9rem;
}

.traffic-light {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16), inset 0 0 0 1px rgba(15, 23, 42, 0.18);
}

.traffic-light.ok {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16), inset 0 0 0 1px rgba(15, 23, 42, 0.18);
}

.traffic-light.warn {
  background: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.16), inset 0 0 0 1px rgba(15, 23, 42, 0.18);
}

.traffic-light.bad {
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16), inset 0 0 0 1px rgba(15, 23, 42, 0.18);
}

.statistics-dashboard {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  align-items: start;
  gap: 18px;
}

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

.statistics-metrics div {
  min-width: 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.statistics-metrics dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.statistics-metrics dd {
  margin: 4px 0 0;
  font-size: 1.35rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.statistics-metrics span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.statistics-duration {
  min-width: 0;
}

.statistics-duration h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.statistics-duration-table {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.statistics-duration-table table {
  min-width: 520px;
}

.statistics-duration-table th {
  letter-spacing: 0;
}

.statistics-duration-table th:not(:first-child),
.statistics-duration-table td:not(:first-child) {
  text-align: right;
}

.statistics-duration-table td:first-child {
  font-weight: 700;
}

.statistics-duration-table td {
  white-space: nowrap;
}

@media (max-width: 980px) {
  .service-status-list,
    .statistics-dashboard {
      grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
  .statistics-metrics {
      grid-template-columns: 1fr;
    }
}

.storage-summary-chart .chart {
  width: 100%;
  height: auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  row-gap: 2px;
  column-gap: 10px;
}

.gallery-header-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  row-gap: 10px;
  width: 100%;
}

.gallery-header-controls-left,
.gallery-header-controls-center,
.gallery-header-controls-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gallery-header-controls-left {
  justify-content: flex-start;
}

.gallery-header-controls-center {
  justify-content: center;
}

.gallery-header-controls-right {
  justify-content: flex-end;
}

.gallery-header-controls .gallery-events-toggle,
.gallery-header-controls .gallery-auto-refresh-control,
.gallery-header-controls .gallery-soft-control,
.gallery-header-controls .gallery-page-size-control {
  height: 40px;
  margin: 0;
}

.gallery-header-controls .gallery-events-toggle {
  display: inline-flex;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

.gallery-header-controls .gallery-auto-refresh-control,
.gallery-header-controls .gallery-soft-control,
.gallery-header-controls .gallery-page-size-control {
  padding-top: 0;
  padding-bottom: 0;
}

.gallery-header-controls .gallery-sort-form,
.gallery-header-controls .gallery-page-size-form {
  display: inline-flex;
  height: 40px;
  margin: 0;
}

@media (max-width: 720px) {
  .gallery-header-controls {
    grid-template-columns: 1fr;
  }
}

.gallery-pagination-controls {
  align-items: center;
  justify-content: flex-end;
}

.gallery-pagination-controls > .helper {
  order: 3;
}

.gallery-pagination-controls > .actions-row {
  display: contents;
}

.gallery-pagination-controls > .actions-row > :nth-child(1) {
  order: 1;
}

.gallery-pagination-controls > .actions-row > :nth-child(2) {
  order: 2;
}

.gallery-pagination-controls > .actions-row > :nth-child(3) {
  order: 4;
}

.gallery-pagination-controls > .actions-row > :nth-child(4) {
  order: 5;
}

.gallery-pagination-controls .button,
.gallery-pagination-controls form,
.gallery-pagination-controls label {
  margin-top: 0;
  margin-bottom: 0;
}

.gallery-auto-refresh-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.gallery-auto-refresh-control input {
  margin: 0;
}

.gallery-page-size-form {
  margin: 0;
}

.gallery-sort-form {
  margin: 0;
}

.gallery-soft-control,
.gallery-page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.gallery-soft-control select,
.gallery-page-size-control select {
  min-width: 64px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.gallery-sort-control select {
  min-width: 150px;
}

.gallery-sort-direction-toggle {
  height: 28px;
  min-width: 54px;
  padding: 4px 8px;
  margin: 0;
}

.gallery-tile {
  display: grid;
  gap: 1px;
  position: relative;
  color: inherit;
  text-decoration: none;
}

.gallery-view-link {
  display: grid;
  gap: 1px;
  color: inherit;
  text-decoration: none;
}

.gallery-thumb-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.gallery-thumb-link {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery-meta-link {
  display: grid;
}

.gallery-thumb {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-status {
  position: absolute;
  top: 8px;
  left: 8px;
  display: block;
  width: 28px;
  height: 28px;
  z-index: 2;
  pointer-events: none;
}

.gallery-status svg {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery-status-ready {
  color: #39ff14;
  filter: drop-shadow(0 0 5px rgba(57, 255, 20, 0.68));
}

.gallery-status-processing {
  color: #ff9f1c;
  filter: drop-shadow(0 0 5px rgba(255, 159, 28, 0.68));
}

.gallery-status-failed {
  color: #ff1744;
  filter: drop-shadow(0 0 5px rgba(255, 23, 68, 0.68));
}

.gallery-edit-link,
.gallery-download-link {
  position: absolute;
  right: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #00fff0;
  text-decoration: none;
  filter: drop-shadow(0 0 5px rgba(0, 255, 240, 0.68));
}

.gallery-edit-link {
  top: 8px;
}

.gallery-download-link {
  bottom: 8px;
}

.gallery-edit-link:hover,
.gallery-edit-link:focus-visible,
.gallery-download-link:hover,
.gallery-download-link:focus-visible {
  color: #39ff14;
  filter: drop-shadow(0 0 7px rgba(57, 255, 20, 0.78));
}

.gallery-edit-link:focus-visible,
.gallery-download-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 999px;
}

.gallery-edit-link svg,
.gallery-download-link svg {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery-events-toggle[aria-expanded="true"] {
  background: var(--panel-soft);
  color: var(--text);
}

.gallery-events-pane {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.gallery-event-assignment-list {
  display: grid;
  gap: 10px;
}

.gallery-event-assignment-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.gallery-event-assignment-row [data-gallery-assignment-event].is-selected {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.gallery-event-filter-form {
  margin: 0;
}

.gallery-event-filter-row {
  display: flex;
  justify-content: flex-end;
}

.gallery-event-apply {
  margin-top: 10px;
}

.gallery-event-select {
  display: none;
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 3;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.gallery-grid.is-assigning-events.has-selected-event .gallery-event-select {
  display: inline-flex;
}

.gallery-event-select input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.gallery-grid.is-assigning-events .gallery-tile:has(.gallery-event-select input:checked) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

.download-event-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.download-event-summary {
  min-width: 0;
}

.download-event-summary h3 {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

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

@media (max-width: 720px) {
  .download-event-row {
      grid-template-columns: 1fr;
    }

  .download-event-actions {
      justify-content: flex-start;
    }
}

.gallery-placeholder,
.picture-viewer-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 160px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.gallery-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-size: smaller;
  text-align: center;
}

.gallery-meta strong,
.gallery-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-meta span {
  color: var(--muted);
  font-size: 0.84rem;
}

.rawtherapee-profile-layout {
  display: flex;
  flex-flow: row wrap;
  gap: 20px;
  align-items: stretch;
  min-width: 0;
}

.rawtherapee-profile-controls {
  display: grid;
  align-content: start;
  gap: 0px;
  flex: 0 1 auto;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
}

.rawtherapee-profile-form {
  padding-bottom: 16px;
}

.rawtherapee-photo-search-panel,
.rawtherapee-profile-status-panel {
  display: grid;
  gap: 12px;
}

.rawtherapee-photo-search-form {
  padding-bottom: 0;
}

.rawtherapee-profile-form .input-action-row {
  align-items: flex-start;
  flex-wrap: wrap;
}

.rawtherapee-photo-search-form .input-action-row {
  align-items: flex-start;
  flex-wrap: wrap;
}

.rawtherapee-profile-form .input-action-row select {
  flex: 1 1 100%;
  min-width: 0;
}

.rawtherapee-photo-search-form .input-action-row input {
  flex: 1 1 180px;
  min-width: 0;
}

.rawtherapee-photo-search-results {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.rawtherapee-photo-search-result {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.rawtherapee-photo-search-meta {
  display: grid;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.rawtherapee-photo-search-meta strong,
.rawtherapee-photo-search-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rawtherapee-photo-search-meta span {
  color: var(--muted);
  font-size: 0.84rem;
}

.rawtherapee-profile-status-heading {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.rawtherapee-profile-state-image {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.rawtherapee-profile-details {
  display: grid;
  gap: 6px;
  margin: 0;
  min-width: 0;
}

.rawtherapee-profile-details div {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.rawtherapee-profile-details dt {
  color: var(--muted);
  font-weight: 800;
}

.rawtherapee-profile-details dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.rawtherapee-profile-details dd::before {
  content: ": ";
}

.rawtherapee-profile-details dd[data-rawtherapee-profile-image-shown="true"] {
  text-transform: capitalize;
}

.rawtherapee-profile-preview {
  flex: 1 1 300px;
  min-width: min(300px, 100%);
  min-height: 280px;
  position: relative;
  overflow: hidden;
}

.rawtherapee-profile-preview > .panel-soft {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  min-height: 0;
  text-align: center;
}

.rawtherapee-profile-preview-frame {
  display: flex;
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.rawtherapee-profile-image-shell {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.rawtherapee-profile-image {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  object-fit: contain;
  object-position: top center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.card.card-maximized .rawtherapee-profile-layout {
  height: 100%;
  min-height: 0;
}

.card.card-maximized .rawtherapee-profile-controls {
  min-height: 0;
  overflow: auto;
}

.card.card-maximized .rawtherapee-profile-preview {
  flex: 1 1 auto;
  min-height: 0;
}

@media (max-width: 720px) {
  .rawtherapee-profile-layout {
    flex-direction: column;
    min-height: 0;
  }

  .rawtherapee-profile-controls {
    flex-basis: auto;
    width: 100%;
  }

  .rawtherapee-profile-preview {
    flex-basis: auto;
    min-height: 280px;
  }

  .card.card-maximized .rawtherapee-profile-preview {
    flex: 1 1 auto;
    min-height: 0;
  }

  .rawtherapee-profile-details div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .rawtherapee-profile-details dd::before {
    content: "";
  }

  .rawtherapee-photo-search-result {
    align-items: stretch;
    flex-direction: column;
  }

  .rawtherapee-profile-status-heading {
    grid-template-columns: minmax(0, 1fr);
  }
}

.event-permissions {
  display: grid;
  gap: 18px;
}

.event-permissions-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: end;
}

.event-select-form,
.event-create-form,
.event-user-search-form {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.event-select-form label,
.event-create-form label,
.event-user-search-form label {
  display: grid;
  gap: 5px;
  flex: 1 1 220px;
}

.event-permissions-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.event-permission-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
}

.event-permission-grid {
  display: grid;
  gap: 10px;
}

.event-permission-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 2fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.event-permission-row-head {
  display: grid;
  gap: 3px;
}

.event-permission-update-form {
  display: contents;
}

.event-permission-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.event-permission-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.event-permission-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.event-permission-actions form {
  margin: 0;
}

.event-user-picker {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.event-user-search-results {
  display: grid;
  gap: 8px;
}

.event-user-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.profile-editor-grid {
  display: grid;
  gap: 0.65rem;
}

.profile-editor-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(8rem, 1fr) minmax(10rem, 1.4fr) minmax(7rem, 0.7fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.profile-editor-header {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .profile-editor-row {
      grid-template-columns: 1fr;
    }
}

.picture-viewer-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}

.picture-viewer-layout.is-details-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.picture-viewer-layout.is-details-collapsed .picture-viewer-details {
  display: none;
}

.picture-viewer-media {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 320px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #111827;
}

.picture-viewer-overlay-actions {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.picture-viewer-overlay-actions .button,
.picture-viewer-details-toggle {
  box-shadow: var(--shadow-soft);
}

.picture-viewer-maximized-only {
  display: none;
}

.card.card-maximized .picture-viewer-maximized-only {
  display: inline-flex;
}

.picture-viewer-details-toggle {
  min-width: 34px;
  padding-inline: 10px;
  font-weight: 900;
}

.picture-viewer-details-open-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  z-index: 2;
  transform: translateY(-50%);
}

.picture-viewer-media img {
  display: block;
  width: 100%;
  max-height: 85vh;
  object-fit: contain;
  cursor: zoom-in;
}

html.has-picture-viewer-fullscreen,
html.has-picture-viewer-fullscreen body {
  overflow: hidden;
}

.picture-viewer-media.is-picture-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #000;
}

.picture-viewer-media.is-picture-fullscreen img {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  cursor: default;
}

.picture-viewer-media.is-picture-fullscreen .picture-viewer-overlay-actions,
.picture-viewer-media.is-picture-fullscreen .picture-viewer-status-pill,
.picture-viewer-media.is-picture-fullscreen .picture-viewer-image-type,
.picture-viewer-media.is-picture-fullscreen .picture-viewer-details-open-toggle {
  display: none;
}

.picture-viewer-fullscreen-close {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 2px solid #39ff14;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  color: #39ff14;
  box-shadow: 0 0 16px rgba(57, 255, 20, 0.82);
  font-size: 0;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.picture-viewer-fullscreen-close::before {
  content: "\00d7";
  display: inline-block;
  font-size: 2rem;
  line-height: 1;
  transform: translateY(-2px);
}

.picture-viewer-fullscreen-close:hover,
.picture-viewer-fullscreen-close:focus-visible {
  background: #39ff14;
  color: #000;
  outline: none;
}

.picture-viewer-fullscreen-close[hidden] {
  display: none;
}

.picture-viewer-status-pill {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.picture-viewer-status-pill[data-picture-viewer-state="queued"] {
  color: var(--warning);
  background: var(--warning-soft);
}

.picture-viewer-status-pill[data-picture-viewer-state="rendering"] {
  color: var(--primary);
  background: var(--primary-soft);
}

.picture-viewer-status-pill[data-picture-viewer-state="loaded"] {
  display: none;
}

.picture-viewer-details {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  max-height: 72vh;
  min-height: 0;
  overflow: hidden;
}

.picture-viewer-details h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.picture-viewer-image-type {
  position: absolute;
  top: 50px;
  right: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.picture-viewer-details-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.picture-details-tabs {
  position: relative;
  display: grid;
  min-height: 0;
  font-size: 0.8em;
}

.picture-details-tab-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.picture-details-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: flex-end;
  border-bottom: 1px solid var(--line);
}

.picture-details-tab {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.picture-details-tab:hover {
  color: var(--primary);
}

.picture-details-tab-panels {
  max-height: min(54vh, 620px);
  min-height: 0;
  overflow: auto;
  padding-top: 10px;
}

.picture-details-tab-panel {
  display: none;
}

.picture-details-tab-input:nth-of-type(1):checked ~ .picture-details-tablist .picture-details-tab:nth-child(1),
.picture-details-tab-input:nth-of-type(2):checked ~ .picture-details-tablist .picture-details-tab:nth-child(2),
.picture-details-tab-input:nth-of-type(3):checked ~ .picture-details-tablist .picture-details-tab:nth-child(3),
.picture-details-tab-input:nth-of-type(4):checked ~ .picture-details-tablist .picture-details-tab:nth-child(4) {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.picture-details-tab-input:nth-of-type(1):checked ~ .picture-details-tab-panels .picture-details-tab-panel:nth-child(1),
.picture-details-tab-input:nth-of-type(2):checked ~ .picture-details-tab-panels .picture-details-tab-panel:nth-child(2),
.picture-details-tab-input:nth-of-type(3):checked ~ .picture-details-tab-panels .picture-details-tab-panel:nth-child(3),
.picture-details-tab-input:nth-of-type(4):checked ~ .picture-details-tab-panels .picture-details-tab-panel:nth-child(4) {
  display: block;
}

.picture-details-pp3 {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.picture-property-table {
  width: 100%;
  border-collapse: collapse;
  font-size: inherit;
  table-layout: fixed;
}

.picture-property-table th,
.picture-property-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.picture-property-table th {
  width: 42%;
  color: var(--muted);
  font-size: inherit;
  font-weight: 800;
  text-transform: uppercase;
}

.picture-property-table td {
  color: var(--text);
}

.picture-property-table tr:first-child th,
.picture-property-table tr:first-child td {
  border-top: 1px solid var(--line);
}

.picture-status-row,
.recent-upload-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.picture-meta-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.picture-meta-list div {
  display: grid;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.picture-meta-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.picture-meta-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.recent-upload-list {
  display: grid;
  gap: 10px;
}

.recent-upload-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.recent-upload-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

@media (max-width: 860px) {
  .picture-viewer-layout {
      grid-template-columns: 1fr;
    }

  .recent-upload-row {
      display: grid;
    }
}

@media (max-width: 900px) {
  .grid-stats,
    .content-grid,
    .settings-layout,
    .nominals-layout,
    .page-stack.page-stack-banking,
    .page-stack.page-stack-uploads,
    .form-grid,
    .summary-grid,
    .chart-demo-grid,
    .storage-summary-dashboard,
    .month-grid,
    .path-meta {
      grid-template-columns: 1fr;
    }
}

.picture-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 18px;
  align-items: start;
  height: 100%;
  min-height: 0;
}

.picture-editor-main {
  display: grid;
  align-self: stretch;
  gap: 10px;
  height: 100%;
  min-height: 0;
  min-width: 0;
}

.picture-editor-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121826;
  touch-action: none;
}

.picture-editor-stage img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
}

.picture-editor-empty {
  color: #cbd5e1;
  font-size: 13px;
}

.picture-editor-crop {
  position: absolute;
  min-width: 12px;
  min-height: 12px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 9999px rgb(2 6 23 / 45%), 0 0 0 1px rgb(15 23 42 / 60%);
  cursor: move;
}

.picture-editor-crop::before,
.picture-editor-crop::after {
  content: "";
  position: absolute;
  inset: 33.333% 0 auto 0;
  border-top: 1px solid rgb(255 255 255 / 65%);
}

.picture-editor-crop::after {
  inset: 66.666% 0 auto 0;
}

.picture-editor-crop span {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #ffffff;
  background: #0f766e;
}

.picture-editor-crop span[data-picture-editor-handle="nw"] {
  top: -8px;
  left: -8px;
  cursor: nwse-resize;
}

.picture-editor-crop span[data-picture-editor-handle="ne"] {
  top: -8px;
  right: -8px;
  cursor: nesw-resize;
}

.picture-editor-crop span[data-picture-editor-handle="sw"] {
  bottom: -8px;
  left: -8px;
  cursor: nesw-resize;
}

.picture-editor-crop span[data-picture-editor-handle="se"] {
  right: -8px;
  bottom: -8px;
  cursor: nwse-resize;
}

.picture-editor-status {
  min-height: 26px;
  align-content: center;
  justify-self: start;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel);
  font-size: 12px;
}

.picture-editor-status[data-picture-editor-state="queued"],
.picture-editor-status[data-picture-editor-state="processing"] {
  color: #075985;
  border-color: #bae6fd;
  background: #e0f2fe;
}

.picture-editor-status[data-picture-editor-state="ready"] {
  color: var(--success);
  border-color: #b7ebc8;
  background: var(--success-soft);
}

.picture-editor-status[data-picture-editor-state="failed"] {
  color: var(--danger);
  border-color: #f4b5b5;
  background: var(--danger-soft);
}

.picture-editor-display-state {
  min-height: 26px;
  align-content: center;
  justify-self: start;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel);
  font-size: 12px;
}

.picture-editor-controls {
  display: grid;
  align-self: start;
  gap: 8px;
  min-width: 0;
}

.picture-editor-profile-state {
  min-height: 26px;
  align-content: center;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel);
  font-size: 12px;
}

.picture-editor-profile-state[data-picture-editor-profile-ready="1"] {
  color: var(--success);
  border-color: #b7ebc8;
  background: var(--success-soft);
}

.picture-editor-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.picture-editor-panel summary {
  cursor: pointer;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  list-style-position: inside;
}

.picture-editor-panel-body {
  display: grid;
  gap: 12px;
  padding: 0 10px 10px;
}

.picture-editor-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 8px;
  align-items: center;
}

.picture-editor-field span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.picture-editor-field input[type="range"] {
  width: 100%;
  min-width: 0;
}

.picture-editor-field input[type="number"] {
  width: 76px;
}

.picture-editor-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.picture-editor-toggle input {
  width: 16px;
  height: 16px;
}

.picture-editor-readout {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.picture-editor-readout output {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.picture-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.picture-editor-revert {
  justify-self: start;
}

@media (max-width: 900px) {
  .picture-editor {
      grid-template-columns: 1fr;
    }

  .picture-editor-stage {
      min-height: 260px;
    }
}
