/* In-app tutorials: app-bar pill, overlay, intro, CSS scenes */

#prj-tutorials-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f5a623;
  color: #1a1204;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(245, 166, 35, 0.45);
  font-family: inherit;
  font-size: 0.92rem;
}
#prj-tutorials-btn:hover,
#prj-tutorials-btn:focus-visible {
  background: #ffb43a;
  color: #1a1204;
  outline: 2px solid #1a1204;
  outline-offset: 2px;
}
#app-menu-bar .prj-tutorials-nav {
  display: flex;
  align-items: center;
  padding: 0 0.25rem;
}

.prj-tut-overlay {
  position: fixed;
  inset: 0;
  z-index: 5100;
  background: rgba(20, 24, 28, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.prj-tut-overlay[hidden],
.prj-tut-intro[hidden] {
  display: none !important;
}
.prj-tut-dialog {
  background: #fff;
  color: #222;
  border-radius: 12px;
  width: min(920px, 96vw);
  max-height: min(88vh, 820px);
  overflow: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
  padding: 1rem 1.15rem 1.25rem;
}
.prj-tut-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.prj-tut-dialog__head h2 {
  margin: 0;
  font-size: 1.25rem;
}
.prj-tut-dialog__sub {
  margin: 0.2rem 0 0;
  color: #5a6b7a;
  font-size: 0.9rem;
}
.prj-tut-close,
.prj-tut-back {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem 0.4rem;
  color: inherit;
}
.prj-tut-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: stretch;
}
button.prj-tut-card,
.prj-tut-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 0;
  border: 1px solid #e2e6ea;
  border-radius: 10px;
  padding: 0.75rem;
  background: #fff !important;
  text-align: left;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto !important;
  min-height: 0 !important;
  font: inherit;
  color: inherit;
  white-space: normal !important;
  line-height: 1.35;
  overflow: hidden;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  text-transform: none;
  isolation: isolate;
}
.prj-tut-card:hover,
.prj-tut-card:focus-visible {
  border-color: #f5a623;
  box-shadow: 0 0 0 2px rgba(245, 166, 35, 0.35);
  outline: none;
}
.prj-tut-card__thumb {
  flex: 0 0 72px;
  height: 72px;
  width: 100%;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}
