@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500&display=swap');

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  background: #FAFAF9;
  color: #14161A;
}
.display { font-family: 'Space Grotesk', sans-serif; }
.mono { font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.02em; }

a { color: inherit; text-decoration: none; }

/* Top bar */
.topbar { border-bottom: 1px solid #E7E7E4; background: #fff; }
.topbar-inner { max-width: 880px; margin: 0 auto; padding: 12px 20px 0; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; flex-shrink: 0; }
.topbar-user { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.role-chip { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; }
.link-muted { color: #8A8F98; font-size: 12.5px; }

.tabs { display: flex; gap: 4px; margin-top: 10px; overflow-x: auto; padding-bottom: 10px; }
.tab {
  padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: #8A8F98; white-space: nowrap; flex-shrink: 0;
}
.tab.active { background: #F1EFEA; color: #14161A; }
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #B0562D; color: #fff; font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 700; border-radius: 999px; min-width: 16px; height: 16px;
  padding: 0 4px; margin-left: 5px; vertical-align: middle;
}

.message-card { }
.message-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.message-meta { font-size: 12px; color: #8A8F98; margin: 4px 0 10px; }
.message-body { font-size: 13.5px; line-height: 1.6; margin: 0; white-space: pre-line; }

/* Page shell */
.page { max-width: 880px; margin: 0 auto; padding: 24px 20px 60px; }

h1.page-title { font-family: 'Space Grotesk', sans-serif; font-size: 24px; font-weight: 700; margin: 0 0 4px; }
.page-subtitle { font-size: 12.5px; color: #8A8F98; margin: 0 0 18px; }

/* Cards */
.card { background: #fff; border: 1px solid #E7E7E4; border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.card h2 { font-family: 'Space Grotesk', sans-serif; font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.card p.hint { font-size: 12.5px; color: #8A8F98; margin: 0 0 14px; }

/* Forms */
label { font-size: 12px; color: #6B6F76; display: block; margin-bottom: 5px; font-weight: 600; }
input, select, textarea {
  border: 1px solid #DCDCD8; border-radius: 8px; padding: 8px 10px; font-size: 13px;
  background: #fff; color: #14161A; width: 100%; font-family: inherit;
}
textarea { min-height: 64px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
.field { margin-bottom: 10px; }

.btn {
  border: none; border-radius: 8px; padding: 9px 16px; background: #14161A; color: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.btn.secondary { background: #fff; border: 1px solid #DCDCD8; color: #6B6F76; }
.btn.danger-text { background: none; border: none; color: #B0562D; padding: 0; }

.error-text { font-size: 12.5px; color: #B0562D; margin: 8px 0; }
.success-text { font-size: 12.5px; color: #4F7A5C; }
.notice { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #8A6D3B; background: #F5EFE3; border-radius: 8px; padding: 10px 12px; }

.reminder-banner {
  background: #F5EFE3; border: 1px solid #E8DCC0; border-radius: 12px;
  padding: 14px 16px; margin-bottom: 16px;
}
.reminder-banner-title { font-size: 13.5px; font-weight: 700; color: #8A6D3B; margin-bottom: 8px; }
.reminder-list { list-style: none; margin: 0; padding: 0; }
.reminder-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; font-size: 13px; border-top: 1px solid rgba(138,109,59,0.15);
}
.reminder-list li:first-child { border-top: none; }
.reminder-list a { color: #6B4C9A; font-weight: 600; }
.reminder-date { color: #8A8F98; font-size: 12px; font-family: 'IBM Plex Mono', monospace; }
.reminder-more { font-size: 12px; color: #8A6D3B; margin-top: 6px; }

.kpi-alert {
  background: #FBEAE3; border: 1px solid #EFC8B8; color: #B0562D;
  border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px;
}
.kpi-chip {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: #B0562D; background: #FBEAE3;
  border-radius: 10px; padding: 1px 7px; margin-left: 6px; vertical-align: middle;
}

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-brand span { font-family: 'Space Grotesk', sans-serif; font-size: 19px; font-weight: 700; }
.login-card { background: #fff; border: 1px solid #E7E7E4; border-radius: 14px; padding: 26px; }
.login-eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #8A8F98; text-transform: uppercase; margin-bottom: 4px; }
.login-card h1 { font-family: 'Space Grotesk', sans-serif; font-size: 20px; margin: 0 0 18px; font-weight: 700; }
.demo-accounts { margin-top: 16px; font-size: 12px; color: #8A8F98; line-height: 1.7; }
.demo-accounts .label { font-family: 'IBM Plex Mono', monospace; color: #B7BAC1; margin-bottom: 6px; }

/* Calendar */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-grid { background: #fff; border: 1px solid #E7E7E4; border-radius: 14px; overflow: hidden; }
.cal-row-header { display: grid; grid-template-columns: repeat(7,1fr); border-bottom: 1px solid #E7E7E4; }
.cal-row-header div { padding: 10px 0; text-align: center; font-size: 11px; color: #8A8F98; font-family: 'IBM Plex Mono', monospace; }
.cal-body { display: grid; grid-template-columns: repeat(7,1fr); }
.cal-cell {
  min-height: 92px; border-right: 1px solid #F0F0EE; border-bottom: 1px solid #F0F0EE; padding: 6px;
  vertical-align: top;
}
.cal-cell.today { background: #FBF9F4; }
.cal-cell .daynum-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cal-cell .daynum { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #B7BAC1; }
.cal-cell.today .daynum { color: #B0562D; }
.cal-cell .plus-link { color: #C7C9CE; font-size: 13px; line-height: 1; }
.cal-event {
  display: block; text-align: left; font-size: 10.5px; line-height: 1.3; border-radius: 4px;
  padding: 3px 5px; margin-bottom: 3px; border-left: 3px solid; background: #F1EBF7; color: #14161A;
}
.legend { display: flex; gap: 16px; margin-top: 16px; flex-wrap: wrap; font-size: 12px; color: #6B6F76; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: middle; }

.detail-badge {
  display: inline-flex; align-items: center; gap: 6px; font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  padding: 5px 10px; border-radius: 20px; background: #F1EFEA; color: #3A4A5C; margin-top: 12px;
}

.report-section { margin-top: 14px; }
.report-section .section-label { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: #8A8F98; text-transform: uppercase; margin-bottom: 8px; }
.report-row { margin-bottom: 8px; }
.report-row .rlabel { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: #8A8F98; text-transform: uppercase; }
.report-row .rvalue { font-size: 13px; }

/* Dashboard */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid #E7E7E4; border-radius: 12px; padding: 14px 16px; flex: 1; min-width: 120px; }
.stat-card .slabel { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: #8A8F98; text-transform: uppercase; margin-bottom: 6px; }
.stat-card .svalue { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; }

.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar-col .bar { width: 100%; border-radius: 4px 4px 0 0; }
.bar-col .bar-value { font-size: 11px; color: #6B6F76; margin-bottom: 4px; }
.bar-col .bar-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #8A8F98; margin-top: 6px; }

.grouped-bars { display: flex; align-items: flex-end; gap: 4px; }

table.simple { width: 100%; border-collapse: collapse; }
table.simple td, table.simple th { padding: 10px 0; border-bottom: 1px solid #F3F2EE; font-size: 13px; text-align: left; }
table.simple th { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: #8A8F98; text-transform: uppercase; }

.member-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 32px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid #F3F2EE; }
.member-row .mname { font-size: 13.5px; font-weight: 600; }
.member-row .memail { font-size: 12px; color: #8A8F98; display: flex; align-items: center; gap: 6px; }
.invited-chip { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: #8A6D3B; background: #F5EFE3; border-radius: 10px; padding: 1px 7px; }

.invite-preview { background: #F1EFEA; border: 1px solid #E2DED4; border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.invite-email { background: #fff; border: 1px solid #E7E7E4; border-radius: 10px; padding: 16px; font-size: 13px; }
.invite-token { display: inline-block; background: #F7F7F5; border: 1px dashed #DCDCD8; border-radius: 8px; padding: 6px 12px; font-family: 'IBM Plex Mono', monospace; font-size: 15px; letter-spacing: 0.08em; margin: 10px 0; }

/* Modal (plan a visit) */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,22,26,0.45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box { background: #fff; border-radius: 14px; padding: 22px; width: 100%; max-width: 380px; max-height: 88vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.modal-close { border: none; background: none; color: #B7BAC1; font-size: 18px; cursor: pointer; }
