:root {
  --bg: #f3f1ec; --surface: #ffffff; --ink: #1c1f24; --muted: #6b6f76; --line: #e2ded5;
  --primary: #1f4e79; --primary-ink: #fff; --ok: #2f7d4f; --danger: #b23a2b; --warn: #c7811b;
  --elec: #e0a106; --mech: #2f6fb0; --civil: #8a5a33;
  --radius: 8px;
  --nav-ink: oklch(1 0 0); --nav-muted: oklch(.85 .008 260); --nav-line: oklch(1 0 0 / 20%);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 'IBM Plex Sans', system-ui, sans-serif; }
h1, h2, h3 { font-family: 'Archivo', sans-serif; letter-spacing: 0; margin: 0 0 .5rem; }
h1 { font-size: 1.8rem; font-weight: 800; } h2 { margin-top: 2rem; font-size: 1.2rem; } h3 { font-size: 1rem; }
a { color: var(--primary); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .75rem 1.5rem; background: var(--ink); color: #fff; }
.brand { color: #fff; text-decoration: none; font-family: 'Archivo'; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.brand-mark { background: var(--elec); color: var(--ink); padding: .15rem .45rem; border-radius: 4px; font-weight: 800; }
.topbar nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar nav a { color: #cfd3d8; text-decoration: none; font-weight: 500; }
.topbar nav a.on, .topbar nav a:hover { color: #fff; }
.who { color: #9aa0a6; font-size: .85rem; margin-left: auto; }
.topbar nav .ico { display: none; }
.link { background: none; border: 0; color: #cfd3d8; cursor: pointer; font: inherit; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.card.highlight { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,78,121,.08); }
.card.narrow { max-width: 440px; margin: 2rem auto; } .card.wide { max-width: 640px; }
.card.empty { color: var(--muted); text-align: center; padding: 2rem; }
.auth { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 3rem; align-items: center; min-height: 70vh; }
.auth h1 { font-size: 2.8rem; line-height: 1.05; }
@media (max-width: 800px) { .auth { grid-template-columns: 1fr; gap: 1rem; } .auth h1 { font-size: 2rem; } }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--muted); font-weight: 600; margin: 0 0 .25rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: .75rem; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
form > input, form > select, form > textarea { margin-bottom: .6rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.btn { display: inline-block; padding: .6rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 .9rem 'IBM Plex Sans'; cursor: pointer; text-decoration: none; text-align: center; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.full { width: 100%; margin-top: .4rem; } .btn.small { padding: .3rem .7rem; font-size: .8rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; }
.flash.success { background: #e3f1e8; color: var(--ok); } .flash.error { background: #f8e3df; color: var(--danger); }
.tabs { display: flex; gap: .25rem; background: var(--bg); padding: .25rem; border-radius: 8px; margin-bottom: 1rem; }
.tabs button { flex: 1; border: 0; background: none; padding: .5rem; border-radius: 6px; font: 600 .9rem 'IBM Plex Sans'; cursor: pointer; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--ink); }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #faf9f6; }
.table tr.click { cursor: pointer; } .table tr.click:hover { background: #faf9f6; }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #eceae4; color: var(--ink); margin-right: .25rem; white-space: nowrap; }
.st-open { background: #e6eef7; color: var(--primary); } .st-assigned, .st-accepted { background: #fff1d6; color: #8a5a00; }
.st-in_progress { background: #e1ecfb; color: #1d4f91; } .st-completed { background: #e3f1e8; color: var(--ok); }
.st-not_completed, .st-rejected, .st-alert { background: #f8e3df; color: var(--danger); } .st-closed { background: #e6e6e6; color: #555; }
.dept { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .1rem .45rem; border-radius: 4px; border-left: 3px solid; background: #f5f3ee; }
.d-electrical { border-color: var(--elec); } .d-mechanical { border-color: var(--mech); } .d-civil { border-color: var(--civil); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.meta { display: grid; grid-template-columns: 140px 1fr; gap: .3rem 1rem; margin: 1rem 0; } .meta dt { color: var(--muted); } .meta dd { margin: 0; }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.thumbs img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.ack { display: grid; grid-template-columns: 180px 1fr; gap: 1rem; } .ack img { width: 100%; border-radius: 8px; }
.inline { display: flex; gap: .5rem; flex-wrap: wrap; } .inline input { flex: 1; min-width: 140px; margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { padding: 0 0 .9rem 1rem; position: relative; } .timeline li::before { content: ''; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.timeline strong { text-transform: capitalize; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 1rem; }
.card.job { text-decoration: none; color: inherit; } .card.job:hover { border-color: var(--primary); } .card.job .row { display: flex; justify-content: space-between; margin-bottom: .5rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; text-decoration: none; color: inherit; }
.stat b { display: block; font: 800 1.6rem 'Archivo'; } .stat span { font-size: .8rem; color: var(--muted); }
.stat.alert b { color: var(--danger); }
.filters { display: flex; gap: .5rem; align-items: end; margin-bottom: 1rem; flex-wrap: wrap; } .filters select, .filters input { width: auto; margin: 0; } .filters label { margin: 0; }
.staff-list { list-style: none; padding: 0; margin: 0; } .staff-list li { display: flex; gap: .7rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line); } .staff-list li > div { flex: 1; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .3rem; flex-shrink: 0; }
.dot.available { background: var(--ok); } .dot.in_work { background: var(--warn); } .dot.checked_out { background: #999; } .dot.absent { background: #d6d2c8; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }

/* Responsive navigation and content */
[hidden] { display: none !important; }
.topbar { gap: .75rem; }
.brand { min-width: 0; overflow-wrap: anywhere; }
.brand-mark { flex-shrink: 0; }
.topbar a:focus-visible, .topbar .link:focus-visible { outline: 2px solid var(--elec); outline-offset: 3px; }
.topbar nav a, .topbar .link { min-height: 44px; display: inline-flex; align-items: center; }
.who { overflow-wrap: anywhere; }
.wrap, .layout > *, .auth > *, .grid2 > *, .ack > *, .staff-list li > div { min-width: 0; }
h1, h2, h3, p, dd, .timeline li, .staff-list strong { overflow-wrap: anywhere; }
img { max-width: 100%; }
input, select, textarea { max-width: 100%; }
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: var(--radius); }
.table-scroll:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.table-scroll .table { min-width: 620px; border: 0; }
.table td { overflow-wrap: anywhere; max-width: 280px; }
.card.job .row { gap: .5rem; flex-wrap: wrap; }
.btn { min-height: 44px; }
.btn.small { display: inline-flex; align-items: center; justify-content: center; }
.filters select { max-width: 100%; }
@media (max-width: 800px) {
  .topbar { padding: .65rem 1rem; }
  .brand { flex: 1; }
  .who { margin-left: 0; font-size: .78rem; text-align: right; }
  .topbar nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    flex-basis: auto; flex-direction: row; align-items: stretch; gap: .15rem;
    margin: 0; padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom));
    background: var(--ink); border-top: 1px solid var(--nav-line);
    box-shadow: 0 -2px 14px rgb(0 0 0 / 25%);
  }
  .topbar nav a, .topbar nav form { flex: 1 1 0; min-width: 0; }
  .topbar nav a, .topbar nav .link {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .15rem; min-height: 54px; padding: .3rem .15rem; border-radius: 8px;
    font-size: .7rem; font-weight: 600; line-height: 1.15; text-align: center; width: 100%;
  }
  .topbar nav .ico { display: block; }
  .topbar nav a.on { background: var(--nav-line); color: #fff; }
  .topbar nav a.on .ico { color: var(--elec); }
  .wrap { padding: 1rem 1rem 6rem; }
  .auth { min-height: auto; padding-top: 1rem; }
}
@media (max-width: 560px) {
  h1 { font-size: 1.5rem; }
  .auth h1 { font-size: 2rem; }
  .grid2, .ack { grid-template-columns: minmax(0, 1fr); }
  .ack > a { max-width: 280px; }
  .meta { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .meta dd { margin-bottom: .65rem; }
  .card { padding: 1rem; }
  .card.narrow { margin: 1rem auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .head-row { align-items: flex-start; }
  .head-row > .btn { width: 100%; }
  .filters { align-items: stretch; }
  .filters > select, .filters > label, .filters > button { flex: 1 1 100%; width: 100%; }
  .filters input, .filters select { width: 100%; }
  .inline input { flex-basis: 100%; min-width: 0; }
  input, select, textarea { font-size: 16px; }
}

.table .dept { white-space: nowrap; }
