/* ===== Vorgangsdashboard – styles.css ===== */
/* Extrahiert aus Stylesheet.html (Apps Script) */

:root {
  --bg: #f0f6fc;
  --card: #ffffff;
  --ink: #2b2b2b;
  --muted: #6f6f6f;
  --line: #dde6ee;
  --accent: rgb(47, 62, 139);
  --accent-ink: #ffffff;
  --link: rgb(47, 62, 139);
  --radius: 12px;
  --gap: 14px;
  --surface: #f8fbff;
  --surface-2: #ffffff;
  --thead: #f0f6fc;
}

[data-theme="dark"] {
  --bg: #0f1720;
  --card: #111827;
  --ink: #e5e7eb;
  --muted: #9ca3af;
  --line: #243244;
  --accent: #60a5fa;
  --accent-ink: #0b1220;
  --link: #93c5fd;
  --surface: #0b1220;
  --surface-2: #111827;
  --thead: #0b1220;
}

[data-theme="gelb"] {
  --bg: #fff7d1; --card: #ffffff; --ink: #2b2b1a; --muted: #6f6542;
  --line: #f6dfa2; --accent: #ca8a04; --accent-ink: #1a1606; --link: #b45309;
}
[data-theme="gruen"] {
  --bg: #eafaf2; --card: #ffffff; --ink: #0f2419; --muted: #4b6b58;
  --line: #c6ead7; --accent: #0f9d58; --accent-ink: #ffffff; --link: #0b7a43;
}
[data-theme="rot"] {
  --bg: #fff1f1; --card: #ffffff; --ink: #1f1b1b; --muted: #ffffff;
  --line: #f2c2c2; --accent: #c81e1e; --accent-ink: #ffffff; --link: #991b1b;
  --thead: #d64b4b; --thead-ink: #ffffff; --zebra: #fff8f8;
  --badge-bg: #fde2e2; --badge-ink: #991b1b;
}
[data-theme="rosa"] {
  --bg: #fff1f7; --card: #ffffff; --ink: #2b2430; --muted: #7a6b7a;
  --line: #ffd6e7; --accent: #ec4899; --accent-ink: #ffffff; --link: #be185d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.35;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Container ===== */
.container {
  width: 100%;
  padding: 24px clamp(16px, 2vw, 32px);
  display: grid;
  gap: var(--gap);
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 14px 16px;
  border-radius: 12px;
  background: #2f3e8b;
  border: 1px solid #2f3e8b;
  color: #fff;
  gap: 20px;
}
.title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.title img { height: 28px; width: auto; display: block; }

.actions {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 10px;
}
.search-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header a { color: #fff; }

.searchbox {
  max-width: 240px; width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 14px;
  color: var(--ink);
}

.theme-btn {
  height: 32px; width: 32px;
  border: 1px solid rgba(255, 255, 255, .35);
  background: transparent; color: #fff; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.theme-btn:hover { background: rgba(255, 255, 255, .12); }

.theme-select {
  height: 32px;
  border: 1px solid rgba(255, 255, 255, .35);
  background: var(--surface-2); color: var(--ink); border-radius: 8px;
  padding: 0 8px; font-size: 13px;
}

.hidden { display: none !important; }
.icon-btn img { position: relative; top: 2px; }

/* ===== Cards ===== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .02);
  padding: 16px 18px;
}
.card h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}

/* ===== Tables ===== */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th {
  text-align: left; color: var(--muted); font-weight: 700;
  background: var(--thead); position: sticky; top: 0; z-index: 1;
}

/* ===== Grid ===== */
.grid { display: grid; gap: var(--gap); }
.cols-3 { grid-template-columns: 1.2fr 1fr 1fr; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.table-wrap { max-height: 360px; overflow: auto; }

@media (max-width: 1100px) {
  .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .cols-2 { grid-template-columns: 1fr; }
}

/* ===== Vorgangs-spezifisch ===== */
.cols-top {
  grid-template-columns: 1.25fr 1.25fr;
  align-items: start;
}
@media (max-width: 1100px) { .cols-top { grid-template-columns: 1fr; } }

.customer-card,
.panel-neutral,
.summary-neutral,
.project-neutral,
.address-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .02);
}

.customer-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  font-size: 14px;
}
.customer-id {
  font-weight: 800;
  color: var(--accent);
  text-decoration: underline;
  margin-bottom: 6px;
  display: inline-block;
}

.panel-cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 700px) { .panel-cols-2 { grid-template-columns: 1fr; } }

