/* =========================================================
   Dashboard app shell — built on the shared tokens in
   style.css (--ink, --paper, --accent, --signal, etc.)
   ========================================================= */

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

#dashboard-page { background: var(--paper-raised); }

/* Native <button> elements come with browser-default border/background
   ("button chrome") that CSS resets elsewhere on the site don't touch.
   Every plain icon/text button in the dashboard needs it stripped
   explicitly — buttons already using the shared .btn classes (which
   define their own border/background on purpose) are left alone. */
#app-shell button:not(.btn) {
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  color: inherit;
}

#app-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

/* ===================== SIDEBAR ===================== */
#app-sidebar {
  background: var(--ink);
  color: var(--ink-text);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

#sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
  padding: 6px 8px 20px;
}

/* ===== Project switcher ===== */
#project-switcher { position: relative; margin-bottom: 20px; }
#project-switcher-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--ink-raised);
  border: 1px solid var(--border-on-ink);
  border-radius: var(--radius-md);
  color: var(--ink-text);
  text-align: left;
}
#project-switcher-current { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#project-switcher-name {
  font-size: 0.88rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#project-switcher-stage {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-text-muted);
}
#project-switcher-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--ink-text-muted); }
#project-switcher-btn[aria-expanded="true"] #project-switcher-icon { transform: rotate(180deg); }

#project-switcher-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--ink-raised);
  border: 1px solid var(--border-on-ink);
  border-radius: var(--radius-md);
  padding: 6px;
  z-index: 20;
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}
.project-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-text);
  font-size: 0.85rem;
  text-align: left;
}
.project-option:hover, .project-option.is-active { background: var(--border-on-ink); }
.project-option-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}
.project-tag-startup { background: rgba(91,79,232,0.2); color: #B4ADF7; }
.project-tag-custom { background: rgba(0,216,160,0.16); color: var(--signal); }
.project-option-new { color: var(--accent); font-weight: 600; }

/* ===== Nav ===== */
#sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
}
.sidebar-link:hover { background: var(--border-on-ink); color: var(--ink-text); }
.sidebar-link.is-active { background: var(--accent); color: #fff; }
.sidebar-link-icon { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-badge {
  margin-inline-start: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: rgba(245,244,250,0.14);
  border: 1px solid var(--border-on-ink);
  padding: 1px 8px;
  border-radius: 999px;
  color: var(--ink-text);
}
.sidebar-link.is-active .sidebar-badge { background: rgba(255,255,255,0.25); }

/* ===== User menu ===== */
#sidebar-footer { position: relative; border-top: 1px solid var(--border-on-ink); padding-top: 12px; }
#sidebar-user-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--ink-text);
  text-align: left;
}
#sidebar-user-btn:hover { background: var(--border-on-ink); }
#sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
#sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
#sidebar-user-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sidebar-user-email { font-size: 0.75rem; color: var(--ink-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#sidebar-user-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--ink-raised);
  border: 1px solid var(--border-on-ink);
  border-radius: var(--radius-md);
  padding: 6px;
}
#sidebar-user-menu a, #sidebar-user-menu button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-text);
  font-size: 0.85rem;
  text-align: left;
}
#sidebar-user-menu a:hover, #sidebar-user-menu button:hover { background: var(--border-on-ink); }
#logout-btn { color: #FF8A80; }

/* ===================== MAIN ===================== */
#app-main { min-width: 0; }

#app-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 32px;
  background: var(--paper);
  border-bottom: 1px solid var(--border-on-paper);
  position: sticky;
  top: 0;
  z-index: 10;
}
#sidebar-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 6px;
}
#sidebar-toggle .bar { width: 20px; height: 2px; background: var(--paper-text); }
#app-page-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }
#app-topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; }
#notifications-btn { position: relative; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border-on-paper); background: #fff; color: var(--paper-text-muted); display: flex; align-items: center; justify-content: center; }
#notifications-btn svg { width: 18px; height: 18px; }
.topbar-badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--accent); color: #fff;
  font-family: var(--font-mono); font-size: 0.65rem;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.topbar-badge:empty, .topbar-badge[data-count="0"] { display: none; }

#app-content { padding: 32px; max-width: 1100px; }

/* ===== Buttons (small variant on top of shared .btn) ===== */
.btn-small { padding: 8px 14px; font-size: 0.85rem; }