.prj-tut-card__thumb--timesheets { background: #f5e6c8; }
.prj-tut-card__thumb--jobs-board { background: #d7e8f5; }
.prj-tut-card__thumb--receipts { background: #d8efe3; }
.prj-tut-card--soon {
  border-style: dashed;
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}
.prj-tut-card__title {
  font-weight: 700;
  font-size: 1rem;
  white-space: normal;
  overflow-wrap: anywhere;
}
.prj-tut-card__blurb {
  color: #5a6b7a;
  font-size: 0.85rem;
  margin-top: 0.25rem;
  white-space: normal !important;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prj-tut-detail {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1rem;
  align-items: start;
}
.prj-tut-detail__why {
  margin: 0.5rem 0 0.75rem 1.1rem;
  padding: 0;
}
.prj-tut-open {
  display: inline-flex;
  align-items: center;
  background: #f5a623;
  color: #1a1204;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  text-decoration: none;
  margin: 0.25rem 0.4rem 0 0;
}
.prj-tut-scene {
  background: #f6f3ec;
  border-radius: 10px;
  padding: 0.75rem;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.prj-tut-scene__caption {
  font-size: 0.85rem;
  color: #5a6b7a;
  margin-bottom: 0.5rem;
  line-height: 1.35;
  min-height: 2.7em;
}
.prj-tut-replay {
  margin-top: 0.5rem;
  background: transparent;
  border: 1px solid #cfc6b4;
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.prj-tut-intro {
  position: fixed;
  inset: 0;
  z-index: 5200;
  background: rgba(20, 24, 28, 0.38);
  pointer-events: auto;
}
.prj-tut-intro__tip {
  position: absolute;
  left: 16px;
  bottom: 16px;
  background: #fff;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  max-width: min(360px, 80vw);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.prj-tut-intro__skip {
  position: absolute;
  right: 12px;
  bottom: 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.7);
  color: #fff;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}
.prj-tut-cursor {
  position: fixed;
  width: 18px;
  height: 18px;
  z-index: 5210;
  pointer-events: none;
  background: #fff;
  clip-path: polygon(0 0, 0 100%, 28% 72%, 55% 100%, 68% 92%, 42% 62%, 100% 62%);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
  transform: translate(-4px, -2px);
}
#prj-tutorials-btn.prj-tut-pulse {
  animation: prj-tut-pulse 0.35s ease-in-out 2;
}
@keyframes prj-tut-pulse {
  50% { transform: scale(1.06); }
}

/* Mini scenes: 4 steps, ~3s each, 12s loop */
.prj-tut-mini {
  background: #fff;
  border: 1px solid #e6d7b8;
  border-radius: 8px;
  padding: 0.55rem;
  min-height: 188px;
  height: 188px;
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
}
.prj-tut-mini .s {
  position: absolute;
  inset: 0.55rem;
  opacity: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  animation: prj-tut-step 12s linear infinite;
}
.prj-tut-mini .s:nth-child(1) { animation-delay: 0s; }
.prj-tut-mini .s:nth-child(2) { animation-delay: 3s; }
.prj-tut-mini .s:nth-child(3) { animation-delay: 6s; }
.prj-tut-mini .s:nth-child(4) { animation-delay: 9s; }
@keyframes prj-tut-step {
  0% { opacity: 0; }
  4% { opacity: 1; }
  22% { opacity: 1; }
  25% { opacity: 0; }
  100% { opacity: 0; }
}
.prj-tut-mini .hl {
  outline: 2px solid #f5a623;
  outline-offset: 1px;
}
.tut-ui-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a94a0;
}
.tut-ui-nav,
.tut-ui-months,
.tut-ui-chips {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}
.tut-ui-nav span,
.tut-ui-months span,
.tut-ui-chips span {
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: #eef2f6;
  color: #445;
}
.tut-ui-nav .on,
.tut-ui-months .on,
.tut-ui-chips .on {
  background: #f5a623;
  color: #1a1204;
  font-weight: 700;
}
.tut-ui-search {
  font-size: 0.78rem;
  color: #8a94a0;
  border: 1px solid #e2e6ea;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
}
.tut-ui-grid {
  display: grid;
  grid-template-columns: 52px repeat(5, 1fr);
  gap: 3px;
  flex: 1;
  min-height: 0;
}
.tut-ui-grid .lab {
  font-size: 0.65rem;
  color: #6b7785;
  display: flex;
  align-items: center;
}
.tut-ui-grid .d {
  background: #f4f7fa;
  border-radius: 3px;
  min-height: 22px;
  position: relative;
}
.tut-ui-bar {
  position: absolute;
  left: 4%;
  right: 8%;
  top: 5px;
  height: 10px;
  border-radius: 3px;
  background: #7eb6d9;
}
.tut-ui-bar.clash { background: #e67e22; top: 16px; width: 55%; right: auto; }
.tut-ui-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.35rem;
  flex: 1;
}
.tut-ui-tiles > div {
  background: #f6f3ec;
  border: 1px solid #e6d7b8;
  border-radius: 6px;
  padding: 0.4rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.tut-ui-phone {
  border: 1px solid #d8dee6;
  border-radius: 10px;
  padding: 0.5rem;
  font-size: 0.78rem;
  flex: 1;
}
.tut-ui-phone .id {
  border: 1px solid #cfd6de;
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  margin: 0.35rem 0;
  color: #5a6b7a;
}
.tut-ui-qr {
  width: 52px;
  height: 52px;
  background:
    repeating-linear-gradient(90deg, #222 0 4px, transparent 4px 8px),
    repeating-linear-gradient(#222 0 4px, transparent 4px 8px);
  background-size: 16px 16px;
  border-radius: 4px;
}
.tut-ui-form {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}
.tut-ui-field {
  border: 1px solid #d8dee6;
  border-radius: 5px;
  padding: 0.28rem 0.4rem;
  font-size: 0.75rem;
  color: #5a6b7a;
  background: #fafbfc;
}
.tut-ui-drop {
  flex: 1;
  border: 1px dashed #b7c2cc;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #6b7785;
  background: #f7fafc;
  min-height: 48px;
}
.tut-ui-table {
  font-size: 0.72rem;
  border: 1px solid #e2e6ea;
  border-radius: 6px;
  overflow: hidden;
}
.tut-ui-table div {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 0.28rem 0.4rem;
  gap: 0.3rem;
}
.tut-ui-table .head { background: #eef2f6; font-weight: 700; }
.tut-ui-ok { color: #1ba261; font-weight: 700; }

@media (max-width: 700px) {
  .prj-tut-grid { grid-template-columns: 1fr; }
  .prj-tut-detail { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .prj-tut-mini .s {
    animation: none;
    opacity: 0;
    position: absolute;
    display: flex;
    flex-direction: column;
    pointer-events: none;
  }
  .prj-tut-mini .s.is-current {
    opacity: 1;
    pointer-events: auto;
  }
  #prj-tutorials-btn.prj-tut-pulse { animation: none; }
}

body.prj-sm-tablet-shell #prj-tutorials-btn {
  display: inline-flex;
}
