/* Light theme — neutral greys, hairline borders, the refa red as the only accent.
   IBM Plex Sans is served from /static/fonts (no third-party font requests). */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/ibm-plex-sans-latin-400.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/ibm-plex-sans-latin-500.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/ibm-plex-sans-latin-600.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/ibm-plex-sans-latin-700.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/ibm-plex-sans-latin-ext-400.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/ibm-plex-sans-latin-ext-500.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/ibm-plex-sans-latin-ext-600.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/ibm-plex-sans-latin-ext-700.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #f7f7f5;
  --card: #ffffff;
  --ink: #0b0b0c;
  --muted: #62626a;
  --faint: #a1a1a8;
  --line: #e3e3e0;
  --line-2: #d4d4d0;
  --accent: #c8102e;
  --accent-d: #9e0b23;
  --green: #12924f;
  --red: #dc2626;
  --amber: #e0a83a;
  --sky: #0ea5e9;
  --brand: #c8102e;
  --brand-d: #9e0b23;
  --brand-tint: #fdecee;
  --travel: #3f4a5a;
  --travel-tint: #eef0f3;
  --panel: #fafaf9;
  --raise: #fafaf9;
  --hover: #f4f4f2;
  --box-line: var(--line);
  --input-border: #d4d4d0;
  --btn-sec: #ffffff;
  --btn-sec-h: #f4f4f2;
  --radius: 4px;
  --sidebar: 232px;
  --scrim: rgba(244, 246, 248, 0.5);
  --scrim-login: rgba(244, 246, 248, 0.4);
  --s1: 0 1px 2px rgba(16, 24, 40, .05);
  --s2: 0 6px 20px rgba(16, 24, 40, .08);
}

/* Shared line-icon sizing (crisp SVG icons instead of emoji). */
.ico { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; display: block; flex: 0 0 auto; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: transparent;
  color: var(--ink);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}
/* Flat page background on a fixed layer (works reliably on mobile). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg);
}
@media print { body::before { display: none; } }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar on phones; on desktop the same markup becomes the left sidebar
   (see "Sidebar" below). */
.topbar {
  display: flex; align-items: center; gap: 1.2rem;
  background: var(--card); color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top) 1.2rem 0; min-height: 56px;
}
.brand { flex-shrink: 0; display: flex; align-items: center; }
.brand a { display: flex; align-items: center; }
.brand a:hover { text-decoration: none; }
.brand-logo { height: 25px; width: auto; display: block; }
/* Worker profile avatar (mobile only) — quick access to account. */
.topava { display: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--ink); color: #fff; place-items: center;
  font-weight: 700; font-size: .78rem; text-decoration: none; flex: 0 0 auto; }
