:root {
  --bg: #edf6ff;
  --bg2: #e9fbf8;
  --card: rgba(255,255,255,.92);
  --text: #0b1b34;
  --muted: #60708d;
  --blue: #2563eb;
  --blue2: #0f55e8;
  --line: rgba(15,35,70,.10);
  --shadow: 0 18px 50px rgba(8,24,54,.10);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(37,99,235,.10), transparent 30%),
    radial-gradient(circle at 85% 20%, rgba(45,212,191,.16), transparent 35%),
    linear-gradient(135deg, var(--bg), var(--bg2));
  min-height: 100vh;
}

.hidden { display: none !important; }
button, input, textarea, select { font: inherit; }
button {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: white;
  padding: 13px 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(37,99,235,.22);
}
button.secondary {
  background: #f1f5f9;
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--line);
}
button.danger-outline {
  background: transparent;
  color: #c2414b;
  border: 1px solid #ffd2d6;
  box-shadow: none;
}
button.delete-btn,
button.danger {
  background: #fff5f5;
  color: #dc2626;
  border: 1px solid #fecaca;
  box-shadow: none;
  padding: 9px 12px;
}
button.full-width { width: 100%; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  background: #fff;
  color: var(--text);
  outline: none;
}
textarea { min-height: 118px; resize: vertical; }
label { display: block; font-weight: 900; margin: 12px 0 7px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 4.4rem); line-height: .98; letter-spacing: -.06em; }
h2 { font-size: clamp(1.8rem, 3vw, 3rem); letter-spacing: -.05em; }
h3 { font-size: 1.35rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.eyebrow { color: var(--blue); text-transform: uppercase; letter-spacing: .09em; font-size: .78rem; font-weight: 900; }
.message { font-weight: 800; min-height: 22px; color: #166534; }
.message.error { color: #b91c1c; }

.login-view {
  width: min(1200px, calc(100% - 32px));
  margin: 32px auto;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 24px;
  align-items: stretch;
}
.login-hero, .login-card, .info-card, .panel, .hero-card, .status-card, .stat-card, .request-card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.login-hero { padding: 38px; min-height: 560px; display: flex; flex-direction: column; justify-content: space-between; }
.login-card { padding: 34px; }
.info-card { padding: 22px; }
.brand-row { display: flex; align-items: center; gap: 18px; }
.brand-row.compact h1 { margin: 0; font-size: 2.5rem; }
.brand-row.compact p { margin: 0; }
.logo {
  width: 58px; height: 58px; flex: 0 0 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2f7af8, #0f55e8);
  color: white; display: grid; place-items: center;
  font-weight: 950; font-size: 1.35rem;
}
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature-grid div {
  padding: 18px; border-radius: 18px;
  background: rgba(255,255,255,.20);
  border: 1px solid rgba(255,255,255,.28);
}
.feature-grid span, .feature-grid strong, .feature-grid p { display: block; }
.access-box { margin-top: 16px; padding: 16px; border-radius: 18px; background: #f8fafc; border: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid .full { grid-column: 1 / -1; }

.app-view { width: min(1320px, calc(100% - 32px)); margin: 28px auto; }
.topbar {
  display: flex; justify-content: space-between; gap: 20px; align-items: center;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 18px;
}
.top-actions { display: flex; gap: 10px; }
.tabs {
  display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto;
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow);
  padding: 10px; margin-bottom: 22px;
}
.tabs button {
  background: transparent; box-shadow: none; color: #465773; white-space: nowrap;
}
.tabs button.active {
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  color: var(--blue);
  border: 1px solid #bfdbfe;
}
.page { display: none; }
.page.active { display: block; }
.hero-card {
  padding: 28px;
  display: grid;
  grid-template-columns: 1.4fr .6fr;
  gap: 22px;
  align-items: center;
  margin-bottom: 22px;
}
.status-card { padding: 22px; box-shadow: none; }
.button-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 20px; }
.stat-card { padding: 22px; }
.stat-card strong { font-size: 2rem; display: block; }
.panel { padding: 22px; margin-bottom: 18px; }
.notice-banner {
  padding: 14px 16px; border-radius: 16px;
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af;
  margin-bottom: 16px;
}
.card-list { display: grid; gap: 16px; margin-top: 18px; }
.request-card { padding: 22px; }
.card-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.badge, .pill {
  display: inline-flex; align-items: center; padding: 7px 10px;
  border-radius: 999px; background: #dbeafe; color: #1d4ed8;
  font-weight: 900; font-size: .82rem;
}
.meta-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.meta-grid div { background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.meta-grid strong, .meta-grid span { display: block; word-break: break-word; }
.meta-grid strong { text-transform: uppercase; letter-spacing: .05em; font-size: .74rem; color: var(--muted); margin-bottom: 4px; }
.actions-grid { display: grid; grid-template-columns: 180px 1fr auto auto; gap: 10px; margin-top: 14px; }
.attachment-box { margin: 14px 0; padding: 14px; background: #f1f5f9; border-radius: 16px; border: 1px solid var(--line); }
.attachment-box a { color: var(--blue); font-weight: 900; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.segmented { display: inline-flex; background: #f1f5f9; border-radius: 14px; padding: 4px; }
.segmented button { background: transparent; box-shadow: none; color: var(--text); padding: 9px 14px; }
.segmented button.active { background: var(--blue); color: #fff; }
body.dark-mode {
  --bg: #081426; --bg2: #09211f; --card: rgba(13,25,44,.92);
  --text: #f8fbff; --muted: #aebbd0; --line: rgba(255,255,255,.12);
}
body.dark-mode input, body.dark-mode textarea, body.dark-mode select { background: rgba(6,16,31,.75); color: var(--text); }
body.dark-mode .meta-grid div, body.dark-mode .attachment-box, body.dark-mode .access-box { background: rgba(6,16,31,.70); }
body.dark-mode .tabs button { color: #cbd5e1; }

@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .topbar, .hero-card { grid-template-columns: 1fr; flex-direction: column; align-items: stretch; }
  .stat-grid, .settings-grid, .meta-grid, .form-grid, .feature-grid, .actions-grid { grid-template-columns: 1fr; }
  .top-actions { flex-direction: column; }
  .brand-row.compact { align-items: flex-start; }
}




/* Wilshire Clean Rebuild V2: Profile Updates */
#profileUpdatesAdminPanel {
  margin-top: 18px;
}




/* Wilshire Clean Rebuild V3: Enquiries */
#adminEnquiriesPanel {
  margin-top: 18px;
}




/* Wilshire Clean Rebuild V4: Dues Accounts */
#adminDuesPanel {
  margin-top: 18px;
}

.soft-line {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}




/* Wilshire Clean Rebuild V5: Committee */
#committeeItemsList {
  margin-top: 16px;
}




/* Wilshire Clean Rebuild V6: Voting */
#adminVotingPanel {
  margin-bottom: 18px;
}




/* Wilshire Clean Rebuild V7: Help Resources */
#adminHelpPanel {
  margin-bottom: 18px;
}




/* Wilshire Clean Rebuild V9: Settings */
.toggle-switch {
  width: 50px;
  height: 30px;
  padding: 4px;
  border-radius: 999px;
  background: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  box-shadow: none;
  border: 0;
}

.toggle-switch span {
  width: 22px;
  height: 22px;
  display: block;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15,23,42,.22);
  transition: transform .18s ease;
}