/* ===== Stage tracker ===== */
#stage-tracker {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
}
.stage-item { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.stage-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border-on-paper); background: #fff; }
.stage-label { font-size: 0.88rem; font-weight: 600; color: var(--paper-text-muted); white-space: nowrap; }
.stage-complete .stage-dot { background: var(--signal); border-color: var(--signal); }
.stage-complete .stage-label { color: var(--paper-text); }
.stage-active .stage-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(91,79,232,0.15); }
.stage-active .stage-label { color: var(--paper-text); }
.stage-connector { flex: 1; height: 2px; background: var(--border-on-paper); margin: 0 10px; min-width: 24px; }
.stage-connector-complete { background: var(--signal); }

/* ===== Dashboard cards ===== */
#overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.dashboard-card {
  background: #fff;
  border: 1px solid var(--border-on-paper);
  border-radius: var(--radius-md);
  padding: 20px;
}
.dashboard-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.dashboard-card-head h2 { font-family: var(--font-display); font-size: 1rem; font-weight: 600; }
.card-view-all { font-size: 0.8rem; font-weight: 600; color: var(--accent); }
.card-view-all:hover { text-decoration: underline; }

/* ===== Checklist (shared: overview + compliance view) ===== */
.checklist { display: flex; flex-direction: column; gap: 10px; }
.checklist-item { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem; }
.checklist-item input[type="checkbox"] { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--accent); }
.checklist-item label { color: var(--paper-text-muted); }
.checklist-item input:checked + label { color: var(--paper-text); text-decoration: line-through; text-decoration-color: var(--border-on-paper); }
.checklist-item-actionable label { color: var(--paper-text); font-weight: 500; }
.checklist-item-actionable::after {
  content: 'Needs you';
  margin-inline-start: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--amber);
  flex-shrink: 0;
}

/* ===== Messages / documents preview lists ===== */
.message-preview-item { padding-bottom: 4px; }
.message-preview-author { font-size: 0.8rem; font-weight: 600; }
.message-preview-text { font-size: 0.88rem; color: var(--paper-text-muted); margin: 4px 0; }
.message-preview-time { font-size: 0.75rem; color: var(--paper-text-muted); }

#documents-preview-list, #documents-table-body { display: flex; flex-direction: column; }
.document-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-on-paper);
  font-size: 0.88rem;
}
.document-item:last-child { border-bottom: none; }
.document-icon {
  font-family: var(--font-mono); font-size: 0.65rem; font-weight: 600;
  background: var(--paper-raised); color: var(--paper-text-muted);
  padding: 3px 6px; border-radius: 4px; flex-shrink: 0;
}
.document-name { flex: 1; }
.document-date { color: var(--paper-text-muted); font-size: 0.8rem; }

/* ===== Billing summary (overview widget) ===== */
.billing-summary-row { display: flex; justify-content: space-between; font-size: 0.9rem; padding: 6px 0; }
.billing-summary-row span:first-child { color: var(--paper-text-muted); }

/* ===================== COMPLIANCE VIEW ===================== */
#compliance-frameworks-list { display: flex; flex-direction: column; gap: 16px; }
.framework-card { background: #fff; border: 1px solid var(--border-on-paper); border-radius: var(--radius-md); padding: 20px; }
.framework-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.framework-card-head h3 { font-family: var(--font-display); font-size: 1rem; }
.framework-status { font-size: 0.75rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.framework-status-progress { background: rgba(232,162,61,0.15); color: #B87A1A; }
.framework-status-pending { background: var(--paper-raised); color: var(--paper-text-muted); }
.framework-status-complete { background: rgba(0,216,160,0.14); color: var(--signal-dim); }

/* ===================== DOCUMENTS VIEW ===================== */
#documents-toolbar { display: flex; gap: 10px; margin-bottom: 20px; }
#documents-search {
  flex: 1; max-width: 320px;
  padding: 9px 12px;
  border: 1px solid var(--border-on-paper);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border-on-paper); border-radius: var(--radius-md); overflow: hidden; }
th, td { text-align: left; padding: 12px 16px; font-size: 0.88rem; border-bottom: 1px solid var(--border-on-paper); }
th { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--paper-text-muted); background: var(--paper-raised); }
tbody tr:last-child td { border-bottom: none; }

