:root {
  --jo-blue: #1671d9;
  --jo-blue-dark: #003090;
  --jo-navy: #001870;
  --jo-ink: #0f172a;
  --jo-text: #334155;
  --jo-muted: #64748b;
  --jo-border: #dbe3ee;
  --jo-surface: #ffffff;
  --jo-bg: #f3f6fb;
  --jo-shadow: 0 12px 32px rgba(15, 23, 42, 0.07);
  --jo-radius: 16px;
  font-family: "Inter", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color: var(--jo-text);
  background: var(--jo-bg);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(22, 113, 217, 0.28);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

@keyframes jo-fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.jo-eyebrow {
  margin: 0 0 5px;
  color: var(--jo-blue);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.jo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  color: var(--jo-text);
  font-weight: 700;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--jo-border);
  border-radius: 12px;
  transition:
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 180ms ease-out,
    background-color 180ms ease-out;
}

.jo-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1);
}

.jo-button--primary {
  color: #fff;
  background: var(--jo-blue);
  border-color: var(--jo-blue);
  box-shadow: 0 6px 16px rgba(22, 113, 217, 0.22);
}

.jo-button--primary:hover {
  background: #125cb5;
}

.jo-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

/* Login */
.jo-login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(22, 113, 217, 0.14), transparent 34%),
    var(--jo-bg);
}

.jo-login-page .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.jo-login-shell {
  width: min(720px, 100%);
}

.jo-login-card {
  padding: 36px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--jo-border);
  border-radius: 20px;
  box-shadow: var(--jo-shadow);
  animation: jo-fade-up 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.jo-login-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 24px;
  color: #fff;
  font-weight: 800;
  background: var(--jo-blue);
  border-radius: 16px;
}

.jo-login-card h1 {
  margin: 0;
  color: var(--jo-ink);
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}

.jo-login-copy {
  margin: 10px 0 24px;
  color: var(--jo-muted);
  line-height: 1.6;
}

.jo-login-card--wide {
  width: min(720px, 100%);
}

.jo-login-search {
  display: block;
  margin-bottom: 14px;
}

.jo-login-search input {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--jo-border);
  border-radius: 12px;
  color: var(--jo-ink);
  background: #fff;
}

.jo-login-people {
  display: grid;
  gap: 10px;
  max-height: min(52vh, 480px);
  overflow: auto;
  margin-bottom: 16px;
  padding-right: 4px;
}

.jo-login-person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--jo-border);
  border-radius: 14px;
  background: #fff;
}

.jo-login-person-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.jo-login-person-main strong {
  color: var(--jo-ink);
  font-size: 0.95rem;
}

