/* FEAT-045: shared dashboard structure. Every colour/font here resolves
   through a --token defined by the active themes/<name>.css, loaded after
   this file. Split verbatim from the pre-split style.css (minus :root). */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  background: var(--brand-green);
  color: #fff;
  padding: 1.1rem 1.5rem 1.35rem;
  border-bottom: 4px solid var(--brand-amber);
}
.wordmark { font-weight: 800; font-size: 1.7rem; letter-spacing: 0.01em; }
.masthead-tag {
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-align: right;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.5;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.topnav a { color: var(--muted); text-decoration: none; padding-bottom: 0.2rem; border-bottom: 2px solid transparent; }
.topnav a:hover { color: var(--text); }
.topnav a.active { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 0.9rem; }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.link-btn:hover { color: var(--text); }

.content { padding: 1.5rem; max-width: 1100px; margin: 0 auto; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card-dark {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #f0f1ee;
}
.card-dark h2 { color: #fff; }
.card-dark .muted { color: rgba(240, 241, 238, 0.7); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

/* FEAT-054 T8: scoped to the proforma's own Invoices/Receipts tables --
   deliberately not a bare `table td:nth-child(2)` rule, which would
   also right-align column 2 of every other table in this app
   (leases, showings, usage, reports, ...). */
.proforma-table th:nth-child(2), .proforma-table td:nth-child(2) { text-align: right; }
.proforma-table tfoot td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: none; }

tr.status-ok td:nth-child(4) { color: var(--ok); }
tr.status-error td:nth-child(4) { color: var(--error); }
tr.status-escalated td:nth-child(4) { color: var(--escalated); }

/* ---- Leases registry (/leases) ---- */
.date-overdue { color: var(--error); font-weight: 600; }
.date-soon { color: var(--escalated); }

.muted { color: var(--muted); }
.error { color: var(--error); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; }
.kv dt { color: var(--muted); }

.login-box {
  max-width: 320px;
  margin: 4rem auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
}
.login-box form { display: flex; flex-direction: column; gap: 0.75rem; }
.login-box label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; color: var(--muted); }
.login-box input, .filters input, .filters select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.5rem;
}
button[type="submit"] {
  background: var(--accent);
  border: none;
  border-radius: 4px;
  color: #fff;
  padding: 0.5rem 1rem;
  cursor: pointer;
}
button[type="submit"]:hover { filter: brightness(1.15); }

.filters { display: flex; gap: 1rem; align-items: end; margin-bottom: 1rem; }
.filters label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.inline { display: inline; }

.raw-json {
  background: var(--brand-dark);
  color: #e6e8eb;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  overflow-x: auto;
  font-size: 0.8rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.stat-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.stat-label { color: var(--muted); font-size: 0.8rem; }
.stat-value { font-size: 1.6rem; font-weight: 600; }
.status-text-ok { color: var(--ok); }
.status-text-error { color: var(--error); }
.status-text-escalated { color: var(--escalated); }

.num { text-align: right; font-variant-numeric: tabular-nums; }

.bar-table .bar-cell { width: 40%; padding-top: 0; padding-bottom: 0; }
.bar-table td { vertical-align: middle; }
.bar {
  display: block;
  height: 10px;
  min-width: 3px;
  background: var(--accent);
  border-radius: 4px;
}

details { margin-top: 0.75rem; }
details summary { color: var(--muted); cursor: pointer; font-size: 0.85rem; }
details summary:hover { color: var(--text); }

.expand-cell { width: 1%; white-space: nowrap; }
.expand-cell details { margin-top: 0; }
.expand-cell summary { color: var(--muted); font-size: 0.85rem; }
.expand-cell summary:hover { color: var(--text); }
.row-detail {
  margin: 0.5rem 0 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 0.75rem;
  font-size: 0.85rem;
  white-space: normal;
}
.row-detail dt { color: var(--muted); }

.banner {
  padding: 0.6rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.banner-ok { background: rgba(47, 107, 70, 0.12); border: 1px solid var(--ok); color: var(--ok); }
.banner-error { background: rgba(196, 68, 50, 0.12); border: 1px solid var(--error); color: var(--error); }

/* ---- Skill grid (Overview) & skill detail page ---- */

.skills-section { margin-bottom: 2rem; }
.skills-heading { margin-bottom: 0.15rem; }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.skill-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: var(--brand-cream);
  border: 1px solid var(--border);
  border-left: 5px solid transparent;
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
a.skill-card { cursor: pointer; }
a.skill-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(22, 33, 28, 0.14);
}
div.skill-card { cursor: default; }

/* Overview grid: Live / Off-by-choice / Not-built (FEAT-043 T5). The
   status-active/attention/undefined rules below still drive the
   /skills/<slug> detail header, which keeps the run-health badge. */
.skill-card.status-live { border-left-color: var(--ok); }
.skill-card.status-off_by_choice { border-left-style: dashed; border-left-color: var(--escalated); }
.skill-card.status-not_built {
  border-left-style: dashed;
  border-left-color: #c6c2b6;
  opacity: 0.62;
  filter: grayscale(0.35);
}

.skill-kicker {
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.skill-card h3 { margin: 0.1rem 0 0.15rem; font-size: 1.15rem; }
.skill-card p { margin: 0; font-size: 0.9rem; color: #363a34; line-height: 1.45; }

.skill-status-badge {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  margin-top: 0.3rem;
}
.badge-active { background: rgba(47, 107, 70, 0.14); color: var(--ok); }
.badge-attention { background: rgba(196, 68, 50, 0.14); color: var(--brand-red); }
.badge-undefined { background: rgba(95, 100, 89, 0.12); color: var(--muted); }

/* Three-state Overview badges (FEAT-043 T5): Live solid, the other two dashed. */
.badge-live { background: rgba(47, 107, 70, 0.14); color: var(--ok); }
.badge-off_by_choice { background: rgba(169, 116, 35, 0.13); color: var(--escalated); border: 1px dashed var(--escalated); }
.badge-not_built { background: rgba(95, 100, 89, 0.1); color: var(--muted); border: 1px dashed #c6c2b6; }

.skill-off-reason { font-size: 0.75rem; font-style: italic; color: var(--escalated); }

.skill-meta { font-size: 0.78rem; color: var(--muted); }

.skill-detail-header {
  background: var(--brand-cream);
  border: 1px solid var(--border);
  border-left: 6px solid transparent;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.skill-detail-header.status-active { border-left-color: var(--ok); }
.skill-detail-header.status-attention { border-left-color: var(--brand-red); }
.skill-detail-header.status-undefined { border-left-color: #c6c2b6; }
.skill-detail-header h1 { margin: 0.2rem 0 0.6rem; }
.skill-detail-header p { margin: 0; max-width: 62ch; color: #363a34; }

.examples-list, .wont-touch-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.examples-list li, .wont-touch-list li {
  position: relative;
  padding-left: 1.2rem;
  font-size: 0.92rem;
  line-height: 1.5;
}
.examples-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--ok);
  font-weight: 700;
}
.wont-touch-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 7px;
  height: 7px;
  background: var(--brand-red);
}

/* /brief -- FEAT-037 portfolio brief, preformatted prose (no md renderer). */
.brief-body {
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
}
.brief-dates {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.9rem;
}

/* /board -- FEAT-043 T10, non-done Kanban tasks from the Hermes snapshot. */
.board-list { list-style: none; margin: 0.4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.board-task {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  border-radius: 8px;
  font-size: 0.9rem;
}
.board-task-elevated { border-left-color: var(--escalated); }
.board-domain {
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.board-title { flex: 1 1 12rem; }
.board-flag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}
.board-flag-elevated { background: rgba(169, 116, 35, 0.14); color: var(--escalated); }
.board-flag-blocked { background: rgba(196, 68, 50, 0.14); color: var(--brand-red); }
.board-generated { margin-top: 1rem; font-size: 0.8rem; }

code {
  font-family: "Courier New", ui-monospace, monospace;
  background: rgba(22, 33, 28, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.9em;
}

/* ---- Connections (data sources / credential vault) ---- */

.info-popover {
  display: inline-block;
  position: relative;
  vertical-align: middle;
  margin-left: 0.4rem;
}
.info-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.info-toggle::-webkit-details-marker { display: none; }
.info-toggle:hover { color: var(--text); border-color: var(--accent); }
.info-popover[open] > .info-toggle { background: var(--accent); color: #fff; border-color: var(--accent); }
.info-popover-body {
  position: absolute;
  top: 1.6rem;
  left: 0;
  z-index: 10;
  width: 300px;
  max-width: min(300px, 80vw);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  box-shadow: 0 6px 20px rgba(22, 33, 28, 0.18);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
}
.info-popover-body p { margin: 0; }
.info-popover-body p + p { margin-top: 0.5rem; }
.info-popover-body code { font-size: 0.85em; }

.secret-chip {
  display: inline-block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0.3rem 0.2rem 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem 1.25rem;
  margin-bottom: 1rem;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.form-grid input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.5rem;
  font-size: 0.95rem;
}

.secrets-heading { margin-top: 1.5rem; margin-bottom: 0.3rem; font-size: 1.05rem; }

.danger-btn {
  background: var(--error);
  border: none;
  border-radius: 4px;
  color: #fff;
  padding: 0.5rem 1rem;
  cursor: pointer;
}
.danger-btn:hover { filter: brightness(1.1); }

/* ---- Appearance picker (/appearance) — FEAT-045 ---- */

.appearance-form { display: flex; flex-direction: column; gap: 0.75rem; align-items: flex-start; }
.appearance-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.1rem 0.6rem;
  align-items: baseline;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.appearance-option input { grid-row: span 2; align-self: center; }
.appearance-option.is-current { border-color: var(--accent); }
.appearance-option-name { font-weight: 600; }
.appearance-option-blurb { grid-column: 2; font-size: 0.85rem; color: var(--muted); }

/* ---- Project notes (/projects/<id>) — FEAT-051 ---- */

.note-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.note-item { padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.note-item:last-child { border-bottom: none; padding-bottom: 0; }
.note-item p { margin: 0.3rem 0 0; }

/* FEAT-052 T9: author-restricted edit/delete controls, next to a note. */
.note-actions { display: flex; align-items: flex-start; gap: 1rem; margin-top: 0.4rem; }
.note-actions details { margin-top: 0; }
.note-actions .note-form { margin-top: 0.5rem; }

/* FEAT-052 T12: CSS-only (:target) lightbox for image attachments -- no
   JavaScript, matching this app's own zero-JS convention. A fixed dark
   scrim regardless of theme is deliberate: a photo needs a neutral
   viewing backdrop, not one tinted by whichever theme is active. */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
}
.lightbox:target { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 4px; }
.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  text-decoration: none;
}
.lightbox-close:hover { color: #ccc; }

.note-form-wrap { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.note-form-wrap h3 { margin: 0 0 0.6rem; font-size: 0.95rem; }
.note-form { display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; max-width: 480px; }
.note-form textarea,
.note-form input[type="text"],
.note-form input[type="number"],
.note-form input[type="date"] {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.6rem;
  font-size: 0.95rem;
  font-family: inherit;
}
.note-form textarea { resize: vertical; }
.note-form label { width: 100%; font-size: 0.85rem; }
.note-form label > span { display: block; margin-bottom: 0.25rem; }

/* ---- Keyboard focus + motion (FEAT-045 T7) — additive over the split ---- */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.appearance-option:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Log out is a plain text control, not a primary button — but it matches
   button[type="submit"] too, which otherwise wins the specificity tie. */
button.link-btn { background: none; border: 0; padding: 0; }

@media (prefers-reduced-motion: reduce) {
  .skill-card { transition: none; }
  a.skill-card:hover { transform: none; }
}
