:root {
  --navy: #1F3864;
  --navy-dark: #16294a;
  --gold: #B08D57;
  --bg: #F4F6FA;
  --panel: #FFFFFF;
  --border: #E4E8F0;
  --text: #1E2532;
  --muted: #7A8496;
  --good: #1E8E5A;
  --mid: #C9902E;
  --bad: #C4453D;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* --- App shell --- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh; /* accounts for an on-screen taskbar/nav bar that 100vh doesn't */
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 22px; border-bottom: 1px solid rgba(255,255,255,0.12); margin-bottom: 18px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--gold); color: var(--navy-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.brand-mark.large { width: 56px; height: 56px; font-size: 20px; border-radius: 12px; margin: 0 auto 12px; }
.brand-mark.has-logo { background: #fff; padding: 5px; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-mark.large.has-logo { width: auto; max-width: 240px; height: 64px; padding: 6px 10px; border-radius: 10px; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: rgba(255,255,255,0.6); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,0.78); text-decoration: none;
  padding: 10px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 500;
  transition: background 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-link.active { background: var(--gold); color: var(--navy-dark); font-weight: 700; }
.nav-icon { width: 18px; text-align: center; }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 14px; flex-shrink: 0; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.user-name { font-size: 13px; font-weight: 600; }

/* --- Sidebar compliance-news ribbon (above the user chip / logout) --- */
.sidebar-news { border-top: 1px solid rgba(255,255,255,0.12); padding: 14px 2px; margin-top: 10px; flex-shrink: 0; max-height: 34vh; overflow-y: auto; }
.sidebar-news-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  color: rgba(255,255,255,0.55); margin-bottom: 8px; padding: 0 4px;
}
.sidebar-news-refresh {
  background: none; border: none; color: rgba(255,255,255,0.55); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: 4px;
}
.sidebar-news-refresh:hover { color: #fff; background: rgba(255,255,255,0.1); }
.sidebar-news-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sidebar-news-list li { padding: 0 4px; }
.sidebar-news-list a {
  color: rgba(255,255,255,0.85); text-decoration: none; font-size: 12px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sidebar-news-list a:hover { color: var(--gold); text-decoration: underline; }
.sidebar-news-empty { font-size: 11.5px; color: rgba(255,255,255,0.45); padding: 0 4px; line-height: 1.4; margin: 0; }
.logout-link { font-size: 11.5px; color: rgba(255,255,255,0.55); text-decoration: none; background: none; border: none; padding: 0; font-family: inherit; cursor: pointer; }
.logout-link:hover { color: #fff; }

.main-content { flex: 1; padding: 28px 36px 60px; max-width: 1240px; }

/* --- Header / page furniture --- */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-header h1 { margin: 4px 0 2px; font-size: 23px; color: var(--navy); }
.page-sub { color: var(--muted); margin: 0; font-size: 13px; }
.back-link { color: var(--gold); text-decoration: none; font-size: 12.5px; font-weight: 600; }
.header-actions { display: flex; gap: 8px; }

/* --- Buttons --- */
.btn {
  display: inline-block; border: none; border-radius: 8px; padding: 9px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform 0.05s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: #fff; color: var(--navy); border: 1px solid var(--border); }
.btn-secondary:hover { background: #F0F2F7; }
.btn-danger { background: #fff; color: var(--bad); border: 1px solid #F2C9C6; }
.btn-danger:hover { background: #FDF2F1; }
.btn-block { width: 100%; text-align: center; }

/* --- KPI cards --- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.kpi-card.kpi-warn { border-color: #F2C9C6; background: #FEF8F7; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--navy); margin-top: 6px; }

/* --- Layout grids --- */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
.side-col { display: flex; flex-direction: column; gap: 20px; }

/* --- Panels --- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-header h2 { font-size: 15px; margin: 0; color: var(--navy); }

/* --- Table --- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.02em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #F7F9FC; }
.cell-strong { font-weight: 600; color: var(--text); }
.empty-cell { text-align: center; color: var(--muted); padding: 30px; }

/* --- Compliance bars --- */
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.bar-track { flex: 1; height: 8px; background: #EDF0F6; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; }
.bar-good { background: var(--good); }
.bar-mid { background: var(--mid); }
.bar-bad { background: var(--bad); }
.bar-pct { font-size: 12px; font-weight: 700; color: var(--text); width: 34px; }

.compliance-badge { background: var(--navy); color: #fff; font-weight: 700; font-size: 14px; padding: 4px 12px; border-radius: 20px; }

/* --- Pills --- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.pill-active { background: #E4F5EB; color: var(--good); }
.pill-onboarding { background: #FDF3E3; color: var(--mid); }
.pill-paused { background: #F0F2F7; color: var(--muted); }
.pill-closed { background: #FBEAE9; color: var(--bad); }

/* --- Lists --- */
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.simple-list li:last-child { border-bottom: none; }
.simple-list a { color: var(--navy); text-decoration: none; font-weight: 600; }
.muted { color: var(--muted); font-size: 12.5px; }

.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-list li:last-child { border-bottom: none; }
.activity-type { font-weight: 600; font-size: 13px; color: var(--text); }
.activity-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.activity-notes { font-size: 12.5px; color: var(--text); margin-top: 4px; background: #F7F9FC; padding: 6px 8px; border-radius: 6px; }

.link-btn { background: none; border: none; color: var(--bad); font-size: 11px; padding: 4px 0 0; cursor: pointer; }

/* --- Checklist --- */
.checklist-category { margin-bottom: 16px; }
.checklist-category-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--gold); margin-bottom: 6px; }
.checklist-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.checklist-item-text { font-size: 13px; }
.status-select { border-radius: 20px; padding: 5px 12px; font-size: 12px; font-weight: 700; border: 1px solid var(--border); cursor: pointer; }
.status-not-started { background: #FBEAE9; color: var(--bad); }
.status-in-progress { background: #FDF3E3; color: var(--mid); }
.status-complete { background: #E4F5EB; color: var(--good); }

/* --- Forms --- */
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stacked-form { display: flex; flex-direction: column; gap: 12px; }
.full-width { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font-family: inherit; font-size: 13.5px; padding: 9px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); }
.form-panel { max-width: 720px; }

.doc-section-row { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.doc-section-row .remove-section-btn { align-self: flex-start; }

.branding-preview { display: flex; align-items: center; gap: 14px; background: #F7F9FC; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.branding-preview img { max-height: 48px; max-width: 160px; object-fit: contain; background: #fff; border-radius: 4px; padding: 4px; }
.branding-remove { flex-direction: row !important; align-items: center; gap: 6px !important; font-weight: 500 !important; color: var(--text) !important; font-size: 12.5px !important; }
.branding-remove input { width: auto; }

.claude-assist { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: linear-gradient(135deg, #F4F0E8 0%, #FBF8F2 100%); border: 1px solid #E9DFC8; border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.claude-assist-text strong { color: var(--navy); font-size: 13.5px; display: block; margin-bottom: 2px; }
.claude-assist-text span { font-size: 12px; color: var(--muted); }

.info-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.info-list dt { color: var(--muted); font-weight: 600; }
.info-list dd { margin: 0; }
.notes-block { margin-top: 12px; font-size: 12.5px; background: #F7F9FC; padding: 8px 10px; border-radius: 8px; }

/* --- Flash messages --- */
.flash-stack { margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 8px; }
.flash-success { background: #E4F5EB; color: var(--good); }
.flash-error { background: #FBEAE9; color: var(--bad); }

/* --- Login page --- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
}
.login-card { background: #fff; border-radius: 16px; padding: 40px 36px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand h1 { font-size: 18px; color: var(--navy); margin: 0 0 4px; }
.login-brand p { font-size: 12px; color: var(--muted); margin: 0; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.login-hint { margin-top: 16px; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.5; }
.login-hint code { background: #F0F2F7; padding: 1px 5px; border-radius: 4px; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .sidebar { position: relative; height: auto; }
  .app-shell { flex-direction: column; }
  .grid-form { grid-template-columns: 1fr; }
}

/* --- Checkbox labels (e.g. "requires signature") --- */
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; color: var(--text) !important; font-size: 13px !important; margin-top: 4px; }
.checkbox-label input { width: auto; }

/* --- Invoice line-item rows --- */
.invoice-item-row {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  gap: 12px;
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px;
}
.invoice-item-row label { flex: 1 1 260px; }
.invoice-item-row .invoice-item-qty { flex: 0 1 90px; }
.invoice-item-row .invoice-item-price { flex: 0 1 130px; }
.invoice-item-row .remove-item-btn { flex: 0 0 auto; margin-bottom: 6px; }

/* --- Compliance news panel --- */
.news-list { display: flex; flex-direction: column; gap: 2px; }
.news-list li.news-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.news-list li.news-item:last-child { border-bottom: none; }
.news-item a { color: var(--navy); font-weight: 600; font-size: 13px; text-decoration: none; line-height: 1.4; }
.news-item a:hover { text-decoration: underline; }
.news-meta { font-size: 11.5px; }

/* --- Client portal link row --- */
.portal-link-row { display: flex; gap: 8px; }
.portal-link-row input { flex: 1; font-size: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: #F7F9FC; color: var(--muted); }

/* --- Inline status select (DSAR / breach quick updates) --- */
.inline-select { font-size: 12.5px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); font-weight: 600; }

/* --- Regulatory form preview + email layout --- */
.reg-preview-layout { display: flex; gap: 20px; align-items: flex-start; }
.reg-preview-frame-panel { flex: 1 1 60%; padding: 8px; }
.reg-preview-frame { width: 100%; height: 78vh; border: none; border-radius: 6px; background: #fff; }
.reg-email-panel { flex: 1 1 34%; max-width: 380px; }
@media (max-width: 900px) {
  .reg-preview-layout { flex-direction: column; }
  .reg-email-panel { max-width: 100%; }
  .reg-preview-frame { height: 60vh; }
}

/* --- Regulatory filings list (Documents page) --- */
.reg-form-list { display: flex; flex-direction: column; gap: 10px; }
.reg-form-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
}
.reg-form-title { font-weight: 700; color: var(--navy); font-size: 13.5px; margin-bottom: 2px; }
.reg-form-actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 700px) {
  .reg-form-row { flex-direction: column; align-items: flex-start; }
  .reg-form-actions { width: 100%; }
  .reg-form-actions .btn { flex: 1; }
}

/* --- Regulatory form edit controls --- */
.reg-radio-row { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 12px; }
.reg-checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; margin: 4px 0 12px; }
.reg-radio-opt { flex-direction: row !important; align-items: flex-start; gap: 6px !important; font-weight: 500 !important; color: var(--text) !important; font-size: 13px !important; }
.reg-radio-opt input { width: auto; margin-top: 2px; }

/* Checklist template editing */
.checklist-template-edit-row { display: flex; gap: 8px; align-items: center; flex: 1; }
.checklist-template-cat-input { max-width: 210px; }
.checklist-template-item-input { flex: 1; }

/* Per-user client access restriction */
.checklist-scroll-box { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }

/* --- Public landing page --- */
.landing-body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
.btn-lg { padding: 13px 26px; font-size: 14.5px; }

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.landing-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 17px;
  color: var(--navy);
}
.landing-nav-brand .brand-mark { width: 34px; height: 34px; font-size: 13px; }
.landing-nav-links { display: flex; gap: 10px; }

.landing-hero {
  text-align: center;
  padding: 80px 24px 60px;
  max-width: 760px;
  margin: 0 auto;
}
.landing-hero h1 {
  font-size: 34px;
  color: var(--navy);
  margin: 0 0 18px;
  line-height: 1.25;
}
.landing-hero-sub {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 32px;
}
.landing-hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.landing-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 50px 24px;
}
.landing-section h2 {
  text-align: center;
  font-size: 26px;
  color: var(--navy);
  margin: 0 0 36px;
}
.landing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.landing-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 22px;
}
.landing-card h3 {
  color: var(--navy);
  font-size: 15.5px;
  margin: 0 0 10px;
}
.landing-card p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0;
}

.landing-contact {
  text-align: center;
  background: var(--panel);
  border-radius: 16px;
  max-width: 700px;
  padding: 50px 30px;
}
.landing-contact-sub { color: var(--muted); margin: 0 0 24px; }
.landing-contact-details {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}
.landing-contact-details > div { margin: 0 30px; }
.landing-contact-details strong { color: var(--navy); font-size: 13px; }
.landing-contact-details a { color: var(--text); text-decoration: none; font-size: 15px; display: block; margin-top: 4px; }
.landing-contact-details a:hover { color: var(--gold); text-decoration: underline; }

.landing-footer {
  text-align: center;
  padding: 30px 24px 50px;
  color: var(--muted);
  font-size: 12.5px;
}

@media (max-width: 800px) {
  .landing-grid { grid-template-columns: 1fr; }
  .landing-nav { padding: 16px 20px; }
  .landing-hero { padding: 50px 20px 40px; }
  .landing-hero h1 { font-size: 26px; }
  .landing-contact-details { gap: 30px; }
}
