/* ==========================================================
   KORE PM
   Same brand tokens as korecontractor.com, but this is a tool,
   not a brochure: dense, fast, no scroll animation.
   ========================================================== */

:root {
  --ink:      #080706;
  --ink2:     #131110;
  --paper:    #f4f1eb;
  --stone:    #c8b89a;
  --stone-lt: #e4dace;
  --stone-dk: #8a7660;
  --white:    #faf9f7;

  --ok:    #6f9b57;
  --warn:  #c08a2e;
  --bad:   #b04a42;
  --muted: #7a7166;

  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans:  'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease:  cubic-bezier(.16, 1, .3, 1);

  --line:  #ded6c8;
  --r:     3px;
}

/* Self-hosted so the app works in mainland China, where Google Fonts is
   blocked, and so a site visit makes no third-party request. Latin subset
   only — Bahasa Indonesia needs no accents beyond it. Falls back to
   Georgia / system-ui if the files are missing.

   DM Sans is a variable font: one file covers 400 and 500, so the weight
   range is declared rather than shipping the same bytes twice. */
@font-face {
  font-family: 'DM Sans';
  src: url('fonts/dmsans.woff2') format('woff2');
  font-weight: 400 500; font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('fonts/cormorant-500.woff2') format('woff2');
  font-weight: 500; font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: .01em; margin: 0; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 22px; }
h3 { font-size: 17px; font-family: var(--sans); font-weight: 500; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny  { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

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

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px; height: 56px;
  background: var(--ink);
  color: var(--white);
}
.topbar a { color: var(--white); }
.brand {
  display: flex; align-items: baseline; gap: 5px;
  font-family: var(--serif); font-size: 20px; letter-spacing: .06em;
  text-transform: uppercase;
  flex: 0 0 auto;
}
/* Height-driven, width auto: the intrinsic width/height on the <img> keep
   the row from jumping while the PNG loads, and this keeps the aspect
   ratio if the logo file is ever swapped for one of different proportions. */
.brand img { height: 19px; width: auto; display: block; }
.brand span { color: var(--stone); }
.topbar nav { display: flex; gap: 16px; font-size: 14px; }
.topbar nav a { opacity: .72; }
.topbar nav a:hover, .topbar nav a.on { opacity: 1; text-decoration: none; }
.topbar nav a.on { border-bottom: 1px solid var(--stone); }
.topbar .spacer { flex: 1; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 26px 20px 80px; }
.wrap.narrow { max-width: 560px; }

.pagehead {
  display: flex; align-items: flex-end; gap: 16px;
  flex-wrap: wrap; margin-bottom: 22px;
}
.pagehead .spacer { flex: 1; }

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

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
}
.card + .card { margin-top: 14px; }
.card h3 { margin-bottom: 10px; }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* A wide subject (floorplan, room editor) with a list beside it. This lives
   in the stylesheet rather than an inline style because an inline
   grid-template-columns outranks the phone media query, and the plan then
   stays in a 190px column with every room label on top of the next. */
.grid.split { grid-template-columns: 1.4fr 1fr; align-items: start; }

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

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .n { font-family: var(--serif); font-size: 34px; line-height: 1; }
/* For a stat whose value is words rather than a number — a date, say. At
   the full 34px "19 Dec 2026" wraps inside a third of a phone screen. */
.stat .n.sm { font-size: 22px; line-height: 1.15; }
.stat .k { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- progress ---------- */

.bar {
  position: relative; height: 6px; border-radius: 99px;
  background: var(--stone-lt); overflow: hidden;
}
.bar i {
  position: absolute; inset: 0 auto 0 0;
  background: var(--stone-dk);
  transition: width .4s var(--ease);
}
.bar.ok i   { background: var(--ok); }
.bar.warn i { background: var(--warn); }
.bar.bad i  { background: var(--bad); }

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

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th {
  text-align: left; font-weight: 500; font-size: 11px;
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
  padding: 0 10px 8px; border-bottom: 1px solid var(--line);
}
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover { background: var(--paper); }

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

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 99px;
  font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
  border: 1px solid var(--line); color: var(--muted); background: var(--paper);
}
.pill.ok   { color: #3f6b2b; border-color: #bcd3ad; background: #eef5e9; }
.pill.warn { color: #7d5806; border-color: #e5cf9d; background: #faf3e3; }
.pill.bad  { color: #8d322b; border-color: #e2b6b2; background: #fbeeed; }

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

label { display: block; font-size: 12px; letter-spacing: .06em;
        text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--ink);
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r); outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--stone-dk); box-shadow: 0 0 0 3px rgba(138, 118, 96, .14);
}
textarea { min-height: 80px; resize: vertical; }
.field + .field { margin-top: 14px; }

/* A set of tickable names — the rooms one material covers. Wraps into as
   many columns as fit, and each label is a whole tap target, because this
   is filled in on a phone on site. */
.ticks {
  display: grid; gap: 2px 14px;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  max-height: 232px; overflow-y: auto;
  padding: 6px 10px; background: var(--white);
  border: 1px solid var(--line); border-radius: var(--r);
}
.tick {
  display: flex; align-items: center; gap: 9px; margin: 0;
  padding: 7px 2px; cursor: pointer;
  text-transform: none; letter-spacing: 0;
  font-size: 14px; color: var(--ink);
}
.tick input { width: auto; flex: 0 0 auto; margin: 0; }

