:root {
  --ocr-bg: #0f1c24;
  --ocr-bg-2: #1a3344;
  --ocr-accent: #3db8a0;
  --ocr-accent-2: #f0b429;
  --ocr-text: #f4f7f8;
  --ocr-muted: #a8b8c0;
  --ocr-danger: #e85d4c;
  --ocr-card: rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; }

body.app-body {
  min-height: 100vh;
  margin: 0;
  color: var(--ocr-text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 184, 160, 0.25), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(240, 180, 41, 0.18), transparent 55%),
    linear-gradient(160deg, var(--ocr-bg), var(--ocr-bg-2));
  font-family: "Segoe UI", "Source Sans 3", system-ui, sans-serif;
}

.app-brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ocr-text) !important;
  text-decoration: none;
  font-size: 1.05rem;
  line-height: 1.2;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem 5rem;
}

/* —— Modern top nav (chips + optional admin burger) —— */
.app-topnav {
  position: sticky;
  top: 0;
  z-index: 1030;
  margin-bottom: 0.75rem;
  background: rgba(15, 28, 36, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.app-topnav-shell {
  max-width: 1100px;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.app-topnav-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.app-nav-burger {
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ocr-text);
  font-size: 1.35rem;
  line-height: 1;
  padding: 0;
}

.app-nav-burger:hover,
.app-nav-burger:focus-visible {
  background: rgba(61, 184, 160, 0.18);
  border-color: rgba(61, 184, 160, 0.45);
  outline: none;
}

.app-topnav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  min-width: 0;
}

.app-nav-workshop {
  flex: 0 0 auto;
  max-width: 5.75rem;
}

.app-nav-workshop .nav-workshop-select {
  width: 100%;
  max-width: 5.75rem;
  min-height: 2rem;
  padding: 0.2rem 1.55rem 0.2rem 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--ocr-text);
  font-size: 0.78rem;
  line-height: 1.2;
}

.app-nav-workshop .nav-workshop-select.is-home-workshop {
  color: var(--ocr-accent);
  border-color: rgba(61, 184, 160, 0.55);
  background: rgba(61, 184, 160, 0.12);
  font-weight: 600;
}

.app-nav-workshop .nav-workshop-select.is-home-workshop:focus {
  color: var(--ocr-accent);
  border-color: var(--ocr-accent);
  box-shadow: 0 0 0 0.15rem rgba(61, 184, 160, 0.25);
}

.app-nav-workshop .nav-workshop-select.is-away-workshop {
  color: #f5b4ac;
  border-color: rgba(232, 93, 76, 0.7);
  background: rgba(232, 93, 76, 0.14);
  font-weight: 600;
}

.app-nav-workshop .nav-workshop-select.is-away-workshop:focus {
  color: #f8c5be;
  border-color: var(--ocr-danger);
  box-shadow: 0 0 0 0.15rem rgba(232, 93, 76, 0.28);
}

.nav-user {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ocr-text);
  flex: 0 0 auto;
  min-width: 0;
}

.nav-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex: 0 0 auto;
  display: block;
}

.nav-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ocr-muted);
  font-size: 1rem;
}

.nav-user-text {
  display: none;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.nav-user-name {
  font-size: 0.86rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 10rem;
}

.nav-user-meta {
  font-size: 0.72rem;
}

.app-nav-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  padding: 0;
  line-height: 1;
}

.app-nav-logout-label {
  display: none;
}

.app-chip-rail {
  position: relative;
  margin: 0 -0.15rem;
}

.app-chip-rail::before,
.app-chip-rail::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.25rem;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.app-chip-rail::before {
  left: 0;
  background: linear-gradient(90deg, rgba(15, 28, 36, 0.95), transparent);
}

.app-chip-rail::after {
  right: 0;
  background: linear-gradient(270deg, rgba(15, 28, 36, 0.95), transparent);
}

.app-chip-rail.is-overflow-left::before,
.app-chip-rail.is-overflow-right::after {
  opacity: 1;
}

.app-chip-scroll {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.1rem 0.15rem 0.25rem;
}

.app-chip-scroll::-webkit-scrollbar {
  display: none;
}

.app-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  color: rgba(244, 247, 248, 0.78);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  scroll-snap-align: start;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.app-chip i {
  font-size: 1rem;
  opacity: 0.9;
}

.app-chip:hover,
.app-chip:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  outline: none;
}

.app-chip.is-active {
  color: #06201a;
  background: var(--ocr-accent);
  border-color: rgba(255, 255, 255, 0.08);
  font-weight: 650;
}

.app-chip.is-active i {
  opacity: 1;
}

