/* ==========================================================================
   DESIGN SYSTEM & VARIABLES ("Heizungskeller-Design")
   ========================================================================== */
:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #0f162a;
  --bg-card: rgba(20, 29, 47, 0.75);
  --bg-input: #070a12;
  --bg-tertiary: #1a2236;
  --bg-nav: rgba(10, 15, 29, 0.95);
  
  --color-text: #f3f4f6;
  --color-text-muted: #9ca3af;
  
  --color-accent: #ea580c; /* DATO Orange */
  --color-accent-hsl: 20, 84%, 48%;
  --color-accent-glow: rgba(234, 88, 12, 0.35);
  --color-accent-muted: rgba(234, 88, 12, 0.15);
  
  --color-blue: #1e40af; /* DATO Blue */
  --color-blue-glow: rgba(30, 64, 175, 0.35);
  --color-blue-muted: rgba(30, 64, 175, 0.15);
  
  --color-cyan: #00e5ff;
  --color-cyan-glow: rgba(0, 229, 255, 0.3);
  
  --color-success: #10b981;
  --color-success-glow: rgba(16, 185, 129, 0.2);
  --color-danger: #ef4444;
  --color-danger-glow: rgba(239, 68, 68, 0.25);
  
  --border-glass: rgba(255, 255, 255, 0.05);
  --border-neon: rgba(30, 64, 175, 0.25);
  
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --shadow-neon: 0 0 20px 0 rgba(30, 64, 175, 0.15);
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--bg-primary);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: -webkit-fill-available;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent-muted);
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
h1, h2, h3, h4 {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #ffffff;
}

