/*
 * Servulet 2.0 — Styles
 * Created by: Luis Curato
 *
 * How it is organised:
 *  1. Colour, size and corner variables in :root. Administration › Appearance overrides
 *     these through /theme.css, so most visual changes need no code at all.
 *  2. Layout: phones first (top bar + bottom tabs); from 900px wide a side menu appears.
 *  3. Components: buttons, cards, tables (shown as cards on phones), forms, badges...
 *  4. Page-specific parts (job page, calendar, admin, sign-in) and print styles at the end.
 */

:root {
  --ink: #173a33;        /* deep moss: sidebar, headings */
  --text: #1d2b2a;
  --muted: #5d6f6b;
  --paper: #eef3f1;      /* cool mist background */
  --surface: #ffffff;
  --line: #d5e0dc;
  --line-strong: #b9c9c3;
  --moss: #2f6b4f;       /* primary actions */
  --moss-dark: #22533d;
  --moss-soft: #e1eee7;
  --water: #1d6579;      /* links */
  --sun: #c98c06;        /* stars, warnings */
  --sun-soft: #fbf0d3;
  --coral: #b33e2a;      /* danger */
  --coral-soft: #f8e3df;
  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 16px;
  --shadow: 0 1px 2px rgba(23, 58, 51, .06), 0 4px 14px rgba(23, 58, 51, .05);
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tab-h: 64px;
  --on-primary: #ffffff;
  --sidebar: #173a33;
  --sidebar-text: #cfdcd7;
  --sidebar-strong: #ffffff;
  --sidebar-active: #24564a;
  --sidebar-accent: #7fc8a1;
  --brand-mark: #3f8a66;
  --base-size: 16px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: var(--base-size); }
