/* stories.css — User Story drawer + the small "📖 Story" chip
   that appears on tasks that have a parent story. Scoped under
   .story-* so it can't bleed into other surfaces. */

/* ── Story chip on task drawer / cards ─────────────────────────── */
.story-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(162, 93, 220, 0.10);
  color: #6c2ea5;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid rgba(162, 93, 220, 0.22);
  cursor: pointer;
  transition: background .12s ease;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.story-chip:hover { background: rgba(162, 93, 220, 0.16); }
.story-chip-emoji { font-size: 12px; }
.story-chip-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(162, 93, 220, 0.18);
}
.story-chip-status.is-review     { background: rgba(162, 93, 220, 0.32); color: #4a1c80; }
.story-chip-status.is-done       { background: rgba(0, 200, 117, 0.20); color: #007a47; }
.story-chip-status.is-changes_req { background: rgba(226, 68, 92, 0.18); color: #8a1024; }

/* Parent-task chip in the task drawer header — appears only when
   the current task is a subtask. Clicking jumps the drawer to the
   parent without closing it. */
.parent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 115, 234, .08);
  color: #0050a8;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid rgba(0, 115, 234, .22);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.parent-chip:hover {
  background: rgba(0, 115, 234, .14);
  border-color: rgba(0, 115, 234, .35);
}
.parent-chip-glyph { font-size: 13px; line-height: 1; }
.parent-chip-label { font-weight: 500; opacity: .75; }
.parent-chip-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Drawer ───────────────────────────────────────────────────── */
.story-drawer-backdrop {
  position: fixed; inset: 0; z-index: 9100;
  background: rgba(15, 23, 41, 0.36);
  display: flex; justify-content: flex-end;
  animation: fadeIn .12s ease-out;
}
.story-drawer {
  width: 520px;
  max-width: calc(100vw - 24px);
  background: var(--bg-surface, #fff);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(16, 22, 40, 0.18);
  animation: slideIn .16s cubic-bezier(.2,.6,.2,1);
  overflow: hidden;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.story-drawer-head {
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--border, #e6e9ef);
  flex: 0 0 auto;
}
.story-drawer-title-row {
  display: flex; align-items: flex-start; gap: 10px;
}
.story-drawer-title {
  flex: 1;
  font-size: 17px; font-weight: 700; color: var(--ink-strong, #0f1729);
  margin: 0; line-height: 1.3;
  letter-spacing: -0.01em;
}
.story-drawer-close {
  appearance: none;
  background: transparent; border: 0;
  font-size: 22px; line-height: 1;
  color: var(--ink-muted, #676879);
  cursor: pointer;
  padding: 0 4px;
  margin-top: -2px;
}
.story-drawer-close:hover { color: var(--ink-strong, #0f1729); }
.story-drawer-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-muted, #676879);
  display: flex; flex-wrap: wrap; gap: 6px;
}
.story-drawer-meta b { color: var(--ink-strong, #0f1729); font-weight: 700; }

/* Body sections — body of the drawer scrolls if content exceeds the
   viewport. The actions footer + header stay pinned. */
.story-drawer-section {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border-row, #eaecf1);
  overflow: visible;
}
.story-drawer-section:last-of-type { border-bottom: 0; }
.story-drawer-section-h {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-muted, #676879);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.story-drawer-progress {
  flex: 1;
  height: 4px;
  background: rgba(0,0,0,.06);
  border-radius: 999px;
  overflow: hidden;
}
.story-drawer-progress-bar {
  display: block;
  height: 100%;
  background: var(--brand, #0073ea);
  border-radius: 999px;
  transition: width .18s ease;
}
.story-drawer-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-body, #323338);
  white-space: pre-wrap;
}
.story-drawer-empty {
  font-size: 12.5px;
  color: var(--ink-muted, #676879);
  font-style: italic;
}

/* Tasks list inside the drawer */
.story-drawer-tasks {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
}
.story-drawer-task {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid var(--border-row, #eaecf1);
  cursor: pointer;
  transition: background .1s ease;
}
.story-drawer-task:first-child { border-top: 0; }
.story-drawer-task:hover { background: var(--bg-hover, #f0f3f7); }
.story-drawer-task.is-done .story-drawer-task-name {
  color: var(--ink-muted, #676879);
  text-decoration: line-through;
}
.story-drawer-task-name {
  flex: 1; min-width: 0;
  font-size: 13px;
  color: var(--ink-strong, #0f1729);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.story-drawer-task-meta {
  font-size: 11px;
  color: var(--ink-muted, #676879);
  flex-shrink: 0;
}

/* Reviewer actions — pinned to the bottom */
.story-drawer-actions {
  margin-top: auto;
  padding: 14px 22px;
  border-top: 1px solid var(--border, #e6e9ef);
  background: var(--bg-subtle, #f5f6f8);
  flex: 0 0 auto;
}
.story-drawer-actions-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.story-drawer-changes-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.story-drawer-err {
  padding: 8px 22px;
  font-size: 12px;
  color: #8a1024;
  background: rgba(226, 68, 92, 0.06);
  border-top: 1px solid rgba(226, 68, 92, 0.18);
}

/* Status pill colours on the drawer header (reuse the global .pill
   classes for consistency with everything else in the app). */
.story-drawer .pill {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.btn-danger {
  background: var(--prio-critical, #bb3354);
  color: #fff;
  border: 0;
}
.btn-danger:hover { background: var(--prio-high, #e2445c); }
.btn-danger:disabled { opacity: .55; cursor: not-allowed; }

/* ── Owner dashboard ─────────────────────────────────────────────── */
.owner-dash {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-app, #f6f7fb);
  padding: 24px 28px 60px;
}
.owner-dash-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.owner-dash-header h1 {
  font-size: 20px; font-weight: 700; color: var(--ink-strong, #0f1729);
  margin: 0; letter-spacing: -0.01em;
}
.owner-dash-sub { font-size: 12px; color: var(--ink-muted, #676879); margin-top: 4px; }
.owner-dash-refreshing { color: var(--brand, #0073ea); font-weight: 600; }

.owner-dash-loading,
.owner-dash-err,
.owner-dash-empty {
  padding: 40px;
  text-align: center;
  color: var(--ink-muted, #676879);
  font-size: 13px;
}
.owner-dash-err { color: var(--prio-critical, #bb3354); }

/* Cards */
.owner-dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.owner-dash-card {
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border, #e6e9ef);
  border-radius: 12px;
  padding: 14px 16px;
}
.owner-dash-card.is-danger { background: rgba(226,68,92,.04); border-color: rgba(226,68,92,.20); }
.owner-dash-card.is-warn   { background: rgba(253,171,61,.06); border-color: rgba(253,171,61,.24); }
.owner-dash-card.is-ok     { background: rgba(0,200,117,.05); border-color: rgba(0,200,117,.22); }
.owner-dash-card.is-clickable {
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.owner-dash-card.is-clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15,23,41,.08);
  border-color: var(--border-strong, #d1d5e0);
}
.owner-dash-card.is-clickable:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(162,93,220,.30);
}
.owner-dash-card-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-muted, #676879);
  margin-bottom: 8px;
}
.owner-dash-card-value {
  font-size: 30px; font-weight: 700;
  color: var(--ink-strong, #0f1729);
  line-height: 1;
  letter-spacing: -0.01em;
}
.owner-dash-card.is-danger .owner-dash-card-value { color: #8a1024; }
.owner-dash-card.is-warn   .owner-dash-card-value { color: #8a5300; }
.owner-dash-card.is-ok     .owner-dash-card-value { color: #007a47; }
.owner-dash-card-sub { font-size: 11px; color: var(--ink-muted, #676879); margin-top: 4px; }

/* Activity strip */
.owner-dash-activity { margin-bottom: 18px; }
.owner-dash-activity-row {
  display: flex; flex-wrap: wrap;
  gap: 8px;
}
.owner-dash-activity-pill {
  display: inline-flex; align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border, #e6e9ef);
  color: var(--ink-strong, #0f1729);
}
.owner-dash-activity-pill b { font-size: 14px; font-weight: 700; }
.owner-dash-activity-pill.is-online { background: rgba(0,200,117,.06); border-color: rgba(0,200,117,.22); color: #007a47; }
.owner-dash-activity-pill.is-today  { background: rgba(0,115,234,.06); border-color: rgba(0,115,234,.20); color: #0050a8; }
.owner-dash-activity-pill.is-week   { background: rgba(253,171,61,.08); border-color: rgba(253,171,61,.24); color: #8a5300; }
.owner-dash-activity-pill.is-cold   { background: rgba(226,68,92,.06);  border-color: rgba(226,68,92,.22); color: #8a1024; }

/* Sections + tables */
.owner-dash-section { margin-bottom: 22px; }
.owner-dash-section h2 {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-muted, #676879);
  margin: 0 0 10px 0;
}
.owner-dash-table-wrap {
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border, #e6e9ef);
  border-radius: 10px;
  overflow: hidden;
}
.owner-dash-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.owner-dash-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted, #676879);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--bg-subtle, #fafbfd);
  border-bottom: 1px solid var(--border, #e6e9ef);
}
.owner-dash-table thead th.num,
.owner-dash-table tbody td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.owner-dash-table tbody td {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink-strong, #0f1729);
  border-bottom: 1px solid var(--border-row, #eaecf1);
}
.owner-dash-table tbody tr:last-child td { border-bottom: 0; }
.owner-dash-table tbody tr:hover { background: var(--bg-hover, #f0f3f7); }
.owner-dash-muted { color: var(--ink-muted, #676879); }
.owner-dash-table .num.is-danger { color: #8a1024; font-weight: 700; }
.owner-dash-table .num.is-warn   { color: #8a5300; font-weight: 700; }

.owner-dash-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

/* People rows */
.owner-dash-user { display: flex; align-items: center; gap: 10px; }
.owner-dash-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.owner-dash-avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: #fff;
}
.owner-dash-user-name { font-weight: 600; color: var(--ink-strong, #0f1729); }
.owner-dash-user-sub  { font-size: 11px; color: var(--ink-muted, #676879); }

.owner-dash-active-pill {
  display: inline-flex; align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(0,0,0,.04);
  color: var(--ink-muted, #676879);
}
.owner-dash-active-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.owner-dash-active-pill.is-online { background: rgba(0,200,117,.12); color: #007a47; }
.owner-dash-active-pill.is-online .owner-dash-active-dot {
  background: #00c875;
  box-shadow: 0 0 0 3px rgba(0,200,117,.18);
  animation: pulseOnline 1.6s ease-in-out infinite;
}
@keyframes pulseOnline {
  0%, 100% { box-shadow: 0 0 0 3px rgba(0,200,117,.18); }
  50%      { box-shadow: 0 0 0 6px rgba(0,200,117,.06); }
}
.owner-dash-active-pill.is-today { background: rgba(0,115,234,.10); color: #0050a8; }
.owner-dash-active-pill.is-week  { background: rgba(253,171,61,.14); color: #8a5300; }
.owner-dash-active-pill.is-cold  { background: rgba(226,68,92,.10);  color: #8a1024; }

/* ── Reviews page (sidebar destination) ──────────────────────────── */
.reviews-page {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-app, #f6f7fb);
  padding: 24px 28px 60px;
}
.reviews-header { margin-bottom: 18px; }
.reviews-header h1 {
  font-size: 20px; font-weight: 700; color: var(--ink-strong, #0f1729);
  margin: 0; letter-spacing: -0.01em;
}
.reviews-sub { font-size: 12px; color: var(--ink-muted, #676879); margin-top: 4px; }

.reviews-section { margin-bottom: 22px; }
.reviews-section-h {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-muted, #676879);
  margin: 0 0 10px 0;
}
.reviews-section-h.is-review  { color: #6c2ea5; }
.reviews-section-h.is-changes { color: #8a1024; }
.reviews-section-count {
  font-size: 11px; font-weight: 700;
  background: rgba(0,0,0,.06);
  color: var(--ink-strong, #0f1729);
  padding: 2px 8px; border-radius: 999px;
  min-width: 22px; text-align: center;
}

.reviews-list {
  list-style: none; margin: 0; padding: 0;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border, #e6e9ef);
  border-radius: 10px;
  overflow: hidden;
}
.reviews-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--border-row, #eaecf1);
  cursor: pointer;
  transition: background .1s ease;
}
.reviews-row:first-child { border-top: 0; }
.reviews-row:hover { background: var(--bg-hover, #f0f3f7); }
.reviews-row-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
}
.reviews-row-main { flex: 1; min-width: 0; }
.reviews-row-title {
  font-size: 14px; font-weight: 600; color: var(--ink-strong, #0f1729);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reviews-row-sub {
  font-size: 11.5px; color: var(--ink-muted, #676879);
  margin-top: 2px;
}
.reviews-row-status {
  flex-shrink: 0;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
}

.reviews-empty {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-muted, #676879);
}
.reviews-empty-emoji { font-size: 38px; margin-bottom: 12px; }
.reviews-empty-title { font-size: 16px; font-weight: 700; color: var(--ink-strong, #0f1729); margin-bottom: 6px; }
.reviews-empty-sub   { font-size: 13px; max-width: 380px; line-height: 1.5; }
