/* Built with the Secure Platform Developer Agent (SPDA v1.2.2) -- Practices by: A2C (2026) */
/* Artifact: the administration console of the attendance clock - the same application shell as the payroll system
   (side menu, quiet top bar, cards, tables, light and dark themes; tokens.css is shared), with the identity of its own
   product. No inline styles: the CSP forbids them. */
body.console { display: block; }
body.console .app { display: flex; min-height: 100vh; }
body.console[data-view="work"] .gate { display: none; }
body.console:not([data-view="work"]) .app { display: none; }

/* ---- the gate: sign-in and invitation ---- */
.gate { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.gate-top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--line); border-top: 4px solid var(--accent); }
.gate-main { width: 100%; max-width: 520px; margin: 0 auto; padding: 32px 16px 48px; }
.gate-main h1 { font-size: 1.6rem; }

/* ---- the application shell ---- */
.app { background: linear-gradient(90deg, var(--side) 0 var(--side-w), transparent var(--side-w)); }  /* the menu's color to the bottom of a tall page */
.sidebar { width: var(--side-w); flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-head { display: flex; align-items: center; gap: 12px; padding: 20px 18px 12px; }
.sidebar .logo-box { border: 1px solid rgba(255, 255, 255, .4); }
.side-name { color: var(--side-on); font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; font-size: 1.05rem; }
.side-sub { color: var(--side-title); font-size: .8rem; }
.tenant-now { margin: 0 14px 6px; display: flex; align-items: center; min-height: 52px; padding: 8px 12px; border: 1px solid var(--side-line); border-radius: var(--r-ctl); color: var(--side-on); }
.tenant-now strong { display: block; font-size: .92rem; font-weight: 600; overflow-wrap: anywhere; line-height: 1.25; }
.tenant-now small { display: block; color: var(--side-title); font-size: .78rem; }
.sidebar nav { flex: 1; padding: 6px 14px 12px; }
.nav-title { color: var(--side-title); font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; padding: 14px 8px 6px; margin: 0; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--side-ink); font: inherit; font-weight: 400; text-align: left; cursor: pointer; transition: background-color .18s var(--ease), color .18s var(--ease); }
.nav-item:hover { background: var(--side-hover); color: var(--side-on); }
.nav-item[aria-current="page"] { background: #0A3D62; color: var(--side-on); font-weight: 600; box-shadow: inset 3px 0 0 #82CCDD; }
.sidebar :focus-visible { outline-color: #fff; }
.side-foot { border-top: 1px solid var(--side-line); padding: 12px 18px 16px; font-size: .85rem; position: sticky; bottom: 0; background: var(--side); }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: var(--r-pill); background: #3C6382; color: #fff; display: grid; place-items: center; font-weight: 600; flex: none; font-size: .85rem; }
.who strong { color: var(--side-on); display: block; font-weight: 600; overflow-wrap: anywhere; }
.who span:not(.avatar) { color: var(--side-title); font-size: .8rem; }
.side-mark { color: var(--side-title); font-size: .75rem; margin: 10px 0 0; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .bar { display: flex; align-items: center; gap: 12px; padding: 14px 32px; min-height: 76px; max-width: 1600px; margin: 0 auto; }
.crumbs { flex: 1 1 0; min-width: 0; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--ink-2); font-size: .9rem; }
.crumbs li { display: flex; align-items: center; gap: 8px; }
.crumbs li + li::before { content: "\203A"; color: var(--ink-2); }
.crumbs [aria-current="page"] { color: var(--ink); overflow-wrap: anywhere; }
.iconbtn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.iconbtn:hover { background: var(--card-2); border-color: var(--field-line); }
.hamburger, .scrim, .menu-close { display: none; }
.usermenu { position: relative; }
.usermenu > summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: .85rem; }
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu[open] > .menu-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(340px, 90vw); padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-lift); display: grid; gap: 10px; }
.menu-panel .me { padding: 2px 4px 8px; border-bottom: 1px solid var(--line); }
.menu-panel .me strong { display: block; overflow-wrap: anywhere; }
.menu-panel .me span { color: var(--ink-2); font-size: .85rem; }
.menu-panel p { margin: 0; }
.menu-panel .org-data { display: grid; gap: 6px; padding: 0 4px 8px; border-bottom: 1px solid var(--line); }
.menu-panel .group-label { font-size: .75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-2); margin: 2px 4px -4px; }
.menu-panel button.small { min-height: 32px; padding: 4px 12px; font-size: .85rem; }
.menu-out { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 10px; border: 0; border-radius: var(--r-ctl); background: none; color: var(--ink); font: inherit; font-weight: 400; cursor: pointer; text-align: left; }
.menu-out:hover { background: var(--accent-soft); }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; margin: 0; background: var(--card-2); }
.seg button { flex: 1; border: 0; border-radius: 0; background: transparent; color: var(--ink); padding: 0 8px; min-height: 40px; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 400; white-space: nowrap; }
.seg button:hover { background: var(--accent-soft); }
.seg button[aria-current="true"], .seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }

