@import url('tokens.css'); /* gemeinsame Design-Grundlage, siehe /home/apps/projects/shared/design/ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; overflow-x: hidden; }
html { font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.4; }
a { color: var(--text-accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; color: inherit; }
svg { display: block; flex-shrink: 0; }
[hidden] { display: none !important; }

/* ── Buttons / Formulare (wie Zeiterfassung/Portal) ─────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text);
  min-height: 40px; transition: background 0.15s, border-color 0.15s; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--accent-lt); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-lt); }
.btn-danger { color: var(--danger); }
.btn-sm { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.btn-icon { min-height: 36px; width: 36px; padding: 0; }
.btn-block { width: 100%; }
.btn.recording { background: var(--tint-danger); border-color: var(--danger); color: var(--danger); }
.btn.recording svg { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
label, .label { font-size: 13px; color: var(--text-muted); }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=time],
input[type=number], input[type=search], select, textarea {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 16px; padding: 10px 12px; font-family: inherit; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 92px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-lt); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.75; }

.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 14px; display: none; margin-bottom: 16px; }
.alert.show { display: block; }
.alert-error { background: var(--tint-danger); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }

/* ── Login ──────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: var(--shadow-md);
}
.login-logo { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 18px; font-weight: 600; margin-bottom: 28px; }
.logo-icon {
  width: 34px; height: 34px; background: var(--accent); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0;
}
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); padding: 6px; }

/* ── Kopf + Tab-Leiste (gleiches Muster wie die eingebetteten Apps) ─ */
.appbar {
  position: sticky; top: 0; z-index: 50; background: var(--bg-card); border-bottom: 1px solid var(--border);
}
.appbar-inner {
  max-width: var(--content-max); margin: 0 auto; padding: 0 var(--page-pad);
  display: flex; align-items: center; gap: 12px; min-height: 52px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand .logo-icon { width: 30px; height: 30px; }
html.embedded .brand { display: none; }
.tabs { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-muted);
  padding: 15px 12px 13px; font-size: 14px; font-weight: 500; white-space: nowrap; flex-shrink: 0;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text-accent); border-bottom-color: var(--accent-lt); }
.tab .count { margin-left: 6px; font-size: 12px; background: var(--tint-neutral); border-radius: 10px; padding: 1px 7px; }
.appbar-actions { display: flex; align-items: center; gap: 8px; }
html.embedded #theme-toggle { display: none; }
.net { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.net.offline { color: var(--warning); }

.page { max-width: var(--content-max); margin: 0 auto; padding: 24px var(--page-pad) 64px; }
.page-narrow { max-width: calc(1000px + 2 * var(--page-pad)); }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; font-weight: 700; flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.head-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }

