/* ── Wohnungsübergabe Applet Stylesheet ───────────────────────── */

:root {
  --accent-glow: rgba(79,70,229,.12);
  --success-bg: rgba(61,214,140,.10);
  --success-border: rgba(61,214,140,.28);
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Topbar Branding */
.header-bar, header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  row-gap: 8px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
}

.header-brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: #40c5d4;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.obj-badge {
  font-size: .88rem;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-d));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main Container Strict Layout Rule */
.app-container {
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
  box-sizing: border-box;
  flex: 1;
}

/* Multi-step progress bar */
.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  position: relative;
}

.progress-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--surface-2);
  transform: translateY(-50%);
  z-index: 1;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.step-node {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 2;
  border: 2px solid var(--border);
  transition: all 0.2s ease;
}

.step-node.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.step-node.completed {
  background: var(--ok);
  color: #ffffff;
  border-color: var(--ok);
}

/* Card Boxes */
.wizard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.step-header {
  margin-bottom: 20px;
}

.step-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 6px 0;
}

.step-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

/* Choice Cards Grid */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 8px;
}

.choice-option {
  position: relative;
  display: block;
}

.choice-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-box {
  border: 1.5px solid var(--border-2);
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s ease;
}

.choice-box:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.choice-option input[type="radio"]:checked + .choice-box {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent);
}

.choice-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.choice-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Form Groups & Field Inputs */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

/* Meter Cards */
.meter-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  margin-bottom: 12px;
}

.meter-card-header {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Room Checklist Items */
.room-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.room-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.room-status-toggles {
  display: flex;
  gap: 6px;
}

.btn-status-toggle {
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-status-toggle.ok.active {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok-border);
}

.btn-status-toggle.defect.active {
  background: var(--err-bg);
  color: var(--err);
  border-color: var(--err-border);
}

/* Key Count Inputs */
.key-count-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-count-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
}

.key-count-label {
  font-size: 0.9rem;
  font-weight: 500;
}

.key-inp {
  width: 70px !important;
  text-align: center;
  padding: 8px !important;
}

/* Photo Drop Zone & Grid */
.photo-drop-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--r-md);
  padding: 20px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.photo-drop-zone:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.photo-thumb-wrap {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--border-2);
}

.photo-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

/* Digital Signature Canvas Box */
.sig-container {
  border: 1.5px dashed var(--border-2);
  background: var(--surface-2);
  border-radius: var(--r-md);
  position: relative;
  touch-action: none;
  overflow: hidden;
}

#sig-canvas {
  width: 100%;
  display: block;
  cursor: crosshair;
  background: transparent;
}

.sig-hint {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 0.75rem;
  color: var(--muted);
  pointer-events: none;
}

/* Review Summary Card */
.review-summary-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-item-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

.review-item-val {
  font-size: 0.92rem;
  color: var(--text);
  margin-top: 3px;
}

/* Stat Grid for Export View */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 12px;
  text-align: center;
}

.stat-val {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

/* History Cards */
.history-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.history-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.history-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-einzug { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); }
.badge-auszug { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }

/* In-App Alert Boxes */
.alert-box {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  line-height: 1.45;
  margin-bottom: 16px;
}

.alert-box.err {
  background: var(--err-bg);
  border: 1px solid var(--err-border);
  color: var(--err);
}

/* Actions Footer in Steps */
.wizard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.wizard-actions .btn-primary,
.wizard-actions .btn-secondary {
  border-radius: var(--r-md);
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Success Card */
.success-card {
  text-align: center;
  padding: 36px 20px;
}

.success-icon-badge {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ok-bg);
  border: 2px solid var(--ok);
  color: var(--ok);
  font-size: 1.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

/* Print View Adjustments */
@media print {
  body { background: #fff !important; color: #000 !important; }
  header, .admin-nav, .wizard-actions, .legal-footer, .btn-link, button { display: none !important; }
  .app-container, .wizard-card { max-width: 100% !important; border: none !important; box-shadow: none !important; padding: 0 !important; }
  .meter-card, .room-card, .key-count-item { border: 1px solid #ccc !important; background: #fff !important; color: #000 !important; }
}
