/* ============================================================
   Vertical Network Portal
   Hand-written, no framework, no build step.
   Bump ASSET_VER in app/inc/layout.php after editing.
   ============================================================ */

:root {
  --navy:    #0f2b46;
  --navy-2:  #17395c;
  --steel:   #2f6f9f;
  --steel-l: #e8f1f8;
  --accent:  #d97706;
  --ink:     #1b2430;
  --muted:   #6b7885;
  --paper:   #ffffff;
  --canvas:  #f4f6f9;
  --line:    #dde3ea;
  --ok:      #1c7c4a;
  --ok-bg:   #e6f4ec;
  --warn:    #9a6700;
  --warn-bg: #fff4e0;
  --bad:     #b3261e;
  --bad-bg:  #fdeceb;
  --radius:  8px;
  --shadow:  0 1px 2px rgba(16,32,48,.08), 0 2px 8px rgba(16,32,48,.05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

a { color: var(--steel); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }

code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- top bar ---------- */

.topbar { background: var(--navy); color: #fff; box-shadow: var(--shadow); }

.topbar-in {
  display: flex; align-items: center; gap: 1rem;
  max-width: 1400px; margin: 0 auto; padding: .6rem 1.25rem;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: .5rem; color: #fff; font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--steel); font-size: .8rem; letter-spacing: .5px;
}
.brand-text { font-size: 1rem; letter-spacing: .2px; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.who { color: #c9d8e6; font-size: .85rem; margin-right: .25rem; }

.topbar .btn {
  background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25);
}
.topbar .btn:hover { background: rgba(255,255,255,.2); text-decoration: none; }

.bell { position: relative; color: #9fb6c9; font-size: .7rem; padding: .35rem; }
.bell .badge {
  position: absolute; top: -2px; right: -6px;
  background: var(--accent); color: #fff; font-size: .65rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px;
  display: grid; place-items: center; font-family: inherit;
}

/* account switcher */
.acct-switch select {
  background: var(--navy-2); color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius); padding: .35rem .5rem; font-size: .85rem; max-width: 22rem;
}
.acct-single { display: flex; align-items: center; gap: .4rem; color: #c9d8e6; font-size: .85rem; }
.acct-single .mono { font-size: .75rem; }

/* ---------- nav ---------- */

.mainnav {
  background: var(--navy-2);
  display: flex; gap: .15rem; overflow-x: auto;
  padding: 0 1.25rem; max-width: 1400px; margin: 0 auto;
}
.mainnav a {
  color: #b8cbdb; padding: .6rem .8rem; font-size: .87rem;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.mainnav a:hover { color: #fff; text-decoration: none; }
.mainnav a.on { color: #fff; border-bottom-color: var(--accent); font-weight: 600; }
.mainnav .nav-cta { margin-left: auto; color: var(--accent); font-weight: 600; }

/* ---------- layout ---------- */

.wrap { max-width: 1400px; margin: 0 auto; padding: 1.25rem; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.page-head p { margin: 0; font-size: .9rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.15rem; margin-bottom: 1.25rem;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin: -.15rem 0 .85rem; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ---------- stat tiles ---------- */

.stat {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow);
}
.stat .label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600;
}
.stat .value { font-size: 1.6rem; font-weight: 600; line-height: 1.2; margin-top: .2rem; }
.stat .sub { font-size: .8rem; color: var(--muted); }
.stat.good .value { color: var(--ok); }
.stat.bad .value  { color: var(--bad); }
.stat.warn .value { color: var(--warn); }

/* ---------- tables ---------- */

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: .55rem .6rem; text-align: left; border-bottom: 1px solid var(--line); }
.tbl th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; background: #fafbfc; white-space: nowrap;
}
.tbl tbody tr:hover { background: var(--steel-l); }
.tbl td.empty { text-align: center; color: var(--muted); padding: 1.75rem; font-style: italic; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- pills ---------- */

.pill {
  display: inline-block; padding: .12rem .5rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; white-space: nowrap;
  background: #eef1f5; color: var(--muted);
}
.pill-good { background: var(--ok-bg);   color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad  { background: var(--bad-bg);  color: var(--bad); }
.pill-neutral { background: #eef1f5; color: #4a5966; }
.pill-tenant   { background: var(--steel-l); color: var(--steel); }
.pill-landlord { background: #ede9fe; color: #6d28d9; }
.pill-mgmt     { background: rgba(255,255,255,.15); color: #fff; }
.pill-in  { background: var(--ok-bg);  color: var(--ok); }
.pill-out { background: #fef3c7; color: #92400e; }

/* ---------- buttons ---------- */

.btn {
  display: inline-block; padding: .45rem .85rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font: inherit; font-size: .87rem; cursor: pointer; text-align: center;
}
.btn:hover { background: #f2f5f8; text-decoration: none; }
.btn-sm { padding: .28rem .6rem; font-size: .8rem; }
.btn-primary { background: var(--steel); border-color: var(--steel); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #26608c; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #8f1e17; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- forms ---------- */

.form-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

label.fld { display: block; font-size: .85rem; }
label.fld > span {
  display: block; font-weight: 600; margin-bottom: .2rem; color: #3a4653; font-size: .8rem;
}
label.fld > span .req { color: var(--bad); }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: .45rem .55rem; font: inherit; font-size: .9rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--steel); outline-offset: -1px; border-color: var(--steel);
}
textarea { min-height: 5rem; resize: vertical; }
input[type=file] { font-size: .85rem; }

.form-actions {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line);
}

.check { display: flex; align-items: center; gap: .45rem; font-size: .87rem; }
.check input { width: auto; }

.hint { font-size: .78rem; color: var(--muted); margin-top: .2rem; }

/* Closed rows start hidden so they do not flash up before the script runs.
   The checkbox handler then sets an explicit display on each row, which wins
   over this. */
tr[data-inactive="1"] { display: none; }

/* filter bar above list tables */
.filters {
  display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .9rem;
}
.filters label.fld { min-width: 8rem; }
.filters input[type=search] { min-width: 14rem; }

/* ---------- flash ---------- */

.flash {
  padding: .65rem .9rem; border-radius: var(--radius); margin-bottom: 1rem;
  border: 1px solid; font-size: .9rem;
}
.flash-ok  { background: var(--ok-bg);  border-color: #b8e0c8; color: var(--ok); }
.flash-err { background: var(--bad-bg); border-color: #f3c2be; color: var(--bad); }

/* ---------- definition lists ---------- */

.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem 1.25rem; }
.dl div { min-width: 0; }
.dl dt {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600;
}
.dl dd { margin: .1rem 0 0; word-break: break-word; }

/* ---------- timeline (property history) ---------- */

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: .4rem; bottom: .4rem;
  width: 2px; background: var(--line);
}
.timeline li { position: relative; padding: 0 0 1.1rem 1.9rem; }
.timeline li::before {
  content: ""; position: absolute; left: 2px; top: .35rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--steel);
}
.timeline li.t-payment::before  { border-color: var(--ok); }
.timeline li.t-document::before { border-color: var(--steel); }
.timeline li.t-project::before  { border-color: var(--accent); }
.timeline li.t-notice::before   { border-color: var(--bad); }
.timeline li.t-lease::before    { border-color: #6d28d9; }
.timeline .t-when { font-size: .75rem; color: var(--muted); }
.timeline .t-what { font-weight: 600; }
.timeline .t-note { font-size: .87rem; color: #4a5966; }

/* ---------- login ---------- */

body.bare { background: var(--navy); }
body.bare .wrap { max-width: 26rem; margin: 0 auto; padding-top: 3.5rem; }
.login-card {
  background: var(--paper); border-radius: 12px; padding: 1.75rem;
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
}
.login-brand { text-align: center; margin-bottom: 1.35rem; }
.login-brand .brand-mark {
  width: 46px; height: 46px; font-size: 1.05rem; border-radius: 10px;
  display: inline-grid; place-items: center; background: var(--steel); color: #fff; font-weight: 700;
}
.login-brand h1 { font-size: 1.15rem; margin: .6rem 0 .1rem; }
.login-card label.fld { margin-bottom: .85rem; }
.login-card .btn-primary { width: 100%; padding: .6rem; }
.login-links { margin-top: 1rem; text-align: center; font-size: .85rem; }

/* ---------- misc ---------- */

.pager { display: flex; align-items: center; gap: .75rem; margin-top: .9rem; font-size: .85rem; }

.foot {
  max-width: 1400px; margin: 1.5rem auto 0; padding: 1rem 1.25rem;
  display: flex; justify-content: space-between; gap: 1rem;
  border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted);
}

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a {
  padding: .5rem .85rem; font-size: .88rem; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--steel); border-bottom-color: var(--steel); font-weight: 600; }

.doc-row { display: flex; align-items: center; gap: .5rem; }
.doc-ext {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: 6px; background: var(--steel-l); color: var(--steel);
  font-size: .6rem; font-weight: 700; text-transform: uppercase; flex: none;
}

.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--steel); }

@media (max-width: 720px) {
  .topbar-in { padding: .6rem .85rem; }
  .wrap { padding: .85rem; }
  .brand-text { display: none; }
  .who { display: none; }
  .acct-switch select { max-width: 12rem; }
}

@media print {
  .topbar, .mainnav, .foot, .page-actions, .filters, .pager { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}
