/* Mobile first: everything works one-handed on a phone, then spreads out
   on wider screens. --brand is set per company in the layout. */

:root {
  --brand: #1f4e79;
  --ink: #1d2733;
  --muted: #5f6b7a;
  --line: #e3e7ec;
  --surface: #f6f8fa;
}

html { font-size: 16px; }

body {
  color: var(--ink);
  background: var(--surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a, .btn-link { color: var(--brand); }

.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: var(--brand);
  border-color: var(--brand);
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background-color: var(--brand); border-color: var(--brand); color: #fff; }

.form-control:focus, .form-select:focus, .form-check-input:focus, .btn:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand) 25%, transparent);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* header and footer */

.demo-banner {
  background: #fff4d6;
  color: #6b4e00;
  border-bottom: 1px solid #f0dca0;
  font-size: .875rem;
  text-align: center;
  padding: .4rem 1rem;
}
.demo-banner a { color: inherit; font-weight: 600; margin-left: .25rem; }

.site-header { background: var(--brand); color: #fff; }

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  text-decoration: none;
  min-width: 0;
}
.brand:hover { color: #fff; }

.brand-mark {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .5rem;
  background: rgba(255, 255, 255, .16);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: .02em;
}

.brand-name {
  font-weight: 600;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link-staff { color: #fff; text-decoration: none; font-weight: 500; }
.nav-link-staff:hover { color: #fff; text-decoration: underline; }
.staff-nav .btn { white-space: nowrap; }
.nav-link-staff.active { text-decoration: underline; text-underline-offset: .3em; }

.site-footer { color: var(--muted); border-top: 1px solid var(--line); background: #fff; }

/* cards and sections */

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: .75rem;
  padding: 1.25rem;
}

.narrow { max-width: 28rem; margin: 0 auto; }
.readable { max-width: 48rem; margin: 0 auto; }

.page-title { font-size: 1.5rem; font-weight: 650; margin-bottom: .25rem; }
.page-sub { color: var(--muted); margin-bottom: 1.5rem; }

.property-card h2 { font-size: 1.15rem; font-weight: 600; }
.property-card .address { color: var(--muted); font-size: .9rem; }

/* the application form */

.form-section { margin-bottom: 1.25rem; }
.form-section > h2 {
  font-size: 1.05rem;
  font-weight: 650;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--line);
}
.form-label { font-weight: 500; font-size: .925rem; }
.form-text { font-size: .825rem; }
.field-validation-error { color: #b42318; font-size: .85rem; }
.input-validation-error { border-color: #b42318; }
.validation-summary-errors ul { margin-bottom: 0; }
.validation-summary-valid { display: none; }

/* staff: application list */

.filters { display: grid; gap: .5rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
@media (min-width: 768px) {
  .filters { grid-template-columns: 2fr 1fr 1fr auto; }
}

.app-list { list-style: none; padding: 0; margin: 0; }
.app-row {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: .6rem;
  padding: .85rem 1rem;
  margin-bottom: .5rem;
  color: inherit;
  text-decoration: none;
}
.app-row:hover { border-color: var(--brand); color: inherit; }
.app-row .name { font-weight: 600; }
.app-row.unread .name::before {
  content: "";
  display: inline-block;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--brand);
  margin-right: .45rem;
  vertical-align: middle;
}
.app-row .meta { color: var(--muted); font-size: .875rem; }

@media (min-width: 768px) {
  .app-row {
    display: grid;
    grid-template-columns: 2fr 1.6fr 1.1fr 1fr;
    align-items: center;
    gap: 1rem;
  }
  .app-row .meta { font-size: .9rem; }
}

.status {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  padding: .15rem .55rem;
  border-radius: 999px;
  background: #eef1f5;
  color: #3d4a5c;
}
.status-New { background: #e6f0fb; color: #1d4f91; }
.status-InReview { background: #fff4d6; color: #7a5800; }
.status-Approved { background: #e3f4ea; color: #1e6b3d; }
.status-Denied { background: #fde8e7; color: #a12a20; }
.status-Withdrawn { background: #eef1f5; color: #5f6b7a; }

/* staff: one application */

.detail-grid { display: grid; gap: .75rem 1.5rem; grid-template-columns: 1fr; margin: 0; }
@media (min-width: 576px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
.detail-grid dt { font-weight: 500; color: var(--muted); font-size: .825rem; margin: 0; }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }

.ssn { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }

.recovery-codes {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .35rem 1rem;
  list-style: none;
  padding: 0;
}

.qr { width: 200px; height: 200px; }
.qr svg { width: 100%; height: 100%; }

.secret-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }

/* staff: users */

@media (min-width: 768px) {
  .app-row.user-row { grid-template-columns: 1.6fr 1.4fr .9fr 1.2fr; }
}
.app-row.user-row > div + div { margin-top: .35rem; }
@media (min-width: 768px) { .app-row.user-row > div + div { margin-top: 0; } }
.app-row.is-disabled { opacity: .6; }

.badge-role {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--brand);
}
.badge-role.staff { color: var(--muted); }

.user-status-Active { background: #e3f4ea; color: #1e6b3d; }
.user-status-Invited { background: #e6f0fb; color: #1d4f91; }
.user-status-InviteExpired { background: #fff4d6; color: #7a5800; }
.user-status-Disabled { background: #eef1f5; color: #5f6b7a; }
.user-status-NotSetUp { background: #eef1f5; color: #5f6b7a; }

/* staff: activity */

@media (min-width: 768px) {
  .activity-filters { grid-template-columns: 1fr 1fr auto; }
}
.activity { padding-top: .5rem; }
.activity-day {
  font-size: .8rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 1rem 0 .5rem;
}
.activity-day:first-child { margin-top: .5rem; }
.activity-row {
  display: grid;
  grid-template-columns: 4.75rem 1fr;
  gap: .75rem;
  padding: .45rem 0;
  border-top: 1px solid var(--line);
  font-size: .925rem;
}
.activity-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* staff: company picker */

.company-choice { display: flex !important; align-items: center; gap: .85rem; width: 100%; }
.choice-mark { background: var(--choice-color); color: #fff; }