.toggle-switch.active {
  background: linear-gradient(135deg, #2563eb, #14b8a6);
}

.toggle-switch.active span {
  transform: translateX(20px);
}

body.side-tabs-mode .tabs {
  justify-content: center;
  gap: 5px;
  padding: 8px;
}

body.side-tabs-mode .tabs button {
  padding: 9px 11px;
  font-size: .92rem;
}

body.dark-mode .toggle-switch {
  background: rgba(255,255,255,.18);
}




/* Wilshire Clean Rebuild V10: Legal Page */
.legal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.legal-grid .panel {
  margin-bottom: 0;
}

.legal-grid h3 {
  margin-bottom: 10px;
}

.legal-wide {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .legal-grid {
    grid-template-columns: 1fr;
  }

  .legal-wide {
    grid-column: auto;
  }
}




/* Wilshire Clean Rebuild V11: Simple Login */
.simple-login-view {
  max-width: 1120px;
  min-height: calc(100vh - 64px);
  align-items: center;
}

.simple-login-hero {
  min-height: 420px;
  padding: 34px;
  justify-content: center;
  gap: 28px;
}

.simple-login-hero h1 {
  font-size: clamp(2.4rem, 6vw, 5rem);
  margin-bottom: 14px;
}

.simple-login-note {
  background: rgba(37,99,235,.08);
  border: 1px solid rgba(37,99,235,.16);
  border-radius: 18px;
  padding: 18px;
}

.simple-login-note p {
  margin: 6px 0 0;
  color: var(--muted);
}

.simple-login-card {
  align-self: center;
}

.simple-login-card h2 {
  margin-bottom: 18px;
}

.simple-login-card .small.muted {
  margin-top: 16px;
}

@media (max-width: 900px) {
  .simple-login-view {
    min-height: auto;
    margin-top: 18px;
  }

  .simple-login-hero {
    min-height: auto;
  }
}




/* Wilshire Clean Rebuild V12: Login HOA Visual */
.hoa-visual-card {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  border-radius: 24px;
  background: linear-gradient(180deg, #dff4ff 0%, #edfdf8 55%, #d8f3dc 56%, #b7e4c7 100%);
  border: 1px solid rgba(37,99,235,.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}

.hoa-sky {
  position: absolute;
  inset: 0 0 55% 0;
}

.hoa-sun {
  position: absolute;
  right: 28px;
  top: 22px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #fde68a;
  box-shadow: 0 0 30px rgba(253,230,138,.9);
}

.hoa-cloud {
  position: absolute;
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.85);
}

.hoa-cloud::before,
.hoa-cloud::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
}

.cloud-one {
  left: 28px;
  top: 34px;
  width: 76px;
}

.cloud-one::before {
  width: 30px;
  height: 30px;
  left: 13px;
  top: -14px;
}

.cloud-one::after {
  width: 24px;
  height: 24px;
  right: 14px;
  top: -10px;
}

.cloud-two {
  right: 96px;
  top: 58px;
  width: 58px;
  opacity: .78;
}

.cloud-two::before {
  width: 24px;
  height: 24px;
  left: 12px;
  top: -11px;
}

.cloud-two::after {
  width: 20px;
  height: 20px;
  right: 10px;
  top: -8px;
}

.hoa-scene {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  width: 270px;
  height: 120px;
}

.hoa-house {
  position: absolute;
  left: 85px;
  bottom: 0;
  width: 112px;
  height: 82px;
}

.hoa-roof {
  position: absolute;
  left: -10px;
  top: -28px;
  width: 132px;
  height: 70px;
  background: #94a3b8;
  clip-path: polygon(50% 0, 100% 58%, 88% 58%, 88% 100%, 12% 100%, 12% 58%, 0 58%);
  box-shadow: 0 10px 18px rgba(15,23,42,.12);
}

.hoa-home-body {
  position: absolute;
  left: 10px;
  bottom: 0;
  width: 92px;
  height: 62px;
  border-radius: 10px 10px 4px 4px;
  background: #fff7ed;
  border: 1px solid rgba(15,23,42,.08);
}

.hoa-door {
  position: absolute;
  left: 38px;
  bottom: 0;
  width: 20px;
  height: 36px;
  border-radius: 8px 8px 0 0;
  background: #b7791f;
}

.hoa-window {
  position: absolute;
  top: 15px;
  width: 18px;
  height: 16px;
  border-radius: 5px;
  background: #bfdbfe;
  border: 2px solid #e0f2fe;
}

.window-left {
  left: 14px;
}

.window-right {
  right: 14px;
}

.hoa-tree {
  position: absolute;
  bottom: 0;
  width: 54px;
  height: 84px;
  border-radius: 999px 999px 18px 18px;
  background: #58a760;
}

.hoa-tree::after {
  content: "";
  position: absolute;
  left: 23px;
  bottom: -4px;
  width: 9px;
  height: 35px;
  border-radius: 999px;
  background: #8b5a2b;
}

.tree-left {
  left: 18px;
}

.tree-right {
  right: 12px;
  transform: scale(1.12);
}

.hoa-sign {
  position: absolute;
  left: 50%;
  bottom: 13px;
  transform: translateX(-50%);
  padding: 8px 24px;
  min-width: 190px;
  text-align: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #fde7c7, #e9c48f);
  border: 1px solid rgba(120,77,31,.18);
  color: #7c4a17;
  font-family: Georgia, serif;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  box-shadow: 0 10px 20px rgba(120,77,31,.12);
}

body.dark-mode .hoa-visual-card {
  background: linear-gradient(180deg, #16365a 0%, #0f253f 55%, #123523 56%, #17452b 100%);
  border-color: rgba(255,255,255,.12);
}

body.dark-mode .hoa-sign {
  background: linear-gradient(180deg, #facc8a, #d9a55d);
}




/* Wilshire V13: Committee Directory Manager */
.committee-directory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.committee-member-card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.committee-member-top {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.committee-photo,
.committee-photo-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  object-fit: cover;
  flex: 0 0 72px;
}

.committee-photo-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #dbeafe, #ccfbf1);
  color: #1d4ed8;
  font-weight: 950;
  font-size: 1.4rem;
}

.committee-member-top h3 {
  margin-bottom: 6px;
}

.committee-member-details p {
  margin: 8px 0;
  color: var(--muted);
}

.committee-member-details strong {
  color: var(--text);
}

@media (max-width: 900px) {
  .committee-directory-grid {
    grid-template-columns: 1fr;
  }
}




/* Wilshire V14: Editable Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.contact-grid .panel {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}




/* Wilshire V15: Settings Side View Menu */
body.side-tabs-mode .app-view {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  align-items: start;
}

body.side-tabs-mode .topbar {
  grid-column: 1 / -1;
}

body.side-tabs-mode .tabs {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  align-self: start;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  flex-wrap: nowrap;
  margin-bottom: 0;
}

body.side-tabs-mode .tabs button {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  padding: 12px 14px;
}

body.side-tabs-mode .page {
  grid-column: 2;
}

body.side-tabs-mode footer {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  body.side-tabs-mode .app-view {
    display: block;
  }

  body.side-tabs-mode .tabs {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 22px;
  }

  body.side-tabs-mode .tabs button {
    width: auto;
    text-align: center;
    white-space: nowrap;
  }
}




/* Wilshire V16: Login Bottom Info Cards */
.login-info-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 0;
}

.login-info-card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.login-info-card h3 {
  margin-bottom: 10px;
}

.login-info-card p {
  color: var(--muted);
  margin-bottom: 8px;
}

.login-info-card a {
  color: var(--blue);
  font-weight: 800;
}

@media (max-width: 900px) {
  .login-info-row {
    grid-template-columns: 1fr;
  }
}

.simple-admin-card select,
.simple-admin-card input,
.simple-admin-card textarea {
  width: 100%;
}

.simple-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 18px;
}