.jo-login-person-main span {
  color: var(--jo-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.jo-login-person-status {
  width: fit-content;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.jo-login-person-status.is-inactive {
  background: #f1f5f9;
  color: #64748b;
}

.jo-login-person .jo-button {
  flex-shrink: 0;
}

.jo-signed-in,
.jo-area-signed {
  display: none !important;
}

.jo-topbar-sub {
  margin: 4px 0 0;
  color: var(--jo-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.jo-login-form {
  display: grid;
  gap: 14px;
}

.jo-login-form label,
.jo-filter-card label {
  display: grid;
  gap: 7px;
  color: var(--jo-ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.jo-login-form input,
.jo-filter-card input,
.jo-filter-card select,
.jo-card textarea {
  width: 100%;
  padding: 12px 13px;
  color: var(--jo-ink);
  background: #fff;
  border: 1px solid var(--jo-border);
  border-radius: 12px;
}

.jo-form-error {
  margin: 0;
  padding: 10px 12px;
  color: #b91c1c;
  font-size: 0.84rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
}

/* Portal shell */
.jo-portal-page {
  background: var(--jo-bg);
}

.jo-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--jo-border);
  backdrop-filter: blur(14px);
}

.jo-topbar h1 {
  margin: 0;
  color: var(--jo-ink);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.jo-topbar-lead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.jo-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.jo-menu-toggle {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  color: var(--jo-ink);
  background: #fff;
  border: 1px solid var(--jo-border);
  border-radius: 12px;
  transition:
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 180ms ease-out;
}

.jo-menu-toggle:active {
  transform: scale(0.94);
}

.jo-menu-toggle .jo-menu-icon-close,
.jo-menu-toggle[aria-expanded="true"] .jo-menu-icon-open {
  display: none;
}

.jo-menu-toggle[aria-expanded="true"] .jo-menu-icon-close {
  display: block;
}

.jo-drawer-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.jo-drawer-head h2 {
  margin: 0;
  color: var(--jo-ink);
  font-size: 1.05rem;
}

.jo-drawer-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--jo-ink);
  background: #f1f5f9;
  border: none;
  border-radius: 12px;
}

.jo-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.44);
  backdrop-filter: blur(2px);
  animation: jo-backdrop-fade 200ms ease-out both;
}

@keyframes jo-backdrop-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

body.jo-no-scroll {
  overflow: hidden;
}

.jo-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 22px;
  width: min(1500px, 100%);
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  padding: 22px;
}

.jo-sidebar,
.jo-detail-shell {
  min-width: 0;
}

.jo-sidebar {
  position: sticky;
  top: 98px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.jo-filter-card,
.jo-card,
.jo-detail-empty {
  background: var(--jo-surface);
  border: 1px solid var(--jo-border);
  border-radius: var(--jo-radius);
  box-shadow: var(--jo-shadow);
}

.jo-filter-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.jo-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 2px 12px;
}

.jo-list-head h2 {
  margin: 0;
  color: var(--jo-ink);
  font-size: 1rem;
}

.jo-list-head span {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  color: var(--jo-blue-dark);
  font-size: 0.75rem;
  font-weight: 800;
  background: #eaf3ff;
  border-radius: 999px;
}

.jo-job-list {
  display: grid;
  gap: 10px;
}

.jo-job-item {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--jo-border);
  border-radius: 14px;
  transition:
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 180ms ease-out,
    background-color 180ms ease-out;
}

.jo-job-item:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
}

.jo-job-item.is-active {
  background: #f0f7ff;
  border-color: var(--jo-blue);
  box-shadow: inset 3px 0 0 var(--jo-blue);
}

.jo-job-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.jo-job-item strong {
  color: var(--jo-ink);
  font-size: 0.9rem;
  line-height: 1.4;
}

.jo-job-item > span:not(.jo-job-item-top),
.jo-job-item time {
  color: var(--jo-muted);
  font-size: 0.76rem;
}

.jo-empty,
.jo-inline-empty {
  margin: 0;
  padding: 16px;
  color: var(--jo-muted);
  font-size: 0.84rem;
  text-align: center;
  background: #fff;
  border: 1px dashed var(--jo-border);
  border-radius: 14px;
}

.jo-detail-empty {
  display: grid;
  justify-items: center;
  padding: 80px 24px;
  text-align: center;
}

.jo-empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: var(--jo-blue);
  font-size: 1.5rem;
  background: #eaf3ff;
  border-radius: 18px;
}

.jo-detail-empty h2 {
  margin: 18px 0 6px;
  color: var(--jo-ink);
}

.jo-detail-empty p {
  max-width: 520px;
  margin: 0;
  color: var(--jo-muted);
  line-height: 1.6;
}

.jo-empty-browse {
  display: none;
  margin-top: 18px;
}

@media (max-width: 800px) {
  .jo-empty-browse {
    display: inline-flex;
  }
}

.jo-job-detail {
  display: grid;
  gap: 18px;
  animation: jo-fade-up 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.jo-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--jo-border);
  border-radius: var(--jo-radius);
  box-shadow: var(--jo-shadow);
}

.jo-detail-code {
  margin: 0 0 5px;
  color: var(--jo-blue);
  font-size: 0.75rem;
  font-weight: 800;
}

