/* Store Tasks — scoped to .st-* classes so it cannot bleed into Control Tower / other SimStore screens.
   Reuses the --ss-* tokens and the 1000px breakpoint already established by simstore.css /
   ControlTowerDrawer; introduces the bottom-sheet pattern that doesn't exist elsewhere yet, using the
   same elevation/z-index vocabulary (--ss-surface-raised, backdrop at rgba(0,0,0,.5), z-index 1099/1100). */

.st-shell {
  min-height: 100vh;
  background: var(--ss-dark);
  color: var(--ss-text);
  font-family: inherit;
}

.st-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1rem 6rem;
  box-sizing: border-box;
}

.st-header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 1rem;
}

.st-header__store {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ss-text);
}

.st-header__sub {
  font-size: 0.82rem;
  color: var(--ss-muted);
}

/* ── Access denied ─────────────────────────────────────────────────────── */

.st-denied {
  margin-top: 3rem;
  text-align: center;
  color: var(--ss-muted);
  padding: 0 1rem;
}

.st-denied__title {
  color: var(--ss-text);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

/* ── Filter chips — wrap, never scroll horizontally ───────────────────── */

.st-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.st-chip {
  min-height: 44px;
  padding: 0 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--ss-border);
  background: var(--ss-surface);
  color: var(--ss-muted);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  transition: background var(--ss-ease), color var(--ss-ease), border-color var(--ss-ease);
}

.st-chip:hover { background: var(--ss-surface-hover); }

.st-chip--active {
  background: var(--ss-accent);
  border-color: var(--ss-accent);
  color: #05130f;
}

.st-chip:focus-visible { outline: 2px solid var(--ss-accent-light); outline-offset: 2px; }

/* ── Task cards ────────────────────────────────────────────────────────── */

.st-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.st-empty {
  text-align: center;
  color: var(--ss-muted);
  padding: 2.5rem 1rem;
  font-size: 0.9rem;
}

.st-card {
  width: 100%;
  text-align: left;
  min-height: 44px;
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius-lg);
  padding: 0.9rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--ss-text);
  font: inherit;
}

.st-card:hover { background: var(--ss-surface-hover); }
.st-card:focus-visible { outline: 2px solid var(--ss-accent-light); outline-offset: 2px; }

.st-card--overdue { border-color: var(--ss-crit-border, #f87171); }

.st-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.st-card__title {
  font-size: 0.95rem;
  font-weight: 700;
  word-break: break-word;
}

.st-card__detail {
  font-size: 0.82rem;
  color: var(--ss-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.st-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.76rem;
  color: var(--ss-muted);
}

/* ── Badges / pills — small, scoped variants on top of the shared .ss-badge look ── */

.st-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.st-pill--overdue { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.st-pill--priority-high { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.st-pill--priority-medium { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.st-pill--priority-low { background: rgba(74, 222, 128, 0.15); color: var(--ss-accent-light); }

.st-pill--status-open { background: rgba(148, 163, 184, 0.18); color: var(--ss-text); }
.st-pill--status-acknowledged { background: rgba(74, 222, 128, 0.15); color: var(--ss-accent-light); }
.st-pill--status-completed { background: rgba(74, 222, 128, 0.22); color: var(--ss-accent-light); }
.st-pill--status-rejected { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.st-pill--status-cancelled { background: rgba(148, 163, 184, 0.18); color: var(--ss-muted); }

/* ── New-task action bar (elevated roles only) ────────────────────────── */

.st-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  background: var(--ss-surface-raised, var(--ss-surface));
  border-top: 1px solid var(--ss-border);
  display: flex;
  justify-content: center;
  z-index: 1050;
}

.st-action-bar__btn {
  min-height: 48px;
  width: 100%;
  max-width: 560px;
  border-radius: var(--ss-radius);
  border: none;
  background: var(--ss-accent);
  color: #05130f;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

.st-action-bar__btn:focus-visible { outline: 2px solid var(--ss-accent-light); outline-offset: 2px; }

/* ── Bottom sheet ──────────────────────────────────────────────────────── */

.st-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1099;
}

.st-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 560px;
  margin: 0 auto;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--ss-surface-raised, var(--ss-surface));
  border: 1px solid var(--ss-border-strong, var(--ss-border));
  border-bottom: none;
  border-radius: var(--ss-radius-lg) var(--ss-radius-lg) 0 0;
  padding: 1rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
  z-index: 1100;
  box-sizing: border-box;
}

.st-sheet__handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--ss-border-strong, var(--ss-border));
  margin: 0 auto 0.75rem;
}

.st-sheet__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.3rem;
  word-break: break-word;
}

.st-sheet__section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ss-muted);
  margin: 0.9rem 0 0.35rem;
}

