/* 4863 E. Riverside Project Archive
   Aesthetic: document-archive / project-binder. Clean, dense, literate.
   Palette: slate + warm parchment. Designed for long reads. */

:root {
  --bg:        #f5f3ee;
  --bg-soft:   #ffffff;
  --bg-card:   #ffffff;
  --text:      #1f2933;
  --muted:     #6b7280;
  --border:    #d8d4c9;
  --border-soft: #ece8de;
  --accent:    #1f2933;
  --accent-h:  #000000;
  --link:      #8a4a2b;
  --link-h:    #5e2f17;
  --error:     #b5453b;
  --success:   #4f7b5c;
  --restricted:#7a4d6d;
  --radius:    4px;
  --shadow-sm: 0 1px 2px rgba(31,41,51,0.04), 0 1px 3px rgba(31,41,51,0.06);
  --shadow-md: 0 4px 12px rgba(31,41,51,0.08);
  --serif:     "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans:      "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover { color: var(--link-h); }

/* ---------- Auth pages (login / verify) ---------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--bg-card);
  padding: clamp(28px, 5vw, 44px);
  max-width: 420px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
}

.auth-card .brand-block {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-soft);
}
.auth-card .brand-num {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 2.6rem;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--accent);
}
.auth-card .brand-rest {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 4px;
  color: var(--text);
}
.auth-card .brand-sub {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-top: 10px;
}

.auth-card h1 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 8px;
  text-align: center;
  letter-spacing: -0.01em;
}

.auth-card .lede {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 22px;
  text-align: center;
}

.auth-card form { margin-top: 8px; }

.auth-card label {
  display: block;
  margin-bottom: 16px;
}
.auth-card label > span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.auth-card input[type=email],
.auth-card input[type=text] {
  width: 100%;
  padding: 11px 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
}
.auth-card input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
}

.auth-card input[name=code] {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.4rem;
  letter-spacing: 0.4em;
  text-align: center;
}

.auth-card button {
  display: block;
  width: 100%;
  padding: 11px 16px;
  font-size: 0.98rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.auth-card button:hover {
  background: var(--accent-h);
  border-color: var(--accent-h);
}

.alert {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.alert.error {
  color: var(--error);
  background: #fbe9e7;
  border: 1px solid #f1c0bb;
}

.small { font-size: 0.85rem; }
.alt-link {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Workspace header ---------- */

.ws-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}
.ws-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.ws-header .brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.ws-header .brand-num {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--accent);
  letter-spacing: -0.01em;
  line-height: 1;
}
.ws-header .brand-rest {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}
.ws-header nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.92rem;
}
.ws-header nav a,
.ws-header nav .ws-feedback-link {
  color: var(--text);
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  padding: 4px 0;
}
.ws-header nav a:hover,
.ws-header nav .ws-feedback-link:hover {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.ws-header nav .nav-help {
  position: relative;
}
.ws-header nav .help-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.5;
  border-radius: 999px;
  background: var(--link);
  color: #fff;
  vertical-align: 1px;
}
.ws-header nav .user-info {
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.role-pill {
  display: inline-block;
  padding: 1px 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}
.role-pill.role-owner  { background: #2b3a4a; color: #fff; border-color: #2b3a4a; }
.role-pill.role-legal  { background: #7a4d6d; color: #fff; border-color: #7a4d6d; }
.role-pill.role-family { background: #4f7b5c; color: #fff; border-color: #4f7b5c; }

@media (max-width: 640px) {
  .nav-desktop { display: none; }
  .ws-header-inner { padding: 12px 16px; }
  .ws-header nav { gap: 12px; font-size: 0.88rem; }
  .ws-header .brand-rest { display: none; }
}

/* ---------- Dashboard ---------- */

.ws-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}

.hub-intro {
  margin-bottom: 28px;
}
.hub-intro h1 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.hub-intro .lede {
  color: var(--muted);
  font-size: 1.02rem;
  margin: 0;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.hub-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px 22px 26px;
  text-decoration: none;
  color: var(--text);
  position: relative;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  display: flex;
  flex-direction: column;
  min-height: 170px;
}
.hub-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.hub-card-icon {
  font-size: 1.6rem;
  margin-bottom: 10px;
  line-height: 1;
}
.hub-card h2 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin: 0 0 8px;
}
.hub-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
}
.hub-card-tag {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border-soft);
  padding: 2px 8px;
  border-radius: 999px;
}
.hub-card.disabled {
  opacity: 0.7;
  cursor: default;
  pointer-events: none;
}
.hub-card.restricted {
  border-left: 3px solid var(--restricted);
}
.hub-card-extlink {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 400;
  margin-left: 4px;
}

/* ---------- Page layouts ---------- */