p {
  color: var(--color-text-muted);
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
  height: 64px;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.header-icon {
  filter: drop-shadow(0 0 4px var(--color-accent-glow));
}

.header-logo h1 {
  font-size: 1.25rem;
  font-weight: 800;
}

.header-logo h1 span {
  color: var(--color-accent);
  text-shadow: 0 0 10px var(--color-accent-glow);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.badge.online {
  background-color: var(--color-success-glow);
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.3);
}
.badge.online .badge-dot {
  background-color: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.badge.offline {
  background-color: var(--color-danger-glow);
  color: var(--color-danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.badge.offline .badge-dot {
  background-color: var(--color-danger);
  box-shadow: 0 0 8px var(--color-danger);
  animation: pulse-red 1.5s infinite;
}

/* ==========================================================================
   APP NAVIGATION FOOTER
   ========================================================================== */
.app-navbar {
  height: calc(64px + var(--safe-area-bottom));
  background-color: var(--bg-nav);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-around;
  padding-bottom: var(--safe-area-bottom);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.nav-item {
  flex: 1;
  background: none;
  border: none;
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: var(--transition-fast);
  padding: 8px 0;
  position: relative;
}

.nav-icon {
  width: 22px;
  height: 22px;
  transition: var(--transition-fast);
}

.nav-item span {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Active Nav State */
.nav-item.active {
  color: var(--color-accent);
}
.nav-item.active .nav-icon {
  transform: translateY(-2px);
  filter: drop-shadow(0 0 8px var(--color-accent-glow));
}
.nav-item::after {
  content: '';
  position: absolute;
  top: 0;
  width: 30%;
  height: 3px;
  background-color: var(--color-accent);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 0 10px var(--color-accent);
  opacity: 0;
  transition: var(--transition-fast);
}
.nav-item.active::after {
  opacity: 1;
}

.nav-label-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.badge-count {
  position: absolute;
  top: -8px;
  right: -14px;
  background-color: var(--color-accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  box-shadow: 0 0 8px var(--color-accent-glow);
}

/* ==========================================================================
   SCREENS / TABS
   ========================================================================== */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px calc(80px + var(--safe-area-bottom));
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-pane.active {
  display: block;
}

.section-title {
  margin-bottom: 20px;
}
.section-title h2 {
  font-size: 1.75rem;
}
.section-title .sub-title {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  display: block;
  margin-top: 2px;
}

/* ==========================================================================
   COMPONENTS: CARDS & CONTAINERS
   ========================================================================== */
.card {
  background-color: var(--bg-card);
  backdrop-filter: blur(16px);
  border-radius: 16px;
  border: 1px solid var(--border-glass);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-premium);
  transition: var(--transition-smooth);
}

.card-neon {
  border-left: 3px solid var(--color-accent);
}
.card-neon:focus-within {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-neon);
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-transform: uppercase;
  font-family: var(--font-title);
  letter-spacing: 0.05em;
  color: var(--color-text);
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 8px;
}

.card-header-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 16px;
  padding-bottom: 8px;
}
.card-header-action h3 {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.optional-tag {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  font-family: var(--font-title);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn-huge {
  width: 100%;
  height: 72px; /* Super touch friendly */
  font-size: 1.2rem;
  border-radius: 16px;
  box-shadow: var(--shadow-premium);
}

.btn-start {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}
.btn-start:active {
  transform: scale(0.97);
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-stop {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}
.btn-stop:active {
  transform: scale(0.97);
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

.btn-accent {
  background-color: var(--color-accent);
  color: white;
  padding: 12px 24px;
  font-size: 0.9rem;
}
.btn-accent:active {
  background-color: #e54e17;
  transform: scale(0.98);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--color-text);
  border: 1px solid var(--border-glass);
  padding: 12px 24px;
  font-size: 0.9rem;
}
.btn-secondary:active {
  background-color: #3f3f46;
  transform: scale(0.98);
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 12px 24px;
  font-size: 0.9rem;
}
.btn-danger:active {
  background-color: rgba(239, 68, 68, 0.25);
  transform: scale(0.98);
}

.btn-block {
  width: 100%;
}

/* Space consecutive full-width buttons when stacked inside a card */
.btn-block + .btn-block {
  margin-top: 10px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-icon-text {
  padding: 10px 18px;
  font-size: 0.85rem;
}

/* Voice Dictation Button (Microphone) */
.btn-voice {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background-color: var(--bg-tertiary);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}
.btn-voice:active {
  transform: scale(0.9);
}
.btn-voice.recording {
  background-color: var(--color-danger);
  color: white;
  border-color: transparent;
  box-shadow: 0 0 15px var(--color-danger);
  animation: pulse-red-border 1.5s infinite;
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="email"],
input[type="number"],
textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: white;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px;
  transition: var(--transition-fast);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(255, 90, 31, 0.15);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.textarea-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
}

.speech-status-indicator {
  font-size: 0.75rem;
  color: var(--color-danger);
  margin-top: 6px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   TAB 1 SPECIFICS: INACTIVE & ACTIVE VIEWS
   ========================================================================== */
.job-state-card {
  display: none;
  animation: fadeIn 0.3s ease;
}
.job-state-card.active {
  display: block;
}

.welcome-banner {
  text-align: center;
  margin: 40px 0 60px;
}
.welcome-logo {
  background: #ffffff;
  border-radius: 16px;
  padding: 18px 22px;
  max-width: 260px;
  margin: 0 auto 28px;
  box-shadow: var(--shadow-premium);
}
.welcome-logo img {
  width: 100%;
  height: auto;
  display: block;
}
.welcome-banner h2 {
  font-size: 2rem;
  margin-bottom: 12px;
  color: #fff;
  text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.welcome-banner p {
  max-width: 280px;
  margin: 0 auto;
  font-size: 0.95rem;
}

#btn-start-job {
  margin: 0 auto;
  max-width: 320px;
  display: flex;
}

/* Active Status Bar */
.active-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-premium);
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.timer-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--color-accent);
  box-shadow: 0 0 8px var(--color-accent);
}

.gps-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.gps-indicator.success {
  color: var(--color-cyan);
}
.gps-indicator.error {
  color: var(--color-danger);
}

/* Category grid selection */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.btn-cat {
  background-color: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 14px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--color-text-muted);
  transition: var(--transition-fast);
}

.btn-cat:hover {
  background-color: rgba(255,255,255,0.02);
}

.btn-cat:active {
  transform: scale(0.95);
}

.btn-cat.selected {
  background-color: var(--color-accent-muted);
  border-color: var(--color-accent);
  color: #fff;
  box-shadow: 0 0 15px rgba(255, 90, 31, 0.1);
}

.cat-icon {
  font-size: 1.6rem;
}
.cat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Dynamic grid spanning */
.category-grid button:nth-child(4) {
  grid-column: span 1;
}
.category-grid button:nth-child(5) {
  grid-column: span 2;
}

/* Material List */
.materials-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.material-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 8px 12px 8px 16px;
}

.material-details {
  display: flex;
  flex-direction: column;
}

.material-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: white;
}

.material-sku {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.material-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-counter {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-glass);
  background-color: var(--bg-tertiary);
  color: white;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-counter:active {
  background-color: var(--color-accent-muted);
  transform: scale(0.9);
}

.material-qty {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1rem;
  min-width: 20px;
  text-align: center;
}

.custom-material-form {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.custom-material-form input {
  flex: 1;
}

/* Measurements grid */
.measurements-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.action-footer {
  margin-top: 24px;
}

/* ==========================================================================
   TAB 2 SPECIFICS: HISTORY / VERLAUF
   ========================================================================== */
.history-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.history-actions button {
  flex: 1;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  background-color: var(--bg-card);
  border: 1px dashed var(--border-glass);
  border-radius: 12px;
  margin-top: 20px;
}
.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 0.85rem;
}

/* Job History Card */
.history-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 16px;
  transition: var(--transition-smooth);
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  cursor: pointer;
}

.history-card-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-card-title h4 {
  font-size: 1rem;
}

.history-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.history-badge-cat {
  background-color: var(--color-accent-muted);
  color: var(--color-accent);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid var(--border-neon);
}

.history-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  border-top: 1px solid var(--border-glass);
  padding-top: 8px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.meta-item svg {
  opacity: 0.6;
}

/* Collapsible Content */
.history-card-body {
  display: none;
  border-top: 1px solid var(--border-glass);
  margin-top: 12px;
  padding-top: 12px;
  animation: slideDown 0.25s ease-out;
}
.history-card.expanded .history-card-body {
  display: block;
}

.report-text-block {
  background-color: rgba(0,0,0,0.15);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.9rem;
  color: var(--color-text);
  white-space: pre-wrap;
  margin-bottom: 12px;
  border-left: 2px solid var(--border-glass);
}

.body-sub-section {
  margin-bottom: 12px;
}
.body-sub-section h5 {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

/* Mini table for measurements */
.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  background-color: rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
}
.mini-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-glass);
}
.mini-table tr:last-child td {
  border-bottom: none;
}
.mini-table td:first-child {
  color: var(--color-text-muted);
}
.mini-table td:last-child {
  text-align: right;
  font-weight: 600;
  color: white;
}