.jo-detail-header h2 {
  margin: 0;
  color: var(--jo-ink);
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.jo-detail-assignment {
  margin: 8px 0 0;
  color: var(--jo-muted);
  font-size: 0.84rem;
}

.jo-detail-header-main {
  width: 100%;
  min-width: 0;
}

.jo-detail-header .jo-workflow-progress {
  max-width: 520px;
  margin: 22px 0 0;
}

.jo-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 9px;
  color: #475569;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
  background: #e2e8f0;
  border-radius: 999px;
}

.jo-status--in-progress {
  color: #92400e;
  background: #fef3c7;
}

.jo-status--completed {
  color: #1d4ed8;
  background: #dbeafe;
}

.jo-status--verified {
  color: #166534;
  background: #dcfce7;
}

.jo-status--rejected {
  color: #b91c1c;
  background: #fee2e2;
}

.jo-rejection-notice {
  padding: 14px 16px;
  color: #991b1b;
  font-size: 0.88rem;
  font-weight: 600;
  background: #fff7f7;
  border: 1px solid #fecaca;
  border-radius: 14px;
}

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

.jo-info-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--jo-border);
  border-radius: 14px;
}

.jo-info-card span,
.jo-info-card strong {
  overflow-wrap: anywhere;
}

.jo-info-card span {
  color: var(--jo-muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.jo-info-card strong {
  color: var(--jo-ink);
  font-size: 0.88rem;
  line-height: 1.5;
}

.jo-card {
  padding: 20px;
}

.jo-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.jo-section-heading h3 {
  margin: 0;
  color: var(--jo-ink);
  font-size: 1.05rem;
}

.jo-section-heading > p {
  max-width: 420px;
  margin: 0;
  color: var(--jo-muted);
  font-size: 0.78rem;
  text-align: right;
}

.jo-workflow-progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 20px 0;
}

.jo-workflow-progress span {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--jo-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
}

.jo-workflow-progress span::before {
  content: "";
  position: absolute;
  top: 6px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--jo-border);
}

.jo-workflow-progress span:first-child::before {
  display: none;
}

.jo-workflow-progress i {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid var(--jo-border);
  border-radius: 50%;
}

.jo-workflow-progress span.is-done,
.jo-workflow-progress span.is-current {
  --step-color: var(--jo-blue);
  color: var(--step-color);
}

.jo-workflow-progress .jo-step--blue.is-done,
.jo-workflow-progress .jo-step--blue.is-current {
  --step-color: #1671d9;
}

.jo-workflow-progress .jo-step--amber.is-done,
.jo-workflow-progress .jo-step--amber.is-current {
  --step-color: #d97706;
}

.jo-workflow-progress .jo-step--indigo.is-done,
.jo-workflow-progress .jo-step--indigo.is-current {
  --step-color: #6366f1;
}

.jo-workflow-progress .jo-step--green.is-done,
.jo-workflow-progress .jo-step--green.is-current {
  --step-color: #16a34a;
}

.jo-workflow-progress .is-done::before,
.jo-workflow-progress .is-current::before {
  background: var(--step-color);
}

.jo-workflow-progress .is-done i,
.jo-workflow-progress .is-current i {
  background: var(--step-color);
  border-color: var(--step-color);
}

.jo-workflow-progress .is-current i {
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--step-color) 16%, transparent);
}

.jo-workflow-actions,
.jo-notes-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.jo-detail-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.jo-stage-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.jo-stage-button {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 18px 12px;
  text-align: center;
  background: #f8fafc;
  border: 1px solid var(--jo-border);
  border-radius: 14px;
  transition:
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 180ms ease-out,
    box-shadow 180ms ease-out;
}

.jo-stage-button:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.jo-stage-check {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #94a3b8;
  background: #e2e8f0;
  border-radius: 999px;
  transition:
    background-color 180ms ease-out,
    color 180ms ease-out;
}

.jo-stage-button.has-photos .jo-stage-check {
  color: #166534;
  background: #dcfce7;
}

