/* ============================================================
   WATCHTOWER — the owner's command center (view inside the Keep)
   Uses the Keep's existing --db-* tokens so it follows each
   tenant's brand and the House Booker skin automatically.
   ============================================================ */

/* Header nav (The Keep ⇄ Watchtower) */
.keep-nav { display: flex; gap: 0.5rem; align-items: center; }
.keep-nav-btn {
  font-family: var(--db-font-body);
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.5rem 1.1rem; border-radius: 9999px; cursor: pointer;
  background: transparent; color: var(--db-text-muted);
  border: 1.5px solid var(--db-outline);
}
.keep-nav-btn.active { background: var(--db-brick-grad); color: #fff; border-color: transparent; }

/* Layout: sub-nav rail + main column */
.wt-shell { display: grid; grid-template-columns: 180px 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .wt-shell { grid-template-columns: 1fr; } }

.wt-rail { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 0.35rem; }
@media (max-width: 900px) {
  .wt-rail { position: static; flex-direction: row; flex-wrap: wrap; }
}
.wt-rail-btn {
  font-family: var(--db-font-body); font-size: 0.85rem; font-weight: 600;
  text-align: left; padding: 0.6rem 0.9rem; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--db-text-muted); border: 1.5px solid transparent;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.wt-rail-btn:hover { color: var(--db-text); border-color: var(--db-outline); }
.wt-rail-btn.active { background: var(--db-card); color: var(--db-text); border-color: var(--db-outline); box-shadow: var(--db-shadow-card); }
.wt-rail-count {
  font-size: 0.7rem; font-weight: 700; min-width: 1.4em; text-align: center;
  background: var(--db-brick-soft); color: var(--db-text); border-radius: 9999px; padding: 0.1rem 0.45rem;
}

/* Cards & sections */
.wt-card {
  background: var(--db-card); border: 1px solid var(--db-outline);
  border-radius: 16px; padding: 1.25rem 1.4rem; margin-bottom: 1.25rem;
  box-shadow: var(--db-shadow-card);
}
.wt-title { font-family: var(--db-font-serif); font-weight: 600; font-size: 1.05rem; color: var(--db-text); margin-bottom: 0.75rem; }
.wt-sub { font-size: 0.78rem; color: var(--db-text-muted); }
.wt-empty { font-size: 0.85rem; color: var(--db-text-muted); padding: 0.4rem 0; }

/* Today header */
.wt-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: baseline; justify-content: space-between; }
.wt-head h2 { font-family: var(--db-font-serif); font-weight: 600; font-size: 1.5rem; color: var(--db-text); margin: 0; }
.wt-greeting { font-size: 0.95rem; color: var(--db-text); margin-top: 0.35rem; }
.wt-head-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* Buttons */
.wt-btn {
  font-family: var(--db-font-body); font-size: 0.82rem; font-weight: 700;
  padding: 0.55rem 1.2rem; border-radius: 9999px; cursor: pointer;
  background: transparent; color: var(--db-text); border: 1.5px solid var(--db-outline);
}
.wt-btn:hover { border-color: var(--db-text-muted); }
.wt-btn.primary { background: var(--db-brick-grad); color: #fff; border-color: transparent; }
.wt-btn.small { font-size: 0.72rem; padding: 0.35rem 0.85rem; }
.wt-btn.danger { color: var(--db-brick); border-color: var(--db-brick); }
.wt-btn:disabled { opacity: 0.5; cursor: default; }

/* Stat chips (verified figures) */
.wt-stats { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.75rem; }
.wt-stat {
  background: var(--db-bg); border: 1px solid var(--db-outline); border-radius: 12px;
  padding: 0.5rem 0.9rem; min-width: 90px;
}
.wt-stat b { display: block; font-size: 1.15rem; color: var(--db-text); font-family: var(--db-font-serif); }
.wt-stat span { font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--db-text-muted); }

/* Item rows (attention, waiting, activity, memory) */
.wt-row {
  display: flex; gap: 0.8rem; align-items: flex-start;
  padding: 0.7rem 0; border-top: 1px dashed var(--db-outline);
}
.wt-row:first-of-type { border-top: 0; }
.wt-row-main { flex: 1 1 auto; min-width: 0; }
.wt-row-title { font-size: 0.9rem; font-weight: 600; color: var(--db-text); }
.wt-row-detail { font-size: 0.8rem; color: var(--db-text-muted); margin-top: 0.15rem; white-space: pre-wrap; word-break: break-word; }
.wt-row-meta { font-size: 0.7rem; color: var(--db-text-dim); margin-top: 0.25rem; }
.wt-row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; flex-shrink: 0; }