/* ===================== MESSAGES VIEW ===================== */
#view-messages { height: calc(100vh - 180px); }
#messages-view-inner { display: flex; flex-direction: column; height: 100%; }
#messages-thread {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border-on-paper);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.thread-message { max-width: 70%; padding: 12px 14px; border-radius: var(--radius-md); font-size: 0.9rem; }
.thread-message-author { font-size: 0.78rem; font-weight: 600; display: block; margin-bottom: 3px; }
.thread-message-time { display: block; margin-top: 6px; font-size: 0.72rem; opacity: 0.6; font-family: var(--font-mono); }
.thread-message-team { align-self: flex-start; background: var(--paper-raised); }
.thread-message-client { align-self: flex-end; background: var(--accent); color: #fff; }

#message-form {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--border-on-paper);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
#message-input { flex: 1; resize: none; max-height: 120px; padding: 10px 12px; border: 1px solid var(--border-on-paper); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 0.9rem; }
#message-send-btn { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--accent); border: none; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
#message-send-btn svg { width: 17px; height: 17px; }

/* ===================== BILLING VIEW ===================== */
#billing-payment-method {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border: 1px solid var(--border-on-paper); border-radius: var(--radius-md);
  padding: 18px 20px; margin-bottom: 20px;
}
#billing-payment-method h3 { font-family: var(--font-display); font-size: 0.95rem; margin-bottom: 4px; }
#billing-card-on-file { font-size: 0.85rem; color: var(--paper-text-muted); }
.invoice-status { font-size: 0.78rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.invoice-status-due { background: rgba(232,162,61,0.15); color: #B87A1A; }
.invoice-status-paid { background: rgba(0,216,160,0.14); color: var(--signal-dim); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 960px) {
  #app-shell { grid-template-columns: 1fr; }
  #app-sidebar {
    position: fixed; inset: 0 auto 0 0; width: 264px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 100;
  }
  #app-shell.sidebar-open #app-sidebar { transform: translateX(0); }
  #sidebar-toggle { display: flex; }
  #overview-grid { grid-template-columns: 1fr; }
  #app-content { padding: 20px; }
  #app-topbar { padding: 14px 20px; }
  table { display: block; overflow-x: auto; }
}

/* =========================================================
   PREMIUM PROJECT-WORKSPACE ENHANCEMENTS
   Built on the existing Talently dashboard tokens.
   These rules intentionally come AFTER the original styles
   so the existing design language remains the default.
   ========================================================= */

/* ===== Global polish ===== */
#app-content {
  padding: 34px 36px 48px;
  max-width: 1240px;
}

#app-topbar {
  min-height: 72px;
}

.topbar-heading {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.topbar-eyebrow,
.section-kicker {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  line-height: 1.2;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--paper-text-muted);
}

.topbar-eyebrow {
  margin-bottom: 1px;
}

#app-page-title {
  line-height: 1.15;
}

.topbar-project-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--border-on-paper);
  border-radius: 999px;
  background: #fff;
  color: var(--paper-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 3px rgba(0, 216, 160, 0.10);
  flex-shrink: 0;
}

#notifications-btn {
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

#notifications-btn:hover {
  background: var(--paper-raised);
  border-color: var(--paper-text-muted);
  transform: translateY(-1px);
}

/* ===== Overview hero ===== */
.overview-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: stretch;
  padding: 30px 32px;
  margin-bottom: 24px;
  border: 1px solid var(--border-on-paper);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 100% 0%, rgba(91, 79, 232, 0.07), transparent 38%),
    #fff;
  box-shadow: 0 8px 28px rgba(26, 23, 36, 0.045);
}

.overview-hero-copy {
  min-width: 0;
}

.hero-status-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--paper-text-muted);
  margin-bottom: 12px;
}

