:root {
  --bg: #ffffff;
  --bg-card: #f8faf8;
  --bg-hover: #eef4ee;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2ED91C;
  --accent-dark: #20a812;
  --ok: #2ED91C;
  --ok-bg: rgba(46, 217, 28, 0.12);
  --err: #dc2626;
  --err-bg: rgba(220, 38, 38, 0.1);
  --muted-bg: #f3f4f6;
  --radius: 0.5rem;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--accent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  height: 44px;
  width: auto;
  display: block;
}

.brand-sub {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  border-left: 2px solid var(--border);
  padding-left: 1rem;
}

.header .date {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.tab {
  padding: 0.65rem 1.4rem;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 500;
  transition: all 120ms;
}

.tab:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent);
}

.tab.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(46, 217, 28, 0.25);
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.summary {
  display: flex;
  gap: 0.5rem;
}

.refresh {
  padding: 0.5rem 1rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  transition: all 120ms;
}

.refresh:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.pill {
  display: inline-block;
  padding: 0.22rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill.ok { background: var(--ok-bg); color: var(--accent-dark); }
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.muted { background: var(--muted-bg); color: var(--text-muted); }
.pill.odoo-synced { background: #c8e6c9; color: #1b5e20; text-decoration: none; }
.pill.odoo-pending { background: #ffe0b2; color: #6e4500; }
.pill.odoo-skipped { background: #fff9c4; color: #6d5b00; }
.pill.odoo-error { background: #ffcdd2; color: #b71c1c; }
a.pill.odoo-synced:hover { background: #a5d6a7; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.75rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tbody tr.row-ok {
  background: var(--ok-bg);
}

tbody tr.row-err {
  background: var(--err-bg);
}

tbody tr:hover {
  background: var(--bg-hover);
}

.err-number {
  color: var(--err);
  font-weight: 700;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: var(--muted-bg);
  border-radius: 0.25rem;
  font-size: 0.72rem;
  margin-right: 0.25rem;
  margin-bottom: 0.15rem;
  color: var(--text-muted);
}

.skip-reason {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--err);
  line-height: 1.3;
  max-width: 200px;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  text-decoration: underline;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.error {
  padding: 0.85rem 1rem;
  background: var(--err-bg);
  color: var(--err);
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.filters {
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.filters label {
  cursor: pointer;
}

.filters input[type="checkbox"] {
  margin-right: 0.35rem;
  accent-color: var(--accent);
}

.resync-btn {
  padding: 0.35rem 0.75rem;
  background: var(--bg);
  color: var(--accent-dark);
  border: 1px solid var(--accent);
  border-radius: 0.375rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 120ms;
}

.resync-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #ffffff;
}

.resync-btn:disabled {
  cursor: wait;
  opacity: 0.7;
}

.resync-ok {
  color: var(--accent-dark);
}

.resync-err {
  color: var(--err);
}

.kuma-frame {
  width: 100%;
  height: 900px;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  margin-top: 0.5rem;
  background: #ffffff;
}

.fallback {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* 28.04.2026: scrollbarer Wrapper fuer breite Tabellen (Audit aus Rahmen geflogen) */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin-top: 0.5rem;
  -webkit-overflow-scrolling: touch;
}
.table-wrap table {
  min-width: 1100px;
}

/* Mantelbogen Status Karte */
.mantelbogen-card {
  margin-top: 1.2rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--panel-bg, #fff);
}
.mantelbogen-card h3 {
  margin: 0 0 0.6rem 0;
  font-size: 0.95rem;
}
.mantelbogen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
}
.mantelbogen-stat {
  background: var(--muted-bg);
  padding: 0.6rem 0.8rem;
  border-radius: 0.35rem;
}
.mantelbogen-stat .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mantelbogen-stat .value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.2rem;
}
.mantelbogen-stat.create .value { color: #1565c0; }
.mantelbogen-stat.update .value { color: #ef6c00; }
.mantelbogen-stat.unchanged .value { color: #2e7d32; }
.mantelbogen-meta {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.mantelbogen-error {
  color: var(--err);
  margin-top: 0.5rem;
}

.mantelbogen-sub {
  margin: -0.2rem 0 0.6rem 0;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* === Login Page === */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8eef3 100%);
}
.login-card {
  background: #fff;
  padding: 2.5rem 2.5rem 2rem;
  border-radius: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 380px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.8rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--accent, #2e7d32);
}
.login-brand .logo {
  height: 36px;
  width: auto;
}
.login-sub {
  font-size: 0.95rem;
  color: var(--text-muted, #555);
  font-weight: 500;
}
.login-form label {
  display: block;
  margin-bottom: 1rem;
}
.login-form label span {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #555);
  margin-bottom: 0.3rem;
  font-weight: 600;
}
.login-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border, #d0d7de);
  border-radius: 0.5rem;
  font-size: 1rem;
  background: #fafbfc;
  transition: border-color 0.15s, background 0.15s;
}
.login-form input:focus {
  outline: none;
  border-color: var(--accent, #2e7d32);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}
.login-submit {
  width: 100%;
  padding: 0.85rem;
  background: var(--accent, #2e7d32);
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.5rem;
}
.login-submit:hover {
  background: var(--accent-dark, #1b5e20);
}
.login-err {
  background: #fdeaea;
  color: #b71c1c;
  padding: 0.7rem 0.9rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  border-left: 3px solid #b71c1c;
}
.login-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted, #888);
}

/* === Logout Button im Header === */
.user-area {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-left: auto;
}
.user-name {
  font-size: 0.85rem;
  color: var(--text-muted, #555);
}
.logout-form {
  display: inline;
  margin: 0;
}
.logout-btn {
  background: transparent;
  border: 1px solid var(--border, #d0d7de);
  color: var(--text-muted, #555);
  padding: 0.4rem 0.85rem;
  border-radius: 0.4rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.logout-btn:hover {
  background: #fdeaea;
  color: #b71c1c;
  border-color: #f5b3b3;
}
