:root {
  --bg: #eef3f7; --panel: #fff; --text: #111827; --muted: #6b7280; --line: #e5e7eb;
  --accent: #0090d6; --accent-d: #0072b5; --accent-l: #e6f3fb; --accent-b: #b5dcf2; --dark: #16243e; --danger: #dc2626;
  --nav-h: 56px; --top-h: 52px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 12px; min-height: 38px; }
button.primary { background: linear-gradient(90deg, #0077c0, #0098dc); border-color: #0084cb; color: #fff; font-weight: 600; }
button.primary:hover { background: linear-gradient(90deg, #00639f, #0084c4); }
button.danger { color: var(--danger); border-color: #fecaca; }
button.ghost { border-color: transparent; background: transparent; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 10px; background: #fff; min-height: 38px; max-width: 100%; }
textarea { width: 100%; min-height: 80px; }
.drop-input { min-height: 68px; width: min(100%, 560px); border: 1px dashed #b7c5d8; border-radius: 10px; background: #f8fbff; padding: 10px 12px; display: flex; gap: 10px; align-items: center; cursor: pointer; user-select: none; }
.drop-input:hover { border-color: var(--accent); background: var(--accent-l); }
.drop-input.dragover { border-color: var(--accent-d); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-l); }
.drop-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop-input-ico { color: var(--accent-d); display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: none; }
.drop-input-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.drop-input-title { font-weight: 600; color: var(--dark); }
.drop-input-files { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.list > * + * { margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eef2f7; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.pill-btn { border-radius: 999px; padding: 6px 12px; min-height: 34px; }
.pill-btn.on { outline: 3px solid var(--dark); }
.wf-icon { display: inline-flex; width: 1.15em; height: 1.15em; align-items: center; justify-content: center; vertical-align: middle; flex: none; }
.wf-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; display: block; }

/* shell */
.top { position: sticky; top: 0; z-index: 1000; height: var(--top-h); background: #fff; color: var(--dark); border-bottom: 1px solid var(--line); box-shadow: 0 1px 4px rgba(22,36,62,.06); display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.top .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.top button { background: #fff; color: var(--dark); border-color: var(--line); min-height: 34px; padding: 4px 10px; }
.top .logo { display: flex; align-items: center; flex: none; text-decoration: none; }
.top .logo img { height: 34px; width: auto; display: block; }
.top .title { color: var(--dark); }
.top button:hover { background: var(--accent-l); border-color: var(--accent-b); }
.layout { display: flex; min-height: calc(100vh - var(--top-h)); }
.side { width: 210px; background: #fff; border-right: 1px solid var(--line); padding: 10px 0; flex: none; }
.side a { display: flex; gap: 10px; padding: 10px 16px; text-decoration: none; color: #374151; }
.side a.on { background: var(--accent-l); color: var(--accent-d); font-weight: 600; border-right: 3px solid var(--accent); }
.main { flex: 1; min-width: 0; padding: 16px; }
.main.full { padding: 0; position: relative; }
.bottom { display: none; }

@media (max-width: 760px) {
  .side { display: none; }
  .main { padding: 10px 10px calc(var(--nav-h) + 14px); }
  .main.full { padding: 0; }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); z-index: 1200; }
  .bottom a { flex: 1; text-align: center; font-size: 11px; text-decoration: none; color: #4b5563; padding-top: 6px; }
  .bottom a .ico { display: block; font-size: 20px; }
  .bottom a.on { color: var(--accent-d); font-weight: 600; }
  .hide-m { display: none !important; }
}

/* login */
.login { max-width: 360px; margin: 12vh auto; }
.login input { width: 100%; }

/* plans */
.plan-folder { margin-top: 16px; }
.plan-folder > summary { cursor: pointer; display: flex; align-items: center; gap: 8px; list-style: none; }
.plan-folder > summary::-webkit-details-marker { display: none; }
.plan-folder > summary::before { content: '▶'; font-size: 11px; transition: transform .15s; }
.plan-folder[open] > summary::before { transform: rotate(90deg); }
.plan-folder > summary h2 { margin: 0; overflow-wrap: anywhere; }
.plan-folder .plan-grid { margin-top: 10px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.plan-upload { min-height: 140px; border: 2px dashed #cbd5e1; background: transparent; color: var(--muted); font-weight: 600; }
.plan-upload:hover { border-color: var(--accent); color: var(--accent-d); }
.plan-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; text-decoration: none; display: block; }
.plan-link { display: block; text-decoration: none; }
.plan-title { display: flex; align-items: center; gap: 6px; }
.plan-title .plan-link { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-rename { flex: none; padding: 2px 6px; border: 0; background: transparent; }
.plan-drop-target { outline: 3px solid var(--accent); outline-offset: 2px; }
.plan-card[draggable=true] { cursor: grab; }
.plan-card .thumb { position: relative; aspect-ratio: 1.41; background: #f9fafb center/contain no-repeat; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.plan-task-count { position: absolute; top: 6px; right: 6px; border-radius: 999px; padding: 3px 7px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; }
.plan-card .meta { padding: 8px 10px; }

/* map */
.mapwrap { position: absolute; inset: 0; height: calc(100vh - var(--top-h)); }
@media (max-width: 760px) { .mapwrap { height: calc(100vh - var(--top-h) - var(--nav-h) - env(safe-area-inset-bottom)); } }
#map { position: absolute; inset: 0; background: #e5e7eb; }
.maptools { position: absolute; z-index: 800; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.maptools button { box-shadow: 0 1px 4px rgba(0,0,0,.2); }
@media (max-width: 760px) {
  .maptools { left: 8px; right: 8px; top: 8px; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; align-items: center; padding-bottom: 4px; scrollbar-width: none; }
  .maptools > * { flex: none; }
  .maptools select { max-width: 45vw; }
  .mapinfo { bottom: 8px; }
  .leaflet-control-zoom { display: none; }
}
.maptools button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.mapinfo { position: absolute; z-index: 800; left: 10px; bottom: 10px; background: rgba(255,255,255,.92); border-radius: 8px; padding: 4px 8px; font-size: 12px; max-width: 70%; }
.plan-view-footer { position: absolute; z-index: 800; bottom: 10px; left: 10px; right: 10px; display: flex; gap: 8px; align-items: center; }
.plan-view-footer .mapinfo { position: static; flex: none; max-width: 35%; }
.plan-pager { display: flex; gap: 4px; flex: none; }
.plan-view-title { display: flex; justify-content: center; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.plan-view-title > span { background: rgba(255,255,255,.95); border-radius: 8px; padding: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .plan-view-footer { flex-wrap: wrap; }
  .plan-view-footer .mapinfo { width: 100%; max-width: 100%; font-size: 11px; }
}
.banner { position: absolute; z-index: 800; left: 50%; top: 10px; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px; }
.pin { width: 18px; height: 24px; position: relative; }
.pin svg { position: absolute; inset: 0; z-index: 0 !important; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.pin span { position: absolute; z-index: 1; top: 6px; left: 0; right: 0; text-align: center; font: 700 9px/1 system-ui, sans-serif; color: #fff; text-shadow: 0 0 2px rgba(0,0,0,.6); }
.pin.sel svg { filter: drop-shadow(0 0 4px #000) drop-shadow(0 0 2px #fff); }
.filterbox { background: #fff; border-radius: 10px; padding: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.25); max-height: 60vh; overflow: auto; width: 250px; }
.filterbox .fb-foot { position: sticky; bottom: -10px; margin: 8px -10px -10px; padding: 8px 10px; background: #fff; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.filterbox .fb-foot button { flex: 1; }
.maptools.fopen { z-index: 1200; }
@media (max-width: 760px) { .filterbox { position: fixed; z-index: 900; top: calc(var(--top-h) + 60px); left: 8px; right: 8px; width: auto; max-height: calc(100vh - var(--top-h) - var(--nav-h) - 80px); } }
.filterbox label { display: flex; gap: 8px; align-items: center; color: var(--text); margin: 4px 0; font-size: 14px; }
/* plan markup toolbar (Fieldwire-like) */
.mk-bar { position: absolute; z-index: 820; left: 10px; top: 106px; display: flex; flex-direction: column; gap: 10px; }
.mk-group { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 1px; box-shadow: 0 1px 4px rgba(22,36,62,.18); }
.mk-btn { width: 38px; height: 38px; min-height: 0; padding: 0; display: flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--dark); border-radius: 6px; box-shadow: none; }
.mk-btn:hover { background: var(--accent-l); color: var(--accent-d); }
.mk-btn.on { background: var(--accent); color: #fff; }
.mk-btn.off { opacity: .4; }
.mk-btn:disabled { opacity: .35; cursor: default; }
.mk-btn.wide { width: auto; padding: 0 10px; font-size: 12px; white-space: nowrap; }
.mk-fly { position: absolute; left: 50px; display: flex; flex-wrap: wrap; gap: 1px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 3px; box-shadow: 0 2px 8px rgba(22,36,62,.22); max-width: 240px; }
.mk-fly.two { width: 197px; }
.mk-dot { width: 20px; height: 20px; border-radius: 50%; display: inline-block; border: 2px solid #fff; box-shadow: 0 0 0 1px #9ca3af; box-sizing: border-box; }
.mk-dot.priv { outline: 3px solid #7700b9; }
.mk-dot.sm { width: 16px; height: 16px; border: 1px solid #999; }
.mk-filter { border-bottom: 1px solid #e5e7eb; padding-bottom: 6px; margin-bottom: 6px; }
.mk-filter-colors { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.mk-filter-colors > div { flex-basis: 100%; }
.filterbox .mk-filter-colors label { margin: 2px 0; gap: 4px; }
.filterbox .mk-filter-colors label.off { opacity: .45; }
.mk-priv { display: flex; align-items: center; gap: 6px; color: var(--dark); font-size: 12px; padding: 6px; width: 100%; }
.mk-priv input { width: 16px; height: 16px; min-height: 0; }
.mk-hint { position: absolute; z-index: 810; left: 50%; top: 58px; transform: translateX(-50%); background: rgba(22,36,62,.9); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 12px; pointer-events: none; max-width: 80%; text-align: center; transition: opacity .6s; }
.mk-hint.gone { opacity: 0; }
.mk-fly.four { width: 162px; }
.mk-selbar { position: absolute; z-index: 830; left: 50%; bottom: 60px; transform: translateX(-50%); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--accent-l); border: 1px solid var(--accent-b); border-radius: 10px; padding: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.2); max-width: calc(100% - 120px); }
.mk-selbar select { max-width: 170px; }
.mk-colors { display: inline-flex; gap: 3px; }
.mk-swatch { width: 22px; height: 22px; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid #9ca3af; }
.mk-drawing, .mk-drawing .leaflet-interactive { cursor: crosshair !important; }
/* While a tool is active the browser must not turn a finger stroke into a scroll (it would send pointercancel). */
.mk-drawing, .mk-drawing * { touch-action: none !important; }
.mk-bar, .mk-fly, .mk-selbar { touch-action: manipulation; }
.mk-text { white-space: pre-wrap; overflow: hidden; line-height: 1.2; font-family: Arial, sans-serif; padding: 2px; box-sizing: border-box; cursor: pointer; }
.mk-label { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font: 600 12px/1 system-ui, sans-serif; padding: 3px 6px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
@media (max-width: 760px) {
  .mk-bar { top: 62px; left: 8px; gap: 6px; }
  .mk-btn { width: 34px; height: 34px; }
  .mk-fly { left: 44px; }
  .mk-hint { top: 62px; }
  .mk-selbar { bottom: 70px; max-width: calc(100% - 70px); left: calc(50% + 25px); }
}
@media (pointer: coarse) {
  .mk-btn { width: 42px; height: 42px; }
  .mk-fly { left: 52px; }
  .mk-fly.two { width: 217px; }
  .mk-fly.four { width: 178px; }
}

/* tasks */
.tasks-top { margin-bottom: 10px; }
.tasks-top > * + * { margin-top: 8px; }
.tasks-head-main { display: flex; align-items: center; gap: 10px; }
.tasks-title { margin: 0; flex: 1; min-width: 0; }
.tasks-head-actions { display: inline-flex; gap: 8px; align-items: center; margin-left: auto; }
.tasks-head-actions:empty { display: none; }
.tasks-head-btn { min-height: 40px; height: 40px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1; white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.filters input[type=search] { flex: 1 1 180px; }
.task-filters-mobile-head, .task-filters-panel { display: none; }
.task-filters-toggle { min-height: 38px; min-width: 38px; width: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.task-filters-toggle.on { background: var(--accent-l); border-color: var(--accent); color: var(--accent-d); }
.task-filters-mobile-head input[type=search] { flex: 1 1 auto; min-width: 0; }
.statusbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.task-row { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; }
.task-row .num { font-weight: 700; min-width: 42px; color: #374151; }
.task-row .t { flex: 1; min-width: 0; }
.task-row .t div:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row input[type=checkbox] { width: 20px; height: 20px; min-height: 0; }
.bulkbar { position: sticky; top: var(--top-h); z-index: 900; background: var(--accent-l); border: 1px solid var(--accent-b); border-radius: 10px; padding: 8px; margin-bottom: 10px; }

/* drawer */
/* the drawer starts below the top bar so 👤 and the bell stay clickable while a task is open */
.drawer-bg { position: fixed; inset: var(--top-h) 0 0 0; background: rgba(0,0,0,.35); z-index: 1300; }
.drawer { position: fixed; z-index: 1301; top: var(--top-h); right: 0; bottom: 0; width: min(460px, 100vw); background: #fff; overflow-y: auto; box-shadow: -4px 0 20px rgba(0,0,0,.2); padding: 0 14px 30px; }
.drawer .dhead { position: sticky; top: 0; background: #fff; padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; z-index: 2; }
.drawer .dhead .title { font-weight: 700; flex: 1; }
@media (max-width: 760px) { .drawer { width: 100vw; top: calc(var(--top-h) + 6px); border-radius: 14px 14px 0 0; } }
.status-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.status-grid button { color: #fff; border: none; font-weight: 600; min-height: 40px; }
.status-grid button.on { outline: 3px solid #111; outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid #f3f4f6; }
.related-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #f3f4f6; }
.related-row a, .pick-item { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: inherit; text-decoration: none; }
.related-row a:hover b { text-decoration: underline; }
.pick-list { max-height: 50vh; overflow: auto; margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.pick-item { width: 100%; text-align: left; justify-content: flex-start; }
.check input { width: 22px; height: 22px; min-height: 0; margin-top: 1px; }
.check.done span { text-decoration: line-through; color: var(--muted); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; cursor: zoom-in; background: #eee; }
.ph-tile { position: relative; }
.ph-tile img { display: block; }
.ph-check { display: none; position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.35); color: transparent; font-size: 13px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 3px rgba(0,0,0,.5); pointer-events: none; }
.photos.picking .ph-check { display: block; }
.photos.picking img { cursor: pointer; }
.ph-tile.selected .ph-check { background: #2563eb; color: #fff; }
.photos.picking .ph-tile.selected img { outline: 3px solid #2563eb; outline-offset: -3px; opacity: .85; }
.photo-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; margin-bottom: 10px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; }
.photo-bar[hidden] { display: none; }
.event { padding: 8px 0; border-bottom: 1px solid #f3f4f6; font-size: 14px; }
.event .who { font-size: 12px; color: var(--muted); }
.event.status { background: #f0fdf4; margin: 0 -6px; padding: 8px 6px; border-radius: 6px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lightbox img { max-width: 100vw; max-height: 85vh; }
.lightbox .row { color: #fff; margin-top: 10px; flex-wrap: wrap; justify-content: center; padding: 0 8px; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; font-size: 22px; border: none; border-radius: 8px; background: rgba(255,255,255,.18); color: #fff; cursor: pointer; }
.lightbox .lb-nav:hover:not(:disabled) { background: rgba(255,255,255,.35); }
.lightbox .lb-nav:disabled { opacity: .25; cursor: default; }
.lightbox .lb-prev { left: 12px; }
.lightbox .lb-next { right: 12px; }
.lightbox .lb-count { color: #fff; font-variant-numeric: tabular-nums; }
.lightbox .row .muted { color: #cbd5e1; }
@media (max-width: 700px) { .lightbox .lb-nav { width: 38px; height: 52px; background: rgba(0,0,0,.45); } .lightbox .lb-prev { left: 4px; } .lightbox .lb-next { right: 4px; } }

table.grid { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
table.grid th { background: #f9fafb; position: sticky; top: 0; }
table.grid.users-grid th, table.grid.users-grid td { text-align: center; vertical-align: middle; }
table.grid.users-grid td:first-child input { text-align: center; }
.scroll-x { overflow-x: auto; }
#toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 3000; display: none; max-width: 90vw; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1500; display: flex; align-items: center; justify-content: center; padding: 10px; }
.modal { background: #fff; border-radius: 12px; padding: 16px; width: min(480px, 100%); max-height: 90vh; overflow: auto; }
.modal input, .modal select, .modal textarea { width: 100%; }
@media print { .top, .side, .bottom, .noprint { display: none !important; } .main { padding: 0; } }
.plan-delete:hover { color: #dc2626; }
.plan-folder > summary .plan-rename { font-size: 15px; }

/* @mention notifications */
.top .bell { position: relative; font-size: 18px; padding: 4px 8px; filter: grayscale(1) opacity(.65); }
.top .bell.has-new { filter: none; background: #dc2626; border-color: #dc2626; }
.bell-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: #fff; color: #dc2626; font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; }
.bell-item .bell-count { background: #dc2626; color: #fff; }
.bell-menu { position: fixed; z-index: 1500; top: calc(var(--top-h) + 4px); right: 8px; width: min(380px, calc(100vw - 16px)); max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.bell-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.bell-item { display: block; padding: 10px 12px; border-bottom: 1px solid #f3f4f6; color: inherit; text-decoration: none; }
.bell-item:hover { background: var(--accent-l); }
.bell-text { font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention { color: var(--accent-d); font-weight: 600; }
.event.mention-me { background: #eff6ff; margin: 0 -6px; padding: 8px 6px; border-radius: 6px; }
.event.flash { animation: evflash 2.5s ease-out; }
@keyframes evflash { 0%, 40% { box-shadow: inset 0 0 0 2px #dc2626; background: #fee2e2; } }
.mention-form { position: relative; }
.mention-list { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 -4px 16px rgba(0,0,0,.15); z-index: 5; max-height: 240px; overflow-y: auto; }
.mention-opt { padding: 8px 10px; cursor: pointer; }
.mention-opt.on, .mention-opt:hover { background: var(--accent-l); }

/* "+" menu in the task message form */
.plus-btn { font-size: 22px; line-height: 1; padding: 0; width: 38px; font-weight: 400; flex: none; border-radius: 50%; border-color: transparent; background: transparent; color: var(--muted, #64748b); }
.send-btn { flex: none; width: 38px; padding: 0; border-radius: 50%; border: none; background: #0084cb; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.send-btn:hover { background: #00639f; }
.send-btn svg { margin-left: -2px; }
.plus-menu { position: absolute; left: 0; bottom: 100%; margin-bottom: 4px; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 -4px 16px rgba(0,0,0,.15); z-index: 6; overflow: hidden; min-width: 230px; }
.plus-menu button { border: 0; border-radius: 0; text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.plus-menu button:last-child { border-bottom: 0; }
.plus-menu button:hover { background: var(--accent-l); }

/* work sub-cards */
.event.work { border-bottom: 0; }
.work-card { border: 1px solid var(--line); border-left: 4px solid #f59e0b; border-radius: 8px; padding: 10px; margin-top: 4px; background: #fffbeb; display: flex; flex-direction: column; gap: 8px; }
.work-card.approved { border-left-color: #16a34a; background: #f0fdf4; }
.work-card.rejected { border-left-color: var(--danger); background: #fef2f2; }
.work-desc { white-space: pre-wrap; }
.work-badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; font-weight: 600; }
.work-badge.pending { background: #fef3c7; color: #92400e; }
.work-badge.approved { background: #dcfce7; color: #166534; }
.work-badge.rejected { background: #fee2e2; color: #991b1b; }
.work-card.cancelled { border-left-color: #9ca3af; background: #f9fafb; }
.work-badge.cancelled { background: #f3f4f6; color: #4b5563; }
.confirm-head { display: inline-flex; flex-direction: column; gap: 4px; align-items: center; margin: 0; color: inherit; font-size: inherit; font-weight: inherit; line-height: inherit; cursor: pointer; white-space: nowrap; }
.cfg-grid input[type=checkbox] { width: 16px; height: 16px; min-height: 0; margin: 0; vertical-align: middle; }
.confirm-hint { margin: 6px 0 0; max-width: 720px; font-size: 13px; }
.work-workers { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.work-actions { gap: 6px; }
.ok-text { color: #166534; }
.bad-text { color: #991b1b; }
.work-form .label { font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.work-form .worker-row { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; margin: 0; padding: 6px 0; border-bottom: 1px solid #f3f4f6; }
.work-form .worker-row input[type=checkbox] { width: 20px; height: 20px; }
.work-form .hours { width: 80px; }
.work-form .photos { margin-bottom: 6px; }
.work-form .thumb { position: relative; }
.work-form .thumb button { position: absolute; top: 2px; right: 2px; min-height: 0; padding: 2px 6px; font-size: 12px; background: rgba(255,255,255,.9); }
.mention-form { flex-wrap: nowrap; gap: 4px; }
.mention-form > input { flex: 1; min-width: 0; }
.mention-form { align-items: flex-end; }
.mention-form > textarea.msg-input { flex: 1; min-width: 0; width: auto; min-height: 38px; max-height: 140px; resize: none; overflow-y: auto; line-height: 20px; border-radius: 19px; padding-left: 14px; padding-right: 14px; }
.mention-form > textarea.msg-input:placeholder-shown { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.event.message { white-space: pre-wrap; }
.event.message .who { white-space: normal; }

/* colleague picker in the work dialog */
.work-form .worker-list { display: flex; flex-direction: column; }
.work-form .worker-row button.ghost { padding: 4px 10px; }
.worker-picker { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 6px 0; background: #f9fafb; display: flex; flex-direction: column; gap: 6px; }
.worker-picker .picker-list { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }
.worker-picker .picker-list button { text-align: left; min-height: 40px; }
.add-colleague { margin-top: 8px; width: 100%; min-height: 42px; border-style: dashed; }

/* reports: segmented toggle, multi-pick filters, timesheet */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: #fff; }
.seg button.on { background: var(--accent); color: #fff; }
.multi-pick { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-pick.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pick-list { max-height: 55vh; overflow-y: auto; }
.pick-list .worker-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f3f4f6; margin: 0; color: var(--text); font-size: 15px; }
.pick-list .worker-row input { width: 20px; height: 20px; }
table.grid td.num, table.grid th.num { text-align: center; white-space: nowrap; }
table.grid td.pre { white-space: pre-wrap; min-width: 180px; }
table.grid tr.sum td { font-weight: 700; background: #f9fafb; }
table.timesheet th.weekend { background: #fee2e2; }
table.timesheet td:first-child, table.timesheet th:first-child { position: sticky; left: 0; background: #fff; z-index: 1; white-space: nowrap; }
.print-only { display: none; }
@media print { .print-only { display: block; } .scroll-x { overflow: visible !important; } }
@media (max-width: 700px) { .multi-pick { max-width: 100%; flex: 1 1 45%; } .filters input[type=date] { flex: 1 1 45%; } }
.worker-picker[hidden] { display: none; }
.timesheet-mobile-toolbar, .timesheet-mobile-panel, .timesheet-more-toggle { display: none; }

.statusbar .sort-btn { margin-left: auto; border: 1px solid var(--line); }
.statusbar .pill-btn.on { outline: 2px solid var(--accent); outline-offset: 0; }

.pin span { top: 5px; font-size: 7px; }

/* Sidebar scrolls independently of the work area and can collapse to icons. */
.side { position: sticky; top: var(--top-h); align-self: flex-start; height: calc(100vh - var(--top-h)); overflow-y: auto; display: flex; flex-direction: column; box-sizing: border-box; transition: width .15s; }
.side a { align-items: center; white-space: nowrap; }
.side a .ico { width: 22px; text-align: center; flex: none; display: inline-flex; justify-content: center; font-size: 18px; }
.side hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.side .side-toggle { margin: auto 8px 4px; display: flex; gap: 10px; align-items: center; justify-content: flex-start; background: #fff; color: #4b5563; border: 1px solid var(--line); padding: 6px 8px; white-space: nowrap; }
.side .side-toggle:hover { background: var(--accent-l); border-color: var(--accent-b); }
.side .side-toggle .ico { font-size: 16px; line-height: 1; display: inline-flex; align-items: center; }
.side.collapsed { width: 56px; }
.side.collapsed .lbl { display: none; }
.side.collapsed a { padding: 10px 0; justify-content: center; }
.side.collapsed .side-toggle { justify-content: center; margin: auto 6px 4px; }
.side.collapsed .side-toggle .ico { transform: none; }
@media (max-width: 760px) { .side { display: none; } }
@media (max-width: 760px) {
  .tasks-head-main { align-items: stretch; }
  .tasks-head-btn { min-height: 42px; height: 42px; }
  .tasks-top > * + * { margin-top: 8px; }
  .task-filters-mobile-head { display: flex; flex-wrap: nowrap; align-items: stretch; }
  .task-filters-panel { display: flex; }
  .task-filters-panel[hidden] { display: none !important; }
  .timesheet-mobile-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
  .timesheet-mobile-toolbar .seg { flex: 1 1 auto; min-width: 0; }
  .timesheet-mobile-toolbar .seg button { min-height: 40px; }
  .timesheet-more-toggle { display: inline-flex; width: 40px; min-height: 40px; height: 40px; padding: 0; align-items: center; justify-content: center; flex: none; }
  .timesheet-more-toggle.on { background: var(--accent-l); border-color: var(--accent); color: var(--accent-d); }
  .timesheet-mobile-panel { display: block; margin-bottom: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
  .timesheet-mobile-panel[hidden] { display: none !important; }
  .timesheet-mobile-panel .filters { margin-bottom: 8px; }
}

.template-type-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.template-type-nav a { display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.template-type-nav a.on { background: var(--accent-l); color: var(--accent-d); font-weight: 600; }
.template-type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.template-type-card { display: block; color: inherit; text-decoration: none; }
.template-type-card h2, .template-list-card h2 { margin: 0 0 6px; }
.template-page-head { margin-bottom: 10px; }
.template-list { display: grid; gap: 8px; }
.template-list-card { display: flex; align-items: center; gap: 12px; }
.template-default { display: inline-block; margin-left: 8px; padding: 2px 7px; border-radius: 12px; background: var(--accent-l); color: var(--accent-d); font-size: 12px; vertical-align: middle; }
.template-editor { display: grid; gap: 6px; }
.template-editor textarea { width: 100%; }
.template-folder-list { display: grid; gap: 6px; max-width: 520px; }
.template-folder-list .row input { flex: 1; min-width: 0; }
.template-add-folder { max-width: 520px; margin-top: 6px; }
.template-add-folder input { flex: 1; min-width: 0; }

.mob-only { display: none; }
@media (max-width: 760px) { .desk-only { display: none !important; } .mob-only { display: initial; } button.mob-only { display: block; } }
@media (max-width: 760px) {
  .template-type-grid { grid-template-columns: 1fr; }
  .template-list-card { align-items: flex-start; }
  .template-list-card button { flex: none; }
  .template-page-head { align-items: center; flex-wrap: nowrap; }
}

/* work timer */
.top .timer-pill, .timer-pill { display: inline-flex; align-items: center; gap: 2px; background: #c62828; color: #fff; border: 0; border-radius: 16px; padding: 4px 10px; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.top .timer-pill:hover { background: #a61f1f; border-color: transparent; }
.timer-pill[hidden] { display: none !important; }
.timer-box { margin: 10px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.timer-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-radius: 10px; padding: 10px 12px; }
.timer-row.running { background: #fdecea; border: 1px solid #f5c2bd; }
.timer-row.stopped { background: #fff8e1; border: 1px solid #f3dc9b; }
.timer-row .clock.big { font-size: 20px; font-variant-numeric: tabular-nums; }
.timer-row .rec { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #c62828; margin-right: 6px; animation: rec-blink 1.2s infinite; }
@keyframes rec-blink { 50% { opacity: .25; } }
.start-work { background: #2e7d32; color: #fff; border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 15px; align-self: flex-start; }
.start-workers { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow: auto; }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: normal; }
.busy-row { padding: 4px 0; }
.timer-note { background: #fdecea; border-radius: 8px; padding: 6px 10px; }
@media (max-width: 760px) { .timer-pill .tp-task { display: none; } .timer-pill { padding: 4px 8px; font-size: 13px; } }

/* timesheet timers and task picking on plans */
.timesheet-timers { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 14px; }
.timesheet-timers .start-work { align-self: auto; }
.timer-row .chip { text-decoration: none; color: inherit; white-space: normal; }
.chip .chip-x { min-height: 0; padding: 0 2px; line-height: 1; font-size: 12px; }
.pick-bar { position: fixed; z-index: 1100; left: 50%; transform: translateX(-50%); bottom: 40px; width: min(560px, calc(100vw - 16px)); box-sizing: border-box; display: flex; align-items: center; gap: 8px; background: var(--dark); color: #fff; border-radius: 12px; padding: 8px 10px; box-shadow: 0 4px 16px rgba(0,0,0,.25); font-size: 14px; }
.pick-bar .ghost { color: #fff; }
@media (max-width: 760px) { .pick-bar { bottom: calc(var(--nav-h) + 8px + env(safe-area-inset-bottom)); font-size: 13px; } }
.split-preview table { margin-top: 4px; }.leave-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-radius: 10px; padding: 8px 12px; border: 1px solid var(--line); background: #fafafa; }
.leave-row.approved { background: #f0fdf4; border-color: #bbf7d0; }
.leave-row.rejected { background: #fef2f2; border-color: #fecaca; }
.leave-row.pending { background: #fffbeb; border-color: #fde68a; }
.leave-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.leave-stats > div { flex: 1 1 180px; display: flex; flex-direction: column; gap: 2px; background: #f4f7fb; border-radius: 10px; padding: 8px 12px; }
.leave-stats b { font-size: 18px; }
.leaves-panel .ghost { padding: 2px 8px; }

/* leave panel header and compact mobile layout */
.leave-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: nowrap; }
.leave-title { display: inline-flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; }
.leave-title-text { overflow: hidden; text-overflow: ellipsis; }
.leave-year { display: inline-flex; align-items: center; gap: 2px; flex: none; font-variant-numeric: tabular-nums; }
.leave-request { flex: none; white-space: nowrap; }
table.grid td.cfg-actions { white-space: nowrap; }
@media (max-width: 760px) {
  .leaves-panel .leave-year .ghost { padding: 2px 6px; min-height: 32px; }
  .leaves-panel .leave-request { padding: 8px 12px; }
  .leave-stats { flex-wrap: nowrap; gap: 8px; }
  .leave-stats > div { flex: 1 1 0; min-width: 0; padding: 8px 10px; }
  .leave-stats b { font-size: 16px; }
  .leave-row { gap: 6px 10px; }
  .leave-row > .grow { flex: 1 1 100%; }
  .report-tabs { display: flex; }
  .timesheet-mobile-toolbar .seg { display: flex; }
  .timesheet-mobile-toolbar .seg button { flex: 1 1 0; min-width: 0; padding-left: 6px; padding-right: 6px; }
  .report-tabs button { flex: 1 1 0; min-width: 0; padding-left: 6px; padding-right: 6px; }
  table.grid.cfg-grid th, table.grid.cfg-grid td { padding: 4px; vertical-align: middle; }
  table.grid.cfg-grid th, table.grid.cfg-grid th.num { white-space: normal; font-size: 12px; line-height: 1.2; }
  table.grid.cfg-grid input:not([type=checkbox]):not([type=color]) { width: 100%; min-width: 84px; }
  table.grid.cfg-grid td.cfg-actions .ghost { padding: 4px; }
  table.grid.cfg-grid input[type=color] { width: 36px; height: 36px; min-height: 0; padding: 2px; }
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .plan-card .meta { padding: 6px 8px; font-size: 13px; }
  .plan-card .plan-rename { padding: 2px 3px; }
  .plan-title .plan-link { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; line-height: 1.25; }
  .task-row { gap: 8px; padding: 8px 10px; }
  .task-row .num { min-width: 0; }
}
@media (max-width: 420px) {
  .leave-title { font-size: 15px; }
  .leave-title > :first-child { display: none; }
  .leaves-panel .leave-request { padding: 6px 10px; font-size: 14px; }
  .leaves-panel .leave-year .ghost { padding: 2px 4px; }
}
@media (max-width: 349px) {
  .leave-request-text { display: none; }
  .leaves-panel .leave-request { width: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
}

/* templates: uniform add button and single-row type navigation */
.template-page-head { min-height: 38px; }
.template-page-head h1 { margin: 0; }
.template-add { display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap; }
@media (max-width: 760px) {
  .template-type-nav { flex-wrap: nowrap; gap: 4px; }
  .template-type-nav a { flex: 1 1 0; justify-content: center; padding: 8px 6px; white-space: nowrap; }
}