.overview-hero-copy h2 {
  max-width: 680px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.7vw, 2.05rem);
  line-height: 1.16;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.overview-hero-copy p {
  max-width: 690px;
  margin: 12px 0 0;
  color: var(--paper-text-muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

.overview-hero-copy p strong {
  color: var(--paper-text);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.hero-progress {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-left: 1px solid var(--border-on-paper);
}

.hero-progress-ring {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background:
    radial-gradient(circle at center, #fff 57%, transparent 58%),
    conic-gradient(var(--accent) 0 68%, var(--paper-raised) 68% 100%);
  box-shadow: inset 0 0 0 1px var(--border-on-paper);
}

.hero-progress-ring::after {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid var(--border-on-paper);
  border-radius: 50%;
}

.hero-progress-ring span {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.hero-progress-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.hero-progress-meta strong {
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 600;
}

.hero-progress-meta span {
  color: var(--paper-text-muted);
  font-size: 0.76rem;
}

/* ===== Stage tracker ===== */
#stage-tracker {
  padding: 0 4px;
  margin-bottom: 24px;
}

.stage-item {
  gap: 9px;
}

.stage-dot {
  width: 10px;
  height: 10px;
}

.stage-label {
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.stage-connector {
  background: var(--border-on-paper);
}

.stage-complete .stage-dot {
  box-shadow: 0 0 0 3px rgba(0, 216, 160, 0.08);
}

/* ===== Project KPI strip ===== */
.project-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid var(--border-on-paper);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 3px 12px rgba(26, 23, 36, 0.025);
}

.metric-label {
  display: block;
  margin-bottom: 7px;
  font-family: var(--font-mono);
  font-size: 0.61rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper-text-muted);
}

.metric-value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.metric-sub {
  display: block;
  margin-top: 5px;
  color: var(--paper-text-muted);
  font-size: 0.72rem;
}

.metric-sub.positive {
  color: var(--signal-dim);
}

/* ===== Overview grid ===== */
#overview-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
}

.dashboard-card {
  padding: 21px;
  box-shadow: 0 4px 16px rgba(26, 23, 36, 0.025);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.dashboard-card:hover {
  border-color: color-mix(in srgb, var(--border-on-paper) 65%, var(--paper-text-muted));
  box-shadow: 0 8px 24px rgba(26, 23, 36, 0.045);
}

.dashboard-card-primary {
  border-color: rgba(91, 79, 232, 0.18);
}

.dashboard-card-head {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.dashboard-card-head > div {
  min-width: 0;
}

.dashboard-card-head h2 {
  margin-top: 3px;
}

.card-count {
  flex-shrink: 0;
  padding: 4px 8px;
  border: 1px solid var(--border-on-paper);
  border-radius: 999px;
  background: var(--paper-raised);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--paper-text-muted);
}

/* ===== Next actions ===== */
#next-actions-widget,
#milestones-widget {
  min-height: 100%;
}

.action-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.action-row {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 11px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent !important;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.action-row:hover {
  background: var(--paper-raised);
  border-color: var(--border-on-paper) !important;
  transform: translateX(1px);
}

.action-row-priority {
  background: rgba(91, 79, 232, 0.045);
  border-color: rgba(91, 79, 232, 0.11) !important;
}

.action-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--paper-raised);
  border: 1px solid var(--border-on-paper);
  color: var(--paper-text-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.action-icon-upload {
  color: var(--accent);
}

.action-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.action-copy strong {
  font-size: 0.84rem;
  font-weight: 600;
}

.action-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--paper-text-muted);
  font-size: 0.74rem;
}

.action-meta {
  color: var(--paper-text-muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  white-space: nowrap;
}

.action-arrow {
  color: var(--accent);
  font-size: 0.96rem;
}

/* ===== Milestones ===== */
.milestone-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.milestone-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.milestone-marker {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-on-paper);
  border-radius: 50%;
  background: #fff;
  color: var(--paper-text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.milestone-row.is-complete .milestone-marker {
  background: var(--signal);
  border-color: var(--signal);
  color: #fff;
}

.milestone-row.is-active .milestone-marker {
  color: var(--accent);
  border-color: rgba(91,79,232,0.32);
  box-shadow: 0 0 0 4px rgba(91,79,232,0.07);
}

.milestone-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.milestone-copy strong {
  font-size: 0.82rem;
  font-weight: 600;
}

.milestone-copy span {
  font-size: 0.71rem;
  color: var(--paper-text-muted);
}

.milestone-percent {
  color: var(--paper-text-muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.milestone-progress,
.compliance-bar,
.framework-progress {
  height: 5px;
  overflow: hidden;
  background: var(--paper-raised);
  border-radius: 999px;
}

.milestone-progress {
  margin: 2px 40px 5px 38px;
}

.milestone-progress span,
.compliance-bar span,
.framework-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

/* ===== Compliance overview ===== */
.compliance-summary {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: 15px;
}

.compliance-score {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.compliance-score strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.compliance-score span {
  color: var(--paper-text-muted);
  font-size: 0.65rem;
}

.compliance-bar {
  width: 100%;
}

/* ===== Activity ===== */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-on-paper);
}

.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.activity-avatar,
.activity-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--paper-raised);
  border: 1px solid var(--border-on-paper);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--paper-text-muted);
}

.activity-avatar {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-text);
}