.check { display: flex; align-items: center; gap: 8px; }
.check label { margin: 0; text-transform: none; letter-spacing: 0;
               font-size: 14px; color: var(--ink); }
.check input { width: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; font: 500 14px/1 var(--sans);
  background: var(--ink); color: var(--white);
  border: 1px solid var(--ink); border-radius: var(--r);
  cursor: pointer; transition: background .2s var(--ease);
}
.btn:hover { background: var(--ink2); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--white); border-color: var(--stone-dk); }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

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

.flash {
  padding: 11px 14px; border-radius: var(--r); margin-bottom: 16px;
  border: 1px solid var(--line); background: var(--white); font-size: 14px;
}
.flash.ok    { border-color: #bcd3ad; background: #eef5e9; }
.flash.error { border-color: #e2b6b2; background: #fbeeed; }

/* ---------- floorplan ---------- */

.plan { position: relative; line-height: 0; background: var(--white);
        border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.plan img { width: 100%; height: auto; display: block; }
.plan svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.plan polygon {
  fill: rgba(138, 118, 96, .28);
  stroke: var(--stone-dk); stroke-width: 2; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: fill .2s var(--ease);
}
.plan polygon:hover { fill: rgba(138, 118, 96, .45); }
.plan polygon.p0   { fill: rgba(176, 74, 66, .22); stroke: var(--bad); }
.plan polygon.p50  { fill: rgba(192, 138, 46, .26); stroke: var(--warn); }
.plan polygon.p100 { fill: rgba(111, 155, 87, .30); stroke: var(--ok); }
/* Room captions are HTML sitting on top of the plan, not SVG <text>. Inside
   the stretched viewBox every length is a user unit, so a 3px halo became
   three times the width of the whole plan and painted out everything under
   it. Out here a pixel is a pixel. pointer-events: none keeps the polygon
   beneath clickable. */
/* The room-editor's label layer. Without this it is a plain block that
   relies on .plan happening to be the nearest positioned ancestor, and it
   adds its own height below the image. Pinned and inert, it does neither. */
.plan .lbls { position: absolute; inset: 0; pointer-events: none; }

/* The caption is capped to the room's own width by an inline max-width, so
   it wraps rather than overprinting the room next door. overflow-wrap
   breaks a single long word instead of letting it escape the box. */
.plan .lbl { position: absolute; transform: translate(-50%, -50%);
             pointer-events: none; text-align: center;
             overflow-wrap: anywhere;
             font: 500 11px/1.2 var(--sans); color: var(--ink);
             text-shadow: 0 0 3px var(--white), 0 0 3px var(--white),
                          0 0 7px var(--white); }
.plan .lbl b { display: block; font: 500 11px/1.2 var(--sans); color: var(--ink); }
.plan .lbl i { display: block; font: 600 13px/1.2 var(--sans); font-style: normal;
               color: var(--ink); }

/* ---------- photos ---------- */

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.shot { position: relative; aspect-ratio: 4/3; overflow: hidden;
        border-radius: var(--r); border: 1px solid var(--line); background: var(--stone-lt); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .tag { position: absolute; left: 6px; bottom: 6px; }

/* ---------- responsive: supervisors work from phones ---------- */

@media (max-width: 760px) {
  .wrap { padding: 18px 14px 70px; }
  .grid.c2, .grid.c3, .grid.c4, .grid.c5, .grid.split { grid-template-columns: 1fr; }
  .grid.c3.keep { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.c4.keep, .grid.c5.keep { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 25px; }
  /* Two rows on a phone. Identity, language and sign-out hold the first
     row; the section links scroll on the second. Squeezed onto one row
     they pushed Sign out past the right edge, which left a supervisor on
     a shared site phone with no way to log out. */
  .topbar { flex-wrap: wrap; height: auto; padding: 9px 14px; gap: 8px 12px; }
  .topbar nav { order: 3; width: 100%; gap: 16px;
                overflow-x: auto; scrollbar-width: none; }
  .topbar nav::-webkit-scrollbar { display: none; }
  table.t { font-size: 13px; }
  table.t th, table.t td { padding: 8px 6px; }
  .hide-sm { display: none; }
}

/* ---------- the Friday report ---------- */

.reporthead { border-bottom: 2px solid var(--ink); padding-bottom: 12px; }

/* Print is a delivery channel here, not an afterthought. The report gets
   sent as a PDF or a screenshot, so the printed copy has to stand on its
   own: no navigation the reader cannot use, no buttons, and photographs
   that survive the trip. Backgrounds are forced on because a progress bar
   printed without its fill is a progress bar that says nothing. */
@media print {
  .noprint, .topbar, .flash { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: none; }
  .card { border: 1px solid #ddd; box-shadow: none; break-inside: avoid; }
  .shots { grid-template-columns: repeat(3, 1fr); }
  .shot, table.t tr { break-inside: avoid; }
  a { text-decoration: none; color: inherit; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