/* Card Actions */
.history-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.history-card-actions button {
  flex: 1;
}

/* ==========================================================================
   TAB 3 SPECIFICS: SYSTEM STATUS & SETTINGS
   ========================================================================== */
.system-status-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--bg-input);
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  margin-bottom: 16px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}
.status-row span {
  color: var(--color-text-muted);
}
.status-row strong {
  color: white;
}

/* ==========================================================================
   TOAST SYSTEM
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 20px;
  left: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background-color: #1a1d24;
  color: white;
  border-left: 4px solid var(--color-accent);
  padding: 14px 18px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
  border-top: 1px solid var(--border-glass);
  border-right: 1px solid var(--border-glass);
  border-bottom: 1px solid var(--border-glass);
}
.toast.toast-success {
  border-left-color: var(--color-success);
}
.toast.toast-danger {
  border-left-color: var(--color-danger);
}
.toast.toast-info {
  border-left-color: var(--color-cyan);
}

.toast-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding-left: 10px;
}

/* ==========================================================================
   KEYFRAME ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; height: 0; }
  to { opacity: 1; height: auto; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse-red {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse-red-border {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.animate-pulse {
  animation: pulse-orange 2s infinite;
}

@keyframes pulse-orange {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(255, 90, 31, 0.7); }
  70% { transform: scale(1.1); opacity: 0.5; box-shadow: 0 0 0 8px rgba(255, 90, 31, 0); }
  100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(255, 90, 31, 0); }
}

/* ==========================================================================
   RESPONSIVE DESIGN ADAPTATIONS
   ========================================================================== */
