/* ConsCem Timesheet – engineering-office look: blueprint ink, steel paper, one signal colour (amber) for "needs action" */
:root {
  --ink: #16283A;          /* sidebar, headings */
  --ink-2: #2B3E52;
  --text: #1C2731;
  --muted: #66778A;
  --paper: #F3F5F7;        /* canvas */
  --sheet: #FFFFFF;        /* surfaces */
  --line: #DCE2E8;
  --line-2: #EBEFF3;
  --blue: #1E6BB8;         /* actions, links */
  --blue-soft: #E8F1FA;
  --amber: #D98E0B;        /* needs action – the one loud colour */
  --amber-soft: #FDF3DF;
  --green: #2E7D4F;
  --green-soft: #E5F3EA;
  --red: #C0392B;
  --red-soft: #FBE9E7;
  --head: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Segoe UI Variable Display", system-ui, sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --r-sm: 5px;
  --r: 8px;
  --r-lg: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.45 var(--body); color: var(--text); background: var(--paper);
       font-variant-numeric: tabular-nums; }
a { color: var(--blue); }
h1, h2, h3, .heading, .big, .kpi b, .brand { font-family: var(--head); letter-spacing: .1px; }
h1 { font-size: 22px; margin: 4px 0 14px; color: var(--ink); font-weight: 600; }
h2 { font-size: 16px; margin: 26px 0 10px; color: var(--ink); font-weight: 600; }
h2:first-child { margin-top: 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.side { width: 236px; flex: 0 0 236px; background: var(--ink); color: #C9D4DF; display: flex; flex-direction: column;
        position: sticky; top: 0; height: 100vh; }
.side .brand { padding: 20px 20px 16px; font-size: 18px; color: #fff; font-weight: 600; }
.side .brand span { color: #8FB4D9; font-weight: 400; }
.side .brand small { display: block; font: 12px var(--body); color: #8597AA; margin-top: 3px; }
.side nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.side .grp { font-size: 12px; color: #7F92A6; margin: 18px 10px 6px; }
.side nav a { display: flex; align-items: center; gap: 11px; color: #C9D4DF; text-decoration: none; padding: 8px 10px;
              border-radius: var(--r); font-size: 14px; margin-bottom: 1px; position: relative; }
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.on { background: rgba(143,180,217,.16); color: #fff; }
.side nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #8FB4D9; }
.side nav a svg { flex: 0 0 18px; opacity: .85; }
.side nav .count { margin-left: auto; background: var(--amber); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 7px; line-height: 18px; }
.side .who { display: flex; gap: 10px; align-items: center; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12.5px; }
.side .who b { color: #fff; font-size: 13px; font-weight: 600; }
.side .who a { color: #8FB4D9; text-decoration: none; }
.side .who a:hover { text-decoration: underline; }
.side .avatar { width: 34px; height: 34px; border-radius: 50%; background: #2B4A68; color: #fff; display: flex; align-items: center;
                justify-content: center; font: 600 12px var(--head); flex: 0 0 34px; }
.mainwrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: blur(6px);
          border-bottom: 1px solid var(--line); padding: 10px 28px; display: flex; align-items: center; gap: 16px;
          flex-wrap: wrap; min-height: 64px; }
.topbar .titles { min-width: 0; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 1px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--blue); text-decoration: underline; }
.crumbs .sl { margin: 0 6px; opacity: .6; }
.topbar .heading { font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.topbar .heading .muted { font: 400 14px var(--body); }
.topbar .toolbar { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.topbar .toolbar form { display: flex; gap: 8px; align-items: center; margin: 0; }
.topbar .toolbar .sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
main { width: 100%; max-width: 1320px; padding: 22px 28px 60px; }
.plain { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.plain main { max-width: 680px; padding: 0; }
.brand-plain { font: 600 24px var(--head); color: var(--ink); margin-bottom: 18px; text-align: center; }
.brand-plain span { color: var(--blue); font-weight: 400; }

/* ---------- surfaces ---------- */
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 16px; }
.card.tight { padding: 12px 16px; }
.card > h2:first-child { margin-top: 0; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.bar .spacer, .spacer { flex: 1; }
.muted { color: var(--muted); font-size: 12.5px; }
.note { background: var(--blue-soft); border-radius: var(--r); padding: 10px 14px; font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.grid input, .grid select, .grid textarea { width: 100%; }
.grid .wide { grid-column: span 2; }
.grid > * { min-width: 0; }
input, select, textarea { max-width: 100%; }
.login { max-width: 400px; margin: 0 auto; }
.login input:not([type=checkbox]) { width: 100%; margin-bottom: 12px; }
.login button { width: 100%; }

/* ---------- tables ---------- */
.tablewrap { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: auto; margin-bottom: 16px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--sheet); }
th, td { padding: 8px 10px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line-2); }
th { background: #F7F9FB; font-weight: 600; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tablewrap th { position: sticky; top: 0; z-index: 1; }
tbody tr:hover td, table tr:hover > td { background-color: #FAFBFD; }
table:not(.tablewrap table) { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.weekend td { background: #F8F9FA; color: var(--muted); }
tr.newweek td { border-top: 2px solid #BBD0E4; }
tr.prefill td { background: #FFFBF0; }
tr.locked td { color: var(--muted); }
tr.total td, tr.total th { background: #F2F5F8; font-weight: 600; border-top: 1px solid var(--line); }
tr.weekrow td { background: #F2F5F8; font-size: 13px; }
tr.today td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
tr.future td { opacity: .55; }
tr.edited td { background: #EEF5FC; }

/* ---------- controls ---------- */
input, select, textarea { font: inherit; color: var(--text); padding: 7px 9px; border: 1px solid #C3CED9; border-radius: var(--r-sm);
                          background: #fff; min-height: 34px; }
input:hover, select:hover, textarea:hover { border-color: #9FB0C2; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,107,184,.15); }
input:disabled, select:disabled { background: #F2F4F6; color: var(--muted); border-color: var(--line); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 16px; height: 16px; accent-color: var(--blue); vertical-align: middle; }
input[type=file] { padding: 5px; }
input[type=month] { min-height: 34px; }
input.hhmm { width: 66px; text-align: center; padding: 6px 4px; }
input.hhmm:invalid { border-color: var(--red); background: var(--red-soft); }
input.desc { width: 100%; min-width: 180px; }
input.small { width: 92px; }
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--text); margin: 4px 0; cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0; }

.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--blue); color: #fff;
               border: 1px solid var(--blue); border-radius: var(--r-sm); padding: 7px 14px; font: 600 13.5px var(--body);
               cursor: pointer; text-decoration: none; min-height: 34px; white-space: nowrap; }
.btn:hover, button:hover { background: #185A9C; border-color: #185A9C; }
.btn.grey, button.grey, .btn.secondary, button.secondary { background: #fff; color: var(--ink-2); border-color: #C3CED9; }
.btn.grey:hover, button.grey:hover, .btn.secondary:hover, button.secondary:hover { background: #F2F5F8; border-color: #9FB0C2; }
.btn.ghost, button.ghost { background: transparent; color: var(--ink-2); border-color: transparent; font-weight: 500; }
.btn.ghost:hover, button.ghost:hover { background: #EEF2F6; }
.btn.icon { padding: 6px 10px; font-size: 18px; line-height: 1; }
.btn.green, button.green { background: var(--green); border-color: var(--green); }
.btn.green:hover, button.green:hover { background: #256641; border-color: #256641; }
.btn.red, button.red { background: #fff; color: var(--red); border-color: #E7B7B1; }
.btn.red:hover, button.red:hover { background: var(--red-soft); }
.btn.small, button.small { padding: 4px 10px; font-size: 12.5px; min-height: 28px; }
.btn.dirty, button.dirty { box-shadow: 0 0 0 3px rgba(217,142,11,.35); }
button:disabled, .btn.disabled { opacity: .5; cursor: default; pointer-events: none; }

.monthnav { display: inline-flex; align-items: center; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 2px; }
.monthnav input[type=month] { border: 0; min-height: 30px; padding: 3px 6px; font-weight: 600; background: transparent; }
.monthnav input[type=month]:focus { box-shadow: none; }

/* ---------- status & feedback ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
       background: #EEF1F4; color: #4A5B6C; white-space: nowrap; line-height: 20px; }
.tag.ok { background: var(--green-soft); color: var(--green); }
.tag.warn { background: var(--amber-soft); color: #94600A; }
.tag.err { background: var(--red-soft); color: var(--red); }
.tag.info { background: var(--blue-soft); color: #1A5A99; }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r); margin-bottom: 12px; font-size: 13.5px; border: 1px solid; }
.flash.ok { background: var(--green-soft); color: #1F5937; border-color: #BFE0CB; }
.flash.error { background: var(--red-soft); color: #8E2A1F; border-color: #F0C3BC; }
.flash .x { margin-left: auto; background: none; border: 0; color: inherit; font-size: 18px; line-height: 1; padding: 0 4px; min-height: 0; cursor: pointer; }
.flash.hide { opacity: 0; transition: opacity .4s; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); background: var(--sheet); border: 1px dashed #C9D3DD; border-radius: var(--r-lg); }
.empty-title { font: 600 16px var(--head); color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 10px; }

/* ---------- numbers ---------- */
.big { font-size: 22px; font-weight: 600; color: var(--ink); }
.totals { font-size: 15px; font-weight: 600; }
.money { color: var(--blue); }
.kpis { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-end; }
.kpi { display: flex; flex-direction: column; }
.kpi > span { font-size: 12px; color: var(--muted); }
.kpi b { font-size: 20px; font-weight: 600; color: var(--ink); }
.kpi.main b { font-size: 26px; color: var(--ink); }

/* ---------- settlement track: hours submitted -> checked -> attachment ---------- */
.track { display: flex; align-items: center; gap: 0; font-size: 12.5px; }
.track .st { display: flex; align-items: center; gap: 7px; color: var(--muted); white-space: nowrap; }
.track .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #C3CED9; background: #fff; display: flex; align-items: center;
              justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex: 0 0 20px; }
.track .ln { width: 28px; height: 2px; background: #D3DCE5; margin: 0 8px; flex: 0 0 28px; }
.track .st.done { color: var(--green); }
.track .st.done .dot { background: var(--green); border-color: var(--green); }
.track .st.now { color: #94600A; font-weight: 600; }
.track .st.now .dot { border-color: var(--amber); background: var(--amber-soft); box-shadow: 0 0 0 3px rgba(217,142,11,.15); }
.track .ln.done { background: var(--green); }

/* home: client rows */
.client-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 150px; grid-template-areas: "name amount go" "track track go";
              gap: 10px 18px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.client-row:last-child { border-bottom: 0; }
.client-row > .who { grid-area: name; min-width: 0; }
.client-row > .trackcell { grid-area: track; }
.client-row > .amount { grid-area: amount; }
.client-row > .go { grid-area: go; }
.client-row .name { font: 600 16px var(--head); color: var(--ink); text-decoration: none; }
.client-row .name:hover { color: var(--blue); }
.client-row .people { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.client-row .amount { text-align: right; font: 600 17px var(--head); color: var(--ink); line-height: 1.2; }
.client-row .amount small { display: block; font: 12.5px var(--body); color: var(--muted); }
.client-row .go { text-align: right; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.todo li:last-child { border-bottom: 0; }
.todo .mark { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex: 0 0 8px; }
.todo .mark.ok { background: var(--green); }
.todo .mark.err { background: var(--red); }
.todo li .btn { margin-left: auto; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.layout-2.side-400 { grid-template-columns: minmax(0, 1fr) 400px; }

/* person rows on the client page */
.prow { border-bottom: 1px solid var(--line-2); }
.prow:last-child { border-bottom: 0; }
.prow-main { display: grid; grid-template-columns: 28px minmax(170px, 1.4fr) 80px 110px 100px 120px minmax(140px, 1fr) 170px; gap: 12px;
             align-items: center; padding: 12px 18px; }
.prow-main .who b { font-weight: 600; }
.prow-main .n { text-align: right; }
.prow details { padding: 0 18px 14px 58px; }
.prow summary { cursor: pointer; color: var(--blue); font-size: 13px; font-weight: 600; width: max-content; }
.prow.idle { opacity: .6; }
.sumbar { position: sticky; bottom: 0; z-index: 10; background: var(--ink); color: #fff; border-radius: var(--r-lg); padding: 12px 18px;
          display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-top: 14px; box-shadow: 0 -6px 18px rgba(22,40,58,.12); }
.sumbar .kpi > span { color: #9FB3C7; }
.sumbar .kpi b { color: #fff; }

/* subcontractor timesheet */
.ts input.desc { min-width: 220px; }
.ts td input, .ts td select, .tablewrap td input, .tablewrap td select { min-height: 30px; padding-top: 4px; padding-bottom: 4px; }
.ts tr.locked td { color: var(--ink-2); }
.ts tr.weekrow td { border-bottom: 1px solid var(--line); }
.ts td.daycell { white-space: nowrap; }
.ts .dname { font-weight: 600; display: inline-block; width: 34px; }
.ts tr.weekrow td { padding: 7px 10px; }
.ts tr.weekrow .wk { font-weight: 600; color: var(--ink); }
.ts .weekacts { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.ts .h-cell { font-weight: 600; }
.savebar { display: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; border: 1px solid var(--line); }

/* misc */
.meter { height: 8px; background: #E7ECF1; border-radius: 4px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--blue); border-radius: 4px; }
.meter.near span { background: var(--amber); }
.meter.over span { background: var(--red); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.weeks { display: flex; gap: 8px; flex-wrap: wrap; }
.weeks .w { border: 1px solid var(--line); background: #fff; border-radius: var(--r); padding: 8px 10px; font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.ccard { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; color: inherit; text-decoration: none; }
details summary { cursor: pointer; color: var(--blue); font-weight: 600; }
code { background: #EEF2F6; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.diff-old { color: var(--red); text-decoration: line-through; }
.diff-new { color: var(--green); }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 13.5px; }
.tabs a:hover { background: #EEF2F6; }
.tabs a .n { color: var(--muted); font-weight: 400; margin-left: 4px; }
.section-anchor { scroll-margin-top: 80px; }

/* ---------- small screens: technicians on site use phones ---------- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .side { width: auto; height: auto; position: sticky; top: 0; z-index: 30; flex: none; flex-direction: row; align-items: center; }
  .side .brand { padding: 10px 14px; font-size: 15px; white-space: nowrap; }
  .side .brand small { display: none; }
  .side nav { display: flex; overflow-x: auto; padding: 6px; flex: 1; }
  .side nav a { padding: 7px 10px; white-space: nowrap; }
  .side nav a.on::before { display: none; }
  .side .grp, .side .who { display: none; }
  .topbar { position: static; padding: 10px 14px; min-height: 0; }
  .topbar .toolbar { margin-left: 0; width: 100%; }
  main { padding: 14px 12px 90px; }
  .layout-2, .layout-2.side-400 { grid-template-columns: 1fr; }
  .first-sm { order: -1; }
  .client-row { grid-template-columns: 1fr auto; grid-template-areas: "name amount" "track track" "go go"; }
  .client-row .track { overflow-x: auto; }
  .client-row .go { text-align: left; }
  .prow-main { grid-template-columns: 24px 1fr auto; }
  .prow-main .hide-sm { display: none; }
  .prow details { padding-left: 14px; }
  .grid .wide { grid-column: auto; }
}
@media (max-width: 760px) {
  /* timesheet rows become cards */
  .ts, .ts tbody, .ts tr, .ts td { display: block; width: 100%; }
  .ts thead, .ts tr.head { display: none; }
  .ts { border: 0; background: transparent; }
  .ts tr.day { background: #fff; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; padding: 10px 12px;
               display: grid; grid-template-columns: 1fr auto auto; gap: 8px 10px; align-items: center; }
  .ts tr.day td { border: 0; padding: 0; background: transparent !important; }
  .ts tr.day td.daycell { grid-column: 1; }
  .ts tr.day td.typecell { grid-column: 2; }
  .ts tr.day td.h-cell { grid-column: 3; text-align: right; min-width: 44px; }
  .ts tr.day td.t1, .ts tr.day td.t2 { grid-column: span 3; display: flex; align-items: center; gap: 6px; }
  .ts tr.day td.t1::before { content: "Morning"; width: 70px; font-size: 12px; color: var(--muted); }
  .ts tr.day td.t2::before { content: "Afternoon"; width: 70px; font-size: 12px; color: var(--muted); }
  .ts tr.day td.t1 input, .ts tr.day td.t2 input { flex: 1; width: auto; min-width: 0; }
  .ts tr.day.locked td.t1:empty, .ts tr.day.locked td.t2:empty { display: none; }
  .hide-sm { display: none !important; }
  .ts tr.day td.ot-cell { display: none; }
  .ts tr.day td.desccell { grid-column: span 3; }
  .ts tr.day td.desccell input { min-width: 0; }
  .ts tr.day.empty-day td.t1, .ts tr.day.empty-day td.t2, .ts tr.day.empty-day td.desccell { display: none; }
  .ts tr.day.empty-day { padding: 6px 12px; background: #F8F9FA; }
  .ts tr.today { border-color: var(--blue); box-shadow: inset 3px 0 0 var(--blue); }
  .ts tr.weekrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: transparent; margin: 14px 0 8px; }
  .ts tr.weekrow td { border: 0; padding: 0; background: transparent !important; width: auto; }
  .ts tr.total { display: none; }
  .savebar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid var(--line);
             padding: 10px 14px; gap: 10px; align-items: center; box-shadow: 0 -4px 14px rgba(22,40,58,.08); }
  .savebar button { flex: 1; min-height: 44px; font-size: 15px; }
  input, select { min-height: 40px; font-size: 16px; }   /* no zoom-in on iPhone */
  /* expense list as cards */
  table.exp thead { display: none; }
  table.exp, table.exp tbody, table.exp tfoot { display: block; }
  table.exp tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "what amt" "date st" "rec act";
                 gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  table.exp td { border: 0; padding: 0; }
  table.exp .c-what { grid-area: what; } table.exp .c-amt { grid-area: amt; } table.exp .c-date { grid-area: date; color: var(--muted); }
  table.exp .c-st { grid-area: st; text-align: right; } table.exp .c-rec { grid-area: rec; } table.exp .c-act { grid-area: act; }
  table.exp tfoot tr { display: block; } table.exp tfoot td { display: inline; } table.exp tfoot td + td { margin-left: 8px; }
  input.hhmm { width: auto; }
}
@media print {
  .side, .topbar .toolbar, .savebar, .flash { display: none !important; }
  .topbar { position: static; border: 0; }
  body { background: #fff; }
}
