.offline-view {
  min-height: calc(100vh - 58px);
  background: #f3f5f6;
}

.offline-view[hidden] { display: none; }

.offline-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.offline-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-strong);
}

.offline-kicker {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.offline-title {
  margin: 5px 0 7px;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
}

.offline-summary {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.offline-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #bdd9ce;
  border-radius: 5px;
  background: #e8f4ef;
  color: #145f4a;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.offline-status svg { width: 15px; height: 15px; }

.offline-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 24px 0 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}

.offline-stat {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.offline-stat:last-child { border-right: 0; }
.offline-stat-label { color: var(--muted); font-size: 11px; font-weight: 750; }
.offline-stat-value { margin-top: 7px; font-size: 18px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.offline-stat-value.is-text { font-size: 14px; }

.offline-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}

.offline-section-title { margin: 0; font-size: 18px; letter-spacing: 0; }
.offline-section-note { color: var(--muted); font-size: 12px; }

.storyline-list {
  position: relative;
  display: grid;
  gap: 0;
  margin-left: 7px;
}

.storyline-list::before {
  content: "";
  position: absolute;
  top: 17px;
  bottom: 17px;
  left: 7px;
  width: 2px;
  background: #b8d8cc;
}

.storyline-entry {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 18px;
  padding: 0 0 28px;
}

.storyline-marker {
  z-index: 1;
  width: 16px;
  height: 16px;
  margin-top: 15px;
  border: 3px solid #f3f5f6;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 1px var(--green);
}

.storyline-body {
  min-width: 0;
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.storyline-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.storyline-order {
  color: var(--blue);
  font-weight: 800;
}

.storyline-title { margin: 8px 0 5px; font-size: 18px; line-height: 1.35; letter-spacing: 0; }
.storyline-summary { margin: 0; color: #4f5d59; font-size: 13px; line-height: 1.65; }

.story-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.story-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #d5e1dd;
  border-radius: 4px;
  background: #f7faf9;
  color: #35433f;
  font-size: 12px;
  line-height: 1.3;
}

.story-step::before {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

.storyline-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.story-next { min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.story-next strong { color: var(--amber); }
.story-actions { display: flex; flex: 0 0 auto; gap: 7px; }

.story-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.story-action:hover { border-color: var(--green); color: var(--green); }
.story-action svg { width: 14px; height: 14px; }

.offline-empty {
  padding: 40px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .offline-shell { width: min(calc(100% - 24px), 1180px); padding-top: 22px; }
  .offline-head { grid-template-columns: 1fr; align-items: start; }
  .offline-status { justify-self: start; white-space: normal; }
  .offline-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .offline-stat:nth-child(2) { border-right: 0; }
  .offline-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 560px) {
  .topbar .source-status,
  .topbar #openFolderButton { display: none; }
  .topbar { align-content: center; }
  .brand { width: 100%; }
  .view-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); flex: 0 0 100%; min-width: 0; }
  .view-tab { min-width: 0; padding-right: 6px; padding-left: 6px; }
  .offline-title { font-size: 23px; }
  .offline-stats { grid-template-columns: 1fr; }
  .offline-stat, .offline-stat:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .offline-stat:last-child { border-bottom: 0; }
  .storyline-entry { gap: 12px; }
  .storyline-body { padding: 14px; }
  .storyline-foot { align-items: flex-start; flex-direction: column; }
  .story-actions { width: 100%; }
  .story-action { flex: 1 1 0; }
}