.activity-copy {
  min-width: 0;
}

.activity-copy strong {
  display: block;
  font-size: 0.79rem;
  font-weight: 600;
}

.activity-copy strong span {
  color: var(--paper-text-muted);
  font-weight: 400;
}

.activity-copy p {
  margin: 3px 0 3px;
  color: var(--paper-text-muted);
  font-size: 0.73rem;
  line-height: 1.45;
}

.activity-copy time {
  font-family: var(--font-mono);
  font-size: 0.61rem;
  color: var(--paper-text-muted);
}

/* ===== Messages overview widget ===== */
#messages-widget .message-preview-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  column-gap: 9px;
  align-items: start;
}

.message-preview-avatar {
  grid-row: span 3;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--ink-text);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

#messages-widget .message-preview-author {
  align-self: center;
}

#messages-widget .message-preview-text {
  grid-column: 2 / -1;
  margin: 4px 0 5px;
  line-height: 1.5;
}

#messages-widget .message-preview-time {
  grid-column: 2 / -1;
}

.message-compose-button {
  width: 100%;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-on-paper) !important;
  color: var(--accent) !important;
  font-size: 0.76rem;
  font-weight: 600;
}

/* ===== Documents overview widget ===== */
#documents-widget .document-item {
  padding: 10px 0;
}

#upload-document-btn-overview {
  margin-top: 9px;
  width: 100%;
  justify-content: center;
}

.document-icon {
  min-width: 28px;
  text-align: center;
}

/* ===== Billing overview ===== */
#billing-widget .billing-summary-row {
  padding: 7px 0;
}

.billing-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding-top: 11px;
  border-top: 1px solid var(--border-on-paper);
  color: var(--paper-text-muted);
  font-size: 0.7rem;
}

#team-widget {
  grid-column: span 2;
}

.team-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.team-person {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--border-on-paper);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
}

.team-person > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.team-person strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.74rem;
  font-weight: 600;
}

.team-person small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
  color: var(--paper-text-muted);
  font-size: 0.64rem;
}

.team-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--ink-text);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.team-avatar-client {
  background: var(--accent);
}

.team-invite {
  margin-top: 11px;
  color: var(--accent) !important;
  font-size: 0.74rem;
  font-weight: 600;
}

.overview-footer-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  color: var(--paper-text-muted);
  font-size: 0.7rem;
}

.overview-footer-note a {
  margin-left: auto;
  color: var(--accent);
  font-weight: 600;
}

.footer-lock {
  font-family: var(--font-mono);
  color: var(--paper-text-muted);
}

/* ===== Generic internal view header ===== */
.view-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 22px;
}

.view-intro > div:first-child {
  min-width: 0;
}

.view-intro h2 {
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.view-intro p {
  max-width: 640px;
  margin-top: 7px;
  color: var(--paper-text-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.view-intro-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.view-intro-stat strong {
  font-family: var(--font-display);
  font-size: 1.55rem;
}

.view-intro-stat span {
  color: var(--paper-text-muted);
  font-size: 0.7rem;
}

/* ===== Compliance view ===== */
.framework-card {
  padding: 22px;
  box-shadow: 0 4px 16px rgba(26, 23, 36, 0.025);
}

.framework-card-head {
  gap: 14px;
}

.framework-card-head > div {
  min-width: 0;
}

.framework-card-head p {
  margin-top: 4px;
  color: var(--paper-text-muted);
  font-size: 0.72rem;
}

.framework-progress {
  margin: 0 0 16px;
}

.framework-status {
  flex-shrink: 0;
}

/* ===== Documents view ===== */
#documents-toolbar {
  align-items: center;
}

#documents-search {
  background: #fff;
  outline: none;
}

#documents-search:focus {
  border-color: rgba(91,79,232,0.42);
  box-shadow: 0 0 0 3px rgba(91,79,232,0.08);
}

.documents-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  padding: 7px 10px !important;
  border: 1px solid var(--border-on-paper) !important;
  border-radius: 999px !important;
  color: var(--paper-text-muted) !important;
  font-size: 0.68rem !important;
}