.app-admin-offcanvas {
  background: #13262f;
  max-width: min(20rem, 92vw);
}

.app-admin-list {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
}

.app-admin-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 1.15rem;
  color: rgba(244, 247, 248, 0.85);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.app-admin-link:hover,
.app-admin-link:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  outline: none;
}

.app-admin-link.is-active {
  background: rgba(61, 184, 160, 0.14);
  border-left-color: var(--ocr-accent);
  color: #fff;
}

@media (min-width: 768px) {
  .nav-user-text {
    display: flex;
  }

  .app-nav-logout {
    width: auto;
    height: auto;
    padding: 0.25rem 0.55rem;
  }

  .app-nav-logout-label {
    display: inline;
  }

  .app-nav-workshop {
    max-width: 8.5rem;
  }

  .app-nav-workshop .nav-workshop-select {
    max-width: 8.5rem;
    font-size: 0.82rem;
    padding: 0.25rem 1.75rem 0.25rem 0.5rem;
  }
}

@media (min-width: 992px) {
  .app-chip-rail::before,
  .app-chip-rail::after {
    display: none;
  }

  .app-chip-scroll {
    flex-wrap: wrap;
    overflow: visible;
    scroll-snap-type: none;
  }
}

.card-soft {
  background: var(--ocr-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  backdrop-filter: blur(8px);
  padding: 1.25rem;
}

.btn-accent {
  background: var(--ocr-accent);
  border-color: var(--ocr-accent);
  color: #06201a;
  font-weight: 600;
}

.btn-accent:hover,
.btn-accent:focus {
  background: #34a58f;
  border-color: #34a58f;
  color: #06201a;
}

.form-control,
.form-check-input {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #f3f7fa;
}

.form-control:focus {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: var(--ocr-accent);
  box-shadow: 0 0 0 0.2rem rgba(61, 184, 160, 0.25);
}

/* Chrome autofill otherwise washes out dark-theme text */
.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus {
  -webkit-text-fill-color: #f3f7fa;
  transition: background-color 99999s ease-in-out 0s;
  caret-color: #f3f7fa;
}

.form-control::placeholder {
  color: var(--ocr-muted);
}

.form-label,
.form-check-label,
.text-muted-ocr {
  color: var(--ocr-muted);
}

.status-box {
  min-height: 3rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status-box .alert {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.rejected-list ul {
  padding-left: 1.1rem;
  max-width: 100%;
}

.rejected-list li {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.rejected-file {
  display: inline;
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  font-size: 0.92em;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.preview-item {
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  aspect-ratio: 4 / 3;
  background: #000;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item.invalid {
  outline: 2px solid var(--ocr-danger);
}

.preview-item.advise {
  outline: 2px solid rgba(234, 179, 8, 0.85);
}

.preview-badge {
  position: absolute;
  left: 0.4rem;
  bottom: 0.4rem;
  right: 0.4rem;
  max-width: calc(100% - 0.8rem);
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.65);
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}

.to-top {
  --scroll-remain: 100;
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: none;
  z-index: 40;
  border: 3px solid transparent;
  background:
    linear-gradient(var(--ocr-accent), var(--ocr-accent)) padding-box,
    conic-gradient(
      from -90deg,
      rgba(255, 255, 255, 0.95) calc(var(--scroll-remain) * 1%),
      rgba(255, 255, 255, 0.18) 0
    ) border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.to-top:hover,
.to-top:focus {
  background:
    linear-gradient(#34a58f, #34a58f) padding-box,
    conic-gradient(
      from -90deg,
      #fff calc(var(--scroll-remain) * 1%),
      rgba(255, 255, 255, 0.22) 0
    ) border-box;
  background-clip: padding-box, border-box;
  border-color: transparent;
}

.to-top.visible {
  display: inline-flex;
  align-items: center;
}

.workshop-quick-filter .workshop-quick-filter-prefix {
  background: rgba(61, 184, 160, 0.18);
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--ocr-accent, #3db8a0);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.workshop-code-hr {
  color: var(--ocr-accent, #3db8a0);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.workshop-code-rest {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.workshop-quick-filter .form-control {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.nav-workshop-select {
  width: auto;
  min-width: 7.5rem;
  max-width: 11rem;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 0.8rem;
}

.nav-workshop-select option {
  color: #111;
}

.archive-thumb {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.archive-preview-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
}

.archive-preview-wrap .archive-preview-img {
  display: block;
  max-width: 100%;
  height: auto;
}

.archive-size-overlay {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  z-index: 2;
  padding: 0.35rem 0.55rem;
  border-radius: 0.4rem;
  background: rgba(0, 0, 0, 0.72);
  color: #f3f4f6;
  font-size: 0.75rem;
  line-height: 1.35;
  letter-spacing: 0.01em;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.archive-row-grouped {
  border-left: 3px solid hsl(var(--archive-group-hue, 160), 55%, 45%) !important;
  padding-left: 0.65rem !important;
}

.archive-group-badge {
  background: rgba(61, 184, 160, 0.22);
  color: var(--ocr-accent, #3db8a0);
  font-weight: 600;
  border: 1px solid rgba(61, 184, 160, 0.35);
}

.archive-sibling {
  display: inline-block;
  max-width: 88px;
  text-align: center;
}

.archive-sibling .archive-thumb {
  width: 88px;
  height: 66px;
}

.kpi-tile {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
  padding: 0.85rem 0.9rem;
}

.kpi-label {
  color: var(--ocr-muted);
  font-size: 0.8rem;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0.2rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: inherit;
}

a.status-chip:hover {
  filter: brightness(1.15);
  border-color: rgba(255, 255, 255, 0.35);
}

.status-chip {
  background: rgba(255, 255, 255, 0.06);
}

.status-success { border-color: rgba(61, 184, 160, 0.45); }
.status-partial { border-color: rgba(240, 180, 41, 0.45); }
.status-failed { border-color: rgba(232, 93, 76, 0.45); }

.spark-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
  align-items: end;
  min-height: 120px;
}

.spark-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 120px;
}

.spark-bar {
  width: 100%;
  max-width: 28px;
  background: linear-gradient(180deg, var(--ocr-accent), rgba(61, 184, 160, 0.35));
  border-radius: 0.35rem 0.35rem 0.15rem 0.15rem;
}

.spark-label,
.spark-count {
  font-size: 0.65rem;
  color: var(--ocr-muted);
  margin-top: 0.2rem;
}

.link-ocr {
  color: var(--ocr-accent);
  text-decoration: none;
}

.link-ocr:hover {
  color: #5fd0b8;
}

.presence-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.presence-dot.online {
  background: var(--ocr-accent);
  box-shadow: 0 0 0 3px rgba(61, 184, 160, 0.25);
}

.presence-dot.offline {
  background: rgba(255, 255, 255, 0.25);
}

@media (min-width: 576px) {
  .preview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.docs-code {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.nav-user:hover .nav-user-name {
  color: var(--ocr-accent);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.profile-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.6rem;
  font-weight: 600;
  color: #fff;
}

.card-soft .d-flex > .flex-grow-1 {
  min-width: 0;
}

.card-soft dl.row {
  max-width: 100%;
}

.card-soft dl.row > dd {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.avatar-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  max-width: 22rem;
}

@media (max-width: 420px) {
  .avatar-preset-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.avatar-preset {
  position: relative;
  display: block;
  margin: 0;
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
  aspect-ratio: 1;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

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

.avatar-preset input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-preset:hover {
  border-color: rgba(61, 184, 160, 0.65);
  transform: translateY(-1px);
}

.avatar-preset.is-selected,
.avatar-preset:has(input:checked) {
  border-color: var(--ocr-accent, #3db8a0);
  box-shadow: 0 0 0 3px rgba(61, 184, 160, 0.28);
}

.sticky-save-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0.6rem 0;
  background: linear-gradient(180deg, rgba(18, 24, 38, 0.98), rgba(18, 24, 38, 0.92));
}

.feedback-events-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.feedback-events-table {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
}

.feedback-events-table .feedback-col-when { width: 6rem; }
.feedback-events-table .feedback-col-stage { width: 5.25rem; }
.feedback-events-table .feedback-col-key { width: 18%; }
.feedback-events-table .feedback-col-user { width: 7.5rem; }
.feedback-events-table .feedback-col-ws { width: 5.75rem; }
.feedback-events-table .feedback-col-file { width: 28%; }

.feedback-events-table th {
  vertical-align: bottom;
  white-space: normal;
  overflow: visible;
  word-break: normal;
  line-height: 1.25;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

.feedback-events-table td {
  vertical-align: top;
  overflow: hidden;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

.feedback-when-cell {
  white-space: normal;
}

.feedback-date,
.feedback-time {
  display: block;
  line-height: 1.25;
}

.feedback-time {
  color: rgba(243, 247, 250, 0.72);
}

.feedback-key-cell code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.feedback-clip {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-ws-cell {
  white-space: nowrap;
}

.feedback-file-cell {
  overflow: visible;
}

.feedback-file-name {
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  font-size: 0.85em;
  line-height: 1.35;
}

.error-page {
  max-width: 32rem;
  text-align: left;
}

.error-page-code {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--ocr-accent, #3db8a0);
  opacity: 0.9;
}