/* Priority / importance markers */
.wt-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 0.45rem; flex-shrink: 0; background: var(--db-text-dim); }
.wt-dot.high { background: var(--db-brick); }
.wt-dot.normal { background: var(--db-gold); }
.wt-badge {
  display: inline-block; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; border-radius: 6px; padding: 0.15rem 0.5rem;
  background: var(--db-bg); border: 1px solid var(--db-outline); color: var(--db-text-muted);
}
.wt-badge.high { color: var(--db-brick); border-color: var(--db-brick); }
.wt-badge.vale { color: var(--db-gold); border-color: var(--db-gold); }

/* Source chips */
.wt-sources { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem; }
.wt-source {
  font-size: 0.68rem; color: var(--db-text-muted); cursor: default;
  background: var(--db-bg); border: 1px solid var(--db-outline); border-radius: 9999px;
  padding: 0.18rem 0.6rem;
}
.wt-source.openable { cursor: pointer; }
.wt-source.openable:hover { color: var(--db-text); border-color: var(--db-text-muted); }

/* Ask Vale */
.wt-ask { display: grid; grid-template-columns: 230px 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .wt-ask { grid-template-columns: 1fr; } }
.wt-convo-list { display: flex; flex-direction: column; gap: 0.3rem; max-height: 60vh; overflow-y: auto; }
.wt-convo-item {
  text-align: left; font-size: 0.8rem; color: var(--db-text-muted); cursor: pointer;
  background: transparent; border: 1.5px solid transparent; border-radius: 10px; padding: 0.5rem 0.7rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wt-convo-item:hover { border-color: var(--db-outline); color: var(--db-text); }
.wt-convo-item.active { background: var(--db-bg); border-color: var(--db-outline); color: var(--db-text); }
.wt-thread { display: flex; flex-direction: column; min-height: 45vh; max-height: 62vh; overflow-y: auto; gap: 0.8rem; padding: 0.25rem 0.25rem 0.75rem; }
.wt-msg { max-width: 82%; padding: 0.65rem 0.9rem; border-radius: 14px; font-size: 0.88rem; white-space: pre-wrap; word-break: break-word; }
.wt-msg.you { align-self: flex-end; background: var(--db-brick-soft); color: var(--db-text); border: 1px solid var(--db-outline); }
.wt-msg.vale { align-self: flex-start; background: var(--db-bg); color: var(--db-text); border: 1px solid var(--db-outline); }
.wt-msg.busy { align-self: flex-start; color: var(--db-text-muted); font-style: italic; background: transparent; }
.wt-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0; }
.wt-ask-form { display: flex; gap: 0.6rem; margin-top: 0.75rem; }
.wt-ask-form input {
  flex: 1; padding: 0.7rem 1rem; border-radius: 9999px; font-size: 0.9rem;
  background: var(--db-bg); border: 1.5px solid var(--db-outline); color: var(--db-text);
}

/* Activity filters */
.wt-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; align-items: center; }
.wt-filters input, .wt-filters select {
  font-size: 0.8rem; padding: 0.45rem 0.7rem; border-radius: 8px;
  background: var(--db-bg); border: 1.5px solid var(--db-outline); color: var(--db-text);
}
.wt-day-head {
  font-family: var(--db-font-serif); font-size: 0.95rem; font-weight: 600; color: var(--db-text);
  margin: 1.1rem 0 0.2rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--db-outline);
}
.wt-time { font-size: 0.7rem; color: var(--db-text-dim); min-width: 62px; padding-top: 0.2rem; }

/* Memory */
.wt-mem-form { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.wt-mem-form input[type="text"] { flex: 1 1 240px; }
.wt-mem-form input, .wt-mem-form select {
  font-size: 0.85rem; padding: 0.55rem 0.8rem; border-radius: 8px;
  background: var(--db-bg); border: 1.5px solid var(--db-outline); color: var(--db-text);
}
.wt-row.disabled .wt-row-title, .wt-row.disabled .wt-row-detail { opacity: 0.45; text-decoration: line-through; }

/* Edit textareas (drafts, memories) */
.wt-edit-area {
  width: 100%; min-height: 90px; margin-top: 0.5rem; padding: 0.7rem 0.9rem;
  border-radius: 10px; font-size: 0.85rem; font-family: var(--db-font-body);
  background: var(--db-bg); border: 1.5px solid var(--db-outline); color: var(--db-text); resize: vertical;
}

/* Record modal */
.wt-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.wt-modal {
  background: var(--db-card); border: 1px solid var(--db-outline); border-radius: 16px;
  box-shadow: var(--db-shadow-raised); max-width: 520px; width: 100%; max-height: 80vh;
  overflow-y: auto; padding: 1.5rem;
}
.wt-modal h3 { font-family: var(--db-font-serif); font-weight: 600; color: var(--db-text); margin-bottom: 0.75rem; }
.wt-kv { display: grid; grid-template-columns: 130px 1fr; gap: 0.25rem 0.75rem; font-size: 0.85rem; }
.wt-kv dt { color: var(--db-text-muted); }
.wt-kv dd { color: var(--db-text); margin: 0; word-break: break-word; }
