/* The page's look (the Hub's colours). Its own file, not a <style> in index.html, so the content security policy
   can refuse inline styles. */
:root {
  --accent: #283360; --accent-hover: #1C2547; --accent-tint: #F2F4FA;
  --page: #FFFFFF; --surface: #F2F2F2; --border: #E5E5E5; --text: #0F0F0F; --muted: #606060;
  --check: #FFF4DC; --missing: #FDECEC;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); font: 14px/1.45 "Segoe UI", system-ui, sans-serif; }
/* The top bar, as the desktop Hub's: the SGH logo, a thin line, "Lease Management". */
header { display: flex; align-items: center; gap: 16px; padding: 9px 24px; border-bottom: 1px solid var(--border);
         min-height: 64px; }
header .logo { height: 46px; width: auto; display: block; }
header .divider { width: 1px; height: 36px; background: #D0D0D0; }
header h1 { font-size: 18px; margin: 0; }
#who { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px;
       text-align: right; }
#who b { color: var(--text); }
.button { border: 0; border-radius: 999px; padding: 8px 16px; background: var(--accent); color: #fff;
          font: inherit; cursor: pointer; }
.button:hover { background: var(--accent-hover); }
a.button { display: inline-block; text-decoration: none; }
.button.quiet { background: var(--surface); color: var(--text); }
.button.quiet:hover { background: var(--border); }
main { padding: 18px 24px 40px; max-width: 1400px; min-width: 0; flex: 1; }

/* The Hub's layout: the sidebar (Home, Applications and each one, Learning), the page beside it. */
.layout { display: flex; align-items: flex-start; }
#nav { width: 230px; flex: none; padding: 16px 12px; border-right: 1px solid var(--border); min-height: calc(100vh - 62px);
       position: sticky; top: 0; }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; }
.nav-title { margin: 0 0 2px; padding: 0 12px; font-size: 11px; font-weight: 700; text-transform: uppercase;
             letter-spacing: .04em; color: var(--muted); }
/* A group's title folds it away: the arrow turns, and it's marked if the page showing is in it. */
.nav-title.fold { border: 0; background: none; font-family: inherit; text-align: left; cursor: pointer;
                  display: flex; align-items: center; justify-content: space-between; padding: 6px 12px;
                  border-radius: 8px; }
