/* Royal Heights mockups — accessibility-first, responsive.
   Designed for older, non-technical users: large text, large targets,
   high contrast, single obvious primary action, no jargon. */

:root {
  --ink: #11263a;
  --ink-soft: #44586b;
  --line: #c4d0da;
  --bg: #eef2f5;
  --panel: #ffffff;
  --brand: #12343b;
  --primary: #1769aa;
  --primary-ink: #ffffff;
  --alert: #b3261e;
  --alert-bg: #fbe5e3;
  --warn-bg: #fdeccf;
  --warn-ink: #7a5500;
  --ok-bg: #d8efdf;
  --ok-ink: #1d6b39;
  --info-bg: #d9eaf6;
  --info-ink: #1a567c;
  --muted-bg: #e6ebef;
  --muted-ink: #4a5a68;
  --radius: 12px;
  --tap: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, Arial, sans-serif;
  font-size: 20px;
  line-height: 1.55;
}

h1 { font-size: 2rem; margin: 0 0 .4em; }
h2 { font-size: 1.4rem; margin: 0 0 .6em; }
p { margin: 0 0 .8em; }
a { color: var(--primary); }
.sub { color: var(--ink-soft); font-size: 1rem; margin: .2em 0 0; }

/* ---- app shell ---- */
.app { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--brand);
  color: #fff;
  padding: 24px 18px;
}
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,.2); }
.logo {
  background: #d6a755; color: #11263a; font-weight: 800;
  width: 52px; height: 52px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.sidebar .brand strong { display: block; font-size: 1.15rem; }
.sidebar .brand span { display: block; font-size: .85rem; color: #cfe0e4; }
nav { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.nav-link {
  display: block; color: #e7eef0; text-decoration: none;
  padding: 16px 16px; border-radius: 10px; font-size: 1.05rem; font-weight: 600;
  min-height: var(--tap);
}
.nav-link:hover { background: rgba(255,255,255,.12); }
.nav-link.active { background: #fff; color: var(--brand); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 28px; flex-wrap: wrap;
}
.topbar-greet { font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.user-chip {
  background: var(--muted-bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 18px; font-weight: 600;
}
.menu-btn { display: none; }
.content { padding: 28px; max-width: 1100px; width: 100%; }

.page-title { margin: 0 0 4px; }
.help-line {
  background: #fff7e8; border-left: 6px solid #d6a755;
  padding: 14px 18px; border-radius: 8px; font-size: 1.05rem; margin-bottom: 22px;
}

/* ---- cards / layout ---- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-bottom: 22px;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 22px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; text-align: center;
}
.stat-num { display: block; font-size: 3rem; font-weight: 800; line-height: 1; }
.stat-label { display: block; font-size: 1.05rem; color: var(--ink-soft); margin-top: 8px; }
.stat-alert { border-color: var(--alert); background: var(--alert-bg); }
.stat-alert .stat-num { color: var(--alert); }
a.stat {
  display: block; text-decoration: none; color: inherit;
  transition: transform .08s ease, border-color .15s ease, box-shadow .15s ease;
}
a.stat:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(17,38,58,.08); }
a.stat.stat-alert:hover { border-color: var(--alert); }
a.stat:focus { outline: 3px solid #8fc0e6; outline-offset: 2px; }

/* ---- filter banner (shown when a list is narrowed by a saved filter) ---- */
.filter-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--alert-bg); border-left: 6px solid var(--alert);
  padding: 14px 18px; border-radius: 8px; margin-bottom: 18px;
}
.filter-banner strong { display: block; color: var(--alert); margin-bottom: 2px; font-size: 1.05rem; }
.filter-banner span { color: var(--ink-soft); font-size: .98rem; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; text-decoration: none; cursor: pointer;
  border-radius: 10px; font-weight: 700; font-size: 1.05rem;
  padding: 14px 22px; min-height: var(--tap); border: 2px solid transparent;
}
.btn-xl { font-size: 1.15rem; padding: 16px 26px; min-height: 60px; }
.btn-sm { font-size: .95rem; padding: 8px 14px; min-height: 40px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #125a93; }
.btn-ghost { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-danger { background: #fff; color: var(--alert); border-color: var(--alert); }
.btn-block { display: flex; width: 100%; }
.text-link { display: inline-block; margin-top: 16px; font-size: 1rem; }

/* ---- forms ---- */
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-weight: 700; margin-bottom: 8px; font-size: 1.02rem; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 1.05rem;
  padding: 14px 16px; border: 2px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink); min-height: var(--tap);
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid #8fc0e6; border-color: var(--primary);
}
textarea { min-height: 120px; resize: vertical; }
.form-card { max-width: 640px; }
.filters {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 16px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 20px;
}
.filters .field { margin-bottom: 0; }
.form-actions { display: flex; gap: 14px; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; }
.head-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- eviction: choice set, warning, block banner ---- */
.choice-set { border: 0; margin: 6px 0 18px; padding: 0; display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  border: 2px solid var(--line); border-radius: 10px;
  padding: 16px 18px; font-size: 1.05rem; font-weight: 600; cursor: pointer;
  min-height: var(--tap);
}
.choice input { width: 22px; height: 22px; min-height: 0; }
.choice.selected { border-color: var(--alert); background: var(--alert-bg); }
.warn-box {
  background: var(--warn-bg); border-left: 6px solid #d6a755;
  border-radius: 8px; padding: 16px 18px; margin: 4px 0 18px; font-size: 1.02rem;
}
.warn-box strong { display: block; margin-bottom: 4px; color: var(--warn-ink); }
.block-banner {
  display: flex; align-items: center; gap: 18px;
  background: var(--alert-bg); border: 2px solid var(--alert);
  border-radius: 12px; padding: 20px 22px; margin-bottom: 18px;
}
.block-banner h2 { color: var(--alert); margin: 0 0 4px; }
.block-banner p { margin: 0; }
.block-ico {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%;
  background: var(--alert); color: #fff; font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center;
}

/* ---- tables that become cards on small screens ---- */
.table-wrap { width: 100%; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: .9rem; text-transform: uppercase;
  letter-spacing: .03em; color: var(--ink-soft); padding: 12px 12px;
  border-bottom: 2px solid var(--line);
}
td { padding: 16px 12px; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
tr:last-child td { border-bottom: 0; }

/* ---- badges (word + colour, never colour alone) ---- */
.badge {
  display: inline-block; border-radius: 999px; padding: 6px 12px;
  font-size: .9rem; font-weight: 800;
}
.badge-alert { background: var(--alert-bg); color: var(--alert); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge-info { background: var(--info-bg); color: var(--info-ink); }
.badge-muted { background: var(--muted-bg); color: var(--muted-ink); }

/* ---- detail list ---- */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.detail-list { margin: 14px 0 0; display: grid; gap: 0; }
.detail-list > div {
  display: grid; grid-template-columns: 220px 1fr; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { font-weight: 700; color: var(--ink-soft); margin: 0; }
.detail-list dd { margin: 0; }
.timeline { padding-left: 22px; margin: 0; }
.timeline li { margin-bottom: 12px; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 18px; }
.tab {
  background: #fff; border: 2px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 12px 22px; font-weight: 700;
  font-size: 1rem; min-height: 48px; cursor: pointer;
}
.tab.selected { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---- accordion ---- */
.accordion { display: flex; flex-direction: column; gap: 14px; }
.acc-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.acc-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; background: #fff; border: 0; cursor: pointer;
  padding: 20px 22px; text-align: left; min-height: 64px;
}
.acc-title { font-size: 1.25rem; font-weight: 800; }
.acc-meta { color: var(--ink-soft); font-size: 1rem; }
.acc-body { padding: 0 22px 22px; border-top: 1px solid var(--line); }
.acc-item:not(.open) .acc-body { display: none; }
.acc-head::after { content: "▾"; font-size: 1.2rem; color: var(--ink-soft); }
.acc-item:not(.open) .acc-head::after { content: "▸"; }

/* ---- auth / choose building ---- */
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 28px; }
.auth-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 36px; width: 100%; max-width: 460px;
}
.brand-stack { text-align: center; margin-bottom: 26px; }
.brand-stack .logo { margin: 0 auto 14px; width: 64px; height: 64px; font-size: 1.5rem; }
.brand-stack h1 { margin: 0; }

/* ---- maintenance job list ---- */
.job-list { display: flex; flex-direction: column; gap: 14px; }
.job {
  display: grid; gap: 4px; text-decoration: none; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line);
  border-left: 8px solid var(--primary);
  border-radius: var(--radius); padding: 20px 22px; min-height: var(--tap);
}
.job.urgent { border-left-color: var(--alert); background: var(--alert-bg); }
.job-id { font-weight: 800; color: var(--ink-soft); }
.job-title { font-size: 1.2rem; font-weight: 700; }
.job-where { color: var(--ink-soft); }
.job-due { margin-top: 6px; }

/* ---- big status buttons + voice note ---- */
.status-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.status-btn {
  background: #fff; border: 2px solid var(--line); color: var(--ink);
  border-radius: 12px; padding: 20px; font-size: 1.15rem; font-weight: 800;
  min-height: 72px; cursor: pointer;
}
.status-btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.note-area { position: relative; margin-bottom: 16px; }
.mic-btn {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 12px; background: #fff; border: 2px solid var(--primary);
  color: var(--primary); border-radius: 999px; padding: 14px 24px;
  font-size: 1.1rem; font-weight: 800; min-height: var(--tap); cursor: pointer;
}
.mic-ico { font-size: 1.4rem; }

/* ---- compact inline-editable controls (table cells, detail headers) ---- */
.inline-edit {
  width: auto; min-width: 150px;
  font: inherit; font-size: .98rem;
  padding: 8px 10px; min-height: 44px;
  border: 2px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink);
}
td .inline-edit { width: 100%; min-width: 0; }
select.inline-edit { cursor: pointer; }
.inline-edit:hover { border-color: var(--primary); }
.inline-edit:focus { outline: 3px solid #8fc0e6; border-color: var(--primary); }

/* ===== TABLET ===== */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { padding: 16px; }
  .sidebar .brand { padding-bottom: 14px; }
  nav { flex-direction: row; flex-wrap: wrap; margin-top: 14px; }
  .nav-link { flex: 1 1 auto; text-align: center; }
  .two-col { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .detail-list > div { grid-template-columns: 1fr; gap: 4px; }
}

/* ===== MOBILE ===== */
@media (max-width: 640px) {
  html, body { font-size: 19px; }
  .content { padding: 18px; }
  .topbar { padding: 14px 18px; }
  .stat-row { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  nav { flex-direction: column; }
  .nav-link { text-align: left; }

  /* tables become stacked cards — no sideways scrolling */
  table, thead, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr {
    border: 1px solid var(--line); border-radius: 12px;
    margin-bottom: 14px; padding: 6px 14px; background: #fff;
  }
  td {
    display: flex; justify-content: space-between; gap: 16px;
    border-bottom: 1px solid var(--line); padding: 12px 0; text-align: right;
  }
  td:last-child { border-bottom: 0; }
  td::before {
    content: attr(data-label); font-weight: 800;
    color: var(--ink-soft); text-align: left;
  }
  .status-grid { grid-template-columns: 1fr; }
  td:has(.inline-edit) {
    flex-direction: column; align-items: stretch; text-align: left;
  }
  td:has(.inline-edit)::before { margin-bottom: 4px; text-align: left; }
}
