:root {
  --bg-success: #e1f5ee; --text-success: #085041;
  --bg-warning: #faeeda; --text-warning: #854f0b;
  --bg-danger: #fcebeb; --text-danger: #a32d2d;
  --border-danger: #e24b4a;
  --surface: #ffffff; --surface-1: #f6f5f2;
  --text: #1a1a18; --text-2: #5f5e5a; --text-3: #94938d;
  --border: #e3e1dc; --accent: #185fa5;
}
* { box-sizing: border-box; }
body {
  margin: 0 auto; padding: 16px 20px 40px; max-width: 1080px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text); background: var(--surface);
}
h1 { font-size: 18px; font-weight: 600; margin: 0 12px 0 0; }
.backlink { font-size: 13px; color: var(--text-3); text-decoration: none; margin-right: 2px; }
.backlink:hover { color: var(--accent); }
.brandlogo { height: 30px; width: auto; margin-right: 4px; }
header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.spacer { flex: 1; }
select { font: inherit; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
#docmeta { font-size: 13px; color: var(--text-2); }
.qnav { display: inline-flex; align-items: center; gap: 6px; }
.qnav button {
  font-size: 16px; line-height: 1; padding: 4px 10px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
}
.qnav button:hover { background: var(--surface-1); }
#qlabel { font-size: 14px; font-weight: 600; min-width: 26px; text-align: center; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin: 0 0 14px; }
.legend .hint { color: var(--text-3); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }
.sw-full { background: var(--bg-success); }
.sw-half { background: var(--bg-warning); }
.sw-zero { background: var(--bg-danger); }
.sw-auto { outline: 1.5px dashed var(--border-danger); outline-offset: -2px; }
.sw-holiday { outline: 2px solid var(--text); outline-offset: -2px; }

.yearhdrs, .qrow, .totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.yearhdrs { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.yearhdrs .lock { color: var(--text-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; font-size: 11px; }
.yearhdrs .draft, .totals .draft .tlabel { color: var(--accent); }

#calwrap { position: relative; }
.qrow { padding: 10px 0; }
.qrow + .qrow { border-top: 1px solid var(--border); }

.mhead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.mname { font-size: 13px; font-weight: 600; }
.mtotal { font-size: 11px; color: var(--text-3); }
.dows, .days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.dows { margin-bottom: 3px; }
.dow { font-size: 11px; color: var(--text-3); text-align: center; }

.cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 36px; border-radius: 4px; font-size: 12px; font-weight: 600; line-height: 1.15;
}
.cell .loc { font-size: 10px; font-weight: 400; display: inline-flex; align-items: center; gap: 3px; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.v1 { background: var(--bg-success); color: var(--text-success); }
.v05 { background: var(--bg-warning); color: var(--text-warning); }
.v0 { background: var(--bg-danger); color: var(--text-danger); }
.blank { background: transparent; }
.nodata { background: var(--surface-1); color: var(--text-3); font-weight: 400; }
.assumed { outline: 1.5px dashed var(--border-danger); outline-offset: -2px; }
.holiday { outline: 2px solid var(--text); outline-offset: -2px; }
.editable { cursor: pointer; }
.editable:hover { box-shadow: inset 0 0 0 1.5px #a6a49e; }

#locmenu {
  display: none; position: absolute; z-index: 10; min-width: 160px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.08);
}
#locmenu .mtitle { font-size: 11px; color: var(--text-3); padding: 4px 10px 2px; }
#locmenu .mi {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  font-size: 13px; cursor: pointer; border-radius: 5px;
}
#locmenu .mi:hover { background: var(--surface-1); }
#locmenu .mi .check { margin-left: auto; color: var(--accent); }

.totals { margin-top: 14px; }
.totals > div { background: var(--surface-1); border-radius: 8px; padding: 10px 14px; }
.tlabel { font-size: 12px; color: var(--text-3); }
.tval { font-size: 20px; font-weight: 600; }

#savedflash {
  position: fixed; right: 18px; bottom: 18px; padding: 8px 14px; border-radius: 8px;
  background: #085041; color: #fff; font-size: 13px; opacity: 0; transition: opacity .25s;
  pointer-events: none;
}
#savedflash.show { opacity: 1; }