.nav-title.fold:hover { background: var(--surface); color: var(--text); }
.nav-title.fold .chev { font-size: 12px; transition: transform .15s ease; }
.nav-title.folded .chev { transform: rotate(-90deg); }
.nav-title.here { color: var(--accent); background: var(--accent-tint); }
.nav-link { border: 0; background: none; text-align: left; font: inherit; color: var(--text); padding: 8px 12px;
            border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.nav-link.sub { padding-left: 26px; color: var(--muted); }
.nav-link:hover { background: var(--surface); }
.nav-link.on { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.soon { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface);
        border-radius: 999px; padding: 1px 7px; font-weight: 400; }
.page-title { font-size: 26px; margin: 2px 0 6px; }
.lead { color: var(--muted); max-width: 680px; margin: 0 0 20px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; max-width: 900px; }
.tile { display: flex; gap: 12px; align-items: flex-start; text-align: left; border: 1px solid var(--border);
        background: var(--page); border-radius: 12px; padding: 14px; font: inherit; color: var(--text); cursor: pointer; }
.tile:hover { border-color: var(--accent); background: var(--accent-tint); }
.tile-mark { background: var(--accent); color: #fff; font-weight: 700; border-radius: 8px; padding: 6px 8px;
             font-size: 12px; min-width: 38px; text-align: center; }
.tile-text { display: flex; flex-direction: column; gap: 4px; }
.tile-text span:last-child { color: var(--muted); font-size: 13px; }
.tile-text .soon { align-self: flex-start; }

/* An application's page: drop areas, file slots, results. */
.drop { border: 2px dashed var(--accent); background: var(--accent-tint); color: var(--accent); border-radius: 12px;
        padding: 16px; text-align: center; font-weight: 600; max-width: 640px; cursor: pointer; }
.drop.over { background: #E3E8F5; }
.drop .muted { font-weight: 400; font-size: 13px; }
.slot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0 0; max-width: 640px; }
.slot-label { width: 130px; font-weight: 600; }
.slot-name { flex: 1; min-width: 160px; overflow-wrap: anywhere; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.button.small { padding: 6px 12px; font-size: 13px; }
.button.big { padding: 12px 28px; font-size: 15px; margin: 8px 0 0; }
.note { max-width: 640px; border-radius: 8px; padding: 8px 12px; }
.note.warn { background: var(--check); }
.result { border: 1px solid var(--border); border-radius: 12px; padding: 4px 18px 16px; margin: 20px 0 0; max-width: 680px; }
.result h3 { color: var(--accent); font-size: 15px; }
.result.warn { background: var(--check); border-color: #F1D9A6; }
.result.warn h3 { color: #7A5200; }
.result.bad { background: var(--missing); border-color: #F3C4C4; }
.result.bad h3 { color: #B3261E; }
.pre { white-space: pre-wrap; font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; color: var(--text); }
#busy { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--accent); color: #fff;
        border-radius: 999px; padding: 10px 20px; box-shadow: 0 6px 20px rgba(0,0,0,.18); max-width: calc(100% - 32px);
        text-align: center; z-index: 40; }                /* over a pop-up too */
#busy[hidden] { display: none; }

/* The splash screen, over everything until the sign-in page or the Hub is ready. */
#splash { position: fixed; inset: 0; z-index: 20; background: var(--page); display: flex; flex-direction: column;
          align-items: center; justify-content: center; gap: 14px; padding: 24px 16px; text-align: center;
          transition: opacity .25s ease; }
#splash img { width: min(320px, 78vw); height: auto; }
#splash .splash-name { font-size: 20px; font-weight: 700; margin: 4px 0 6px; }
#splash #splash-text { color: var(--muted); font-size: 13px; margin: 0; max-width: 420px; }
#splash.gone { opacity: 0; pointer-events: none; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--accent-tint);
           border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
#status { color: var(--muted); font-size: 12px; margin: 0 0 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 16px 0;
         max-width: 900px; }
.card { background: var(--surface); border-radius: 12px; padding: 12px 16px; }
/* The Overview's figures: each opens property by property. */
button.card { border: 2px solid transparent; font: inherit; color: var(--text); text-align: left; cursor: pointer;
              display: flex; flex-direction: column; }
button.card:hover { border-color: var(--border); }
button.card.on { border-color: var(--accent); background: var(--accent-tint); }
.by-property th.on, .by-property td.on { background: var(--accent-tint); font-weight: 600; }
.by-property tbody tr { cursor: pointer; }
.by-property tfoot td { font-weight: 700; border-top: 2px solid var(--border); }
.card-label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.card-value { font-size: 20px; font-weight: 700; margin-top: 2px; }
#tabs, .chips { display: flex; flex-wrap: wrap; gap: 8px; }
#tabs { margin: 4px 0 0; }

/* Lease Management: status badges, what needs attention, a lease's folded sections. */
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600;
         background: #E7F4EA; color: #1E6B34; white-space: nowrap; }
.badge.warn { background: var(--check); color: #7A5200; }
.badge.bad { background: var(--missing); color: #B3261E; }
.badge.info { background: var(--accent-tint); color: var(--accent); }
.badge.muted { background: var(--surface); color: var(--muted); }
.attention-list { display: flex; flex-direction: column; gap: 6px; max-width: 900px; }
.attention-group { max-width: 900px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
                   margin: 0 0 8px; }
.attention-group summary { color: var(--text); }
.attention-group .attention-list { margin: 10px 0 2px; }
.attention { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 0; border-radius: 8px;
             background: var(--surface); padding: 8px 12px; font: inherit; color: var(--text); cursor: pointer; }
.attention:hover { background: var(--accent-tint); }
.attention .muted { font-size: 13px; }
.notice + .notice, .attention-list + .notice, .hint + .notice { margin-top: 16px; }
.reports { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; max-width: 1000px; }
.report { border: 1px solid var(--border); border-radius: 12px; padding: 4px 18px 16px; display: flex;
          flex-direction: column; gap: 8px; align-items: flex-start; }
.report h3 { margin-bottom: 0; }
.report .hint { margin: 0; }
.report .row { margin: 0; }
.report .search { min-width: 0; }
.report.which { max-width: 1000px; margin: 0 0 12px; }
.field { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.ticks { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; margin: 0; max-height: 260px;
         overflow-y: auto; width: 100%; display: flex; flex-direction: column; }
.tick { display: flex; gap: 6px; align-items: center; padding: 3px 0; cursor: pointer; }
.tick-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
              margin: 8px 0 2px; }
.note.ok { background: #E7F4EA; color: #1E6B34; }
details { margin: 14px 0 0; }
summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.panel-inner .badge { margin: 0 0 6px; }
.chip { border: 0; border-radius: 999px; padding: 8px 16px; background: var(--surface); color: var(--text);
        font: inherit; cursor: pointer; }
.chip:hover { background: var(--border); }
.chip.on { background: var(--accent); color: #fff; }
.chip.small { padding: 5px 12px; font-size: 13px; }
#toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 6px; }
select, .search { font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
                  background: var(--page); color: var(--text); }
.search { min-width: 260px; }
.switch { color: var(--muted); display: flex; align-items: center; gap: 6px; cursor: pointer; }
h2 { font-size: 16px; margin: 22px 0 6px; }
h3 { font-size: 14px; margin: 14px 0 6px; }
h3 .code { color: var(--muted); font-weight: 400; }
h3 .facts { color: var(--muted); font-weight: 400; margin-left: 10px; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
thead th { font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; background: var(--accent-tint); }
thead th:hover { color: var(--accent); }
.r { text-align: right; }
tbody tr[data-do] { cursor: pointer; }
tbody tr[data-do]:hover td { background: var(--accent-tint); }
tr.bad td { background: var(--missing); }
tr.warn td { background: var(--check); }
tr.muted td, tr.past td, .muted { color: var(--muted); }
.hint, .empty { color: var(--muted); }
#panel { position: fixed; top: 0; right: 0; height: 100%; width: min(520px, 100%); background: var(--page);
         border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgba(0,0,0,.08); overflow-y: auto;
         transform: translateX(100%); transition: transform .18s ease; z-index: 35; }      /* above the page's bars and tips */
#panel.open { transform: none; }
.panel-inner { padding: 22px 24px 40px; }
.panel-inner .close { float: right; border: 0; background: var(--surface); border-radius: 999px; width: 32px;
                      height: 32px; cursor: pointer; font: inherit; }
.eyebrow { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.panel-inner h2 { font-size: 22px; margin: 4px 0 12px; }
table.facts th { color: var(--muted); font-weight: 400; width: 50%; }
table.facts td { white-space: normal; }
.history { padding-left: 18px; color: var(--text); }
.history li { margin: 2px 0; }
.notice { background: var(--accent-tint); border-radius: 12px; padding: 16px 20px; max-width: 760px; }
.notice h3 { margin-top: 0; }
.notice p { color: var(--muted); }
#gate:empty { display: none; }
#gate { display: grid; place-items: center; min-height: calc(100vh - 80px); padding: 24px 16px; }
.gate-card { text-align: center; max-width: 360px; }
.gate-card .gate-logo { width: min(280px, 80%); height: auto; }
.gate-card h2 { font-size: 22px; margin: 12px 0 4px; }
.gate-card p { color: var(--muted); margin: 0 0 18px; }
.gate-card .problem { color: #B3261E; margin-top: 14px; }
p.problem { color: #B3261E; }
/* Billing checks: the month, and each lease's checks typed in its row. */
.billing-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.billing-bar input[type=month] { font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
                                 background: var(--page); color: var(--text); }
table.billing td { vertical-align: top; }
table.billing td.wrap { white-space: normal; min-width: 150px; max-width: 260px; }
table.billing td[data-label=Watch] { min-width: 220px; }
table.billing td .button.small { margin-top: 4px; padding: 3px 10px; font-size: 12px; }
/* A Watch item's explanation: on hover, or a tap (it takes focus) on a phone. */
.tip { position: relative; cursor: help; }
span.tip:not(.badge) { border-bottom: 1px dotted var(--muted); }
.tip:hover::after, .tip:focus::after {
  content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; width: 300px;
  white-space: normal; text-align: left; font-size: 12px; font-weight: 400; line-height: 1.45; letter-spacing: 0;
  background: #1F2430; color: #FFFFFF; padding: 9px 11px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.tip:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
td.r .tip:hover::after, td.r .tip:focus::after { left: auto; right: 0; }
/* Arrears: the mail merge's wording, and a tenant's email as it'll be sent. */
textarea.check { font: inherit; font-size: 14px; resize: vertical; }
textarea.template { width: 100%; max-width: 760px; }
.preview { white-space: pre-wrap; background: var(--page); border: 1px solid var(--border); border-radius: 8px;
           padding: 12px 14px; font-size: 14px; }
#panel textarea.check.wide, #panel select.check.wide { width: 100%; margin: 0 0 6px; }
table.billing tbody tr:hover td { position: relative; z-index: 1; }
.difference { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin: 0 0 8px; }
.difference p { margin: 6px 0; font-size: 13px; }
.difference.done { opacity: .7; }
.schedule-lines { margin: 6px 0 10px; padding-left: 20px; }
.schedule-lines li { margin: 2px 0; }
/* A lease's billing details (its panel): each field, the Lease Split's and the register's side by side. */
table.facts.details th { width: 30%; }
table.facts.details thead th { color: var(--muted); font-size: 12px; font-weight: 600; cursor: default;
                               background: none; }
table.facts.details td { width: 35%; }
.detail { display: flex; flex-direction: column; gap: 3px; margin: 0 0 12px; }
.detail > span { font-size: 12px; color: var(--muted); }
.detail .check.wide { width: 100%; }
.detail small { font-size: 12px; }
table.billing .badge { margin: 0 0 3px; }
.check { font: inherit; font-size: 13px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px;
         background: var(--page); color: var(--text); width: 110px; }
.check.wide { width: 220px; }
.check.ok { background: #E8F5EC; }
.check.warn { background: var(--check); }
.check.bad { background: var(--missing); }
.check.carried { color: var(--muted); font-style: italic; }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer;
           text-align: left; }
.linkish:hover { text-decoration: underline; }
.billing-foot { margin: 14px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { margin: 4px 0 14px; }
.status-tabs { align-items: center; margin: 12px 0; }
.attention .who .code { color: var(--muted); font-weight: 400; }
.status-tabs .chip b { margin-left: 4px; }
.status-tabs .hint { margin-left: 4px; font-size: 13px; }
/* Forms: fields side by side, labelled above. */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 16px; max-width: 720px;
             margin: 0 0 8px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.form-grid input, .form-grid select, .row input { font: inherit; font-weight: 400; padding: 7px 10px;
             border: 1px solid #CFCFCF; border-radius: 8px; background: var(--page); color: var(--text); }
.row label { display: flex; align-items: center; gap: 8px; }
/* The phone's bar along the bottom, and an application's way back: on a phone only. */
.nav-bar, .back { display: none; }
@media (max-width: 760px) {
  .check, .check.wide { width: 100%; }
  /* A phone: no sidebar - Home and Leases along the bottom, as a banking app's; Lease Management has its own tabs. */
  #nav { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 20; width: auto; min-height: 0;
         padding: 0 0 env(safe-area-inset-bottom); border: 0; border-top: 1px solid var(--border);
         background: var(--page); display: block; overflow: visible; }
  #nav .nav-group { display: none; }
  .nav-bar { display: grid; grid-template-columns: repeat(2, 1fr); }
  .nav-tab { border: 0; background: none; font: inherit; font-size: 11px; color: var(--muted); padding: 7px 2px 6px;
             display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
  .nav-tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7;
                 stroke-linecap: round; stroke-linejoin: round; }
  .nav-tab.on { color: var(--accent); font-weight: 600; }
  main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .back { display: inline-block; border: 0; background: none; font: inherit; color: var(--accent); padding: 4px 0;
          margin: 0 0 4px; cursor: pointer; }
  #page .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  /* A pop-up (a tenant's details, a lease, an arrears tenant) covers the whole screen - nothing shows through -
     the page behind it stays still, and its ✕ stays at the top as you scroll. */
  #panel { inset: 0; width: 100%; height: 100%; height: 100dvh; border: 0; box-shadow: none;
           padding-bottom: env(safe-area-inset-bottom); overscroll-behavior: contain; }
  body:has(#panel.open) { overflow: hidden; }
  .panel-inner { padding: 16px 16px 40px; }
  .panel-inner .close { position: sticky; top: 8px; z-index: 1; width: 40px; height: 40px; font-size: 18px;
                        box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
  .panel-inner h2 { padding-right: 48px; }
  #page .chip { white-space: nowrap; flex: none; }
  .layout { flex-direction: column; align-items: stretch; }
  header, main { padding-left: 16px; padding-right: 16px; }
  header .logo { height: 34px; }
  header h1 { font-size: 16px; }
  .search { min-width: 0; width: 100%; }
  #who span { display: none; }
  /* Lists become cards: each row a card, each cell with its heading. */
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border: 1px solid var(--border); border-radius: 10px; margin: 0 0 8px; padding: 6px 4px; }
  table.list td { border: 0; padding: 3px 10px; white-space: normal; text-align: left; }
  table.list td::before { content: attr(data-label); display: inline-block; min-width: 120px; color: var(--muted);
                          font-size: 12px; }
}
