:root {
  --bg: #f6f5f1; --panel: #ffffff; --ink: #1c1f22; --muted: #5d6670; --line: #d9d6cd;
  --head: #1d2329; --accent: #c2410c; --accent-ink: #ffffff; --ok: #2e7d32; --warn: #b26a00; --bad: #b3261e;
  --focus: #1f6fb2;
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

header.top {
  height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--head); color: #f3f1ea;
}
header.top h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .2px; }
header.top h1 b { color: #ff8a50; }
header.top .spacer { flex: 1; }
header.top .who { font-size: 13px; opacity: .85; }
header.top button, header.top a.btn-head {
  background: transparent; color: #f3f1ea; border: 1px solid #4b5560; border-radius: 6px; padding: 5px 10px; font-size: 13px; text-decoration: none;
}

.btn { text-decoration: none; display: inline-flex; align-items: center; background: var(--panel); border: 1px solid #b9b4a8; border-radius: 6px; padding: 7px 12px; min-height: 36px; }
.btn:hover { background: #efede6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #a3360a; }
.btn.small { padding: 3px 8px; min-height: 28px; font-size: 13px; }
.btn.danger { color: var(--bad); border-color: #e0b4b0; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* login */
.login-wrap { min-height: calc(100% - 52px); display: grid; place-items: center; padding: 24px; }
.login { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 28px; width: 100%; max-width: 360px; }
.login h2 { margin: 0 0 4px; font-size: 22px; }
.login p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea { border: 1px solid #b9b4a8; border-radius: 6px; padding: 8px 10px; background: #fff; }
.field textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* plans list */
.page { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 24px; flex: 1; }
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #ece9e1; font-size: 14px; }
table.list th { background: #efede6; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
table.list tr.row { cursor: pointer; }
table.list tr.row:hover td { background: #faf9f6; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: #e6e3da; border-radius: 4px; overflow: hidden; width: 120px; display: inline-block; vertical-align: middle; }
.bar > i { display: block; height: 100%; background: var(--ok); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid; }
.badge.draft { color: #555; border-color: #bbb; background: #f4f4f4; }
.badge.review { color: #7a4b00; border-color: #e3b45f; background: #fff4de; }
.badge.approved { color: #1b5e20; border-color: #8fc59a; background: #e6f4e8; }
.badge.implemented { color: #0d47a1; border-color: #90b4e6; background: #e6effa; }
.badge.closed, .badge.cancelled { color: #444; border-color: #aaa; background: #eee; }
.badge.demo { color: #8a1c1c; border-color: #e0a8a8; background: #fbecec; }

/* workspace */
.ws { display: grid; grid-template-columns: minmax(0, 1fr) 540px; grid-template-rows: minmax(0, 1fr); height: calc(100dvh - 108px); }
.ws-bar { height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.ws-bar h2 { font-size: 18px; margin: 0; white-space: nowrap; }
.ws-bar .meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.ws-bar .spacer { flex: 1; }
#map { height: 100%; min-height: 300px; }
.side { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 11px 9px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabpanel { overflow-y: auto; padding: 14px 16px 30px; flex: 1; min-height: 0; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
.locked { background: #fff4de; border: 1px solid #e3b45f; color: #6b4300; border-radius: 6px; padding: 8px 10px; font-size: 13px; margin-bottom: 12px; }

.el-list { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 14px; }
.el-chip { position: relative; border: 1px solid #cfcabd; background: #faf9f6; border-radius: 6px; min-height: 38px; font-weight: 700; font-size: 13px; color: var(--muted); }
.el-chip:hover { background: #f1eee6; }
.el-chip[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.el-chip .dot { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-width: 1px; }
.el-legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin: -6px 0 12px; align-items: center; }
.el-legend .dot { margin-right: 4px; vertical-align: -1px; }
.el-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; text-align: left; background: none; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; font-size: 14px; }
.el-item:hover { background: #f4f2ec; }
.el-item[aria-current="true"] { background: #fdf1ea; border-color: #f0c2a8; }
.el-item .code { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1.5px solid #9a958a; }
.dot.draft { background: #f2c14e; border-color: #b8901f; }
.dot.complete { background: var(--ok); border-color: var(--ok); }
.owner { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.el-edit h3 { margin: 4px 0 4px; font-size: 18px; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 14px; }
table.grid th, table.grid td { border-bottom: 1px solid #e6e3da; padding: 6px 6px; text-align: left; vertical-align: top; }
table.grid th { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
table.grid input { width: 100%; border: 1px solid #c9c4b8; border-radius: 4px; padding: 4px 6px; }
h4 { margin: 16px 0 6px; font-size: 14px; }
.feat { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid #efede6; font-size: 14px; }
.feat .sw { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.feat .lbl { flex: 1; }
.feat .m { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.hours { display: grid; grid-template-columns: repeat(16, 1fr); gap: 2px; margin: 8px 0; }
.hours div { height: 34px; border-radius: 3px; font-size: 10px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 2px; color: #fff; font-weight: 600; }
.hours .go { background: var(--ok); } .hours .no { background: var(--bad); } .hours .ign { outline: 2px solid var(--ink); outline-offset: -2px; }
.verdict { padding: 8px 10px; border-radius: 6px; font-weight: 600; font-size: 14px; }
.verdict.go { background: #e6f4e8; color: #1b5e20; } .verdict.part { background: #fff4de; color: #6b4300; } .verdict.no { background: #fbecec; color: #8a1c1c; }

.leaflet-container { font: inherit; }
.layer-toggle { background: #fff; border: 0; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.3); padding: 8px 12px; font-weight: 600; font-size: 13px; }
.layer-panel { background: #fff; padding: 8px 10px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.3); font-size: 13px; max-height: 60vh; overflow-y: auto; min-width: 210px; }
.layer-panel label { display: flex; gap: 6px; align-items: center; padding: 3px 0; }
.layer-panel .sec { font-weight: 700; font-size: 11px; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.layer-panel input[type=date] { width: 100%; }

@media (max-width: 900px) {
  .ws { grid-template-columns: 1fr; grid-template-rows: 45vh auto; height: auto; }
  .side { min-height: 60vh; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
}
.rx-pt { white-space: nowrap; }
.rx-pt span { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 3px; border-radius: 11px; color: #fff; font-size: 11px; font-weight: 700; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); transform: translate(-11px, -11px); }
.rx-pt b { font-size: 12px; color: #111; text-shadow: 0 0 3px #fff, 0 0 3px #fff; transform: translate(-6px, -11px); display: inline-block; }