.st-sheet__field { margin-bottom: 0.75rem; }

.st-sheet__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.st-btn {
  min-height: 44px;
  padding: 0 1rem;
  border-radius: var(--ss-radius);
  border: 1px solid var(--ss-border);
  background: var(--ss-surface);
  color: var(--ss-text);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  flex: 1 1 auto;
}

.st-btn:focus-visible { outline: 2px solid var(--ss-accent-light); outline-offset: 2px; }
.st-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.st-btn--primary { background: var(--ss-accent); border-color: var(--ss-accent); color: #05130f; }
.st-btn--danger { background: rgba(248, 113, 113, 0.15); border-color: #f87171; color: #f87171; }
.st-btn--secondary { background: transparent; }
.st-btn--elevated { opacity: 0.85; border-style: dashed; }

.st-note {
  width: 100%;
  min-height: 72px;
  box-sizing: border-box;
  background: var(--ss-dark);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius);
  color: var(--ss-text);
  padding: 0.6rem 0.7rem;
  font: inherit;
  resize: vertical;
}

.st-note:focus-visible { outline: 2px solid var(--ss-accent-light); }

.st-inline-error {
  color: #f87171;
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

.st-inline-info {
  color: var(--ss-muted);
  font-size: 0.78rem;
  margin: 0.2rem 0 0.6rem;
}

.st-toast {
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid var(--ss-accent);
  color: var(--ss-accent-light);
  border-radius: var(--ss-radius);
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.st-toast--conflict {
  background: rgba(251, 191, 36, 0.12);
  border-color: #fbbf24;
  color: #fbbf24;
}

/* ── History ──────────────────────────────────────────────────────────── */

.st-history {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.st-history__entry {
  font-size: 0.82rem;
  color: var(--ss-text);
  border-left: 2px solid var(--ss-border);
  padding-left: 0.6rem;
}

.st-history__when {
  display: block;
  font-size: 0.72rem;
  color: var(--ss-muted);
}

/* ── Wider screens: sheet reads as a centered modal instead of edge-to-edge ── */

@media (min-width: 1000px) {
  .st-sheet {
    bottom: 2rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
    border-radius: var(--ss-radius-lg);
    border-bottom: 1px solid var(--ss-border-strong, var(--ss-border));
  }
}

/* ── S1: progress updates + LP outcome panel ─────────────────────────────── */
.st-select,
.st-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--ss-dark);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius);
  color: var(--ss-text);
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
}
.st-select:focus-visible,
.st-input:focus-visible { outline: 2px solid var(--ss-accent-light); }
.st-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.82rem; color: var(--ss-muted); margin: 0.5rem 0; }
.st-outcome { display: flex; flex-direction: column; gap: 0.35rem; }
.st-outcome__summary { font-size: 0.88rem; color: var(--ss-text); display: flex; flex-direction: column; gap: 0.2rem; }
.st-outcome__meta { font-size: 0.78rem; color: var(--ss-muted); }
.st-outcome__line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem;
  padding: 0.45rem 0; border-top: 1px solid var(--ss-border); font-size: 0.86rem;
}
.st-outcome__amount { font-weight: 700; margin-left: auto; }
.st-outcome__review { display: flex; gap: 0.35rem; width: 100%; justify-content: flex-end; }
.st-outcome__badge { font-size: 0.72rem; }
.st-outcome__badge--accepted { border-color: var(--ss-accent); color: var(--ss-accent-light); }
.st-outcome__badge--pendingreview { border-color: var(--ss-crit-border); }
.st-outcome__badge--excluded { opacity: 0.7; text-decoration: line-through; }
.st-outcome__reconcile { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.5rem; border: 1px dashed var(--ss-border-strong); border-radius: var(--ss-radius); font-size: 0.82rem; }
.st-outcome__value { display: grid; grid-template-columns: 1fr; gap: 0.2rem; padding: 0.4rem 0; border-top: 1px solid var(--ss-border); }
@media (min-width: 560px) {
  .st-outcome__value { grid-template-columns: 2fr 1fr 1fr; gap: 0.6rem; align-items: end; }
}