.simple-stack textarea {
  min-height: 110px;
}

.enquiry-editor {
  max-width: 100%;
}

/* V27: Enquiry open/closed threaded replies */
.enquiry-thread {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.thread-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,.72);
}

.thread-item.admin-thread {
  background: rgba(37,99,235,.08);
}

.thread-item.resident-thread {
  background: rgba(15,23,42,.04);
}

.thread-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 6px;
}

.thread-item p {
  margin: 0;
  white-space: pre-wrap;
}

.resident-reply-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.resident-reply-box textarea {
  min-height: 90px;
}

.closed-note {
  margin-top: 14px;
  font-weight: 700;
}

/* Wilshire Clean Rebuild V37: Dark theme tab/button polish
   Keeps dark mode controls blue and readable instead of pale white/gray. */
body.dark-mode .tabs {
  background: rgba(13,25,44,.92);
  border: 1px solid rgba(255,255,255,.08);
}

body.dark-mode .tabs button {
  color: #cbd5e1;
  background: transparent;
  border: 1px solid transparent;
}

body.dark-mode .tabs button.active {
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: #ffffff;
  border: 1px solid rgba(96,165,250,.45);
  box-shadow: 0 12px 28px rgba(37,99,235,.28);
}

body.dark-mode .segmented {
  background: rgba(6,16,31,.70);
  border: 1px solid rgba(255,255,255,.08);
}