.page-back {
  margin-bottom: 18px;
}
.page-back a {
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
}
.page-back a:hover { color: var(--accent); text-decoration: underline; }

.prose {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: clamp(28px, 5vw, 56px);
  box-shadow: var(--shadow-sm);
  font-family: var(--serif);
  font-size: 1.04rem;
  line-height: 1.7;
}

.prose h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.4em;
  letter-spacing: -0.015em;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.3em;
}
.prose h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1.6em 0 0.4em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25em;
  letter-spacing: -0.01em;
}
.prose h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.4em 0 0.3em;
  color: var(--accent);
}
.prose h4 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 1.2em 0 0.3em;
  color: var(--accent);
}
.prose p { margin: 0.8em 0; }
.prose strong { color: var(--accent); }
.prose ul {
  margin: 0.6em 0 0.6em 0;
  padding-left: 1.4em;
}
.prose li {
  margin: 0.35em 0;
}
.prose hr {
  margin: 2.4em 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  padding: 1px 5px;
  border-radius: 3px;
}

.md-table {
  border-collapse: collapse;
  margin: 1.4em 0;
  font-family: var(--sans);
  font-size: 0.94rem;
  width: 100%;
}
.md-table th {
  background: var(--bg);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--accent);
  font-weight: 600;
}
.md-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

.prose-meta {
  margin-top: 2.4em;
  font-size: 0.82rem;
  font-family: var(--sans);
  color: var(--muted);
  border-top: 1px solid var(--border-soft);
  padding-top: 1em;
  font-style: italic;
}

/* ---------- Page head + sections ---------- */

.page-head { margin-bottom: 24px; }
.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.page-head .lede {
  color: var(--muted);
  font-size: 1rem;
  margin: 0;
}

.section-h {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.restricted-banner {
  margin-bottom: 22px;
  padding: 12px 16px;
  background: #f3eaf0;
  border: 1px solid #d9c4d2;
  border-left: 4px solid var(--restricted);
  border-radius: 4px;
  font-size: 0.92rem;
  color: var(--text);
}

/* ---------- Document list ---------- */

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.doc-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
}
.doc-row-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.doc-row-date {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  min-width: 90px;
}
.doc-row h2 {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.005em;
}
.doc-row h2 a { color: var(--text); text-decoration: none; }
.doc-row h2 a:hover { color: var(--link); }
.doc-summary {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}
.doc-btn:hover { background: var(--accent-h); border-color: var(--accent-h); color: #fff; }
.doc-btn-secondary {
  background: var(--bg);
  color: var(--text);
}
.doc-btn-secondary:hover { background: var(--bg-soft); color: var(--text); }

/* ---------- Communications ---------- */

.comms-filters {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.comms-filters .filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}
.comms-filters .filter-row:last-child { margin-bottom: 0; }
.comms-filters input[type=search],
.comms-filters input[type=text],
.comms-filters input[type=date],
.comms-filters select {
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}
.comms-filters input[type=search] { flex: 2 1 280px; }
.comms-filters input[type=text]   { flex: 1 1 200px; }
.comms-filters .filter-date { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.comms-filters button {
  padding: 8px 18px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}
.comms-filters button:hover { background: var(--accent-h); }
.comms-filters .filter-clear {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: underline;
}

.comms-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.comms-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}
.empty-state {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  padding: 24px;
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
}

.comm-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.comm-row[open] { box-shadow: var(--shadow-sm); }
.comm-row summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.comm-row summary::-webkit-details-marker { display: none; }
.comm-row summary:hover { background: var(--bg); }
.comm-row[open] summary {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.comm-date { color: var(--muted); font-size: 0.8rem; min-width: 130px; flex-shrink: 0; }
.comm-kind {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.comm-kind-email { background: #eef0f3; color: #3b4651; }
.comm-kind-text  { background: #e7f1ec; color: #4f7b5c; }

.comm-sender { font-weight: 600; min-width: 180px; flex-shrink: 0; }
.comm-subject { color: var(--text); font-weight: 600; }
.comm-snippet {
  flex: 1 1 200px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem;
}
.comm-att { color: var(--muted); font-size: 0.85rem; }

.comm-body {
  padding: 14px 18px 18px;
  font-family: var(--serif);
  font-size: 0.96rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

mark {
  background: #fff2a6;
  padding: 0 2px;
  border-radius: 2px;
}

.comms-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.comms-pager a { color: var(--text); text-decoration: none; font-weight: 600; }
.comms-pager a:hover { color: var(--link); text-decoration: underline; }

@media (max-width: 700px) {
  .comm-row summary { font-size: 0.85rem; }
  .comm-snippet { display: none; }
  .comm-date { min-width: auto; }
  .comm-sender { min-width: auto; }
}