body.console main { flex: 1; width: 100%; max-width: 1600px; margin: 0 auto; padding: 28px 32px; display: flex; flex-direction: column; gap: var(--sp); }
body.console main > * { margin: 0; min-width: 0; }
body.console .footer { border-top: 1px solid var(--line); color: var(--ink-2); font-size: .85rem; padding: 14px 32px; }
.footer .inner { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; max-width: 1600px; margin: 0 auto; }
.page-head h1 { font-size: 30px; font-weight: 600; margin: 0; overflow-wrap: anywhere; letter-spacing: -.01em; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); max-width: 78ch; }
.page-head p:empty { display: none; }
[data-pane] { display: flex; flex-direction: column; gap: var(--sp); }
[data-pane][hidden] { display: none !important; }
[data-pane] > * { margin: 0; min-width: 0; }
body.console .card { margin: 0; }

/* ---- tables: the component is in base.css (table.stack), shared with the payroll system ---- */
body.console tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
button.sm { min-height: 36px; padding: 4px 14px; font-size: .88rem; white-space: nowrap; width: auto; }
body.console .empty { margin: 0; }

/* ---- filters and forms: one row of fields, the button at the end; never loose pieces ---- */
.filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 16px; align-items: end; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label, .field-label { margin: 0; font-weight: 600; font-size: .9rem; }
.field input, .field select { width: 100%; min-width: 0; }
.field-go button { width: 100%; }
body.console form.card .filters-grid + .filters-grid, body.console form.card .filters-grid + p { margin-top: 12px; }
body.console form.card label { margin-top: 0; }
body.console form.card .row button, body.console form.card p > button { width: auto; }
body.console form.card .field-go button { width: 100%; }
@media (min-width: 1100px) {
  .filters-5 { grid-template-columns: minmax(150px, 210px) minmax(150px, 190px) minmax(0, 1fr) minmax(0, 1fr) auto; }
  .filters-6 { grid-template-columns: minmax(130px, 180px) minmax(130px, 180px) minmax(0, 1fr) minmax(0, 1fr) minmax(110px, 150px) minmax(120px, 160px) auto; }
  .filters-4 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
  .filters-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; }
  .filters-eq3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; min-height: 32px; cursor: pointer; }
.check input { width: auto; min-height: 0; margin: 0; }