.jo-stage-button-label {
  color: var(--jo-ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.jo-stage-button-count {
  color: var(--jo-muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.jo-stage-button.has-photos .jo-stage-button-count {
  color: var(--jo-blue-dark);
}

.jo-stage-count {
  margin: 0;
  color: var(--jo-blue-dark);
  font-size: 0.76rem;
  font-weight: 700;
}

/* Stage photos modal */
.jo-stage-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 18px;
}

.jo-stage-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  animation: jo-backdrop-fade 200ms ease-out both;
}

.jo-stage-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  padding: 20px;
  overflow-y: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  animation: jo-modal-pop 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.jo-stage-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.jo-stage-modal-head h3 {
  margin: 0 0 3px;
  color: var(--jo-ink);
  font-size: 1.1rem;
}

.jo-stage-modal-head p {
  margin: 0;
  color: var(--jo-muted);
  font-size: 0.76rem;
}

.jo-stage-modal-close {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  color: var(--jo-ink);
  background: #f1f5f9;
  border: none;
  border-radius: 12px;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.jo-stage-modal-close:active {
  transform: scale(0.92);
}

.jo-stage-upload {
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.jo-dropzone {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 22px 16px;
  color: var(--jo-blue);
  text-align: center;
  cursor: pointer;
  background: #f6faff;
  border: 2px dashed #b6d4f5;
  border-radius: 14px;
  transition:
    border-color 180ms ease-out,
    background-color 180ms ease-out,
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.jo-dropzone:hover {
  border-color: var(--jo-blue);
  background: #eef6ff;
}

.jo-dropzone.is-dragover {
  border-color: var(--jo-blue);
  background: #e3f0ff;
  transform: scale(1.01);
}

.jo-dropzone.is-disabled {
  cursor: not-allowed;
  color: var(--jo-muted);
  background: #f1f5f9;
  border-color: var(--jo-border);
}

.jo-dropzone strong {
  color: var(--jo-ink);
  font-size: 0.86rem;
}

.jo-dropzone.is-disabled strong {
  color: var(--jo-muted);
}

.jo-dropzone span {
  color: var(--jo-muted);
  font-size: 0.74rem;
}

.jo-upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.jo-pending-photo {
  position: relative;
  overflow: hidden;
  margin: 0;
  background: #f8fafc;
  border: 1px solid #b6d4f5;
  border-radius: 12px;
}

.jo-pending-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.jo-pending-photo figcaption {
  overflow: hidden;
  padding: 7px 8px;
  color: var(--jo-text);
  font-size: 0.68rem;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.jo-photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #b91c1c;
  background: rgba(255, 255, 255, 0.94);
  border: none;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.22);
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.jo-photo-remove:hover {
  transform: scale(1.08);
}

.jo-photo-remove:active {
  transform: scale(0.9);
}

.jo-photo-grid figure {
  position: relative;
}

.jo-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.jo-photo-grid figure {
  overflow: hidden;
  margin: 0;
  background: #f8fafc;
  border: 1px solid var(--jo-border);
  border-radius: 12px;
}

.jo-photo-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.jo-photo-grid figcaption {
  padding: 8px 9px;
  color: var(--jo-text);
  font-size: 0.72rem;
  line-height: 1.4;
}

.jo-card textarea {
  display: block;
  margin-bottom: 10px;
  resize: vertical;
  line-height: 1.55;
}

.jo-timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jo-timeline li {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 0 0 18px 24px;
  border-left: 2px solid var(--jo-border);
}

.jo-timeline li:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

.jo-timeline li {
  --tl-color: var(--jo-blue);
}

.jo-timeline li.jo-tl--blue {
  --tl-color: #1671d9;
}

.jo-timeline li.jo-tl--sky {
  --tl-color: #0ea5e9;
}

.jo-timeline li.jo-tl--amber {
  --tl-color: #d97706;
}

.jo-timeline li.jo-tl--indigo {
  --tl-color: #6366f1;
}

.jo-timeline li.jo-tl--green {
  --tl-color: #16a34a;
}

.jo-timeline li.jo-tl--red {
  --tl-color: #dc2626;
}

.jo-timeline li::before {
  content: "";
  position: absolute;
  top: 2px;
  left: -6px;
  width: 10px;
  height: 10px;
  background: var(--tl-color);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--tl-color);
}

.jo-timeline strong {
  color: var(--tl-color);
  font-size: 0.82rem;
}

.jo-timeline span,
.jo-timeline p {
  margin: 0;
  color: var(--jo-muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

/* Photo preview modal */
.jo-photo-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
}

.jo-photo-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.66);
  backdrop-filter: blur(3px);
  animation: jo-backdrop-fade 200ms ease-out both;
}

.jo-photo-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0;
  width: min(680px, 100%);
  max-height: calc(100vh - 36px);
  margin: 0;
  overflow: hidden;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  animation: jo-modal-pop 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes jo-modal-pop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.jo-photo-modal-panel img {
  display: block;
  width: 100%;
  max-height: min(72vh, 620px);
  object-fit: contain;
  background: #0f172a;
}

.jo-photo-modal-panel figcaption {
  padding: 14px 16px;
  color: var(--jo-text);
  font-size: 0.86rem;
  line-height: 1.5;
}

.jo-photo-modal-panel figcaption:empty {
  display: none;
}

.jo-photo-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--jo-ink);
  background: rgba(255, 255, 255, 0.94);
  border: none;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.22);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.jo-photo-modal-close:active {
  transform: scale(0.92);
}

.jo-photo-grid figure {
  cursor: zoom-in;
}

.jo-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 70;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 16px;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  background: var(--jo-ink);
  border-radius: 12px;
  box-shadow: var(--jo-shadow);
  animation: jo-fade-up 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (max-width: 1100px) {
  .jo-detail-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .jo-workspace {
    grid-template-columns: 1fr;
  }

  .jo-menu-toggle {
    display: grid;
  }

  /* Sidebar becomes a slide-in drawer opened by the burger button */
  .jo-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: min(86vw, 360px);
    max-height: none;
    padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
    overflow-y: auto;
    background: var(--jo-bg);
    border-right: 1px solid var(--jo-border);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.24);
    transform: translateX(-105%);
    visibility: hidden;
    transition:
      transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
      visibility 260ms;
  }

  .jo-sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .jo-sidebar.is-dragging {
    visibility: visible;
    transition: none;
  }

  .jo-drawer-head {
    display: flex;
  }

  .jo-list-head {
    margin-top: 16px;
  }
}