.topava:hover { text-decoration: none; opacity: .9; }
.navmenu { display: flex; align-items: center; gap: 1.2rem; flex: 1; }
.mainnav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.mainnav a {
  display: flex; align-items: center; gap: .7rem;
  color: #3f3f46; padding: .45rem .65rem; border-radius: 3px; font-size: .92rem; font-weight: 500;
}
.mainnav a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.mainnav a.on { background: #f1f1ef; color: var(--ink); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent); }
.mainnav a .ico { width: 17px; height: 17px; stroke-width: 1.6; color: #71717a; }
.mainnav a.on .ico { color: var(--accent); }
.mainnav a .nav-dot { margin-left: auto; }
.mainnav .nav-sect { font-size: .7rem; font-weight: 600; color: var(--faint); text-transform: uppercase;
  letter-spacing: .06em; padding: 1.1rem .65rem .35rem; }
/* Hamburger toggle — hidden on desktop, shown on mobile via media query. */
.navtoggle { display: none; }
.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer;
  padding: .5rem; margin-left: auto; }
.hamburger span { display: block; width: 24px; height: 2px; background: var(--ink);
  border-radius: 2px; transition: transform .2s, opacity .2s; }
/* Red "something new" markers in the header / tab bar (nav_dots). */
.nav-dot { display: inline-block; min-width: 1.15rem; height: 1.15rem; margin-left: .35rem;
  padding: 0 .3rem; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: .68rem; font-weight: 700; line-height: 1.15rem; text-align: center;
  vertical-align: .1em; }
.hamburger { position: relative; }
.menu-dot, .tab-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: #dc2626; box-shadow: 0 0 0 2px var(--card, #fff); }
.menu-dot { top: 2px; right: 0; }
.tab-dot { top: 0; left: calc(50% + 6px); }
#navtoggle:checked ~ .hamburger .menu-dot { display: none; }
.userbox .lbl { display: none; }
.userbox { display: flex; align-items: center; gap: .6rem; font-size: .88rem; }
.langswitch { display: inline-flex; gap: .15rem; }
.langswitch a { color: var(--muted); font-size: .72rem; font-weight: 700; padding: .1rem .3rem;
  border-radius: 4px; }
.langswitch a.on { background: var(--ink); color: #fff; }
.foot .on { font-weight: 700; }
.userbox .uname { color: var(--ink); font-weight: 600; }
.userbox a { color: var(--ink); }
.role { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em;
  padding: .1rem .4rem; border-radius: 3px; font-weight: 600; border: 1px solid var(--line); }
/* Download dropdown that looks like a secondary button (overview exports). */
.dl-select {
  font: inherit; font-size: .85rem; font-weight: 600;
  padding: .45rem .7rem; border-radius: 3px;
  border: 1px solid var(--line-2); background: var(--btn-sec); color: var(--ink);
  cursor: pointer; max-width: 17rem; vertical-align: middle;
}
.dl-select:hover { background: var(--btn-sec-h); }

.role-admin { background: #f4f4f2; color: #52525b; }
.role-projectmanager { background: #f4f4f2; color: #52525b; }
.role-worker { background: var(--panel); color: var(--muted); }
.role-temp { background: #ffedd5; color: #9a3412; }
.temps-card { border-left: 4px solid #fb923c; }

/* Layout */
.container { max-width: 1180px; margin: 1.6rem auto; padding: 0 1.2rem; }
.foot { text-align: center; color: var(--muted); padding: 2rem; font-size: .8rem; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem 1.35rem; margin-bottom: 1.1rem;
  /* A table wider than the card scrolls inside it instead of spilling out. */
  overflow-x: auto;
}
.card h2 { margin-top: 0; font-size: 1.02rem; font-weight: 600; letter-spacing: -.01em; }
.page-head { display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .8rem; margin-bottom: 1.2rem; }
.page-head h1 { font-size: 1.6rem; margin: 0; font-weight: 700; letter-spacing: -.025em; }

/* Stat tiles — one strip with hairline dividers (the 1px gap shows the
   strip's line colour between tiles, also when they wrap to a second row). */
.tiles { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr));
  gap: 1px; margin-bottom: 1.1rem; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; }
.tile { background: var(--card); padding: 1rem 1.2rem; min-width: 0; }
.tiles .tile { border: 0 !important; border-radius: 0; }
.tile .label { color: var(--muted); font-size: .8rem; font-weight: 500; }
/* Shrinks on narrow screens so big CHF totals stay inside the tile. */
.tile .value { font-size: clamp(1.2rem, 4.6vw, 1.75rem); font-weight: 600; margin-top: .3rem;
  letter-spacing: -.025em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile.ot .value { color: var(--red); }
/* Overtime tiles: overtime always reads green. */
.tile.over .value { color: var(--green); }
.tile.warn .value { color: #b45309; }

/* Tables */
table.grid { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.grid th, table.grid td { padding: .65rem .65rem; border-bottom: 1px solid #efefed;
  text-align: left; }
table.grid th { font-size: .78rem; font-weight: 500; color: var(--muted);
  border-bottom-color: var(--line-2); padding-top: .4rem; padding-bottom: .45rem; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tr:hover td { background: var(--panel); }
table.grid td > a:not(.btn):not(.count-badge) { color: var(--ink); font-weight: 500; }
table.grid td > a:not(.btn):not(.count-badge):hover { color: var(--accent); }
/* Overtime values are green wherever they appear. */
.ot-val { color: var(--green); font-weight: 600; }
/* Negative totals are shown in red. */
.neg { color: var(--red); }
.subtotal td { font-weight: 700; background: var(--panel); }

/* Buttons */
.btn { display: inline-block; background: var(--accent); color: #fff;
  padding: .5rem .9rem; border-radius: 3px; border: 1px solid transparent; cursor: pointer;
  font-size: .9rem; font-weight: 600; font-family: inherit; }
.btn:hover { background: var(--accent-d); text-decoration: none; }
.btn.secondary { background: var(--btn-sec); color: var(--ink); border-color: var(--line-2); }
.btn.secondary:hover { background: var(--btn-sec-h); }
.btn.danger { background: var(--red); }
.btn.small { padding: .3rem .6rem; font-size: .8rem; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

/* Forms */
form.styled label { display: block; font-weight: 600; margin: .8rem 0 .25rem; font-size: .9rem; }
form.styled input[type=text], form.styled input[type=password],
form.styled input[type=email], form.styled input[type=number],
form.styled input[type=date], form.styled input[type=month], form.styled select, form.styled textarea {
  width: 100%; padding: .55rem .6rem; border: 1px solid var(--input-border); border-radius: 3px;
  font-size: .95rem; font-family: inherit; background: var(--card); color: var(--ink);
}
form.styled .row { display: flex; gap: 1rem; flex-wrap: wrap; }
form.styled .row > div { flex: 1; min-width: 160px; }
form.styled .check { display: flex; align-items: center; gap: .5rem; margin-top: .8rem; }
form.styled .check input { width: auto; }
.form-narrow { max-width: 480px; }
.errors { color: var(--red); font-size: .82rem; margin: .2rem 0 0; padding-left: 1rem; }
.help { color: var(--muted); font-size: .82rem; }

/* Flash */
/* Flash: white bar with a coloured edge, so messages read as part of the page. */
.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: .8rem; font-size: .9rem;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.flash a { font-weight: 600; }
.flash-success { box-shadow: inset 3px 0 0 var(--green); }
.flash-danger, .flash-error { box-shadow: inset 3px 0 0 var(--red); }
.flash-warning { box-shadow: inset 3px 0 0 #d97706; }
.flash-info { box-shadow: inset 3px 0 0 #2563eb; }

/* Badges */
.badge { font-size: .72rem; padding: .12rem .45rem; border-radius: 3px; font-weight: 600; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.approved { background: #dcfce7; color: #166534; }
.badge.rejected { background: #fee2e2; color: #991b1b; }
.badge.inactive { background: #e2e8f0; color: #475569; }

/* Login */
.login-wrap { max-width: 360px; margin: 8vh auto; }
.login-wrap .brand-big { text-align: center; margin-bottom: 1.4rem; }
.login-logo { width: 100%; max-width: 240px; height: auto; display: block; margin: 0 auto; }

/* Toolbar */
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar form { display: flex; gap: .4rem; align-items: center; }
.toolbar input[type=month], .toolbar input[type=date] {
  padding: .4rem .5rem; border: 1px solid var(--input-border); border-radius: 7px;
  background: var(--card); color: var(--ink); }
.spacer { flex: 1; }

/* Calendar */
.cal-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
table.cal { border-collapse: collapse; font-size: .74rem; }
table.cal th, table.cal td { border: 1px solid var(--line); padding: 0; text-align: center; }
table.cal th.name, table.cal td.name { text-align: left; padding: .35rem .55rem;
  position: sticky; left: 0; background: var(--card); z-index: 2; white-space: nowrap;
  min-width: 150px; font-weight: 600; border-right: 2px solid var(--input-border); }
table.cal thead th { background: var(--panel); padding: .3rem .2rem; min-width: 26px; }
table.cal thead th.weekend { background: var(--btn-sec); color: var(--muted); }
table.cal td.cell { width: 26px; height: 26px; }
.cell-free { background: var(--card); }
.cell-work { background: #bfdbfe; }
.cell-holiday { background: var(--green); }
.cell-holiday.sick { background: #f97316; }
.cell-holiday.other { background: #8b5cf6; }
.cell-holiday.training { background: #0ea5e9; }
.cell-holiday.military { background: #78716c; }
.cell-holiday.feiertag { background: #14b8a6; }
.cell-holiday.parental { background: #ec4899; }
.cell-holiday.compensation { background: #f59e0b; }
.cell-unpaid { background: repeating-linear-gradient(45deg,#9ca3af,#9ca3af 4px,#e5e7eb 4px,#e5e7eb 8px); }
.cell-pending { background: repeating-linear-gradient(45deg,#fde68a,#fde68a 4px,#fff 4px,#fff 8px); }
.cell-pending-unpaid { background: repeating-linear-gradient(45deg,#fcd34d,#fcd34d 4px,#9ca3af 4px,#9ca3af 8px); }
.cell-public { background: #c7d2fe; }
.cell-weekend { background: var(--panel); }
table.cal thead th.public { background: #c7d2fe; color: #3730a3; }
.cal td.name.me { background: #fef9c3; color: #713f12; }
table.cal tr.me td { outline: 1px solid #eab308; }
.cal-avail td { font-weight: 700; background: var(--hover); color: var(--muted); }
.cal-avail td.low { color: var(--red); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; margin: .8rem 0; font-size: .82rem; align-items: center; }
.legend .swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px;
  vertical-align: middle; margin-right: .3rem; border: 1px solid rgba(0,0,0,.1); }

.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 2rem; }

/* ------------------------------------------------------------------ */
/* Mobile: collapse the top navigation into a hamburger dropdown      */
/* ------------------------------------------------------------------ */
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; padding: calc(.5rem + env(safe-area-inset-top)) 1rem .5rem; gap: .5rem; }
  .hamburger { display: flex; }

  /* Workers navigate via the bottom bar — no title-bar menu; show their avatar. */
  .has-tabbar .hamburger { display: none; }
  .has-tabbar .navmenu { display: none !important; }
  .has-tabbar .topava { display: grid; margin-left: auto; }

  /* The menu is hidden until the hamburger checkbox is toggled. */
  .navmenu {
    display: none; flex-direction: column; align-items: stretch;
    width: 100%; flex: 0 0 100%; gap: 0; order: 3;
  }
  #navtoggle:checked ~ .navmenu { display: flex; }

  .mainnav { flex-direction: column; width: 100%; gap: 0; flex: none; }
  .mainnav a {
    padding: .8rem .4rem; border-radius: 0; font-size: 1rem;
    border-top: 1px solid rgba(15,23,42,.15);
  }

  .userbox {
    width: 100%; flex-wrap: wrap; justify-content: flex-start;
    gap: 1rem; padding: .9rem .4rem; border-top: 1px solid rgba(15,23,42,.15);
    font-size: .95rem;
  }
  .userbox a { padding: .2rem 0; }
  .userbox .lbl { display: inline; }

  /* Animate the hamburger into an X when open. */
  #navtoggle:checked ~ .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  #navtoggle:checked ~ .hamburger span:nth-child(2) { opacity: 0; }
  #navtoggle:checked ~ .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* General mobile tightening. */
  .container { padding: 0 .8rem; margin-top: 1rem; }
  .page-head h1 { font-size: 1.25rem; }
  .card { padding: .9rem; }

  /* Let wide data tables scroll horizontally instead of breaking the layout. */
  .card { overflow-x: auto; }

  /* Hide elements not wanted on small screens (e.g. dashboard "+ Log time"). */
  .hide-mobile { display: none !important; }

  /* Dashboard: reorder sections — greeting, recent entries, week/month,
     then the holiday / overtime balance tiles at the bottom. */
  .dash { display: flex; flex-direction: column; }
  .dash > * { order: 3; }
  .dash .page-head { order: 1; }
  .dash-recent { order: 2; }
  .dash-balances { order: 10; }
}

/* Download-choice modal (overview per-worker Excel) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000; padding: 1rem;
  background: rgba(15, 23, 42, .45);
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 1.1rem 1.2rem; width: 320px; max-width: 92vw;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .28);
}
.modal h3 { margin: .1rem 0 .7rem; font-size: 1rem; }
.modal .dlform { margin: 0 0 .55rem; }
.modal label {
  display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .02em; color: var(--muted); margin: 0 0 .25rem;
}
.modal .row { display: flex; gap: .4rem; align-items: center; }
.modal .row input { flex: 1; min-width: 0; }
.modal .block { display: block; width: 100%; }
#dlClose { margin-top: .3rem; width: 100%; }

/* ================================================================== */
/* Mobile time-entry: big tap-tiles for work / travel time            */
/* ================================================================== */
.entry-shell { max-width: 460px; }
.entry-ctx { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1rem; }
.entry-day { font-size: 1.05rem; font-weight: 700; }
.entry-day span { color: var(--muted); font-weight: 600; font-size: .9rem; }
.entry-dayrow { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.copy-last { text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.copy-last .muted { font-weight: 500; }
.confirmbar { display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  background: var(--brand-tint); border: 1px solid var(--box-line); border-radius: 12px;
  padding: .6rem .9rem; margin-bottom: .9rem; font-size: .92rem; }
.confirmbar form { margin: 0; }
.count-badge { display: inline-block; min-width: 1.4rem; text-align: center;
  background: var(--brand); color: #fff; border-radius: 999px; padding: .05rem .45rem;
  font-size: .72rem; font-weight: 700; }
.kw-chip { font-weight: 700; font-size: .72rem; letter-spacing: .04em; color: var(--brand);
  background: var(--brand-tint); border-radius: 8px; padding: .32rem .6rem; white-space: nowrap; }

.pick { display: flex; align-items: center; gap: .75rem; background: var(--card);
  border: 1px solid var(--box-line); border-radius: 14px; padding: .8rem .85rem;
  box-shadow: var(--s1); }
.pick .pick-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-tint);
  color: var(--brand); display: grid; place-items: center; flex: 0 0 auto; }
.pick .pick-body { flex: 1; min-width: 0; }
.pick .pick-k { font-size: .66rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 700; }
.pick select, .pick input[type=date] { width: 100%; border: none; background: transparent;
  font: inherit; font-weight: 700; font-size: 1rem; color: var(--ink); padding: .1rem 0;
  cursor: pointer; -webkit-appearance: none; appearance: none; }
.pick select:focus, .pick input[type=date]:focus { outline: none; }
.pick .pick-chev { color: var(--faint); display: flex; }

.time-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.tt { position: relative; overflow: hidden; border-radius: 16px;
  padding: 1rem .8rem .8rem; border: 1px solid var(--line);
  background: var(--card); display: flex; flex-direction: column; gap: .7rem;
  box-shadow: var(--s1); }
.tt::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.tt.work::before { background: var(--brand); }
.tt.travel::before { background: var(--travel); }
.tt .tt-lab { display: flex; align-items: center; gap: .45rem; font-weight: 700;
  font-size: .82rem; color: var(--muted); }
.tt .tt-lab .g { width: 11px; height: 11px; border-radius: 3px; }
.tt.work .tt-lab .g { background: var(--brand); }
.tt.travel .tt-lab .g { background: var(--travel); }
/* High specificity so these beat the generic form.styled input rule. */
.entry-shell .tt input.tt-val { width: 100%; border: none; background: transparent;
  text-align: center; font-weight: 800; font-size: 2.6rem; line-height: 1;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; padding: .1rem 0;
  border-radius: 0; font-family: inherit; }
.entry-shell .tt input.tt-val:focus { outline: none; }
.entry-shell .tt input.tt-val { color: var(--ink); }
/* Admin/PM entry form: live decimal readout under the H:MM input. */
.tt .tt-dec { text-align: center; font-size: .85rem; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums; margin-top: -.2rem; }
.tt-step { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tt-step button { width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink); cursor: pointer;
  font-size: 1.4rem; font-weight: 700; font-family: inherit; line-height: 1; display: grid;
  place-items: center; box-shadow: var(--s1); -webkit-tap-highlight-color: transparent; }
.tt-step button:active { transform: scale(.94); }
.tt-step .tt-unit { font-size: .7rem; color: var(--muted); font-weight: 700; letter-spacing: .03em; }
.tt-chips { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; }
.tt-chips button { border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: .35rem .65rem; font-size: .8rem; font-weight: 700;
  font-variant-numeric: tabular-nums; cursor: pointer; font-family: inherit; }
.tt-chips button:hover { border-color: var(--brand); color: var(--brand); }

.entry-sum { display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: 14px; padding: .8rem 1rem; box-shadow: var(--s1); }
.entry-sum .s { display: flex; flex-direction: column; gap: 1px; }
.entry-sum .s .k { font-size: .64rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; }
.entry-sum .s .v { font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.entry-sum .s .v.ot { color: var(--green); }
.entry-sum .divide { width: 1px; height: 30px; background: var(--line); }
.entry-save { width: 100%; padding: .95rem; font-size: 1.05rem; border-radius: 14px;
  box-shadow: 0 8px 18px rgba(206,17,38,.26); }

.today-list { display: flex; flex-direction: column; gap: .55rem; }
.today-row { display: flex; align-items: center; gap: .75rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: .7rem .8rem; }
.today-row .tr-badge { width: 42px; height: 42px; border-radius: 11px; background: var(--brand-tint);
  color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: .74rem;
  flex: 0 0 auto; }
.today-row .tr-info { flex: 1; min-width: 0; }
.today-row .tr-info .p { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.today-row .tr-info .m { font-size: .78rem; color: var(--muted); font-weight: 600; }
.today-row .tr-tot { font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; }

/* ================================================================== */
/* Bottom tab bar — workers, mobile only                              */
/* ================================================================== */
.tabbar { display: none; }
@media (max-width: 820px) {
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    justify-content: space-around; align-items: center; background: var(--card);
    border-top: 1px solid var(--line);
    padding: .5rem .3rem calc(.55rem + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(16,24,40,.05); }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center;
    gap: 4px; font-size: .64rem; font-weight: 700; color: var(--faint); flex: 1; padding: .2rem 0;
    text-decoration: none; }
  .tabbar a .i { font-size: 1.2rem; line-height: 1; }
  .tabbar .ico { width: 21px; height: 21px; stroke-width: 1.8; }
  .tabbar a.on { color: var(--brand); }
  .tabbar a.on::before { content: ""; position: absolute; top: -.5rem; left: 50%;
    transform: translateX(-50%); width: 22px; height: 3px; border-radius: 0 0 3px 3px;
    background: var(--brand); }
  body.has-tabbar .container { padding-bottom: 4.8rem; }

  /* Bigger, thumb-readable time value on phones. */
  .entry-shell .tt input.tt-val { font-size: 3.2rem; }
  .tt { padding: 1rem .7rem .85rem; }
}

/* ================================================================== */
/* Account menu on the worker dashboard ("More" tab)                  */
/* ================================================================== */
.mobile-only { display: none; }
.acct-card h2 { margin-bottom: .3rem; }
.acct-row { display: flex; align-items: center; gap: .8rem; padding: .95rem .2rem;
  border-top: 1px solid var(--line); font-weight: 600; font-size: 1rem;
  color: var(--ink); text-decoration: none; }
.acct-row .ai { width: 36px; height: 36px; border-radius: 10px; background: var(--panel);
  display: grid; place-items: center; font-size: 1.1rem; flex: 0 0 auto; }
.acct-row.out { color: var(--accent); }
.acct-row:hover { text-decoration: none; }
.acct-chev { margin-left: auto; color: var(--faint); font-weight: 800; font-size: 1.1rem; }
.acct-lang { margin-left: auto; display: flex; gap: .35rem; }
.acct-lang a { border: 1px solid var(--line); border-radius: 7px; padding: .3rem .6rem;
  font-size: .82rem; font-weight: 700; color: var(--muted); }
.acct-lang a.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ================================================================== */
/* Thumb-friendly sizing on phones (applies to every page)            */
/* ================================================================== */
@media (max-width: 820px) {
  .mobile-only { display: block; }
  .dash .acct-card { order: 11; }

  .btn { padding: .7rem 1.05rem; font-size: .95rem; border-radius: 9px; }
  .btn.small { padding: .5rem .75rem; font-size: .85rem; }
  .page-head { gap: .6rem; }
  .page-head > div { display: flex; gap: .5rem; flex-wrap: wrap; width: 100%; align-items: center; }
  .page-head > div .btn { flex: 1; text-align: center; }

  form.styled input[type=text], form.styled input[type=password],
  form.styled input[type=email], form.styled input[type=number],
  form.styled input[type=date], form.styled input[type=month], form.styled select, form.styled textarea {
    font-size: 1rem; padding: .75rem .7rem; border-radius: 10px; }
  form.styled label { font-size: .95rem; }

  .toolbar .btn, .toolbar button { min-height: 42px; }
  .toolbar input[type=month], .toolbar input[type=date] { min-height: 42px; }

  table.grid th, table.grid td { padding: .65rem .55rem; }
  .badge { font-size: .78rem; padding: .2rem .6rem; }
}

.entry-sum { border: 1px solid var(--box-line); }

/* ================================================================== */
/* Tabbed site picker (bottom sheet)                                  */
/* ================================================================== */
button.pick { width: 100%; font-family: inherit; color: inherit; cursor: pointer;
  text-align: left; }
.pick-v { font-weight: 700; font-size: 1rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-v.chosen { color: var(--ink); }

.picker-overlay { position: fixed; inset: 0; z-index: 1100; background: rgba(0,0,0,.55);
  display: none; align-items: flex-end; justify-content: center; }
.picker-overlay.open { display: flex; }
.picker { background: var(--card); width: 100%; max-width: 560px; max-height: 86vh;
  border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
  box-shadow: 0 -12px 44px rgba(0,0,0,.45); overflow: hidden;
  border: 1px solid var(--box-line); border-bottom: none; }
.picker-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.1rem .6rem; }
.picker-head strong { font-size: 1.05rem; }
.picker-x { background: var(--panel); border: none; color: var(--ink); width: 34px;
  height: 34px; border-radius: 10px; font-size: 1rem; cursor: pointer; }
.picker-tabs { flex: 0 0 auto; display: flex; gap: .4rem; overflow-x: auto;
  padding: .1rem 1.1rem .7rem; -webkit-overflow-scrolling: touch; }
.ptab { flex: 0 0 auto; background: var(--panel); border: 1px solid var(--line);
  color: var(--muted); border-radius: 999px; padding: .5rem .95rem; font-weight: 700;
  font-size: .9rem; cursor: pointer; font-family: inherit; white-space: nowrap; }
.ptab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.picker-search { flex: 0 0 auto; margin: 0 1.1rem .7rem; padding: .75rem .8rem;
  border: 1px solid var(--input-border); border-radius: 12px; background: var(--panel);
  color: var(--ink); font-size: 1rem; font-family: inherit; }
.picker-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 1.1rem 1.2rem;
  -webkit-overflow-scrolling: touch; }
.prow-opt { display: flex; align-items: center; gap: .85rem; width: 100%; text-align: left;
  background: var(--raise); border: 1px solid var(--line); border-radius: 12px;
  padding: .8rem .9rem; margin-bottom: .5rem; cursor: pointer; font-family: inherit; color: var(--ink); }
.prow-opt:hover { border-color: var(--brand); }
.prow-opt .pn { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3.4rem;
  color: var(--brand); flex: 0 0 auto; }
.prow-opt .pa { font-weight: 600; font-size: .92rem; }
.prow-opt .pa em { color: var(--muted); font-style: normal; font-weight: 700; font-size: .76rem;
  margin-left: .2rem; }
.picker-empty { color: var(--muted); text-align: center; padding: 2.5rem 0; }

/* Admin projects page — year / Kundendienst / Garantie tabs */
.proj-tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.proj-tabs .ptab { cursor: pointer; }
.ptab-n { opacity: .6; margin-left: .15rem; font-variant-numeric: tabular-nums; }
.bulkbar { display: flex; justify-content: flex-end; gap: .4rem; margin-bottom: .7rem; }
.toggle { border: 1px solid var(--line-2); border-radius: 999px; padding: .28rem .75rem;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  cursor: pointer; font-family: inherit; }
.toggle.on { background: #e6f5ec; border-color: transparent; color: var(--green); }
.toggle.off { background: var(--panel); color: var(--muted); }
.toggle:hover { filter: brightness(.97); }
.toggle:disabled { opacity: .5; cursor: default; }

/* Worker master-data card (SMGV profile) */
.stammdaten { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .7rem 1.6rem; }
.stammdaten > div { display: flex; flex-direction: column; gap: 1px; }
.stammdaten .k { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; }
.stammdaten .v { font-weight: 600; }
.balrow { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.1rem; }
.baltile { flex: 1; min-width: 130px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: .7rem .9rem; }
.baltile .k { display: block; font-size: .66rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.baltile .v { font-weight: 800; font-size: 1.3rem; font-variant-numeric: tabular-nums; }

/* Row action dropdown (e.g. Workers table) — collapses per-row buttons        */
.rowmenu { position: relative; display: inline-block; }
.rowmenu-btn::after { content: ""; }
.rowmenu-list {
  position: fixed; z-index: 100; min-width: 12rem;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, .14);
  padding: .3rem; display: flex; flex-direction: column; gap: .1rem;
  overflow: auto;
}
.rowmenu-list[hidden] { display: none; }
.rowmenu-list a, .rowmenu-list button {
  display: block; width: 100%; text-align: left; padding: .5rem .6rem;
  border: 0; background: none; border-radius: 7px;
  font: inherit; color: var(--ink); cursor: pointer;
  white-space: nowrap; text-decoration: none;
}
.rowmenu-list a:hover, .rowmenu-list button:hover { background: var(--hover); }
.rowmenu-list .rm-sep { height: 1px; background: var(--line); margin: .2rem .1rem; }
.rowmenu-list button.rm-danger { color: var(--red); }
.rowmenu-list form { margin: 0; }

/* Site-photo button + sheet on the worker's entry screen. */
.entry-ctx .photo-open { width: 100%; }
.photo-sheet form { padding: 0 1.1rem 1.2rem; overflow-y: auto; }
.photo-sheet label { display: block; margin-top: .8rem; font-weight: 700; font-size: .85rem; }
.photo-sheet select, .photo-sheet input[type=text], .photo-sheet input[type=file] {
  width: 100%; padding: 10px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--bg); font: inherit; color: var(--ink); }
.photo-sheet .entry-save { margin-top: 1rem; width: 100%; }
.photo-msg { margin: .8rem 0 0; font-weight: 700; font-size: .9rem; }
.photo-msg.ok { color: var(--green); }
.photo-msg.err { color: var(--red); }

/* Rechnungen */
.badge.sent { background: #e0e7ff; color: #3730a3; }
.badge.paid { background: #e2e8f0; color: #166534; }
.inv-run { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: 0; }
.inv-run input[type=date] { padding: 8px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--bg); font: inherit; color: var(--ink); }
.inv-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; }
.inv-kpis .k { font-size: .8rem; color: var(--muted); }
.inv-kpis .v { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.inv-table tr.inv-group-row td { background: var(--hover); font-weight: 700; padding-top: .7rem; }
.page-head h1 .badge { white-space: nowrap; vertical-align: middle; }
.inv-upload { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.inv-upload input[type=file] { flex: 1 1 260px; padding: 10px; border: 1px solid var(--line-2);
  border-radius: 10px; background: var(--bg); }
.inv-bulk { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; }
.inv-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1rem;
  align-items: start; }
.inv-pdf { padding: 0; overflow: hidden; position: sticky; top: 1rem; }
.inv-pdf iframe { width: 100%; height: calc(100vh - 2.4rem); border: 0; display: block; background: var(--panel); }
/* Invoice + delivery note detail: full width, the document gets everything the form doesn't need. */
.doc-page .container { max-width: none; }
.doc-page .inv-layout { grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); }
.inv-side .card { margin-top: 0; }
.inv-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 .8rem; }
.inv-total { font-weight: 800; font-size: 1.15rem; padding: .55rem 0; font-variant-numeric: tabular-nums; }
.inv-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.inv-actions form { margin: 0; }
.inv-table .inline-form { display: inline; margin: 0; }
.inv-paid-form, .inv-export { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: 0; }
.inv-paid-form label, .inv-export label { display: flex; gap: .4rem; align-items: center; margin: 0; }
.inv-paid-form input[type=date], .inv-export select { width: auto; padding: 8px; border: 1px solid var(--line-2);
  border-radius: 10px; background: var(--bg); font: inherit; color: var(--ink); }
.inv-visum form { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.inv-visum input[type=text], .inv-visum select { flex: 1 1 200px; padding: 10px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); font: inherit; }
.inv-visum .inv-ok { font-size: 1.05rem; padding: .7rem 1.4rem; }
.inv-more { margin-top: .8rem; }
.inv-form .inv-more select, .inv-form .inv-more input { width: 100%; margin: .4rem 0; }
.mail-tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: .05rem .4rem;
  border-radius: 6px; background: #e0f2fe; color: #075985; margin-right: .3rem; white-space: nowrap; }
.qr-card { border-left: 4px solid #8b5cf6; }
.suggest { border: 1px solid #c4b5fd; background: #f5f3ff; border-radius: 10px; padding: .6rem .7rem;
  margin: .5rem 0; font-size: .9rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.mail-card { border-left: 4px solid #0ea5e9; }
.mail-boxes { margin: .2rem 0 .8rem; padding-left: 1.1rem; }
.mail-boxes li { margin: .2rem 0; }
.ls-pick { display: grid; gap: .3rem; margin-top: .5rem; }
.ls-pick-row { display: flex; gap: .6rem; align-items: flex-start; padding: .45rem .5rem;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 400; }
.ls-pick-row input { margin-top: .25rem; }
.ls-pick-row .help { display: block; }
.ls-pages { padding: .6rem; display: grid; gap: .6rem; align-content: start; }
.ls-pages img { width: 100%; height: auto; display: block; border-radius: 8px; }
.ls-pages iframe { width: 100%; height: calc(100vh - 3.6rem); border: 0; }
.inv-question { font-size: 1.05rem; font-weight: 600; margin: .3rem 0 .6rem; }
.inv-more summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.inv-dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.inv-dl dt { color: var(--muted); font-size: .85rem; }
.inv-dl dd { margin: 0; }
.inv-history { list-style: none; padding: 0; margin: 0 0 .8rem; display: grid; gap: .5rem; }
.inv-table td .help { margin-top: .2rem; }
@media (max-width: 860px) {
  .inv-layout, .doc-page .inv-layout { grid-template-columns: 1fr; }
  .inv-pdf { position: static; }
  .inv-pdf iframe, .ls-pages iframe { height: 75vh; }
  .inv-side { order: -1; }   /* sign-off + details first on a phone, PDF below */
}

/* Mitteilungen */
.msg-list { list-style: none; margin: 0; padding: 0; }
.msg-list li + li { border-top: 1px solid var(--line); }
.msg-list a { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem .2rem;
  color: var(--ink); text-decoration: none; }
.msg-list a:hover { background: var(--panel); }
.msg-list li.unread .msg-text { font-weight: 700; }
.msg-list li.unread .msg-text::before { content: "● "; color: var(--brand); }
.msg-when { color: var(--muted); font-size: .8rem; white-space: nowrap; }
@media (max-width: 600px) { .msg-list a { flex-direction: column; gap: .2rem; } }
.inv-h3 { font-size: .95rem; margin: 1.1rem 0 .2rem; }
.inv-lines { display: grid; gap: .5rem; margin-top: .6rem; }
/* Project on its own full-width row: the side column next to the PDF is too
   narrow to fit it beside cost centre and amount (it was cut to "Pro…"). */
.inv-line { display: grid; gap: .4rem; align-items: center; padding: .55rem;
  border: 1px solid var(--line); border-radius: 10px;
  grid-template-columns: minmax(0, 1fr) 7.5rem auto;
  grid-template-areas: "proj proj proj" "kst amt del"; }
.inv-line [name=line_cost_center] { grid-area: kst; font-weight: 700; }
.inv-line [name=line_project] { grid-area: proj; }
.inv-line [name=line_amount] { grid-area: amt; text-align: right; }
.inv-line .js-del { grid-area: del; }
.inv-line select, .inv-line input { width: 100%; padding: 8px; border: 1px solid var(--line-2);
  border-radius: 8px; background: var(--bg); font: inherit; min-width: 0; }
.inv-lines-foot { display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  flex-wrap: wrap; margin: .6rem 0 .4rem; }
.inv-sum { font-size: .85rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.inv-sum.ok { color: var(--green); }
.inv-sum.bad { color: var(--red); }
.inv-lines-ro { margin-top: .4rem; }
/* Nachträge on the project page */
.addendum-form { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 8rem auto; gap: .4rem;
  align-items: center; }
.addendum-form input { width: 100%; padding: 8px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--bg); font: inherit; min-width: 0; }
.addendum-form [name=amount] { text-align: right; }
.addendum-new { margin-top: .8rem; }
.addendum-new .proof-pick { grid-column: 1 / -1; font-size: .85rem; color: var(--muted); }
.proof-list { display: flex; flex-wrap: wrap; gap: .3rem .6rem; margin-top: .3rem; font-size: .82rem; }
.proof-list form { display: inline; }
.proof-add { cursor: pointer; color: var(--accent, #ce1126); font-weight: 600; }
.proof-list .rm { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 .2rem; }
.badge.nstat-open { background: #e5e7eb; color: #374151; }
.badge.nstat-billed { background: #fef3c7; color: #92400e; }
.badge.nstat-paid { background: #dcfce7; color: #166534; }
.nstat-sums td { font-size: .85rem; color: var(--muted); }
select.nstat-select { padding: 4px 6px; border: 1px solid var(--line-2); border-radius: 6px; font: inherit; font-size: .82rem; }
.inline-edit { display: inline-block; }
.inline-edit[open] { position: relative; }
/* The edit form floats under its button instead of squeezing into the narrow
   actions column; fixed (not absolute) so a scrolling card can't clip it. */
.inline-edit[open] > form { position: fixed; z-index: 50;   /* placed by script (time_project.html) */
  width: min(36rem, calc(100vw - 2rem)); padding: .7rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  text-align: left; white-space: normal; }
.inline-edit summary { list-style: none; cursor: pointer; }
.inline-edit summary::-webkit-details-marker { display: none; }
@media (max-width: 600px) {
  .addendum-form { grid-template-columns: 1fr 7rem; }
  .addendum-form [name=description] { grid-column: 1 / -1; grid-row: 1; }
}
/* Kostenstelle tag — deliberately unlike a project's A-Nr. */
.kst { display: inline-block; padding: 0 .35rem; border: 1px solid var(--line-2); border-radius: 5px;
  font-size: .78em; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kst-grid td.num, .kst-grid th.num { font-variant-numeric: tabular-nums; }
.kst-grid a.cell { color: inherit; text-decoration: none; display: block; }
.kst-grid a.cell:hover { text-decoration: underline; }
.kst-grid tfoot td { font-weight: 700; border-top: 2px solid var(--line-2); }
.kst-tabs { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* Project costs */
.cost-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.cost-scope { font-size: .8rem; font-weight: 600; }
.cost-tiles { margin: .6rem 0; }
.cost-bar { height: 10px; border-radius: 999px; background: var(--panel); overflow: hidden; margin: .2rem 0 1rem; }
.cost-bar span { display: block; height: 100%; background: var(--green); }
.cost-bar.warn span { background: #f59e0b; }
.cost-bar.over span { background: var(--red); }
.part-bar { display: flex; height: 10px; border-radius: 999px; background: var(--panel); overflow: hidden; margin: .2rem 0 .4rem; }
.part-bar .paid { background: var(--green); }
.part-bar .billed { background: #f59e0b; }
.cost-break .cost-total td { font-weight: 800; border-top: 2px solid var(--line-2); }
.cost-warn { color: #b45309; }
.cost-more { margin-top: .8rem; }
.cost-more summary { cursor: pointer; font-weight: 700; margin-bottom: .4rem; }
.cost-bar.small { height: 6px; margin: .25rem 0 0; min-width: 90px; }
.cost-ticker { font-size: .85rem; }
table.grid.cost-ticker th, table.grid.cost-ticker td { padding: .5rem .4rem; }
.cost-ticker td:first-child { min-width: 11rem; }
.cost-ticker .cost-used { min-width: 90px; }
.cost-ticker td.num { white-space: nowrap; }
.cost-ticker .pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.cost-ticker tr.lvl-over td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.cost-ticker tr.lvl-warn td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.cost-ticker tfoot td { font-weight: 800; border-top: 2px solid var(--line-2); }
/* Auftragssumme split by trade */
.split-chips { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; margin-top: .35rem; }
.tile .split-chips { align-items: flex-start; }
.cost-ticker td.cost-split { vertical-align: middle; }
.cost-ticker td.cost-split .split-chips { flex-direction: row; flex-wrap: wrap; align-items: center; margin-top: 0; }
.split-chip { display: inline-flex; gap: .35rem; align-items: baseline; padding: .12rem .5rem; border-radius: 5px;
  font-size: .85rem; line-height: 1.35; white-space: nowrap; color: #1f2937; background: #eef2f7;
  border-left: 4px solid #94a3b8; font-variant-numeric: tabular-nums; }
.split-chip .k { font-weight: 600; }
.split-chip.t-isolation, .split-chip.t-iso { background: #fef3c7; border-left-color: #d97706; }
.split-chip.t-gipser, .split-chip.t-gips { background: #dbeafe; border-left-color: #2563eb; }
.split-chip.t-maler { background: #dcfce7; border-left-color: #16a34a; }
.split-chip.t-gipser-maler { background: #e0e7ff; border-left-color: #4f46e5; }
.split-chip.t-brandschutz { background: #fee2e2; border-left-color: #dc2626; }
/* Trade (Arbeitsgattung) tags next to a site name */
.trade-tag { display: inline-block; margin-left: .3rem; padding: 0 .4rem; border-radius: 4px;
  font-size: .72rem; font-weight: 700; line-height: 1.45; vertical-align: .08em; white-space: nowrap;
  color: #1f2937; background: #eef2f7; border-left: 3px solid #94a3b8; }
.trade-tag + .trade-tag { margin-left: .2rem; }
.trade-tag.t-iso { background: #fef3c7; border-left-color: #d97706; }
.trade-tag.t-gips { background: #dbeafe; border-left-color: #2563eb; }
.trade-tag.t-maler { background: #dcfce7; border-left-color: #16a34a; }
.trade-tag.t-brandschutz { background: #fee2e2; border-left-color: #dc2626; }
.cost-ticker .cgroup td { background: var(--panel, #f5f7fa); font-weight: 700; padding-top: .9rem; }
.proj-tabs .ptab.nohit { opacity: .45; }
/* Projekte area views (list / costs / import) */
.view-switch { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 1rem; }
.view-switch a { padding: .55rem .9rem; margin-bottom: -2px; border-bottom: 3px solid transparent;
  color: var(--muted); font-weight: 700; text-decoration: none; }
.view-switch a:hover { color: inherit; }
.view-switch a.on { color: var(--brand); border-bottom-color: var(--brand); }

/* ================================================================== */
/* Sidebar — desktop navigation down the left edge                    */
/* ================================================================== */
@media (min-width: 821px) {
  body:not(.login-page) { padding-left: var(--sidebar); }
  .topbar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: var(--sidebar);
    flex-direction: column; align-items: stretch; gap: 0; padding: 1.2rem .75rem .9rem;
    border: 0; border-right: 1px solid var(--line); overflow-y: auto; }
  .brand { padding: 0 .5rem 1.3rem; }
  .brand-logo { height: 22px; }
  .navmenu { flex-direction: column; align-items: stretch; gap: 0; flex: 1; min-height: 0; }
  .mainnav { flex-direction: column; flex-wrap: nowrap; gap: 1px; flex: 1; }
  .userbox { flex-wrap: wrap; gap: .4rem .55rem; border-top: 1px solid var(--line);
    padding: .9rem .5rem 0; font-size: .85rem; }
  .userbox .uname { order: -1; width: 100%; }
  .container { padding: 0 2.2rem; margin: 1.8rem auto; }

  /* Weekly plan: the sidebar folds to an icon rail and slides open on hover,
     so the planner gets the full width. */
  body.rail { --sidebar: 60px; }
  body.rail .topbar { width: 60px; padding: 1rem .5rem .9rem; overflow: hidden;
    transition: width .15s ease; }
  body.rail .topbar:hover, body.rail .topbar:focus-within { width: 232px; overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .12); }
  body.rail .brand { width: 216px; padding: 0 .25rem 1.1rem; }
  body.rail .topbar:not(:hover):not(:focus-within) .brand { width: 22px; overflow: hidden; }
  body.rail .mainnav a { white-space: nowrap; padding: .5rem .6rem; }
  body.rail .topbar:not(:hover):not(:focus-within) .lbl,
  body.rail .topbar:not(:hover):not(:focus-within) .userbox { visibility: hidden; }
  body.rail .topbar:not(:hover):not(:focus-within) .nav-sect { height: 1px; padding: 0;
    margin: .45rem .3rem; background: var(--line); color: transparent; overflow: hidden; }
  body.rail .topbar:not(:hover):not(:focus-within) .nav-dot { position: absolute; left: 30px;
    margin: -14px 0 0; min-width: 8px; width: 8px; height: 8px; padding: 0; font-size: 0; }
  body.rail .container { padding: 0 1.5rem; margin: 1.2rem auto; }
}
@media (max-width: 820px) {
  .mainnav a .ico, .mainnav .nav-sect { display: none; }
  .topbar { border-top: 3px solid var(--brand); }
}
@media print { body:not(.login-page) { padding-left: 0; } }

/* Line icon inline with text (file links, icon-only buttons). */
.ico.ico-i { display: inline-block; width: 15px; height: 15px; vertical-align: -3px; }
.btn .ico.ico-i { width: 16px; height: 16px; }

/* Camera button on a logged entry (shows how many photos it has). */
.entry-photo { display: inline-flex; align-items: center; gap: .25rem; flex: 0 0 auto; }
.entry-photo .ep-n:empty { display: none; }
.photo-sheet form { min-height: 0; }

/* Erfassen | Meine Einträge switch on the worker's phone view. */
.seg-switch { display: flex; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 1rem; }
.seg-switch a { flex: 1; text-align: center; padding: .6rem .5rem; border-radius: 9px;
  font-weight: 700; font-size: .95rem; color: var(--muted); text-decoration: none; }
.seg-switch a.on { background: var(--card); color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Tick several people (forward an invoice / send a delivery note). */
.people-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: .15rem .8rem; max-height: 14rem; overflow-y: auto; margin: .4rem 0 .6rem;
  padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.people-pick label, form.styled .people-pick label { display: flex; align-items: center; gap: .45rem; font-weight: 500;
  font-size: .9rem; margin: 0; padding: .25rem 0; cursor: pointer; }
.people-pick input { width: auto; margin: 0; }
.inv-more > form > input[type=text] { width: 100%; padding: 10px; margin: 0 0 .6rem;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg);
  font: inherit; color: var(--ink); }
.inv-more .people-pick input { width: auto; margin: 0; }

/* Delivery notes on the invoice page: thumbnail + who / where, so a note is
   recognisable even without supplier and number. */
.ls-row { display: flex; gap: .6rem; align-items: flex-start; }
.ls-pick-row { align-items: center; }
.ls-thumb { flex: 0 0 auto; width: 52px; height: 66px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center;
  font-size: .7rem; font-weight: 700; color: var(--muted); text-decoration: none; }
.ls-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ls-info { min-width: 0; }
.ls-search { width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--bg); font: inherit; color: var(--ink); }
.ls-pick-row[hidden] { display: none; }