body.dark-mode .segmented button {
  color: #cbd5e1;
}

body.dark-mode .segmented button.active {
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(37,99,235,.24);
}

body.dark-mode button.secondary,
body.dark-mode #themeBtn {
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: #ffffff;
  border: 1px solid rgba(96,165,250,.45);
  box-shadow: 0 12px 28px rgba(37,99,235,.22);
}

body.dark-mode button.secondary:disabled,
body.dark-mode button.secondary[disabled] {
  background: rgba(148,163,184,.18);
  color: rgba(226,232,240,.55);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: none;
}


/* Wilshire Clean Rebuild V38: Refresh controls */
.refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.refresh-btn::before {
  content: "↻";
  font-weight: 950;
}
.refresh-note {
  margin-top: 12px;
}
body.dark-mode .refresh-btn.secondary,
body.dark-mode #portalRefreshBtn {
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: #fff;
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 12px 28px rgba(37,99,235,.24);
}

/* Client-ready assistant and image-free login refinements */
.simple-login-hero { min-height: 420px; justify-content: center; }
.ai-assistant-panel { border: 1px solid var(--line); }
.ai-answer { margin-top: 14px; min-height: 72px; padding: 14px; border-radius: 12px; background: var(--soft); white-space: pre-wrap; line-height: 1.55; }
button:disabled { opacity: .65; cursor: wait; }
