/* ERP gosner.ro — design system adapted from the cnc_zeiterfassung reference.
   Presentation layer only; backend (Flask) and DB (SQLite) stay separate. */
:root {
  --bg: #f0ede8;
  --surface: #ffffff;
  --surface2: #f7f5f2;
  --border: #ddd9d2;
  --text: #1a1a18;
  --muted: #6b6860;
  --accent: #1a4f7a;
  --accent-light: #e8f0f7;
  --green: #1e6b3a;
  --green-light: #e6f4ec;
  --amber: #7a4a00;
  --amber-light: #fdf0d8;
  --red: #8b1a1a;
  --red-light: #fdeaea;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg);
  color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }

/* NAV (the admin "Verwaltung" bar) */
.nav { background: var(--accent); color: #fff; display: flex; align-items: center; }
.nav-brand { padding: 14px 20px; font-weight: 600; font-size: 16px; letter-spacing: 0.02em;
  border-right: 1px solid rgba(255,255,255,0.15); text-decoration: none; color: #fff; }
.nav-btn { padding: 14px 22px; background: none; border: none; color: rgba(255,255,255,0.75);
  font-size: 14px; cursor: pointer; font-weight: 500; text-decoration: none;
  transition: background 0.15s, color 0.15s; }
.nav-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-btn.active { background: rgba(255,255,255,0.15); color: #fff;
  border-bottom: 2px solid rgba(255,255,255,0.7); }
.nav-spacer { margin-left: auto; }
.nav-right { display: flex; align-items: center; gap: 4px; padding-right: 12px; }
.nav-langs a { color: rgba(255,255,255,0.7); text-decoration: none; font-size: 12px;
  padding: 3px 6px; border-radius: 4px; }
.nav-langs a.active { background: rgba(255,255,255,0.2); color: #fff; }
.nav-user { color: rgba(255,255,255,0.85); font-size: 13px; padding: 0 8px; }
.nav-icon { color: rgba(255,255,255,0.75); text-decoration: none; font-size: 13px;
  padding: 6px 8px; border-radius: 6px; }
.nav-icon:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-logout { background: rgba(255,255,255,0.12); border: none; color: #fff; cursor: pointer;
  font-size: 13px; padding: 6px 12px; border-radius: 6px; }
.nav-logout:hover { background: rgba(255,255,255,0.22); }

/* Environment switcher (Prod / Test) */
.nav-env { display: inline-flex; border: 1px solid rgba(255,255,255,0.25); border-radius: 6px;
  overflow: hidden; margin-right: 8px; }
.env-btn { padding: 5px 12px; font-size: 12px; font-weight: 600; text-decoration: none;
  color: rgba(255,255,255,0.7); background: transparent; }
.env-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.env-btn.active { color: #fff; }
.nav-env .env-btn:first-child.active { background: #1e6b3a; }   /* Prod = grün */
.nav-env .env-btn:last-child.active  { background: #7a4a00; }   /* Test = amber */

.nav-label { color: rgba(255,255,255,0.5); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 0 6px 0 16px; border-left: 1px solid rgba(255,255,255,0.15);
  margin-left: 8px; }

/* PROCESS STEPPER */
.stepper { display: flex; align-items: flex-start; }
.step { flex: 1; text-align: center; position: relative; }
.step:not(:first-child)::before { content: ""; position: absolute; top: 13px; left: -50%;
  width: 100%; height: 2px; background: var(--border); z-index: 0; }
.step-dot { position: relative; z-index: 1; width: 28px; height: 28px; line-height: 28px;
  border-radius: 50%; margin: 0 auto 6px; background: var(--surface2); color: var(--muted);
  border: 2px solid var(--border); font-size: 13px; font-weight: 700; }
.step-label { font-size: 12px; color: var(--muted); }
.step-done .step-dot { background: var(--green); color: #fff; border-color: var(--green); }
.step-done::before { background: var(--green); }
.step-done .step-label { color: var(--text); }
.step-active .step-dot { background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(26,79,122,0.15); }
.step-active .step-label { color: var(--accent); font-weight: 700; }
.step-note { margin-top: 14px; font-size: 13px; font-weight: 600; }
.note-warn { color: var(--amber); }
.note-bad { color: var(--red); }

/* CONTENT */
.content { padding: 28px 24px; max-width: 980px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
h1 { font-size: 20px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }

/* CARD */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card-title { font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); margin-bottom: 16px; }
.card.narrow { max-width: 420px; }

/* FORM */
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 7px; font-size: 14px; background: var(--surface); color: var(--text);
  outline: none; font-family: inherit; transition: border 0.15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,79,122,0.1); }
.form-row { display: grid; gap: 14px; margin-bottom: 14px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.field { margin-bottom: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

/* BUTTONS */
.btn { display: inline-block; padding: 9px 18px; border: none; border-radius: 7px;
  font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: opacity 0.15s, transform 0.1s; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* TABLE */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); padding: 8px 12px; border-bottom: 2px solid var(--border); }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }
.table-card { padding: 0; overflow: hidden; }

/* BADGES (ticket status) */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px;
  font-weight: 600; white-space: nowrap; }
.st-offen       { background: var(--amber-light); color: var(--amber); }
.st-in_arbeit   { background: #e0f0ff; color: #0a4a8a; }
.st-rueckfrage  { background: var(--amber-light); color: var(--amber); }
.st-auf_staging { background: var(--accent-light); color: var(--accent); }
.st-abgenommen  { background: var(--green-light); color: var(--green); }
.st-live        { background: var(--green); color: #fff; }
.st-abgelehnt   { background: var(--red-light); color: var(--red); }

/* DEV-LOOP STATUS BAR */
.loop-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 16px; font-size: 13px; color: var(--muted); box-shadow: var(--shadow); }
.loop-bar strong { color: var(--text); }
.loop-bar .sep { color: var(--border); }
.loop-dot { width: 9px; height: 9px; border-radius: 50%; }
.dot-active { background: var(--green); box-shadow: 0 0 0 3px var(--green-light); }
.dot-idle { background: var(--muted); box-shadow: 0 0 0 3px var(--border); }
.mode-badge { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.04em; }
.mode-active { background: var(--green-light); color: var(--green); }
.mode-idle { background: var(--surface2); color: var(--muted); }

/* FILTER PILLS */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters a { text-decoration: none; padding: 4px 12px; border: 1px solid var(--border);
  border-radius: 20px; font-size: 13px; background: var(--surface); color: var(--muted); }
.filters a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* COMMENT THREAD */
.comment { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  margin-bottom: 10px; background: var(--surface); }
.comment-head { font-size: 12px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase;
  letter-spacing: 0.04em; }
.comment-claude { border-left: 3px solid var(--accent); }
.comment-kevin  { border-left: 3px solid var(--amber); }

/* ATTACHMENTS */
.attach-list { list-style: none; margin-bottom: 12px; }
.attach-list li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.attach-list li:last-child { border-bottom: none; }
.attach-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.attach-form input[type=file] { width: auto; flex: 1; min-width: 220px; }

/* MISC */
.flash { list-style: none; max-width: 980px; margin: 16px auto 0; padding: 12px 18px;
  background: var(--amber-light); border: 1px solid #f0d9a8; border-radius: 8px; color: var(--amber); }
.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.empty { text-align: center; padding: 40px; color: var(--muted); font-size: 14px; }
.secret { font-family: ui-monospace, monospace; font-size: 1.2rem; letter-spacing: 2px;
  background: var(--surface2); padding: 10px 12px; border-radius: 8px; word-break: break-all;
  user-select: all; border: 1px solid var(--border); }
.secret.small { font-size: 0.8rem; letter-spacing: 0; }
.center-wrap { max-width: 420px; margin: 48px auto; padding: 0 20px; }

/* ===================== ZEITERFASSUNG ===================== */
.subnav { background: var(--surface); border-bottom: 1px solid var(--border); display: flex; }
.subnav-btn { padding: 12px 20px; background: none; border: none; color: var(--muted);
  font-size: 14px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; }
.subnav-btn:hover { color: var(--text); }
.subnav-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.ze-view { display: none; }
.ze-view.active { display: block; }
.ze-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.ag-row { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 10px; }
.ze-aghead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ag-row-title { font-size: 13px; font-weight: 600; color: var(--accent); }
.ze-savemsg { margin-top: 10px; font-size: 13px; color: var(--green); display: none; }
.ze-filters { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }

/* Stat boxes */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--accent); }
.stat-value.amber { color: var(--amber); } .stat-value.accent { color: var(--accent); } .stat-value.green { color: var(--green); }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.percent-good { color: var(--green); font-weight: 700; }
.percent-warn { color: var(--amber); font-weight: 700; }
.percent-bad { color: var(--red); font-weight: 700; }

/* Terminal (dark, shop-floor) */
#ze-view-terminal { background: #1a1a18; min-height: calc(100vh - 51px); }
.terminal-wrap { max-width: 540px; margin: 0 auto; padding: 28px 20px; }
.t-header { text-align: center; margin-bottom: 28px; }
.t-header h1 { color: #fff; font-size: 22px; font-weight: 700; }
.t-header p { color: #888; font-size: 14px; margin-top: 4px; }
.t-scan { background: #252523; border: 1px solid #383836; border-radius: 14px; padding: 24px; margin-bottom: 20px; }
.t-scan label { color: #aaa; font-size: 13px; margin-bottom: 6px; display: block; }
.t-scan input { background: #1a1a18; border: 2px solid #444; border-radius: 10px; color: #fff; font-size: 22px; font-weight: 700; text-align: center; padding: 14px; letter-spacing: 0.1em; width: 100%; }
.t-scan input:focus { border-color: #4a8fd4; outline: none; }
.t-order { background: #252523; border: 1px solid #383836; border-radius: 14px; padding: 22px; margin-bottom: 20px; display: none; }
.t-order.visible { display: block; }
.t-order-title { color: #4a8fd4; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 14px; }
.t-order-name { color: #fff; font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.t-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.t-info-box { background: #1a1a18; border-radius: 8px; padding: 12px 14px; }
.t-info-box .label { color: #777; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px; }
.t-info-box .value { color: #fff; font-size: 18px; font-weight: 700; }
.t-info-box .value.green { color: #4eca7a; } .t-info-box .value.amber { color: #f0b84a; }
.t-btns { display: grid; gap: 12px; }
.t-btn { width: 100%; padding: 20px; border: none; border-radius: 12px; font-size: 20px; font-weight: 700; cursor: pointer; }
.t-btn:disabled { opacity: 0.35; }
.t-btn-start { background: #1e6b3a; color: #fff; } .t-btn-stop { background: #8b3a1a; color: #fff; }
.t-btn-blue { background: #1a4f7a; color: #fff; } .t-btn-gray { background: #333; color: #ccc; font-size: 16px; padding: 14px; }
.t-steps { display: flex; gap: 8px; margin-bottom: 18px; }
.t-step { flex: 1; height: 4px; border-radius: 2px; background: #333; }
.t-step.done { background: #4eca7a; } .t-step.active { background: #4a8fd4; }
.t-qty { background: #1a1a18; border: 2px solid #444; border-radius: 10px; color: #fff; font-size: 32px; font-weight: 700; text-align: center; padding: 16px; width: 100%; margin-bottom: 12px; }
.t-timer { text-align: center; color: #4a8fd4; font-size: 42px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 14px 0; }
.t-timer-label { text-align: center; color: #666; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; }
.t-result { background: #1e2e1e; border: 1px solid #2a5a2a; border-radius: 12px; padding: 18px; text-align: center; margin-bottom: 14px; display: none; }
.t-result.visible { display: block; }
.t-result .pct { font-size: 52px; font-weight: 800; color: #4eca7a; }
.t-result .pct.warn { color: #f0b84a; } .t-result .pct.bad { color: #e06060; }
.t-result .pct-label { color: #aaa; font-size: 14px; margin-top: 4px; }
.t-err { color: #e06060; text-align: center; margin-top: 12px; font-size: 14px; display: none; }
.t-ag-label { color: #aaa; font-size: 11px; margin-bottom: 6px; }
.t-ag-opt { background: #1a1a18; border: 1px solid #383836; border-radius: 8px; padding: 10px 12px; margin-bottom: 6px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.t-ag-opt.sel { border-color: #4a8fd4; background: #1a2a3a; }
.t-ag-name { color: #fff; font-size: 14px; font-weight: 600; } .t-ag-meta { color: #888; font-size: 12px; }

@media (max-width: 700px) {
  .form-row.cols-2, .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr 1fr; }
  .ze-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .nav { flex-wrap: wrap; }
}