@media (max-width: 560px) {
  .jo-topbar {
    padding: 10px 12px;
    min-height: 64px;
  }

  .jo-topbar h1 {
    font-size: 1.08rem;
  }

  .jo-topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .jo-topbar-actions .jo-button {
    min-height: 40px;
    padding: 0 12px;
    font-size: 0.82rem;
  }

  .jo-workspace {
    padding: 12px;
  }

  .jo-button,
  .jo-workflow-actions .jo-button {
    min-height: 46px;
  }

  .jo-workflow-actions,
  .jo-notes-actions {
    flex-direction: column;
  }

  .jo-workflow-actions .jo-button,
  .jo-notes-actions .jo-button {
    width: 100%;
  }

  /* Stage buttons become full-width rows on phones */
  .jo-stage-buttons {
    grid-template-columns: 1fr;
  }

  .jo-stage-button {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    justify-items: start;
    padding: 14px 16px;
    text-align: left;
  }

  .jo-stage-button-count {
    justify-self: end;
  }

  .jo-detail-header,
  .jo-section-heading {
    flex-direction: column;
  }

  .jo-section-heading > p {
    text-align: left;
  }

  .jo-info-grid {
    grid-template-columns: 1fr;
  }

  .jo-card,
  .jo-detail-header {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Work-type views: calendar jobs vs assigned area */
.jo-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 4px 0 8px;
}

.jo-mode-tabs--area {
  max-width: 280px;
  margin: 0 0 16px;
}

.jo-mode-tab {
  appearance: none;
  border: 1px solid var(--jo-border);
  background: #fff;
  color: var(--jo-muted);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.jo-mode-tab.is-active {
  background: rgba(22, 113, 217, 0.1);
  border-color: rgba(22, 113, 217, 0.35);
  color: #003090;
}

.jo-mini-calendar {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--jo-border);
  border-radius: 14px;
  background: #fff;
  margin-bottom: 4px;
}

.jo-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.jo-cal-nav strong {
  color: var(--jo-ink);
  font-size: 0.86rem;
}

.jo-cal-nav button,
.jo-cal-clear {
  appearance: none;
  border: 1px solid var(--jo-border);
  background: #fff;
  color: var(--jo-ink);
  border-radius: 8px;
  min-width: 32px;
  min-height: 32px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.jo-cal-clear {
  width: 100%;
  font-size: 0.75rem;
  padding: 7px 10px;
}

.jo-cal-weekdays,
.jo-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.jo-cal-weekdays span {
  text-align: center;
  color: var(--jo-muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.jo-cal-day {
  appearance: none;
  border: 0;
  background: #f8fafc;
  border-radius: 8px;
  min-height: 34px;
  padding: 4px 2px;
  display: grid;
  place-items: center;
  gap: 1px;
  cursor: pointer;
  color: var(--jo-ink);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
}

.jo-cal-day.is-empty {
  background: transparent;
  cursor: default;
}

.jo-cal-day.is-today {
  box-shadow: inset 0 0 0 1px rgba(22, 113, 217, 0.35);
}

.jo-cal-day.has-jobs {
  background: rgba(22, 113, 217, 0.1);
  color: #003090;
}

.jo-cal-day.is-selected {
  background: #1671d9;
  color: #fff;
}

.jo-cal-day em {
  font-style: normal;
  font-size: 0.58rem;
  opacity: 0.85;
}

.jo-workspace--daily {
  display: block;
  padding: clamp(16px, 2.5vw, 28px);
}

.jo-calendar-workspace {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.jo-calendar-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.jo-calendar-topbar:not(:has(.jo-mode-tabs:not([hidden]))) {
  display: none;
}

.jo-daily-work-root {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--jo-border);
  border-radius: 18px;
  padding: clamp(14px, 2vw, 20px);
  box-shadow: var(--jo-shadow);
}

.jo-daily-work-root .btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
}

.jo-daily-work-root .btn.primary {
  background: #1671d9;
  color: #fff;
}

.jo-daily-work-root .personnel-daily-calendar-title-wrap select {
  appearance: auto;
  -webkit-appearance: menulist;
  border: 1px solid var(--jo-border, #dbe3ee);
  background: #fff;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 8px 10px;
}

.jo-daily-work-root .personnel-daily-calendar-head {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
}

.jo-daily-work-root .personnel-daily-summary-card strong {
  color: #0b3d91;
}

.jo-daily-work-root .personnel-daily-history-item.is-active {
  border-color: rgba(22, 113, 217, 0.35);
  background: rgba(22, 113, 217, 0.06);
}

.jo-daily-work-root .btn.secondary {
  background: #fff;
  border-color: #cbd5e1;
  color: #0f172a;
}

.jo-detail-shell--overlay {
  width: min(920px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.jo-detail-shell--overlay > .jo-button {
  width: fit-content;
}

.jo-portal-page .jo-menu-toggle[hidden] {
  display: none !important;
}

.jo-area-root .assigned-area-panel {
  gap: 14px;
}

.jo-area-root .assigned-area-info {
  margin-bottom: 2px;
}

.jo-area-root .assigned-area-columns {
  gap: 14px;
}

.jo-area-root .assigned-area-gallery {
  max-height: min(72vh, 720px);
}

.jo-area-root .aa-folder-scroll {
  max-height: none;
  flex: 1 1 auto;
}

.jo-area-root .aa-preview-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px;
}

.jo-area-root .aa-thumb,
.jo-area-root .aa-view-all {
  aspect-ratio: 1 / 1;
  min-height: 0;
}

.jo-area-root .btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
}

.jo-area-root .btn.primary {
  background: #1671d9;
  color: #fff;
}

.jo-area-root .btn.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.jo-portal-page.jo-area-only .jo-menu-toggle {
  display: none;
}
