/* 2nd Home CRM. Colors taken from 2ndhome.org */
:root {
  --navy: #004c7e;
  --navy-dark: #003a61;
  --blue: #3294c4;
  --teal: #007fa3;
  --red: #b20734;
  --ink: #1f2a37;
  --muted: #5b6b7c;
  --line: #dde4ea;
  --bg: #f4f7f9;
  --card: #ffffff;
  --ok-bg: #e7f5ec; --ok: #1d6b3a;
  --warn-bg: #fff5e0; --warn: #8a5a00;
  --bad-bg: #fdecef; --bad: var(--red);
  --info-bg: #e6f2f9; --info: var(--navy);
  --radius: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 Poppins, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; color: var(--navy); }
h2 { font-size: 16px; margin: 0 0 12px; color: var(--navy); }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* Top bar */
.topbar { background: var(--navy); color: #fff; }
.topbar-inner { display: flex; align-items: center; gap: 16px; padding: 10px 24px; max-width: 1400px; margin: 0 auto; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; background: #fff; border-radius: 6px; padding: 2px 6px; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #fff; color: var(--red); font-weight: 800; font-size: 16px; }
.brand small { font-weight: 400; opacity: .8; font-size: 13px; }
.facility-switch select { background: var(--navy-dark); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; padding: 6px 10px; font: inherit; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; opacity: .9; }
.topbar .link-btn { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; padding: 5px 10px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; }
.nav { background: #fff; border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; gap: 4px; padding: 0 24px; max-width: 1400px; margin: 0 auto; overflow-x: auto; }
.nav a { padding: 12px 14px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.nav a:hover { color: var(--navy); text-decoration: none; }
.nav a.active { color: var(--navy); border-bottom-color: var(--red); }

main { max-width: 1400px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.sub { color: var(--muted); font-size: 14px; }

/* Cards & grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }
.stat { padding: 16px 18px; }
.stat .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 30px; font-weight: 700; color: var(--navy); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .note { font-size: 13px; color: var(--muted); }
.stat.accent { border-top: 4px solid var(--red); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--blue); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-dark); }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(50,148,196,.45); outline-offset: 1px; }

/* Tables */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f8fafb; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
tbody tr:hover { background: #f8fbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; background: #f8fafb; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f5; color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }

/* Forms */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=month], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #c9d3dc; border-radius: 6px; font: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
.filters input, .filters select { width: auto; min-width: 140px; }
textarea { min-height: 90px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: 1 / -1; }
.field-error { color: var(--red); font-size: 13px; margin-top: 3px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); font-size: 14px; }
.check input { width: 18px; height: 18px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px 18px; margin: 0 0 16px; background: #fff; }
legend { font-weight: 700; color: var(--navy); padding: 0 6px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--blue); }
.tabs .count { font-weight: 400; color: var(--muted); font-size: 13px; }

/* Flash */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-weight: 600; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.bad { background: var(--bad-bg); color: var(--bad); }

/* Detail lists */
dl.details { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.details dt { color: var(--muted); font-weight: 600; }
dl.details dd { margin: 0; }

/* Pipeline steps on a lead */
.steps { display: flex; gap: 0; margin: 4px 0 6px; flex-wrap: wrap; }
.step { flex: 1; min-width: 110px; padding: 10px 12px; border: 1px solid var(--line); background: #fff; font-size: 13px; }
.step + .step { border-left: 0; }
.step:first-child { border-radius: 6px 0 0 6px; }
.step:last-child { border-radius: 0 6px 6px 0; }
.step b { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.step.done { background: var(--ok-bg); border-color: #bfe3cc; }
.step.done b { color: var(--ok); }
.step.current { background: var(--info-bg); border-color: #b9d9ec; }
.step.failed { background: var(--bad-bg); border-color: #f2c2cd; }

/* Attendance */
.att-list { columns: 2; column-gap: 24px; }
.att-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); break-inside: avoid; }
.att-row input { width: 20px; height: 20px; accent-color: var(--navy); }
.att-row label { margin: 0; color: var(--ink); font-weight: 500; font-size: 14px; flex: 1; cursor: pointer; }
.sticky-bar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 18px; display: flex; gap: 14px; align-items: center; margin-top: 16px; border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 -4px 12px rgba(0,0,0,.05); }
.month-grid td, .month-grid th { padding: 4px 6px; text-align: center; font-size: 12px; }
.month-grid td:first-child, .month-grid th:first-child { text-align: left; white-space: nowrap; position: sticky; left: 0; background: #fff; }
.month-grid .p { color: var(--ok); font-weight: 700; }
.month-grid .a { color: #b8c2cc; }

/* Login: matches 2ndhome.org (Poppins, periwinkle hero, blue/maroon logo) */
.login-body { margin: 0; font-family: Poppins, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: #fff; color: #23324a; }
.login-split { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1fr) 1.15fr; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.login-inner { width: 100%; max-width: 380px; }
.login-logo { display: inline-block; margin-bottom: 28px; }
.login-logo img { height: 78px; width: auto; display: block; }
.logo-text { display: inline-flex; flex-direction: column; line-height: .95; font-family: Georgia, "Times New Roman", serif; }
.logo-2nd { color: #5b8fd0; font-size: 40px; font-style: italic; font-weight: 700; }
.logo-home { color: #a3123a; font-size: 30px; letter-spacing: .28em; }
.login-inner h1 { font-size: 28px; font-weight: 600; color: #0b3c6b; margin: 0 0 6px; }
.login-sub { margin: 0 0 26px; color: #6b7a90; font-size: 14px; }
.login-form > div { margin-bottom: 16px; }
.login-form label { font-size: 13px; font-weight: 500; color: #3c4a60; margin-bottom: 6px; }
.login-form input { height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid #d5dbe6; font-family: inherit; font-size: 15px; background: #f8f9fc; transition: border-color .15s, box-shadow .15s, background .15s; }
.login-form input:focus { outline: none; background: #fff; border-color: #7b8af8; box-shadow: 0 0 0 4px rgba(123, 138, 248, .18); }
.login-btn { width: 100%; height: 48px; border: 0; border-radius: 999px; margin-top: 6px; cursor: pointer; font-family: inherit; font-size: 15px; font-weight: 600; letter-spacing: .02em; color: #fff; background: linear-gradient(90deg, #3294c4, #6f7ff5); box-shadow: 0 8px 20px rgba(91, 112, 230, .28); transition: transform .1s, box-shadow .15s; }
.login-btn:hover { box-shadow: 0 10px 24px rgba(91, 112, 230, .38); }
.login-btn:active { transform: translateY(1px); }
.login-error { background: #fdecef; color: #a3123a; border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 500; margin: -4px 0 12px; }
.login-foot { margin-top: 26px; font-size: 12px; color: #8a96a8; line-height: 1.6; }
.login-hero { position: relative; overflow: hidden; display: flex; align-items: center; padding: 56px; color: #fff;
  background: linear-gradient(160deg, #bcc2fe 0%, #9aa6fb 45%, #7b8af8 100%); }
.hero-shape { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.hero-shape.s1 { width: 520px; height: 520px; right: -140px; top: -120px; }
.hero-shape.s2 { width: 340px; height: 340px; left: -110px; bottom: -90px; background: rgba(255, 255, 255, .10); }
.hero-shape.s3 { width: 140px; height: 140px; right: 18%; bottom: 14%; background: rgba(255, 255, 255, .18); }
.hero-copy { position: relative; max-width: 440px; }
.hero-kicker { text-transform: uppercase; letter-spacing: .18em; font-size: 12px; font-weight: 600; opacity: .85; margin: 0 0 10px; }
.hero-copy h2 { color: #fff; font-size: 34px; line-height: 1.2; font-weight: 600; margin: 0 0 14px; text-shadow: 0 2px 12px rgba(40, 50, 140, .18); }
.hero-copy p { font-size: 16px; line-height: 1.6; margin: 0 0 22px; opacity: .95; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.hero-points li { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.hero-points li::before { content: ""; width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: rgba(255, 255, 255, .9) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z' fill='%236f7ff5'/%3E%3C/svg%3E") center/14px no-repeat; }
@media (max-width: 860px) {
  .login-split { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-body { background: linear-gradient(180deg, #eef0ff 0%, #fff 40%); }
  .login-panel { background: transparent; align-items: flex-start; padding-top: 56px; }
}

.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pagination { margin-top: 14px; }
.pagination nav > div:first-child { display: none; }
.pagination svg { width: 16px; height: 16px; }

@media (max-width: 900px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3, .grid.cols-2, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .att-list { columns: 1; }
  main { padding: 16px; }
  .topbar-inner, .nav-inner { padding-left: 16px; padding-right: 16px; }
  dl.details { grid-template-columns: 1fr; }
}
@media print {
  .topbar, .nav, .actions, .filters, .sticky-bar { display: none !important; }
  body { background: #fff; }
}