.subbox {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
  font-size: 14px;
}
.subrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.subrow:nth-child(even) { background: var(--surface-2); }
.subrow .label { color: var(--muted); }
.subrow .value { text-align: right; font-weight: 600; }
.subrow:last-child { border-bottom: none; }

.summary-neutral {
  padding: 10px 12px;
  position: relative;
}
.summary-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  font-size: 14px;
}
.summary-list .label { color: var(--muted); font-size: 12px; }
.summary-list .value { text-align: right; font-weight: 700; color: var(--ink); }

.project-neutral .row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  font-size: 14px;
  align-items: center;
}
.project-neutral .label { color: var(--muted); font-weight: 700; }

.address-title {
  padding: 7px 9px;
  background: var(--thead);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.address-body {
  padding: 9px 10px;
  background: var(--surface-2);
  display: grid;
  gap: 4px;
  font-size: 14px;
}

.pos-table thead th { white-space: nowrap; font-size: 13px; }
.pos-table td { font-size: 14px; }
.bullets { margin: 0; padding-left: 16px; }
.bullets li { margin: 2px 0; }
.book { font-size: 16px; opacity: .9; }

.customer-card,
.project-neutral { min-height: 118px; }
.project-neutral {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.info-btn {
  position: absolute; top: -10px; left: -10px;
  height: 26px; width: 26px; border-radius: 999px;
  border: 2px solid var(--accent); color: var(--accent);
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12); z-index: 5;
}

.longtext-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px; padding: 4px 6px;
  font-size: 15px; cursor: pointer; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.longtext-btn:hover { filter: brightness(.97); }
.longtext-btn.is-empty {
  opacity: .25;
  cursor: not-allowed;
  pointer-events: none;
  background: transparent;
}

/* ===== Overlays ===== */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 9999;
}
.overlay.hidden { display: none !important; }

.overlay-card {
  width: min(1100px, 96vw); max-height: 90vh; overflow: auto;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  padding: 18px 20px 16px; position: relative;
}
.overlay-title {
  font-size: 14px; font-weight: 800; letter-spacing: .4px;
  text-transform: uppercase; color: var(--muted);
  margin: 0 0 8px;
}
.overlay-text {
  font-size: 16px; white-space: pre-wrap; line-height: 1.45;
}
.overlay-close {
  position: absolute; top: 10px; right: 10px; border: none;
  background: transparent; font-size: 22px; cursor: pointer;
  color: var(--muted); line-height: 1;
}
.overlay-close:hover { color: var(--ink); }

/* ===== Tooltip ===== */
.vgnr-tooltip-wrap { position: relative; display: inline-block; }
.vgnr-tooltip {
  position: absolute; left: 0; top: calc(100% + 6px);
  background: #222; color: #fff; font-size: 12px;
  padding: 6px 8px; border-radius: 6px; white-space: nowrap;
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  z-index: 9999;
}
.vgnr-tooltip-wrap:hover .vgnr-tooltip,
.vgnr-tooltip-wrap:focus-within .vgnr-tooltip {
  opacity: 1; transform: translateY(0);
}

/* ===== Pfeil-Button ===== */
.vgnr-wrap { position: relative; display: inline-block; }
.vgnr-wrap .searchbox { padding-right: 34px; }
.searchbox-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  height: 22px; width: 22px; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.searchbox-btn:active { transform: translateY(-50%) scale(.96); }

/* ===== Edit-Links ===== */
.edit-link {
  margin-left: 6px;
  font-size: 13px;
  opacity: 0.6;
}
.edit-link:hover { opacity: 1; }

/* ===== Adress-Panel ===== */
.address-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.address-panel .subbox:first-child { grid-column: 1 / -1; }
.address-panel .subbox { margin-top: 0 !important; }

/* ===== Speichern-Button ===== */
.btn-save {
  border: 1px solid var(--line);
  background: var(--accent, #2f3e8b);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  margin-top: 10px;
}

/* ===== Loading-Spinner ===== */
.loading-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 15px;
  gap: 10px;
}
.spinner {
  width: 20px; height: 20px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Hinweis bei leerem Dashboard ===== */
.empty-hint {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
  font-size: 16px;
}