body {
  margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.5; color: var(--text);
  background: var(--paper); font-variant-numeric: tabular-nums;
}
img { max-width: 100%; }
a { color: var(--water); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
h1, h2, h3 { color: var(--ink); line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; margin-top: 1rem; }
p { margin: 0 0 .75rem; }
code { font-size: .85em; background: var(--moss-soft); padding: .05em .35em; border-radius: 4px; }
:focus-visible { outline: 3px solid #5aa0ff; outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.block { display: block; }
small { font-size: .82rem; color: var(--muted); }
.prewrap { white-space: pre-wrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 99; }
.skip:focus { left: 0; }
.mt { margin-top: 1.25rem; }
.center { text-align: center; }
.spacer { flex: 1; }

/* ---------- Layout ---------- */
.main { padding: 1rem 1rem calc(var(--tab-h) + 1.5rem + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; }
.is-bare .main { padding-bottom: 2rem; }
.sidebar { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem; padding-top: calc(.6rem + env(safe-area-inset-top));
  background: var(--sidebar); color: var(--sidebar-strong);
}
.topbar .brand { color: var(--sidebar-strong); }
.topbar-title { font-weight: 600; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand-logo { height: 32px; width: auto; max-width: 170px; object-fit: contain; background: #fff; padding: 3px 6px; border-radius: var(--radius-s); }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-mark); color: #fff; }
.brand-mark.big { width: 56px; height: 56px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar > a, .tabbar summary {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .72rem; color: var(--muted); text-decoration: none; cursor: pointer; list-style: none; min-width: 0;
}
.tabbar summary::-webkit-details-marker { display: none; }
.tabbar > a.current { color: var(--moss); font-weight: 650; }
.tabbar > a.current .i { stroke-width: 2.3; }
.more { flex: 1; display: flex; }
.more[open] summary { color: var(--moss); }
.more-sheet {
  position: fixed; left: .5rem; right: .5rem; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + .5rem);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: 0 10px 40px rgba(0,0,0,.18); padding: .5rem;
}
.more-sheet ul { list-style: none; margin: 0; padding: 0; }
.more-sheet a, .more-sheet .linklike { display: flex; align-items: center; gap: .75rem; padding: .8rem .75rem; color: var(--text); text-decoration: none; border-radius: var(--radius-s); width: 100%; font-size: 1rem; }
.more-sheet a:hover, .more-sheet .linklike:hover { background: var(--moss-soft); }
.me { display: flex; flex-direction: column; padding: .5rem .75rem .75rem; border-bottom: 1px solid var(--line); margin-bottom: .25rem; }
.me span { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

.linklike { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; padding: 0; }

@media (min-width: 900px) {
  .has-nav { display: grid; grid-template-columns: 248px 1fr; }
  .topbar, .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--sidebar); color: var(--sidebar-text); padding: 1.25rem .75rem;
  }
  .sidebar .brand { color: var(--sidebar-strong); padding: 0 .5rem 1.25rem; }
  .sidebar ul { list-style: none; margin: 0; padding: 0; }
  .sidebar nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: var(--radius-s); color: var(--sidebar-text); text-decoration: none; font-weight: 500; }
  .sidebar nav a:hover { background: var(--sidebar-active); color: var(--sidebar-strong); }
  .sidebar nav a.current { background: var(--sidebar-active); color: var(--sidebar-strong); box-shadow: inset 3px 0 0 var(--sidebar-accent); }
  .sidebar-foot { margin-top: auto; border-top: 1px solid var(--sidebar-active); padding-top: .75rem; }
  .sidebar-foot .me { border: 0; padding: 0 .75rem .5rem; }
  .sidebar-foot .me span { color: var(--sidebar-text); opacity: .8; }
  .sidebar-foot a, .sidebar-foot .linklike { display: flex; align-items: center; gap: .6rem; padding: .45rem .75rem; color: var(--sidebar-text); text-decoration: none; font-size: .92rem; width: 100%; }
  .sidebar-foot a:hover, .sidebar-foot .linklike:hover { color: var(--sidebar-strong); }
  .main { padding: 2rem 2.25rem 3rem; width: 100%; }
  .main.wide { max-width: 1400px; }
  h1 { font-size: 1.85rem; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.page-head .sub, .sub { color: var(--muted); margin: .15rem 0 0; }
.page-head .actions, .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.back { display: inline-flex; align-items: center; gap: .2rem; font-size: .9rem; text-decoration: none; margin-bottom: .35rem; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .55rem 1rem;
  border-radius: var(--radius-s); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .95rem;
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s;
}
.btn-primary { background: var(--moss); color: var(--on-primary); }
.btn-primary:hover { background: var(--moss-dark); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--moss); color: var(--moss-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn-ghost:hover { background: var(--moss-soft); color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--coral); border-color: #e4b2a9; }
.btn-danger:hover { background: var(--coral); color: #fff; }
.btn-small { min-height: 34px; padding: .3rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-big { min-height: 60px; font-size: 1.15rem; width: 100%; border-radius: var(--radius); }
.btn .i { flex: none; }
.inline-form { display: inline; }
.icon-btn { border: 0; background: rgba(255,255,255,.92); border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; color: var(--coral); }

/* ---------- Cards, grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; gap: 1rem; }
.grid-2 > .card { margin-bottom: 0; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; align-items: start; } }
.narrow { max-width: 460px; margin: 1rem auto; }
.narrow-card { max-width: 520px; }
.stack > * + * { margin-top: .9rem; }
.note { display: flex; gap: .6rem; align-items: flex-start; background: var(--moss-soft); border: 1px solid #c6ddd0; padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.note .i { margin-top: 2px; color: var(--moss); flex: none; }
.danger-zone { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--line-strong); }

/* ---------- Dashboard tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1.25rem; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(5, 1fr); } }
.tile { display: flex; flex-direction: column; gap: .2rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.tile strong { font-size: 2rem; line-height: 1; color: var(--ink); font-weight: 700; }
.tile span { font-size: .85rem; color: var(--muted); }
.tile:hover { border-color: var(--moss); }
.tile.warn { background: var(--sun-soft); border-color: #ecd391; }
.tile.warn strong { color: #8a5d00; }

/* ---------- Job lines (compact lists) ---------- */
.job-lines { list-style: none; margin: 0; padding: 0; }
.job-lines.card { padding: .25rem .5rem; }
.job-line { display: grid; grid-template-columns: 4.8rem 1fr auto; gap: .75rem; align-items: center; padding: .7rem .25rem; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.job-lines li:last-child .job-line { border-bottom: 0; }
.job-line .time { font-weight: 650; color: var(--ink); font-size: .92rem; }
.job-line .what { display: flex; flex-direction: column; min-width: 0; }
.job-line .what strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-line:hover strong { color: var(--water); }
.empty-inline { color: var(--muted); }

/* ---------- The job order ticket (the one bold element) ---------- */
.tickets { display: grid; gap: .9rem; margin-bottom: 1.5rem; }
@media (min-width: 700px) { .tickets { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.job-ticket {
  position: relative; display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem 1rem 1.4rem;
  background: var(--surface); color: var(--text); text-decoration: none; border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  -webkit-mask: radial-gradient(circle 9px at 0 50%, transparent 98%, #000) ; mask: radial-gradient(circle 9px at 0 50%, transparent 98%, #000);
}
.job-ticket::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--moss); border-radius: var(--radius) 0 0 var(--radius); }
.job-ticket:hover { border-color: var(--moss); }
.ticket-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.jo { font-weight: 800; font-size: 1.35rem; letter-spacing: .02em; color: var(--ink); }
.ticket-title { font-size: 1.05rem; color: var(--ink); }
.ticket-when { display: flex; align-items: center; gap: .35rem; margin-top: .35rem; font-weight: 600; color: var(--moss-dark); }
.job-ticket.mini { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding-left: 1.3rem; }
.job-ticket.mini .jo { font-size: 1.1rem; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 650; line-height: 1.5; white-space: nowrap; vertical-align: middle; }
.badge-pending { background: #eef1f6; color: #3d4d68; }
.badge-started { background: var(--sun-soft); color: #7a5300; }
.badge-done { background: var(--moss-soft); color: var(--moss-dark); }
.badge-cancelled { background: var(--coral-soft); color: var(--coral); }
.status-dot { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.status-dot i { width: 10px; height: 10px; border-radius: 50%; background: #999; box-shadow: 0 0 0 2px rgba(0,0,0,.06); }
.overdue { color: var(--coral); font-weight: 650; display: block; }
.due { color: #8a5d00; font-weight: 650; display: block; }

/* ---------- Stars ---------- */
.stars { display: inline-flex; gap: 1px; color: #cfd8d5; vertical-align: middle; }
.stars .on { color: var(--sun); }
.stars .on .i { fill: currentColor; }
.star-input { border: 0; padding: 0; margin: 0; display: flex; flex-direction: row-reverse; justify-content: center; gap: .25rem; }
.star-input legend { width: 100%; text-align: center; font-weight: 600; margin-bottom: .4rem; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { cursor: pointer; color: #cfd8d5; padding: .1rem; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: var(--sun); }
.star-input input:checked ~ label .i, .star-input label:hover .i, .star-input label:hover ~ label .i { fill: currentColor; }
.star-input input:focus-visible + label { outline: 3px solid #5aa0ff; border-radius: 6px; }

/* ---------- Search & filters ---------- */
.searchbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.search-input { flex: 1 1 260px; display: flex; align-items: center; gap: .4rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 0 .7rem; min-height: 44px; }
.search-input input { border: 0; outline: 0; flex: 1; min-width: 0; font: inherit; background: transparent; padding: .5rem 0; }
.search-input:focus-within { border-color: var(--moss); box-shadow: 0 0 0 3px var(--moss-soft); }
.searchbar select, .searchbar input[type=date] { min-height: 44px; }
label.inline { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--muted); }

/* ---------- Tables (become cards on phones) ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: .82rem; font-weight: 650; color: var(--muted); background: #f6f9f8; padding: .65rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: .7rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tr.linked { cursor: pointer; }
table.data tr.linked:hover td { background: #f5faf7; }
table.data td a:first-child strong { color: var(--water); }
table.data .num { text-align: right; }
table.data.compact td { padding: .45rem .7rem; font-size: .92rem; }
table.data tfoot td { font-weight: 700; background: #f6f9f8; border-top: 2px solid var(--line); }
.sort { color: inherit; text-decoration: none; }
.sort.sorted { color: var(--ink); }
.sort.sorted.asc::after { content: " \2191"; }
.sort.sorted.desc::after { content: " \2193"; }
td.pick, th.pick { width: 2.5rem; }
td.pick input { width: 20px; height: 20px; }
.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 2rem 1rem; text-align: center; color: var(--muted); }

@media (max-width: 760px) {
  .table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; }
  table.data thead { display: none; }
  table.data tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .6rem; padding: .55rem .9rem; box-shadow: var(--shadow); }
  table.data td { border: 0; padding: .2rem 0; display: grid; grid-template-columns: 7.5rem 1fr; gap: .5rem; }
  table.data td::before { content: attr(data-label); color: var(--muted); font-size: .82rem; padding-top: .1rem; }
  table.data td:first-child, table.data td.title { grid-template-columns: 1fr; font-size: 1.05rem; padding-bottom: .35rem; padding-right: 2.5rem; }
  table.data td:first-child::before, table.data td.title::before { display: none; }
  table.data td.pick + td.title { padding-top: 0; }
  table.data td.pick { position: absolute; right: .9rem; top: .75rem; padding: 0; }
  table.data td.pick::before { display: none; }
  table.data tr { position: relative; }
  table.data .num { text-align: left; }
  table.data .hide-sm { display: none; }
  table.data tfoot { display: block; }
}

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-top: 1rem; }
.pager div { display: flex; gap: .25rem; flex-wrap: wrap; }
.pager a, .pager span.current { min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; padding: 0 .6rem; border-radius: var(--radius-s); text-decoration: none; border: 1px solid var(--line); background: var(--surface); }
.pager span.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.count { color: var(--muted); font-size: .9rem; margin: .75rem 0 0; }
.pager .count { margin: 0; }

.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .75rem; padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.bulk-bar > span { font-weight: 600; color: var(--ink); }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: .9rem 1rem; }
.form-grid.inner { padding: 0; }
@media (min-width: 760px) { .form-grid { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: 1 / -1; } }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset > legend { font-weight: 650; color: var(--ink); margin-bottom: .5rem; padding: 0; }
.field label, .field > legend { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; color: var(--ink); }
.req { color: var(--coral); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search]:not(.search-input input), input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  padding: .6rem .7rem; min-height: 44px;
}
.searchbar select, label.inline input { width: auto; }
textarea { resize: vertical; min-height: 88px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--moss); box-shadow: 0 0 0 3px var(--moss-soft); }
input[type=color] { width: 72px; height: 44px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); }
input[type=file] { font: inherit; }
.hint { font-size: .85rem; color: var(--muted); margin: .3rem 0 0; }
.checks { display: grid; gap: .35rem; }
@media (min-width: 760px) { .checks { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } .checks legend, .checks .hint { grid-column: 1 / -1; } }
.check { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .6rem; border-radius: var(--radius-s); cursor: pointer; }
.check:hover { background: var(--moss-soft); }
.check input { width: 20px; height: 20px; margin-top: .1rem; accent-color: var(--moss); flex: none; }
.check span { display: flex; flex-direction: column; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.add-row { align-items: end; }
.field.end { align-self: end; }

.flashes { margin-bottom: 1rem; display: grid; gap: .5rem; }
.flash { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius); border: 1px solid; margin-bottom: 1rem; }
.flashes .flash { margin: 0; }
.flash .i { flex: none; margin-top: 2px; }
.flash-success { background: var(--moss-soft); border-color: #b7d6c4; color: #1d4a35; }
.flash-error { background: var(--coral-soft); border-color: #e9b8ae; color: #7d2717; }

/* ---------- Detail lists ---------- */
.details { margin: 0; display: grid; gap: .55rem; }
.details > div { display: grid; grid-template-columns: 8.5rem 1fr; gap: .75rem; }
.details dt { color: var(--muted); font-size: .9rem; }
.details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.details.compact > div { grid-template-columns: 7.5rem 1fr; }
.summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; margin: 0 0 1rem; }
.summary > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; }
.summary dt { font-size: .82rem; color: var(--muted); }
.summary dd { margin: 0; font-size: 1.2rem; font-weight: 700; color: var(--ink); }

.project-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.project-list a { display: flex; flex-direction: column; gap: .15rem; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.project-list a:hover { border-color: var(--moss); }
.project-list strong { color: var(--ink); }
.project-list span { font-size: .9rem; color: var(--muted); }

/* ---------- Job page ---------- */
.job-layout { display: grid; gap: 1rem; }
@media (min-width: 1000px) { .job-layout { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }
.action-panel { background: var(--surface); border: 2px solid var(--moss); border-radius: var(--radius-l); padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.action-panel .hint { text-align: center; }
.photos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
.photos li { position: relative; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-s); display: block; background: var(--moss-soft); }
.photos form { position: absolute; top: 4px; right: 4px; }
.upload label.btn { position: relative; overflow: hidden; }
.upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.edit-record { margin-top: .75rem; }
.edit-record summary { cursor: pointer; color: var(--water); }
.edit-record form { margin-top: .75rem; }

/* ---------- Calendar ---------- */
.week { display: grid; gap: .75rem; }
@media (min-width: 1100px) { .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; } }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; min-height: 120px; }
.day.today { border-color: var(--moss); box-shadow: inset 0 3px 0 var(--moss); }
.day h3 { margin: 0 0 .5rem; font-size: .9rem; }
.cal-job { display: flex; flex-direction: column; gap: .05rem; padding: .5rem .6rem; border-radius: var(--radius-s); background: #eef1f6; border-left: 4px solid #6b7fa3; text-decoration: none; color: var(--text); margin-bottom: .45rem; font-size: .85rem; }
.cal-job.started { background: var(--sun-soft); border-left-color: var(--sun); }
.cal-job.completed { background: var(--moss-soft); border-left-color: var(--moss); }
.cal-job strong { color: var(--ink); }
.cal-job .time { font-weight: 650; font-size: .8rem; color: var(--muted); }
.cal-job .crew { color: var(--moss-dark); }

/* ---------- Admin ---------- */
.admin-grid { display: grid; gap: .75rem; }
@media (min-width: 700px) { .admin-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); } }
.admin-link { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .8rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.admin-link .i { grid-row: span 2; color: var(--moss); margin-top: 2px; }
.admin-link strong { color: var(--ink); }
.admin-link span { font-size: .88rem; color: var(--muted); }
.admin-link:hover { border-color: var(--moss); }
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs a { padding: .6rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.current { color: var(--ink); border-bottom-color: var(--moss); font-weight: 650; }
.temp-pass { font-size: 1.6rem; font-weight: 700; letter-spacing: .04em; background: var(--moss-soft); padding: .75rem 1rem; border-radius: var(--radius); text-align: center; user-select: all; }
.report-form { display: grid; gap: .75rem; }
@media (min-width: 900px) { .report-form { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; } }
.report-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; margin: 1.5rem 0 1rem; }
.section { margin: 1.25rem 0 .6rem; font-size: 1rem; color: var(--muted); font-weight: 650; }

/* ---------- Sign in & public pages ---------- */
.auth, .public { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.is-bare .main:has(.auth), .is-bare .main:has(.public) { padding: 0; max-width: none; }
.auth { background: radial-gradient(ellipse at 20% 0%, #d8e9e0 0, transparent 55%), radial-gradient(ellipse at 100% 100%, #d4e4ea 0, transparent 50%); }
.auth-card, .public-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 2rem 1.5rem; box-shadow: 0 12px 40px rgba(23,58,51,.12); }
.public-card { max-width: 520px; }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand img { max-height: 70px; }
.auth-brand h1 { margin: .5rem 0 0; font-size: 1.7rem; }
.auth-brand p { color: var(--muted); margin: 0; }
.public-head { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; color: var(--ink); font-size: 1.1rem; }
.public-head img { max-height: 56px; }
.public-card .stars { margin: .25rem 0 .75rem; }

/* ---------- Print ---------- */
.print-page { max-width: 820px; margin: 0 auto; }
.print-copy { background: #fff; border: 1px solid #999; padding: 1rem 1.25rem; margin-bottom: 1rem; font-size: .9rem; }
.print-copy header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #333; padding-bottom: .5rem; margin-bottom: .75rem; }
.print-copy header div { display: flex; flex-direction: column; }
.print-company { font-size: 1.15rem; }
.print-jo { text-align: right; }
.print-jo strong { font-size: 1.3rem; }
.print-grid { width: 100%; border-collapse: collapse; }
.print-grid th, .print-grid td { border: 1px solid #bbb; padding: .35rem .5rem; text-align: left; vertical-align: top; }
.print-grid th { width: 16%; background: #f3f3f3; font-weight: 600; }
.print-checks { margin: .75rem 0; }
.print-sign { display: flex; gap: 2rem; margin-top: 2.5rem; }
.print-sign div { flex: 1; border-top: 1px solid #333; padding-top: .3rem; font-size: .85rem; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .tabbar, .no-print, .flashes, .searchbar, .report-form, .actions, .pager { display: none !important; }
  .has-nav { display: block; }
  .main { padding: 0; max-width: none; }
  .print-copy { break-inside: avoid; border-color: #555; }
  .table-wrap, .card, .summary > div { box-shadow: none; }
  table.data td, table.data th { font-size: 10pt; padding: 3px 6px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.public-card .details { margin: 1rem 0 1.25rem; }
.field label.check { display: flex; font-weight: 500; font-size: 1rem; margin: 0; color: var(--text); }
.field label.check small { font-weight: 400; }

/* ---------- Demo mode ---------- */
.demo-banner { display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .45rem 1rem; background: var(--sun-soft); color: #5e4300; font-size: .85rem; text-align: center; border-bottom: 1px solid #ecd391; }
.demo-banner a { color: inherit; font-weight: 600; }
.has-nav.is-demo { grid-template-rows: auto 1fr; }
.has-nav.is-demo .demo-banner { grid-column: 1 / -1; }
.demo-logins { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.demo-logins h2 { font-size: 1rem; margin-bottom: .2rem; }
.demo-logins ul { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .5rem; }
.demo-logins li { display: flex; align-items: center; gap: .75rem; }
.demo-logins li span { display: flex; flex-direction: column; line-height: 1.3; }

/* ---------- Appearance editor ---------- */
.appearance { display: grid; gap: 1rem; }
@media (min-width: 1000px) { .appearance { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } .appearance .preview-col { position: sticky; top: 1rem; } }
.presets { display: flex; flex-wrap: wrap; gap: .5rem; }
.preset { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .75rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); cursor: pointer; font: inherit; font-size: .9rem; }
.preset i { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
.preset:hover { border-color: var(--moss); }
.color-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.color-field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; color: var(--ink); }
.color-field .pair { display: flex; gap: .4rem; align-items: center; }
.color-field .pair input[type=text] { font-family: ui-monospace, monospace; }
.radio-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.radio-row label { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border: 1px solid var(--line-strong); border-radius: var(--radius-s); cursor: pointer; background: var(--surface); }
.radio-row input { accent-color: var(--moss); }
.preview { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); box-shadow: var(--shadow); }
.preview-bar { background: var(--sidebar); color: var(--sidebar-strong); padding: .7rem 1rem; display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.preview-bar img { height: 26px; background: #fff; padding: 2px 5px; border-radius: var(--radius-s); }
.preview-nav { background: var(--sidebar); padding: 0 .5rem .6rem; display: flex; gap: .25rem; flex-wrap: wrap; }
.preview-nav span { padding: .3rem .6rem; border-radius: var(--radius-s); color: var(--sidebar-text); font-size: .85rem; }
.preview-nav span.on { background: var(--sidebar-active); color: var(--sidebar-strong); box-shadow: inset 3px 0 0 var(--sidebar-accent); }
.preview-body { padding: 1rem; display: grid; gap: .75rem; }
.preview-body .card { margin: 0; }
.logo-now { display: flex; align-items: center; gap: .75rem; }
.logo-now img { max-height: 48px; max-width: 180px; background: #fff; border: 1px solid var(--line); padding: 4px 8px; border-radius: var(--radius-s); }
.mail-text { font-family: inherit; font-size: .92rem; margin: .75rem 0 0; background: var(--paper); padding: .75rem; border-radius: var(--radius-s); }
details.card > summary { cursor: pointer; }
.demo-banner .i { flex: none; }
.gmail-help ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .5rem; }
.gmail-help { font-size: .95rem; }
[hidden] { display: none !important; }
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; max-width: 12rem; }
.secret-key { font-family: ui-monospace, monospace; font-size: 1.15rem; letter-spacing: .08em; background: var(--moss-soft); padding: .6rem .9rem; border-radius: var(--radius-s); word-break: break-all; user-select: all; }
.recovery-codes { columns: 2; font-family: ui-monospace, monospace; font-size: 1.05rem; background: var(--paper); padding: .9rem 1.2rem; border-radius: var(--radius-s); list-style: none; margin: 0; }
.finding { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.finding:last-child { border-bottom: 0; }
.finding .badge { flex: none; }
.steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .75rem; }
.steps .secret-key { margin: .4rem 0; }
