/* Cockpit Shell — desk-readable single-column read surface. */

:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1c2128;
  --ink-soft: #57606a;
  --line: #e2e5e9;
  --accent: #2f5bea;

  --ok: #1a7f37;
  --ok-bg: #e6f4ea;
  --warn: #9a6700;
  --warn-bg: #fff4d6;
  --info: #0a5ad6;
  --info-bg: #e5efff;
  --danger: #b3261e;
  --danger-bg: #fce8e6;
  --muted: #6a737d;
  --muted-bg: #eef0f2;
}

* { box-sizing: border-box; }

/* Safety net: an image can never overflow its container / the page, even if a
   more specific rule is missing. */
img { max-width: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.cockpit {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

/* ---------- Header ---------- */
.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.date { font-size: 1.7rem; margin: 0 0 2px; letter-spacing: -0.01em; }
.subtle { color: var(--ink-soft); margin: 0; font-size: 0.95rem; }
.refresh {
  flex: none;
  text-decoration: none;
  color: var(--accent);
  border: 1px solid var(--line);
  background: var(--card);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
}
.refresh:hover { border-color: var(--accent); }

/* ---------- Banners ---------- */
.banner {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.96rem;
  border: 1px solid transparent;
}
.banner-empty { background: var(--muted-bg); color: var(--ink-soft); }
.banner-stale { background: var(--warn-bg); color: var(--warn); border-color: #f0d692; }
.banner-degraded { background: var(--danger-bg); color: var(--danger); border-color: #f3c0bc; }
.banner-note { background: var(--muted-bg); color: var(--ink-soft); font-size: 0.9rem; }

/* ---------- Panels ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  margin-top: 20px;
}
.panel-title {
  font-size: 1.05rem;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.empty { color: var(--ink-soft); font-style: italic; margin: 4px 0; }

/* ---------- Plan sections ---------- */
.plan .section { padding: 2px 0; }
.plan .section + .section { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.plan h2 { font-size: 1.15rem; margin: 0 0 8px; }
.plan h3 { font-size: 1rem; margin: 12px 0 4px; }
.plan ul, .plan ol { margin: 6px 0; padding-left: 22px; }
.plan p { margin: 6px 0; }
.plan table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.plan th, .plan td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.plan code { background: var(--muted-bg); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

/* Quarantine the proposed (unconfirmed) section. */
.section-proposed {
  border: 1px dashed #c9a227 !important;
  background: #fffdf3;
  border-radius: 10px;
  padding: 12px 16px !important;
  margin-top: 14px;
}
.proposed-flag {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--warn);
}

/* ---------- Schedule ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item {
  display: flex;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.timeline-item:last-child { border-bottom: none; }
.time { flex: 0 0 150px; color: var(--ink-soft); font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.event { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.event-title { font-weight: 500; }
.event-loc { color: var(--ink-soft); font-size: 0.9rem; }
.cal-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); align-self: center; }
.cal-work { background: var(--info); }
.cal-personal { background: var(--ok); }

/* ---------- Badges ---------- */
.badges { display: flex; flex-wrap: wrap; gap: 10px; }
.badge {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  min-width: 110px;
}
.badge-label { font-weight: 600; font-size: 0.92rem; }
.badge-status { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-pending    { background: var(--warn-bg); border-color: #f0d692; color: var(--warn); }
.badge-downloaded { background: var(--info-bg); border-color: #bcd6ff; color: var(--info); }
.badge-refreshed  { background: var(--ok-bg); border-color: #bfe3c8; color: var(--ok); }
.badge-unknown    { background: var(--muted-bg); color: var(--ink-soft); }
.stale-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid #f0d692;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: none;
  letter-spacing: 0;
}

/* ---------- Tools ---------- */
.tool-links { display: flex; flex-wrap: wrap; gap: 12px; }
.tool {
  text-decoration: none;
  color: var(--accent);
  border: 1px solid var(--line);
  background: var(--card);
  padding: 10px 16px;
  border-radius: 9px;
  font-weight: 500;
}
.tool:hover { border-color: var(--accent); }
.tool-disabled {
  color: var(--muted);
  background: var(--muted-bg);
  cursor: not-allowed;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.tool-note { font-size: 0.75rem; font-style: italic; }

/* ---------- Footer ---------- */
.footer { margin-top: 26px; color: var(--ink-soft); }
.inputs-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 0.85rem; }
.legend-label { font-weight: 600; }
.input-flag { padding: 1px 6px; border-radius: 5px; }
.input-used { color: var(--ok); }
.input-absent { color: var(--muted); text-decoration: line-through; }
.readonly-note { font-size: 0.82rem; margin: 12px 0 0; color: var(--muted); }

/* ---------- Tab bar ---------- */
.tabbar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.tab {
  text-decoration: none;
  color: var(--ink-soft);
  padding: 10px 18px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 9px 9px 0 0;
  font-weight: 500;
  position: relative;
  top: 1px;
}
.tab:hover { color: var(--ink); background: var(--muted-bg); }
.tab-active {
  color: var(--accent);
  background: var(--card);
  border-color: var(--line);
  border-bottom: 1px solid var(--card);
}

/* Log out sits at the far end of the tab bar. */
.logout { margin-left: auto; align-self: center; }
.logout button {
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
}
.logout button:hover { color: var(--ink); background: var(--muted-bg); }

/* ---------- Login ---------- */
.login-card { max-width: 360px; margin: 64px auto 0; }
.login-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.login-form input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.login-form button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}
.login-error { color: var(--danger); background: var(--danger-bg); padding: 8px 12px; border-radius: 8px; margin: 12px 0 0; }

/* ---------- Weather ---------- */
.weather-updated { font-size: 0.78rem; font-weight: 400; color: var(--ink-soft); margin-left: 6px; }
.weather-now { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.weather-icon { font-size: 2rem; line-height: 1; }
.weather-temp { font-size: 2.2rem; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.weather-detail { font-size: 0.92rem; color: var(--ink-soft); }
.weather-detail strong { color: var(--ink); }
.weather-day { margin-left: auto; }
.weather-hours {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0 0 4px;
  overflow-x: auto;
}
.weather-hours li {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.hour-label { color: var(--ink-soft); font-size: 0.78rem; }
.hour-temp { font-weight: 600; }
.hour-rain { color: var(--info); font-size: 0.78rem; }
.weather-tomorrow { margin: 12px 0 0; font-size: 0.92rem; color: var(--ink-soft); }
.weather-tomorrow strong { color: var(--ink); }

/* ---------- Check-in ---------- */
.banner-nudge {
  display: block;
  text-decoration: none;
  font-weight: 600;
  color: var(--accent);
  background: var(--info-bg);
  border-color: #bcd6ff;
}
.banner-nudge:hover { text-decoration: underline; }
.banner-saved { background: var(--ok-bg); color: var(--ok); border-color: #b7e0c2; }
.checkin-state { font-size: 0.78rem; font-weight: 600; color: var(--ok); margin-left: 6px; }
.checkin-old { color: var(--ink-soft); font-weight: 400; }
.checkin-form { display: flex; flex-direction: column; gap: 6px; }
.checkin-form label { font-weight: 600; font-size: 0.92rem; margin-top: 8px; }
.checkin-form .hint { font-weight: 400; color: var(--ink-soft); font-size: 0.82rem; }
.checkin-form textarea {
  font: inherit;
  font-size: 16px; /* 16px stops iOS Safari zooming into the field */
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  width: 100%;
}
.checkin-form button {
  align-self: flex-start;
  margin-top: 12px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
}
.form-error { color: var(--danger); background: var(--danger-bg); padding: 8px 12px; border-radius: 8px; margin: 0 0 8px; }

/* ---------- Today in Pictures ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.photo-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  display: flex;
  flex-direction: column;
}
.photo-img {
  width: 100%;
  height: 240px;
  object-fit: contain;   /* whole photo visible, scaled to fit — no cropping */
  display: block;
  background: var(--muted-bg);
}
.photo-placeholder {
  height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 16px;
  background: var(--muted-bg);
  color: var(--ink-soft);
}
.ph-format {
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 1.1rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  background: var(--card);
}
.ph-note { font-size: 0.8rem; }
.photo-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
}
.years-ago { font-weight: 600; }
.taken-date { color: var(--ink-soft); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.photo-caption { font-size: 0.9rem; margin-top: 2px; }
.copy-path {
  margin-top: 8px;
  align-self: flex-start;
  font: inherit;
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 12px;
  cursor: pointer;
}
.copy-path:hover { border-color: var(--accent); }
.copy-path.copied { color: var(--ok); border-color: #bfe3c8; background: var(--ok-bg); }
.copy-path.copy-failed { color: var(--danger); border-color: #f3c0bc; background: var(--danger-bg); }

/* ---------- Weekly Reading ---------- */
.reading-list { list-style: none; margin: 0; padding: 0; }
.reading-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.reading-card:first-child { padding-top: 0; }
.reading-card:last-child { border-bottom: none; padding-bottom: 0; }
.reading-main { min-width: 0; }  /* let long text wrap instead of overflowing */
.reading-topic {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--info);
  background: var(--info-bg);
  border: 1px solid #bcd6ff;
  border-radius: 20px;
  padding: 1px 9px;
  margin-bottom: 6px;
}
.reading-title { font-size: 1.08rem; line-height: 1.35; margin: 0 0 4px; }
.reading-title a { color: var(--ink); text-decoration: none; }
.reading-title a:hover { color: var(--accent); text-decoration: underline; }
.reading-summary { margin: 4px 0 8px; color: var(--ink-soft); font-size: 0.94rem; }
.reading-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.reading-meta-text { font-variant-numeric: tabular-nums; }
.reading-source { color: var(--accent); text-decoration: none; }
.reading-source:hover { text-decoration: underline; }
.read-toggle {
  flex: none;
  font: inherit;
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 12px;
  cursor: pointer;
}
.read-toggle:hover { border-color: var(--accent); }

/* Read state — greyed out + struck-through title, obviously "done". */
.reading-card.is-read { opacity: 0.55; }
.reading-card.is-read .reading-title a { text-decoration: line-through; color: var(--muted); }
.reading-card.is-read .read-toggle {
  color: var(--ok);
  border-color: #bfe3c8;
  background: var(--ok-bg);
}

/* ---------- Goals ---------- */
.quarter + .quarter { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 20px; }
.quarter-title {
  font-size: 1.15rem;
  margin: 0 0 14px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}
.quarter-current {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--info);
  background: var(--info-bg);
  border: 1px solid #bcd6ff;
  border-radius: 20px;
  padding: 1px 9px;
}
.quarter-range { font-size: 0.85rem; font-weight: 400; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.objective-list { list-style: none; margin: 0; padding: 0; }
.objective-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  background: var(--card);
}
.objective-card + .objective-card { margin-top: 14px; }
.objective-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.objective-badge {
  flex: none;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--muted-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 8px;
}
.objective-title { font-size: 1.08rem; line-height: 1.35; margin: 0; min-width: 0; }
.objective-title a { color: var(--ink); text-decoration: none; }
.objective-title a:hover { color: var(--accent); text-decoration: underline; }
.objective-context { margin: 4px 0 0; color: var(--muted); font-size: 0.85rem; }

/* Goal status chip (on-track / at-risk / off-track). */
.goal-chip {
  flex: none;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  border-radius: 20px;
  padding: 1px 10px;
  border: 1px solid var(--line);
}
.goal-ontrack  { background: var(--ok-bg);    color: var(--ok);     border-color: #bfe3c8; }
.goal-atrisk   { background: var(--warn-bg);  color: var(--warn);   border-color: #f0d692; }
.goal-offtrack { background: var(--danger-bg); color: var(--danger); border-color: #f3c0bc; }
.goal-unknown  { background: var(--muted-bg); color: var(--ink-soft); }

/* Progress bar. */
.objective-progress { margin-top: 12px; }
.progress-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 0.88rem;
}
.progress-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.progress-tasks { color: var(--ink-soft); }
.progress-source { color: var(--muted); font-size: 0.78rem; font-style: italic; }
.progress-bar {
  height: 8px;
  border-radius: 6px;
  background: var(--muted-bg);
  overflow: hidden;
}
.progress-fill { height: 100%; background: var(--accent); border-radius: 6px; }

/* Status update + description. */
.status-update {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--muted-bg);
  border-radius: 8px;
}
.status-update-title { margin: 0; font-weight: 600; font-size: 0.92rem; }
.status-update-text { margin: 4px 0 0; font-size: 0.9rem; color: var(--ink-soft); }
.status-update-meta { margin: 6px 0 0; font-size: 0.78rem; color: var(--muted); }
/* Key results: a compact list inside the objective card. */
.kr-list { list-style: none; margin: 14px 0 0; padding: 0; }
.kr-item { padding: 10px 0 10px 12px; border-left: 3px solid var(--line); }
.kr-item + .kr-item { margin-top: 6px; }
.kr-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.kr-badge {
  flex: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--info-bg);
  border-radius: 6px;
  padding: 1px 6px;
}
.kr-title { font-size: 0.94rem; min-width: 0; flex: 1 1 240px; }
.kr-title a { color: var(--ink); text-decoration: none; }
.kr-title a:hover { color: var(--accent); text-decoration: underline; }
.kr-item .progress-row { margin-top: 6px; }
.progress-bar-kr { height: 5px; }
.kr-item .task-list { margin-top: 6px; }
.objective-description { margin: 12px 0 0; font-size: 0.92rem; color: var(--ink-soft); }

/* Supporting tasks checklist. */
.task-list { list-style: none; margin: 12px 0 0; padding: 0; }
.task-item { display: flex; gap: 10px; padding: 6px 0; align-items: baseline; }
.task-item + .task-item { border-top: 1px solid var(--line); }
.task-check { flex: none; color: var(--muted); font-size: 0.9rem; }
.task-item.is-done .task-check { color: var(--ok); }
.task-body { min-width: 0; }
.task-title { font-size: 0.94rem; }
.task-title a { color: var(--ink); text-decoration: none; }
.task-title a:hover { color: var(--accent); text-decoration: underline; }
.task-item.is-done .task-title a { text-decoration: line-through; color: var(--muted); }
.task-meta { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 1px; }
.task-empty { margin: 12px 0 0; color: var(--ink-soft); font-style: italic; font-size: 0.9rem; }

@media (max-width: 560px) {
  .weather-day { margin-left: 0; }
  .time { flex-basis: 100%; }
  .header-row { flex-direction: column; }
  .tabbar { overflow-x: auto; }
  .reading-card { flex-direction: column; }
  .read-toggle { align-self: flex-start; }
}