@media (min-width: 600px) {
  .app-content {
    max-width: 600px;
    margin: 0 auto;
    border-left: 1px solid var(--border-glass);
    border-right: 1px solid var(--border-glass);
    height: calc(100vh - 64px - 64px);
  }
  .app-header {
    max-width: 600px;
    margin: 0 auto;
    border-left: 1px solid var(--border-glass);
    border-right: 1px solid var(--border-glass);
  }
  .app-navbar {
    max-width: 600px;
    margin: 0 auto;
    border-left: 1px solid var(--border-glass);
    border-right: 1px solid var(--border-glass);
  }
}

/* ==========================================================================
   PHOTO COMPONENT STYLES
   ========================================================================== */
.photo-upload-section {
  margin-top: 16px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.photo-thumb-wrapper {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  background-color: var(--bg-input);
}

.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: var(--transition-fast);
}
.photo-thumb:hover {
  transform: scale(1.05);
}

.btn-photo-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: rgba(239, 68, 68, 0.85);
  color: white;
  border: none;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  z-index: 10;
  line-height: 1;
  padding-bottom: 2px;
}
.btn-photo-delete:active {
  transform: scale(0.9);
  background-color: rgb(239, 68, 68);
}

.photo-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-neon);
  border-radius: 8px;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  background-color: rgba(30, 64, 175, 0.05);
  color: var(--color-blue);
  transition: var(--transition-fast);
}
.photo-upload-placeholder:hover {
  background-color: rgba(30, 64, 175, 0.1);
  border-color: var(--color-blue);
}
.photo-upload-placeholder svg {
  margin-bottom: 4px;
  stroke: var(--color-blue);
}
.photo-upload-placeholder span {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  color: var(--color-blue);
}