/* ── Liste ─────────────────────────────────────────────────────── */
.list-tools { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.list-tools input { max-width: 360px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.report-card { display: flex; flex-direction: column; gap: 8px; text-align: left; color: var(--text); transition: border-color 0.15s; cursor: pointer; }
.report-card:hover { border-color: var(--accent-lt); }
.report-card .rc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.report-card .rc-num { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.report-card .rc-site { font-weight: 600; font-size: 15.5px; overflow-wrap: anywhere; }
.report-card .rc-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-muted); }
.report-card .rc-meta span { display: inline-flex; align-items: center; gap: 5px; }
.empty { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.empty svg { margin: 0 auto 10px; }

.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.st-entwurf        { background: var(--tint-neutral); color: var(--text-muted); }
.st-zugewiesen     { background: var(--tint-accent);  color: var(--text-accent); }
.st-in_arbeit      { background: var(--tint-warning); color: var(--warning); }
.st-unterschrieben { background: var(--tint-success); color: var(--success); }
.st-geprueft       { background: var(--tint-success); color: var(--success); }
.st-abgerechnet    { background: var(--tint-neutral); color: var(--text); }

/* ── Editor ────────────────────────────────────────────────────── */
.section { margin-bottom: 16px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin-right: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 14px; }
.field-with-mic { display: flex; gap: 8px; align-items: flex-start; }
.field-with-mic > :first-child { flex: 1; min-width: 0; }
.lock-note { background: var(--tint-success); color: var(--success); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; margin-bottom: 16px; display: flex; gap: 8px; align-items: center; }
.save-state { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.save-state.warn { color: var(--warning); }
.save-state.err { color: var(--danger); }

/* Diktat-Panel */
.dictation { border: 1px dashed var(--accent-lt); background: var(--tint-accent); border-radius: var(--radius); padding: 12px; margin-bottom: 16px; }
.dictation textarea { background: var(--bg-card); min-height: 110px; }
.dictation .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.suggest { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.suggest-item { display: flex; gap: 10px; align-items: flex-start; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; }
.suggest-item input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; }
.suggest-item .k { font-size: 12px; color: var(--text-muted); }
.suggest-item .v { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Zeilen-Tabellen (Arbeitszeit, Material): Desktop als Raster, Handy als Karten */
.rows { display: flex; flex-direction: column; gap: 10px; }
.row-item { display: grid; gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-input); }
.row-item .cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row-item .cell label { font-size: 11.5px; }
.row-item input, .row-item select { padding: 8px 9px; font-size: 15px; background: var(--bg-card); }
.labor-row { grid-template-columns: 1.5fr 1.25fr 0.95fr 0.95fr 0.55fr 0.9fr 0.8fr auto; }
.material-row { grid-template-columns: 2.4fr 0.8fr 0.8fr 1.6fr auto; }
.row-actions { display: flex; gap: 6px; }
.hours { font-weight: 600; padding: 9px 0; font-variant-numeric: tabular-nums; }
.totals { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg button { background: var(--bg-card); border: none; padding: 8px 14px; font-size: 14px; min-height: 38px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent); color: #fff; }
.seg button:disabled { cursor: default; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--tint-accent); color: var(--text-accent); }
.link-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Fotos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.photo { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); aspect-ratio: 1; background: var(--bg-input); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo label { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,0.6); color: #fff; font-size: 12px; border-radius: 6px; padding: 3px 7px; display: flex; gap: 5px; align-items: center; }

/* Abschluss / Unterschriften */
.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sig-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sig-box img { background: #fff; border-radius: 6px; height: 84px; object-fit: contain; width: 100%; border: 1px solid var(--border); }
.sig-box .who { font-size: 13px; color: var(--text-muted); }
.done-line { display: flex; align-items: center; gap: 8px; color: var(--success); font-weight: 600; }

/* Overlays (Unterschrift, Dialoge) */
.overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow: auto; padding: 20px; box-shadow: var(--shadow-md); }
.dialog h3 { font-size: 17px; margin-bottom: 6px; }
.dialog p { margin-bottom: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.sig-canvas { width: 100%; height: 220px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); touch-action: none; display: block; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 80; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); min-width: 230px; padding: 6px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: none; padding: 10px; border-radius: 6px; font-size: 14px; }
.menu button:hover { background: var(--bg-hover); }
.menu .danger { color: var(--danger); }
.menu-wrap { position: relative; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 300; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--radius); font-size: 14px; box-shadow: var(--shadow-md); max-width: calc(100vw - 32px); }

/* ── Tablet / Handy ────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .labor-row { grid-template-columns: 1fr 1fr 1fr; }
  .labor-row .c-worker { grid-column: 1 / -1; }
  .material-row { grid-template-columns: 1fr 1fr 1fr; }
  .material-row .c-name, .material-row .c-note { grid-column: 1 / -1; }
  .row-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 600px) {
  :root, body.light { --page-pad: 16px; }
  .page { padding-top: 16px; }
  .page-head h1 { font-size: 19px; }
  .grid2, .grid3, .sig-grid { grid-template-columns: 1fr; }
  .tab { padding: 13px 10px 11px; font-size: 13.5px; }
  .card { padding: 14px; }
  .cards { grid-template-columns: 1fr; }
  .labor-row { grid-template-columns: 1fr 1fr; }
  .net .net-text { display: none; }
}