.filter-chip:hover,
.filter-chip.is-active {
  border-color: rgba(91,79,232,0.24) !important;
  background: rgba(91,79,232,0.06) !important;
  color: var(--accent) !important;
}

.documents-table-shell {
  overflow: hidden;
  border: 1px solid var(--border-on-paper);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 4px 16px rgba(26, 23, 36, 0.025);
}

.documents-table-shell table {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

#documents-table td:first-child {
  font-weight: 500;
}

#documents-table td:first-child,
#invoices-table td:first-child {
  white-space: nowrap;
}

.table-file-icon {
  display: inline-grid;
  place-items: center;
  min-width: 27px;
  margin-right: 9px;
  padding: 4px 5px;
  border-radius: 4px;
  background: var(--paper-raised);
  color: var(--paper-text-muted);
  font-family: var(--font-mono);
  font-size: 0.57rem;
  font-weight: 600;
}

.table-status {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0,216,160,0.10);
  color: var(--signal-dim);
  font-family: var(--font-mono);
  font-size: 0.59rem;
}

.table-status-action {
  background: rgba(232,162,61,0.13);
  color: #B87A1A;
}

.document-row-attention td {
  background: rgba(232,162,61,0.025);
}

.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-top: 14px;
  padding: 20px;
  border: 1px dashed var(--border-on-paper);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.55);
  text-align: center;
}

.upload-dropzone strong {
  font-family: var(--font-display);
  font-size: 0.78rem;
}

.upload-dropzone span {
  color: var(--paper-text-muted);
  font-size: 0.7rem;
}

/* ===== Messages view ===== */
#view-messages {
  height: auto;
  min-height: calc(100vh - 170px);
}

#messages-view-inner {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 14px;
  height: 650px;
}

.message-context-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.context-card {
  padding: 15px;
  border: 1px solid var(--border-on-paper);
  border-radius: var(--radius-md);
  background: #fff;
}

.context-card > strong {
  display: block;
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 0.88rem;
}

.context-card p {
  margin-top: 6px;
  color: var(--paper-text-muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.context-due {
  display: inline-flex;
  margin-top: 10px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(232,162,61,0.12);
  color: #B87A1A;
  font-family: var(--font-mono);
  font-size: 0.58rem;
}

.mini-person {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
  color: var(--paper-text-muted);
  font-size: 0.67rem;
}

.mini-person + .mini-person {
  margin-top: 8px;
}

.messages-main-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-on-paper);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: #fff;
}

.thread-header > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.thread-header strong {
  font-size: 0.8rem;
  font-weight: 600;
}

.thread-header span {
  color: var(--paper-text-muted);
  font-size: 0.66rem;
}

.thread-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.thread-online .status-dot {
  width: 6px;
  height: 6px;
}

#messages-thread {
  border-radius: 0;
  padding: 18px 20px;
  background:
    linear-gradient(to bottom, rgba(245,244,250,0.32), transparent 38%),
    #fff;
}

.thread-date-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 5px;
  color: var(--paper-text-muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.thread-date-divider::before,
.thread-date-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--border-on-paper);
}

.thread-message {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  gap: 9px;
  max-width: 76%;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.thread-message-client {
  align-self: flex-end;
  grid-template-columns: minmax(0, 1fr);
  max-width: 68%;
}

.thread-message-avatar {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--ink-text);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.thread-message-body {
  padding: 11px 13px;
  border: 1px solid var(--border-on-paper);
  border-radius: 13px 13px 13px 4px;
  background: var(--paper-raised);
}

.thread-message-client .thread-message-body {
  border-color: rgba(91,79,232,0.12);
  border-radius: 13px 13px 4px 13px;
  background: rgba(91,79,232,0.08);
}

.thread-message-author {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 4px;
}

.thread-message-author em {
  color: var(--paper-text-muted);
  font-style: normal;
  font-weight: 400;
}

.thread-message p {
  line-height: 1.55;
}

#message-form {
  gap: 8px;
  flex-direction: column;
  align-items: stretch;
  padding: 10px;
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

#message-input {
  width: 100%;
  min-height: 45px;
  outline: none;
  border-color: var(--border-on-paper);
}

#message-input:focus {
  border-color: rgba(91,79,232,0.42);
  box-shadow: 0 0 0 3px rgba(91,79,232,0.08);
}