/* ==========================================================================
   LIGHTBOX MODAL
   ========================================================================== */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  max-width: 90%;
  max-height: 80%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  border: 1px solid rgba(255,255,255,0.1);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.lightbox.active .lightbox-content {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   PRINT MEDIA STYLES
   ========================================================================== */
@media print {
  body {
    background-color: white !important;
    color: black !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  .app-header,
  .app-navbar,
  .toast-container,
  .history-actions,
  .history-card-actions,
  .empty-state,
  #tab-job,
  #tab-settings {
    display: none !important;
  }
  
  .app-content {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    max-width: 100% !important;
    height: auto !important;
  }
  
  #tab-history {
    display: block !important;
  }
  
  .section-title {
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
    margin-bottom: 30px;
  }
  
  .section-title h2 {
    color: black !important;
  }
  
  .history-card {
    border: none !important;
    box-shadow: none !important;
    background: none !important;
    padding: 0 !important;
    margin-bottom: 40px !important;
    page-break-inside: avoid;
    display: none; /* Hide all by default */
  }
  
  /* Show only the expanded card during print */
  .history-card.expanded {
    display: block !important;
  }
  
  .history-card-header {
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 15px;
    cursor: default !important;
  }
  
  .history-card-title h4 {
    font-size: 1.5rem !important;
    color: black !important;
  }
  
  .history-date {
    font-size: 0.9rem !important;
    color: #444 !important;
  }
  
  .history-badge-cat {
    border: 1px solid #000 !important;
    color: black !important;
    background: #eee !important;
    font-size: 0.85rem !important;
  }
  
  .history-card-meta {
    border-top: none !important;
    margin-bottom: 20px !important;
  }
  
  .meta-item {
    color: black !important;
    font-size: 0.9rem !important;
  }
  .meta-item a {
    color: black !important;
    text-decoration: none;
    font-weight: bold;
  }
  
  .history-card-body {
    display: block !important;
    border-top: none !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
  
  .report-text-block {
    background-color: #f5f5f5 !important;
    border: 1px solid #ccc !important;
    border-left: 4px solid #000 !important;
    color: black !important;
    font-size: 1rem !important;
    padding: 15px !important;
  }
  
  .body-sub-section h5 {
    color: black !important;
    border-bottom: 1px solid #000;
    padding-bottom: 4px;
    margin-bottom: 10px !important;
  }
  
  .mini-table {
    background-color: white !important;
    border: 1px solid #ccc;
  }
  
  .mini-table td {
    color: black !important;
    border-bottom: 1px solid #eee;
  }
  
  .mini-table td:last-child {
    color: black !important;
  }
  
  /* Print images nicely */
  .photo-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px !important;
    page-break-inside: avoid;
  }
  
  .photo-thumb-wrapper {
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
  }
  
  .btn-photo-delete,
  .photo-upload-placeholder {
    display: none !important;
  }
  
  .signature-display-img {
    border: 1px solid #ccc !important;
    max-width: 200px !important;
    background-color: white !important;
  }
}

/* ==========================================================================
   ADDED DATO MOBIL EXTENSION STYLES
   ========================================================================== */
.active-status-bar {
  flex-wrap: wrap;
  gap: 10px;
}

.gps-address-indicator {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--color-cyan);
  border-top: 1px solid var(--border-glass);
  padding-top: 8px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gps-address-indicator svg {
  flex-shrink: 0;
  stroke: var(--color-cyan);
  filter: drop-shadow(0 0 2px var(--color-cyan-glow));
}

.signature-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

#signature-canvas {
  background-color: #ffffff;
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  width: 100%;
  max-width: 400px;
  height: 150px;
  cursor: crosshair;
  touch-action: none; /* Disables standard touch gesture scrolling on the canvas */
}

.signature-buttons {
  display: flex;
  justify-content: center;
  width: 100%;
}

.signature-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 4px;
}

.signature-display-img {
  background-color: #ffffff;
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  max-width: 250px;
  height: auto;
  display: block;
  margin-top: 8px;
}

/* iOS install hint banner */
.ios-install-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--color-blue-muted);
  border: 1px solid var(--border-neon);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--color-text);
}
.ios-hint-text { flex: 1; line-height: 1.4; }
.ios-hint-text strong { color: var(--color-cyan); }
.ios-hint-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}

/* DSGVO consent placeholder near the signature */
.consent-text {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  line-height: 1.45;
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px dashed var(--border-glass);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
}
.consent-text strong { color: var(--color-accent); }

/* ==========================================================================
   ADDENDUM (NACHTRAG) MODAL + DISPLAY
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-premium);
}
.modal-box h3 { font-size: 1.15rem; margin-bottom: 6px; }
.modal-hint {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}
.modal-box textarea { min-height: 110px; margin-bottom: 12px; }
.modal-box .photo-grid:empty { display: none; }
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.modal-actions .btn { flex: 1; }

/* Addenda shown inside the history card */
.addendum-entry {
  border-left: 2px solid var(--color-accent);
  padding-left: 10px;
  margin-bottom: 12px;
}
.addendum-entry:last-child { margin-bottom: 0; }
.addendum-date {
  font-size: 0.72rem;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 4px;
}

