/* asapp.shanet.at -- builds on /style.css (shared with shanet.at) (colour tokens, light/dark switch). */

body.worktime {
  place-items: normal; /* style.css centres; newer browsers apply that to block layout too */
  display: block;
  text-align: left;
  padding: 0;
  line-height: 1.45;
  font-size: 15px;
}
body.worktime h1 { font-size: 1.6rem; letter-spacing: 0; }
body.worktime h2 { font-size: 1.15rem; margin: 0; }
body.worktime h3 { font-size: 1rem; margin: 1.5rem 0 0.5rem; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.strong { font-weight: 600; }
.pre, .field.pre .field-value { white-space: pre-line; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.noscript { padding: 2rem; text-align: center; }
[hidden] { display: none !important; }

.error {
  color: #b42318;
  background: color-mix(in srgb, #b42318 9%, transparent);
  border: 1px solid color-mix(in srgb, #b42318 35%, transparent);
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
}
:root[data-theme="dark"] .error { color: #ff8a80; }
.warning { color: #9a6700; }
:root[data-theme="dark"] .warning { color: #e3b341; }

/* --- buttons & inputs ---------------------------------------------------- */
.btn {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, .tab:focus-visible, .sheet-row:focus-visible, tr.clickable:focus-visible, .link-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 0.35rem 0.7rem; font-size: 0.9rem; }
.btn.wide { width: 100%; }
.btn.danger { color: #b42318; }
:root[data-theme="dark"] .btn.danger { color: #ff8a80; }
.btn.icon { padding: 0.15rem 0.55rem; font-size: 1.1rem; line-height: 1.2; color: var(--muted); }
.link-btn {
  display: block;
  font: inherit;
  font-size: 0.9rem;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0.1rem 0;
  text-align: left;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  padding: 0.45rem 0.6rem;
  min-width: 0;
}
textarea { resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input.readonly { color: var(--muted); background: transparent; }
input.invalid { border-color: #b42318; outline-color: #b42318; }

label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
label > input, label > textarea, label > select { color: var(--text); font-size: 15px; }
label.check { flex-direction: row; align-items: center; gap: 0.45rem; font-size: 0.95rem; color: var(--text); }
label.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }

code { font-size: 0.9em; background: var(--bg); border: 1px solid var(--border); border-radius: 0.3rem; padding: 0 0.25rem; }

/* --- top bar ------------------------------------------------------------------ */
.wt-top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.wt-top-inner, .wt-main { max-width: 78rem; margin: 0 auto; padding-inline: 1rem; }
.wt-top-inner { display: flex; align-items: center; gap: 1rem; min-height: 3.6rem; flex-wrap: wrap; }
.wt-brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; }
.wt-brand .brand-mark {
  display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem;
  border-radius: 0.5rem; background: var(--accent); color: #fff; font-size: 1rem;
}
.tabs { display: flex; gap: 0.25rem; }
.tab {
  font: inherit; font-weight: 600; color: var(--muted); background: none; border: 0;
  padding: 0.5rem 0.75rem; border-radius: 0.5rem; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.wt-user { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.wt-main { padding-block: 1.25rem 3rem; }
.wt-footer { max-width: 78rem; margin: 0 auto; padding: 1rem 1rem 2rem; text-align: center; color: var(--muted); border-top: 1px solid var(--border); }
.wt-footer a { color: var(--muted); }
.wt-footer a:hover { color: var(--text); }

@media (max-width: 640px) {
  .wt-top-inner { gap: 0.4rem 0.75rem; padding-block: 0.5rem; }
  .tabs { order: 3; width: 100%; }
  .tab { flex: 1; }
  #user-name { display: none; }
}

.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 0.6rem; }
.toolbar input[type=search] { flex: 1 1 16rem; }
.period-nav { display: flex; align-items: center; gap: 0.5rem; }
.period-nav strong { min-width: 12rem; text-align: center; }

/* --- sheet list ---------------------------------------------------------------- */
.sheet-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.sheet-list .empty { color: var(--muted); padding: 2rem 0; }
.sheet-row {
  display: grid;
  /* fixed / fr columns only: an "auto" column would size per row (each row is its
     own grid), so a short badge like "offen" would shift the other columns */
  grid-template-columns: 10rem minmax(0, 1.2fr) minmax(0, 2fr) minmax(0, 1fr) 8.5rem;
  gap: 0.4rem 1rem;
  align-items: start;
  width: 100%;
  font: inherit;
  color: var(--text);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
}
.sheet-row:hover { border-color: var(--accent); }
.sheet-row > span { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.sr-work { color: var(--muted); display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-badges { align-items: flex-end; gap: 0.3rem !important; }
.badge {
  font-size: 0.75rem; font-weight: 600; border-radius: 999px; padding: 0.1rem 0.55rem;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.badge.ok { color: #1a7f37; border-color: color-mix(in srgb, #1a7f37 40%, transparent); }
.badge.open { color: #9a6700; border-color: color-mix(in srgb, #9a6700 40%, transparent); }
:root[data-theme="dark"] .badge.ok { color: #56d364; }
:root[data-theme="dark"] .badge.open { color: #e3b341; }

@media (max-width: 900px) {
  .sheet-row { grid-template-columns: 1fr auto; }
  .sr-date { grid-column: 1; }
  .sr-badges { grid-column: 2; grid-row: 1; }
  .sr-customer, .sr-work, .sr-meta { grid-column: 1 / -1; }
}

/* --- tables -------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table, .edit-table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.data-table th, .data-table td { border-bottom: 1px solid var(--border); padding: 0.4rem 0.55rem; text-align: left; vertical-align: top; }
.data-table th { font-size: 0.8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.data-table tfoot td { font-weight: 600; border-bottom: 0; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plus { color: #1a7f37; }
.minus { color: #b42318; }
:root[data-theme="dark"] .plus { color: #56d364; }
:root[data-theme="dark"] .minus { color: #ff8a80; }
.hol { display: block; color: #9a6700; font-weight: 600; white-space: normal; max-width: 6rem; margin-left: auto; }
:root[data-theme="dark"] .hol { color: #e3b341; }
th.today { color: var(--accent); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.overview-table { background: var(--surface); border: 1px solid var(--border); border-radius: 0.7rem; }
.note { margin-top: 1rem; max-width: 60rem; }

.edit-table th { font-size: 0.78rem; color: var(--muted); font-weight: 600; text-align: left; padding: 0 0.25rem 0.25rem; white-space: nowrap; }
.edit-table td { padding: 0.15rem 0.2rem; vertical-align: top; }
.edit-table tfoot td { font-weight: 600; padding-top: 0.4rem; }
.edit-table input, .edit-table select, .edit-table textarea { width: 100%; padding: 0.4rem 0.45rem; }
.edit-table input.time { width: 3.9rem; text-align: right; font-variant-numeric: tabular-nums; }
.edit-table input.short { width: 4.5rem; }
.edit-table input.wide { min-width: 14rem; }
.time-table select.emp { min-width: 9rem; }
.time-table select.role { min-width: 6.8rem; }
.extra-table select.emp { min-width: 9rem; }
.extra-table input.xdate { min-width: 9.5rem; }
.week-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.week-nav strong { min-width: 13rem; text-align: center; }
.week-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; margin: 0; }
.week-chips:empty { display: none; }
.week-chip {
  font: inherit; color: var(--accent); background: var(--surface); cursor: pointer;
  border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.6rem;
}
.week-chip:hover { border-color: var(--accent); }
.week-chip.current { background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: var(--accent); }
.week-title { font-weight: 600; margin: 1rem 0 0.25rem; }
.edit-table input.time.future { background: var(--bg); border-style: dashed; color: var(--muted); cursor: not-allowed; }
.edit-table th.future { opacity: 0.55; }
#future-warning { margin: 0; font-weight: 600; }
.extra-table textarea { min-width: 14rem; }
.material-table td:nth-child(5) input { min-width: 8rem; }

/* --- dialogs -------------------------------------------------------------------- */
dialog {
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
dialog::backdrop { background: rgba(10, 12, 16, 0.55); }

.sheet-dialog {
  width: min(70rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: clip; /* "hidden" would still let scrollIntoView() scroll the header away */
}
.sheet-dialog[open], .sheet-dialog[open] > form { display: flex; flex-direction: column; }
/* flex-basis auto, not 0: Safari collapses a 0-basis child of a max-height-only flexbox to nothing */
.sheet-dialog > form { min-height: 0; flex: 1 1 auto; overflow: clip; }
.sheet-dialog.narrow { width: min(52rem, calc(100vw - 2rem)); }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--surface);
}
.dialog-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.dialog-body { padding: 0.5rem 1.1rem 1.5rem; overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.dialog-body > :first-child { margin-top: 0.75rem; }

@media (max-width: 640px) {
  .sheet-dialog, .sheet-dialog.narrow {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0;
  }
}

fieldset { border: 1px solid var(--border); border-radius: 0.7rem; padding: 0.75rem 0.9rem 0.9rem; margin: 1rem 0 0; background: var(--surface); display: grid; gap: 0.6rem; min-width: 0; }
legend { font-weight: 700; padding: 0 0.35rem; }
fieldset p { margin: 0; }
fieldset > .btn { justify-self: start; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 0.6rem 0.9rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
.checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.form-end { display: flex; justify-content: flex-end; margin-top: 1rem; }
#edit-error { margin: 1rem 0 0; }

.fields { margin-top: 0.75rem; }
.field { display: flex; flex-direction: column; gap: 0.1rem; }
.field-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.field-value { overflow-wrap: anywhere; }
.meta { margin-top: 2rem; }

.signature-pad {
  display: block;
  width: 100%;
  max-width: 34rem;
  height: 11rem;
  background: #fff;
  border: 1px dashed var(--muted);
  border-radius: 0.5rem;
  touch-action: none;
  cursor: crosshair;
}
.sign-body { display: grid; gap: 0.6rem; justify-items: start; align-content: start; }
.sign-body p { margin: 0; }
.sign-body .signature-pad { max-width: none; height: 13rem; }

.confirm-dialog { width: min(30rem, calc(100vw - 2rem)); padding: 1.3rem 1.4rem 1.1rem; }
.confirm-dialog h2 { margin: 0 0 0.6rem; }
.confirm-dialog p { margin: 0 0 0.6rem; line-height: 1.5; }
.confirm-dialog label { margin: 0.4rem 0 0.6rem; }
.confirm-dialog input[type=email] { width: 100%; }
.confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
.signature-img { display: block; max-width: min(100%, 22rem); background: #fff; border: 1px solid var(--border); border-radius: 0.4rem; }

/* --- login ---------------------------------------------------------------------- */
.login-dialog { width: min(24rem, calc(100vw - 2rem)); padding: 1.75rem 1.5rem 1.25rem; }
.login-dialog::backdrop { background: var(--bg); }
.login-dialog form { display: grid; gap: 0.85rem; }
.login-dialog h1 { margin: 0; }
.login-dialog p { margin: 0; }
.login-foot { text-align: center; color: var(--muted); margin-top: 0.4rem !important; }
.login-foot a { color: var(--muted); }

/* --- print -------------------------------------------------------------------------
   Printing the page is disabled on purpose: the "PDF" buttons create proper PDFs
   on the server (page numbers, no browser header/footer). */
@media print {
  body > * { display: none !important; }
  body::before {
    content: "Drucken ist hier deaktiviert. Bitte den Button „PDF“ verwenden.";
    display: block;
    padding: 2rem;
    color: #000;
    font: 14pt -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  }
}
