/*
 * Layout and components for every screen. Colours, fonts and corner shapes
 * come from theme.css - change them there, not here.
 */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--text-size)/1.5 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-underline-offset: 2px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------ shell */

.shell { display: grid; grid-template-columns: var(--side-width) 1fr; min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--side-text-strong); text-decoration: none; padding: 0 8px 20px; border-bottom: 1px solid var(--side-line); margin-bottom: 6px; }
.brand img { height: 46px; width: auto; display: block; }
.brand span { font-family: var(--font-heading); font-size: 13px; line-height: 1.35; color: var(--gold-light); border-left: 1px solid var(--side-line); padding-left: 12px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side .sect { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--gold); opacity: .75; padding: 18px 12px 6px; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--side-text); text-decoration: none; font-weight: 500; }
.side nav a:hover { background: var(--side-hover); color: var(--side-text-strong); }
.side nav a.on { background: var(--side-active); color: var(--side-text-strong); box-shadow: inset 3px 0 0 var(--gold); }
.side nav a.on svg.i { color: var(--gold); }
.side .count { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--orange); color: var(--black); font-size: 12px; font-weight: 600; text-align: center; line-height: 20px; }
.me { margin-top: auto; border-top: 1px solid var(--side-line); padding: 16px 6px 0; display: grid; grid-template-columns: 36px 1fr; gap: 4px 10px; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--btn-bg); color: var(--accent-text); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.me .who { line-height: 1.25; } .me .who b { color: var(--side-text-strong); font-weight: 600; display: block; } .me .who span { font-size: 12px; text-transform: capitalize; }
.me .links { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.me .links a, .me .links button { font: inherit; font-size: 12.5px; color: var(--side-text); background: var(--side-hover); border: 0; border-radius: 6px; padding: 4px 9px; text-decoration: none; cursor: pointer; font-weight: 500; }
.me .links a:hover, .me .links button:hover { color: var(--gold-light); background: rgb(201 162 75 / .14); }
.me form { margin: 0; }

.main { min-width: 0; }
.wrap { max-width: var(--width); margin: 0 auto; padding: 0 32px; }
main { padding-top: 28px; padding-bottom: 64px; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 12px 16px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .brand { padding: 0; border: 0; margin: 0; } .brand img { height: 34px; }
  .side nav { order: 3; flex-direction: row; overflow-x: auto; width: 100%; gap: 4px; padding-bottom: 2px; scrollbar-width: none; }
  .side nav a { white-space: nowrap; padding: 7px 10px; }
  .side nav a.on { box-shadow: inset 0 -2px 0 var(--accent); }
  .side .sect { display: none; }
  .me { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; gap: 8px; }
  .me .who { display: none; } .me .links { margin: 0; }
  .wrap { padding: 0 16px; }
  main { padding-top: 20px; }
}

/* ------------------------------------------------------------ headings */

h1 { font-family: var(--font-heading); font-size: 25px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; margin: 0 0 6px; }
h2 { font-family: var(--font); font-size: 15.5px; font-weight: 600; margin: 0; }
.sub { color: var(--muted); margin: 0 0 22px; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head .sub { margin-bottom: 0; }
.crumbs { font-size: 13.5px; margin-bottom: 8px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--link); }
.crumbs a::after { content: " ›"; color: var(--faint); }

/* ------------------------------------------------------------ cards */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card > header a { font-size: 13.5px; font-weight: 500; text-decoration: none; }
.card > .body { padding: 18px 20px; }
.card > .empty { padding: 20px; color: var(--muted); }
.card.scroll { overflow-x: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 20px; }

/* Dashboard layout: a wide column and a narrow one. */
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cols.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cols > * { margin-bottom: 0; }
.cols + .cols, .cols + .card, .kpis + .cols { margin-top: 20px; }
@media (max-width: 1100px) { .cols, .cols.even { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ figures */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi .k { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi .k .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--gold-deep); }
.kpi .k .ico svg.i { width: 16px; height: 16px; }
.kpi.crit .k .ico { background: var(--crit-bg); color: var(--crit); }
.kpi.ok .k .ico { background: var(--ok-bg); color: var(--ok); }
.kpi.teal .k .ico { background: var(--warn-bg); color: var(--orange); }
/* The headline figure: a black card with gold numbers. */
.kpi.hero { background: radial-gradient(420px 160px at 100% 0%, rgb(201 162 75 / .28), transparent 70%), linear-gradient(160deg, #141310, #0b0b0c); border-color: #2a261d; color: #fff; }
.kpi.hero .k { color: #b8b2a6; } .kpi.hero .k .ico { background: rgb(201 162 75 / .18); color: var(--gold-light); }
.kpi.hero .v { color: var(--gold-light); } .kpi.hero .n { color: #9d978b; } .kpi.hero .meter { background: rgb(255 255 255 / .1); }
.kpi .v { font-size: 27px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi.crit .v { color: var(--crit); }
.kpi .n { font-size: 12.5px; color: var(--muted); }
.meter { height: 6px; border-radius: 999px; background: var(--chart-grid); overflow: hidden; margin-top: 4px; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--orange)); }

/* The older stat tiles, still used on several screens. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; }
.stat .k { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .v { font-size: 22px; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.stat.crit .v { color: var(--crit); } .stat.warn .v { color: var(--warn); }

/* ------------------------------------------------------------ charts */

.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 11px var(--font); fill: var(--faint); }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .grid-line.zero { stroke: var(--line-strong); }
.chart .s1 { fill: var(--chart-1); } .chart .s2 { fill: var(--chart-2); }
.chart .net { fill: none; stroke: var(--chart-3); stroke-width: 2; }
.chart .dot { fill: var(--surface); stroke: var(--chart-3); stroke-width: 2; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; border-radius: 2px; }
.figures { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 14px; }
.figures div { font-size: 13px; color: var(--muted); }
.figures b { display: block; font-size: 19px; color: var(--text); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.donut-wrap { display: grid; grid-template-columns: 170px 1fr; gap: 22px; align-items: center; }
.donut-wrap .chart { max-width: 170px; }
.donut-total { font: 700 17px var(--font) !important; fill: var(--text) !important; }
.slices { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.slices li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.slices li i, .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.slices li b { font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 520px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } }

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

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.feed .t { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.feed .m { font-size: 12.5px; color: var(--muted); }
.feed .m a { color: var(--muted); }
.badge-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--info-bg); color: var(--info); }
.badge-ico.critical { background: var(--crit-bg); color: var(--crit); } .badge-ico.warning { background: var(--warn-bg); color: var(--warn); }
.badge-ico svg.i { width: 17px; height: 17px; }
.datebox { width: 44px; text-align: center; border-radius: 10px; background: var(--accent-soft); color: var(--gold-deep); padding: 4px 0; line-height: 1.1; }
.datebox b { display: block; font-size: 17px; font-weight: 700; }
.datebox span { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.datebox.late { background: var(--crit-bg); color: var(--crit); }

/* Property tiles on the dashboard. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: inherit; display: flex; flex-direction: column; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgb(17 17 17 / .1); border-color: var(--gold); }
/* Each owner company gets its own band colour (t1, t2, t3...). */
.tile .top { height: 64px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: flex-start; color: #fff; background: radial-gradient(200px 80px at 100% 0%, rgb(201 162 75 / .45), transparent 70%), #0b0b0c; position: relative; }
.tile .top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold)); }
.tile .top.t2 { background: radial-gradient(200px 80px at 100% 0%, rgb(250 152 1 / .45), transparent 70%), #0b0b0c; }
.tile .top.t3 { background: radial-gradient(200px 80px at 100% 0%, rgb(255 255 255 / .22), transparent 70%), #1a1916; }
.tile .top.t4 { background: radial-gradient(200px 80px at 100% 0%, rgb(201 162 75 / .6), transparent 70%), #2a2110; }
.tile .ref { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: var(--gold-light); border: 1px solid rgb(201 162 75 / .5); background: rgb(0 0 0 / .25); border-radius: 6px; padding: 2px 7px; }
.tile .info { padding: 12px 14px 14px; display: grid; gap: 2px; }
.tile .nm { font-family: var(--font-heading); font-weight: 700; font-size: 14.5px; }
.tile .ad { font-size: 12.5px; color: var(--muted); }
.tile .row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13px; }
.tile .row b { font-variant-numeric: tabular-nums; }

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

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--sunk); }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:hover td { background: var(--sunk); }
table.data tr:last-child td { border-bottom: 0; }
table.data th:first-child, table.data td:first-child { min-width: 150px; padding-left: 20px; }
table.data th:last-child, table.data td:last-child { padding-right: 20px; }
table.data tfoot td { font-weight: 650; border-top: 1px solid var(--line-strong); background: var(--sunk); }
table.data .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.dim td { color: var(--faint); }
.name { font-weight: 600; text-decoration: none; }
a.name:hover { text-decoration: underline; }
.muted { color: var(--muted); } .small { font-size: 13px; }

/* ------------------------------------------------------------ chips, alerts, messages */

.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.chip.ok { color: var(--ok); background: var(--ok-bg); } .chip.warn { color: var(--warn); background: var(--warn-bg); }
.chip.crit { color: var(--crit); background: var(--crit-bg); } .chip.info { color: var(--info); background: var(--info-bg); }
.chip.muted { color: var(--muted); border-color: var(--line); }
dl.kv { display: grid; grid-template-columns: minmax(130px, 40%) 1fr; margin: 0; }
dl.kv dt { color: var(--muted); padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
dl.kv dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.alert { padding: 14px 20px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 4px 1fr; gap: 14px; }
.alert:first-child, .group + .alert { border-top: 0; }
.alert .bar { border-radius: 2px; } .alert.critical .bar { background: var(--crit); } .alert.warning .bar { background: var(--warn); } .alert.info .bar { background: var(--info); }
.alert .t { font-weight: 600; } .alert .m { color: var(--muted); font-size: 13px; margin: 1px 0 3px; } .alert .d { font-size: 13.5px; }
.group { padding: 9px 20px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; border-bottom: 1px solid var(--line); }
.group.critical { color: var(--crit); background: var(--crit-bg); } .group.warning { color: var(--warn); background: var(--warn-bg); } .group.info { color: var(--info); background: var(--info-bg); }
.flash { padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); } .flash.bad { background: var(--crit-bg); color: var(--crit); }
.banner { padding: 13px 18px; border-radius: var(--radius-sm); background: var(--info-bg); color: var(--text); margin-bottom: 20px; font-size: 13.5px; border-left: 3px solid var(--info); }
.notes { white-space: pre-wrap; font-size: 13.5px; color: var(--muted); }
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.hello .date { color: var(--muted); font-size: 13.5px; }

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

details.form { border-top: 1px solid var(--line); }
details.form > summary { padding: 13px 20px; cursor: pointer; color: var(--link); font-weight: 600; list-style: none; }
details.form > summary::-webkit-details-marker { display: none; }
details.form > summary::before { content: "+ "; }
details.form[open] > summary::before { content: "− "; }
.f { padding: 4px 20px 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 16px; align-items: end; }
.f.inline { padding: 0; }
.f .wide { grid-column: 1 / -1; }
label.fld { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 10px; width: 100%; transition: border-color .12s, box-shadow .12s; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
textarea { min-height: 64px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: var(--radius-sm); padding: 9px 16px; background: var(--btn-bg); color: var(--accent-text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; box-shadow: 0 1px 2px rgb(17 17 17 / .15), inset 0 1px 0 rgb(255 255 255 / .35); transition: filter .12s; }
.btn.dark, button.dark { background: var(--black); color: var(--gold-light); box-shadow: none; }
button:hover, .btn:hover { filter: brightness(1.08); }
button.quiet, .btn.quiet { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); box-shadow: none; }
button.quiet:hover, .btn.quiet:hover { background: var(--sunk); filter: none; }
button.bad { background: var(--crit); color: #fff; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters a { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); text-decoration: none; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.filters a.on { background: var(--black); color: var(--gold-light); border-color: var(--black); }
.filters a:hover { border-color: var(--gold); }
.danger { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.docs { columns: 2 280px; column-gap: 24px; padding: 4px 20px 18px; margin: 0; }
.docs h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 4px; break-after: avoid; }
.docs ul { list-style: none; padding: 0; margin: 0 0 8px; break-inside: avoid; }
.docs li { font-size: 13.5px; padding: 2px 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ sign-in */

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.login-art { background: radial-gradient(700px 400px at 0% 0%, rgb(201 162 75 / .22), transparent 60%), linear-gradient(160deg, #0b0b0c, #16140f); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 50%; border: 2px solid rgb(201 162 75 / .5); box-shadow: 0 0 0 40px rgb(201 162 75 / .06), 0 0 0 80px rgb(201 162 75 / .04); }
.login-art h2 em { font-style: normal; color: var(--gold-light); }
.login-art img { height: 64px; width: auto; align-self: flex-start; }
.login-art h2 { font-family: var(--font-heading); font-size: 30px; font-weight: 700; line-height: 1.25; max-width: 13em; }
.login-art p { color: #a8a39a; margin: 12px 0 0; max-width: 30em; }
.login-form { display: grid; place-items: center; padding: 32px 16px; background: var(--bg); }
.login { width: 100%; max-width: 400px; }
.login .logo { display: none; height: 56px; width: auto; margin-bottom: 18px; }
@media (max-width: 860px) { .login-page { grid-template-columns: 1fr; } .login-art { display: none; } .login .logo { display: block; } }
.login form { grid-template-columns: 1fr; padding-top: 20px; }
.login button { width: 100%; justify-content: center; padding: 11px 16px; }

@media (max-width: 640px) {
  h1 { font-size: 22px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; } .kpis .hero { grid-column: 1 / -1; }
  .kpi { padding: 14px; } .kpi .k .ico { display: none; }
  .kpi .v { font-size: 22px; }
  dl.kv { grid-template-columns: 1fr; } dl.kv dt { border-bottom: 0; padding-bottom: 0; }
}