/* Returning-customer (Stammkunde) suggestion below the customer field */
.returning-hint {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  background-color: var(--color-blue-muted);
  border: 1px solid var(--border-neon);
  border-radius: 10px;
  padding: 12px 14px;
  animation: fadeIn 0.25s ease;
}
.returning-hint-body {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--color-text);
  line-height: 1.4;
}
.returning-hint-body svg {
  flex-shrink: 0;
  stroke: var(--color-cyan);
  filter: drop-shadow(0 0 2px var(--color-cyan-glow));
}
.returning-hint-actions {
  display: flex;
  gap: 8px;
}
.returning-hint-actions .btn { flex: 1; }

/* Voice row inside the addendum modal */
.addendum-voice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.addendum-voice-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   TIME TRACKING: PAUSE BUTTON + TIME DIALOG
   ========================================================================== */
.btn-pause {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-glass);
  color: var(--color-text);
  border-radius: 9999px;
  padding: 6px 14px;
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-pause:active { transform: scale(0.95); }
.btn-pause.paused {
  background-color: var(--color-accent-muted);
  border-color: var(--color-accent);
  color: var(--color-accent);
  box-shadow: 0 0 12px var(--color-accent-glow);
}
.btn-pause svg { flex-shrink: 0; }

/* datetime-local picks up the same look as the other inputs */
input[type="datetime-local"] {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: white;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 12px;
  transition: var(--transition-fast);
  outline: none;
}
input[type="datetime-local"]:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(255, 90, 31, 0.15);
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
}

.time-auto-record {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  background-color: rgba(0, 0, 0, 0.18);
  border-left: 2px solid var(--color-cyan);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.5;
}
.time-auto-record strong { color: var(--color-cyan); }

.time-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 4px;
}
.time-fields .input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.time-fields .input-group:last-child { grid-column: 1 / -1; }
.time-fields label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.time-net-preview {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-cyan);
  margin-top: 10px;
}

.time-correction-note {
  font-size: 0.72rem;
  color: var(--color-accent);
  margin-top: 4px;
}

/* "Direkt ans Büro senden" checkbox in the check-out dialog */
.time-send-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--color-text);
  cursor: pointer;
}
.time-send-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-accent);
  flex-shrink: 0;
}

/* Sent / open status on the history card */
.meta-item.sent-ok span { color: var(--color-success); font-weight: 600; }
.meta-item.sent-open span { color: var(--color-accent); font-weight: 600; }

/* Active "Nur offene" filter button */
.btn-filter-active {
  background-color: var(--color-accent-muted) !important;
  border-color: var(--color-accent) !important;
  color: var(--color-accent) !important;
}

/* ==========================================================================
   TECHNICAL HELP: MEASUREMENT FEEDBACK (Abgasverlust + plausibility)
   ========================================================================== */
select {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: white;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px;
  outline: none;
  transition: var(--transition-fast);
}
select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(255, 90, 31, 0.15);
}
select option { background-color: var(--bg-secondary); color: white; }

/* A measurement input flagged as implausible */
.measure-flagged {
  border-color: var(--color-danger) !important;
  box-shadow: 0 0 8px var(--color-danger-glow) !important;
}

.measure-feedback:empty { display: none; }
.measure-feedback { margin-top: 14px; }

.measure-result {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-cyan);
  background-color: rgba(0, 229, 255, 0.08);
  border: 1px solid var(--color-cyan-glow);
  border-radius: 8px;
  padding: 8px 12px;
}
.measure-result.over {
  color: var(--color-danger);
  background-color: var(--color-danger-glow);
  border-color: rgba(239, 68, 68, 0.3);
}

.measure-warning-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.measure-warning-list li {
  font-size: 0.78rem;
  color: var(--color-accent);
  background-color: var(--color-accent-muted);
  border-left: 2px solid var(--color-accent);
  border-radius: 6px;
  padding: 6px 10px;
}