.message-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.attach-message-btn {
  width: 31px;
  height: 31px;
  display: grid !important;
  place-items: center;
  border: 1px solid var(--border-on-paper) !important;
  border-radius: 8px;
  color: var(--paper-text-muted) !important;
  font-size: 0.9rem;
}

.message-helper {
  margin-right: auto;
  color: var(--paper-text-muted);
  font-family: var(--font-mono);
  font-size: 0.57rem;
}

#message-send-btn {
  width: 34px;
  height: 34px;
}

/* ===== Billing view ===== */
.billing-account-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--signal-dim);
  font-size: 0.72rem;
  font-weight: 600;
}

#billing-payment-method {
  justify-content: flex-start;
  gap: 13px;
  margin-bottom: 15px;
  padding: 16px 18px;
}

#billing-payment-method > div:nth-child(2) {
  min-width: 0;
}

.payment-method-icon {
  width: 40px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-on-paper);
  border-radius: 7px;
  background: var(--paper-raised);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
}

#billing-payment-method .btn {
  margin-left: auto;
}

.billing-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

.billing-stat-card {
  padding: 15px 16px;
  border: 1px solid var(--border-on-paper);
  border-radius: var(--radius-md);
  background: #fff;
}

.billing-stat-card span {
  display: block;
  color: var(--paper-text-muted);
  font-size: 0.68rem;
}

.billing-stat-card strong {
  display: block;
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.billing-stat-card small {
  display: block;
  margin-top: 4px;
  color: var(--paper-text-muted);
  font-size: 0.65rem;
}

/* ===== Subtle consistent hover/focus treatment ===== */
.card-view-all:focus-visible,
.sidebar-link:focus-visible,
.project-option:focus-visible,
.team-invite:focus-visible,
.message-compose-button:focus-visible,
.action-row:focus-visible,
.filter-chip:focus-visible,
.attach-message-btn:focus-visible {
  outline: 2px solid rgba(91,79,232,0.35);
  outline-offset: 2px;
}

/* ===== Responsive additions ===== */
@media (max-width: 1080px) {
  #app-content {
    padding-inline: 24px;
  }

  .overview-hero {
    grid-template-columns: minmax(0, 1fr) 240px;
    padding: 26px;
  }

  .project-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #overview-grid {
    grid-template-columns: 1fr 1fr;
  }

  #team-widget {
    grid-column: span 2;
  }
}

@media (max-width: 860px) {
  .overview-hero {
    grid-template-columns: 1fr;
  }

  .hero-progress {
    align-items: flex-start;
    flex-direction: row;
    border-left: none;
    border-top: 1px solid var(--border-on-paper);
    padding: 18px 0 0;
  }

  .hero-progress-meta {
    text-align: left;
    align-self: center;
  }

  #overview-grid {
    grid-template-columns: 1fr;
  }

  #team-widget {
    grid-column: auto;
  }

  .team-stack,
  .billing-summary-grid {
    grid-template-columns: 1fr;
  }

  #messages-view-inner {
    grid-template-columns: 1fr;
    height: auto;
  }

  .message-context-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .messages-main-panel {
    min-height: 560px;
  }
}

@media (max-width: 640px) {
  #app-content {
    padding: 18px 14px 32px;
  }

  #app-topbar {
    padding: 12px 14px;
  }

  .topbar-project-status {
    display: none;
  }

  .overview-hero {
    padding: 20px;
  }

  .overview-hero-copy h2 {
    font-size: 1.4rem;
  }

  .project-kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .metric-card {
    padding: 13px;
  }

  .metric-value {
    font-size: 0.95rem;
  }

  #stage-tracker {
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .stage-connector {
    min-width: 16px;
  }

  .action-row {
    grid-template-columns: 32px minmax(0, 1fr) 15px;
  }

  .action-meta {
    display: none;
  }

  .view-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .view-intro .btn {
    width: 100%;
    justify-content: center;
  }

  #documents-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  #documents-search {
    max-width: none;
  }

  .message-context-panel {
    grid-template-columns: 1fr;
  }

  .thread-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .thread-message,
  .thread-message-client {
    max-width: 90%;
  }

  .overview-footer-note {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .overview-footer-note a {
    width: 100%;
    margin-left: 22px;
  }
}

/* If color-mix is unsupported, keep the original border behaviour. */
@supports not (color: color-mix(in srgb, white 50%, black)) {
  .dashboard-card:hover {
    border-color: var(--border-on-paper);
  }
}