/* ---- the map ---- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--sp); align-items: start; }
.map-layout .card { margin: 0; }
/* (the map itself - tiles, markers, pop-up - lives in ../shared/map.css, also used by the phone app) */
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 12px 0 0; font-size: .85rem; color: var(--ink-2); }
.map-legend li { display: flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); background: var(--accent); }
.lg-in { background: var(--ink-3); } .lg-out { background: var(--card); border: 3px solid var(--ink-3); box-shadow: none; }
.lg-flag { background: var(--card); border: 3px solid var(--red); box-shadow: none; } .lg-low { background: var(--card); border: 3px dashed var(--orange); box-shadow: none; }
.lg-fence { background: transparent; border: 2px dashed var(--accent); box-shadow: none; } .lg-kiosk { background: var(--purple); border-radius: 3px; }
.lg-cluster { background: var(--accent); }
.people-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; list-style: none; padding: 0; margin: 10px 0 0; font-size: .82rem; }
.people-legend li { display: inline-flex; align-items: center; gap: 6px; }
.people-legend .sw { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.map-side { display: flex; flex-direction: column; gap: 10px; max-height: calc(clamp(440px, 62vh, 760px) + 140px); }
.map-side h2 { display: flex; align-items: baseline; gap: 8px; margin: 0; }
.count { color: var(--ink-2); font-size: .9rem; font-weight: 400; }
.punch-list { display: grid; gap: 4px; overflow-y: auto; min-height: 120px; max-height: 520px; padding-right: 2px; }
.punch-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; grid-template-areas: "dot name marks" "dot meta meta"; gap: 1px 10px; align-items: center; width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--card); color: var(--ink); text-align: left; font: inherit; font-weight: 400; min-height: 0; cursor: pointer; }
.punch-row:hover { background: var(--accent-soft); }
.punch-row[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.punch-row .dot { grid-area: dot; width: 12px; height: 12px; border-radius: 50%; align-self: center; }
.punch-row .name { grid-area: name; font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.punch-row .meta { grid-area: meta; color: var(--ink-2); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.punch-row .marks { grid-area: marks; display: inline-flex; gap: 6px; align-items: center; }
.punch-row .icon.in { color: var(--ok); } .punch-row .icon.out { color: var(--blue); }
.punch-row .icon.warn { color: var(--orange); } .punch-row .icon.kind { color: var(--ink-2); }
.map-tools { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; margin-bottom: 10px; }
.chip-filter { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 12px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--r-ctl); font-size: .88rem; }
.chip-filter span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x { min-height: 28px; width: 28px; padding: 0; background: transparent; color: var(--ink); display: inline-grid; place-items: center; }
.chip-x:hover { background: var(--card-2); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
dl.facts dt { color: var(--ink-2); } dl.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---- small screens: the menu opens over the page ---- */
@media (max-width: 1100px) { .map-layout { grid-template-columns: 1fr; } .map-side { max-height: none; } }
@media (max-width: 860px) {
  .app { background: none; }
  .hamburger { display: inline-grid; }
  body.menu-open { overflow: hidden; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; width: 304px; max-width: 86vw; transform: translateX(-100%); visibility: hidden; transition: transform .2s var(--ease); }
  .menu-open .sidebar { transform: none; visibility: visible; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: var(--scrim); opacity: 0; pointer-events: none; }
  .menu-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-close { display: inline-grid; position: sticky; top: 10px; align-self: flex-end; margin: 10px 10px -54px 0; z-index: 2; background: transparent; border-color: var(--side-line); color: #fff; }
  .topbar .bar { padding: 10px 14px; min-height: 64px; gap: 8px; }
  .crumbs li:not(:last-child) { display: none; }
  .crumbs li + li::before { content: none; }
  body.console main { padding: 18px 14px; gap: 16px; }
  .page-head h1 { font-size: 24px; }
  body.console .footer { padding: 12px 14px; }
}
@media (min-width: 861px) { .menu-close, .scrim { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
#m-list { overflow-y: auto; min-height: 120px; flex: 1 1 auto; }
.punch-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.map-card .map { height: clamp(440px, 62vh, 760px); }
/* the map needs the room: its explanation is the note under the map */
body[data-page="map"] #page-help { display: none; }
body[data-page="map"] .page-head { margin-bottom: 8px; }

.map-card .alert { margin-top: 10px; }

/* the punches table is wide: names are cut sooner, a sentence (the origin) keeps room to wrap at its spaces, and what
   still does not fit scrolls inside its card */
table.stack.wide td.cut { max-width: 9rem; }
table.stack td.origin { min-width: 10rem; }

/* the map cannot be dragged into a text selection, and a click on a label is not a selection either */
.map, .map-controls, .map-tools, .seg, .punch-row, .check { user-select: none; -webkit-user-select: none; }
.map-small { height: 300px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1 1 auto; min-width: 0; }
.search-results { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.search-results button { width: 100%; justify-content: flex-start; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.field > *, .search-results li { min-width: 0; }
.search-results button { max-width: 100%; display: block; }

/* a text-like button for a secondary action inside a form ("Forgot your password?") */
button.link { background: none; border: 0; padding: 4px 0; min-height: 44px; color: var(--link); font: inherit; font-weight: 400; text-decoration: underline; cursor: pointer; }
button.link:hover { color: var(--ink); }
.req { color: var(--muted); font-weight: 400; font-size: .85em; }
.kiosk-where { display: grid; gap: 12px; margin-top: 12px; }
.kiosk-where .map-small { min-height: 200px; }

/* a field that is wrong: red border and its reason right under it (never a silent failure) */
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.field-error { margin: 4px 0 0; color: var(--red); font-size: .85rem; font-weight: 600; }
#s-form .filters-grid { align-items: start; }  /* the fields have notes and errors of different height: tops line up */

/* "Addresses in use": on a narrow screen the label sits over its address instead of squeezing the address into half the width */
@media (max-width: 600px) {
  #addr-effective table, #addr-effective tbody, #addr-effective tr, #addr-effective th, #addr-effective td { display: block; width: 100%; }
  #addr-effective th { padding-bottom: 0; border-bottom: 0; background: transparent; }
  #addr-effective td { padding-top: 2px; overflow-wrap: anywhere; }
  #addr-effective code { font-size: .78rem; }  /* an address is long: smaller, so it breaks less */
}
/* the warnings about an address read as notes of the form, not as loose paragraphs */
#addr-warnings p.warn { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--notice-line); background: var(--notice-bg); color: var(--notice-ink); border-radius: var(--r-ctl); }

/* the planning calendar: a cell is a button that opens the exception of that date; an unplanned person is marked */
table.plan td.plan-cell button.link { all: unset; cursor: pointer; color: var(--link); text-decoration: underline; text-decoration-style: dotted; }
table.plan td.plan-cell button.link:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
table.plan td.plan-cell.muted button.link { color: var(--ink-2); }
table.plan tr.unplanned td:first-child { box-shadow: inset 3px 0 0 var(--notice-line); }
#pl-unplanned { border-left: 3px solid var(--notice-line); background: var(--notice-bg); }

/* ---- C4b: search in the menu, the home (dashboard), people, team, devices switch ---- */
.side-search { margin: 4px 14px 6px; position: relative; }
.side-search-row { display: flex; gap: 6px; }
.side-search input { flex: 1 1 auto; min-width: 0; background: var(--side-hover); color: var(--side-on); border: 1px solid var(--side-line); }
.side-search input::placeholder { color: var(--side-title); }
.side-search .iconbtn { background: transparent; border-color: var(--side-line); color: var(--side-on); }
.side-search .iconbtn:hover { background: var(--side-hover); }
.side-search .search-results { margin: 6px 0 0; }
.side-search .search-results button { background: var(--side-hover); color: var(--side-on); border: 1px solid var(--side-line); min-height: 40px; padding: 6px 10px; }
.side-search .search-results button:hover, .side-search .search-results button:focus-visible { background: #0A3D62; }
.side-search .search-results .kind { display: block; font-size: .72rem; color: var(--side-title); text-transform: uppercase; letter-spacing: .8px; }
.side-search .search-none { color: var(--side-title); font-size: .85rem; padding: 4px 2px; margin: 0; }
.nav-top { padding-top: 6px; }

.dev-switch { max-width: 360px; }

.dash-grid { display: grid; gap: var(--sp); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.dash-card { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.dash-card h2 { margin: 0; font-size: 1rem; }
.dash-card .big { font-size: 2.2rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; margin: 0; }
.dash-card .big small { font-size: .9rem; font-weight: 400; color: var(--ink-2); }
.dash-card .what { margin: 0; color: var(--ink-2); font-size: .88rem; }
.dash-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: .9rem; }
.dash-card li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-card li span { color: var(--ink-2); }
.dash-card .more { color: var(--ink-2); font-size: .85rem; }
.dash-card .go { margin-top: auto; }
.dash-card .go a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.dash-card.attention { border-left: 3px solid var(--notice-line); }
.dash-card.fine { border-left: 3px solid var(--ok-line); }
.dash-card.soon { border-left: 3px dashed var(--field-line); }

#pp-tabs { max-width: 360px; margin-bottom: 12px; }
#pp-tabs button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
#tm-site-boxes, #tm-edit-boxes { display: grid; gap: 4px; margin-top: 6px; }
#tm-roles-body table { margin-top: 10px; }
