/* Tenant portal + admin console. Builds on the site palette in /styles.css. */
body.portal { background: var(--mist); font-size: 15.5px; }
.p-top { background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.p-top .wrap { display: flex; align-items: center; gap: 16px; padding-block: 10px; flex-wrap: wrap; max-width: 1280px; }
.p-top .brand img { height: 46px; }
.p-top .who { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: .92rem; }
.p-title { font-family: var(--display); text-transform: uppercase; letter-spacing: .16em; font-size: .95rem; color: var(--muted); }
.p-main { max-width: 1280px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-left, 0px)) 60px; }
.p-layout { display: grid; grid-template-columns: 210px 1fr; gap: 22px; align-items: start; }
.p-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; }
.p-nav a { text-decoration: none; color: var(--fg); padding: 8px 12px; border-radius: 8px; display: flex; justify-content: space-between; gap: 8px; }
.p-nav a:hover { background: var(--bg); }
.p-nav a.on { background: var(--navy); color: var(--on-navy); }
.p-nav-h { font-family: var(--display); text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; color: var(--muted); padding: 14px 12px 4px; }
.p-nav a { padding-top: 6px; padding-bottom: 6px; }
.p-nav .badge { background: #c2410c; color: #fff; border-radius: 999px; font-size: .75rem; padding: 0 7px; line-height: 1.6; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 14px 0 16px; }
.tabs a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--fg); border-bottom-color: var(--navy); font-weight: 600; }
@media (max-width: 860px) {
  .p-layout { grid-template-columns: 1fr; }
  .p-nav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .p-nav a { white-space: nowrap; }
  .p-nav-h { display: none; }
}
h1.p-h { font-size: 2rem; text-transform: none; letter-spacing: .01em; margin-bottom: 4px; }
h2.p-h { font-size: 1.35rem; text-transform: none; letter-spacing: .01em; margin: 22px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .k { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.stat .v { font-family: var(--display); font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat.warn .v { color: #b42318; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--navy); color: var(--on-navy); border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.sm { padding: 5px 10px; font-size: .88rem; font-weight: 500; }
.btn.ghost { background: transparent; color: var(--link); border: 1px solid var(--line); }
.btn.danger { background: #b42318; }
.btn[disabled] { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--link); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
table.t { width: 100%; border-collapse: collapse; background: var(--bg); font-size: .93rem; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); padding: 8px; white-space: nowrap; }
table.t td { border-bottom: 1px solid var(--line); padding: 8px; vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--mist); }
table.t tr.dim td { color: var(--muted); text-decoration: line-through; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.scroll table.t td:first-child, .scroll table.t th:first-child { padding-left: 14px; }
.pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: .78rem; font-weight: 600; background: var(--mist); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: #e7f6ec; color: #18794e; border-color: #bfe5cd; }
.pill.warn { background: #fff4e5; color: #9a4a00; border-color: #f5d3a8; }
.pill.bad { background: #fde8e8; color: #b42318; border-color: #f5c2c2; }
.pill.info { background: var(--sea); color: var(--sea-deep); border-color: transparent; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: .86rem; color: var(--muted); }
label.f.chk { flex-direction: row; align-items: center; gap: 8px; color: var(--fg); font-size: .95rem; }
input, select, textarea { font: inherit; font-size: .95rem; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; }
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.form .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 0 0 14px; background: var(--bg); }
legend { font-family: var(--display); text-transform: uppercase; letter-spacing: .1em; font-size: 1rem; padding: 0 6px; }
.alert { border-radius: 10px; padding: 10px 14px; background: var(--sea); color: var(--fg); }
.alert.bad { background: #fde8e8; color: #7a1414; }
.alert.warn { background: #fff4e5; color: #6b3500; }
.list > * + * { border-top: 1px solid var(--line); }
.list > * { padding: 10px 0; }
.msg { border-radius: 12px; padding: 10px 14px; background: var(--bg); border: 1px solid var(--line); max-width: 760px; }
.msg.me { background: var(--sea); border-color: transparent; margin-left: auto; }
.msg.internal { background: #fff8db; border-style: dashed; }
.msg .meta { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.msgs { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.pre { white-space: pre-wrap; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 10px; z-index: 100; display: none; max-width: calc(100% - 32px); }
#toast.bad { background: #b42318; color: #fff; }
dialog { border: 0; border-radius: 14px; padding: 0; width: min(760px, calc(100% - 24px)); background: var(--bg); color: var(--fg); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10, 10, 30, .45); }
dialog .dh { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
dialog .dh h3 { font-size: 1.4rem; }
dialog .db { padding: 18px; max-height: 70vh; overflow: auto; }
dialog .df { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.auth { max-width: 420px; margin: 50px auto; }
.auth .card { padding: 26px; }
.auth h1 { font-size: 2rem; text-transform: none; margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.empty { color: var(--muted); padding: 18px; text-align: center; }
.p-foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 30px 0; }
@media print { .p-top, .p-nav, .btn, .tabs { display: none !important; } .p-layout { display: block; } body.portal { background: #fff; } }

/* keep wide tables scrolling inside their box instead of pushing the page wider */
.p-layout > main { min-width: 0; }
