/* JobForge – Forge your workflow. Basis-Stylesheet (ohne Build-Schritt). */
:root {
  --primary: #ff8900;
  --primary-contrast: #fff;
  --sidebar: #1a1a1a;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --info: #0284c7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1d212a; --text: #e5e7eb; --muted: #9ca3af;
    --border: #2a2f3a; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --surface-2: #1d212a; --text: #e5e7eb; --muted: #9ca3af;
  --border: #2a2f3a; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
small, .muted { color: var(--muted); }
.mono, code { font-family: var(--mono); font-size: .92em; }
.icon { vertical-align: -3px; flex-shrink: 0; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }

/* Layout -------------------------------------------------------------- */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: #cbd5e1; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; z-index: 30;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.1rem; color: #fff; font-weight: 700; }
.brand img { max-height: 34px; max-width: 120px; border-radius: 6px; background: #fff; padding: 2px; }
.brand .logo-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--primary); display: grid;
  place-items: center; color: #fff; font-weight: 800; }
.brand small { display: block; color: #94a3b8; font-weight: 400; font-size: .75rem; }
.nav { padding: .25rem .6rem 1.5rem; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b;
  margin: 1rem .6rem .35rem; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .45rem .6rem; border-radius: 8px;
  color: #cbd5e1; font-size: .92rem; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active { background: var(--primary); color: var(--primary-contrast); }
.sidebar-footer { margin-top: auto; padding: .8rem 1.1rem; font-size: .75rem; color: #64748b; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .8rem;
  padding: .6rem 1.4rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar form.search { flex: 1; max-width: 520px; position: relative; }
.topbar form.search input { padding-left: 2.1rem; background: var(--surface-2); }
.topbar form.search .icon { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; }
.content { padding: 1.4rem; max-width: 1500px; width: 100%; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: .2rem; }
.actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }

/* Karten & Raster ----------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .7rem; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stat { display: flex; flex-direction: column; gap: .2rem; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.55rem; font-weight: 700; }
.stat.warn .value { color: var(--danger); }
.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: .35rem .9rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; white-space: pre-line; }

/* Buttons ------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .48rem .85rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem;
  font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover { background: var(--primary); filter: brightness(.94); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-sm { padding: .28rem .55rem; font-size: .82rem; }
.btn-lg { padding: .75rem 1.2rem; font-size: 1rem; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 230px; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: .35rem; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; gap: .5rem; align-items: center; padding: .45rem .6rem;
  border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-menu form { margin: 0; }
.dropdown-menu .sep { border-top: 1px solid var(--border); margin: .3rem 0; }

/* Formulare ----------------------------------------------------------- */
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .48rem .62rem; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
  border-color: var(--primary); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primary); transform: scale(1.1); }
input[type="color"] { padding: 2px; height: 38px; width: 70px; }
input[type="file"] { padding: .35rem; }
select[multiple] { min-height: 8rem; }
textarea { resize: vertical; }
label { font-weight: 500; font-size: .88rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.1rem; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field.check { flex-direction: row; align-items: center; gap: .55rem; }
.field .help { color: var(--muted); font-size: .8rem; }
.field .errors, .errorlist { color: var(--danger); font-size: .82rem; margin: 0; padding: 0; list-style: none; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field ul.checks, .field div.checks, .field > div > div { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.field ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.field ul label, .field div > div > label { font-weight: 400; display: inline-flex; gap: .35rem; align-items: center; }
.form-actions { display: flex; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.inline-form { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { min-width: 140px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0 .4rem; }

/* Tabellen ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -1.2rem; padding: 0 1.2rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .55rem .6rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600;
  background: var(--surface-2); white-space: nowrap; }
tbody tr:hover { background: color-mix(in srgb, var(--primary) 4%, transparent); }
tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 600; border-bottom: 0; }
tr.row-heading td { background: var(--surface-2); font-weight: 600; }
tr.row-total td { font-weight: 600; border-top: 2px solid var(--border); }
tr.row-muted td { color: var(--muted); }
tr.row-danger td { background: color-mix(in srgb, var(--danger) 7%, transparent); }
tr.row-ok td { background: color-mix(in srgb, var(--success) 6%, transparent); }
.empty { color: var(--muted); padding: 1.2rem; text-align: center; }

/* Badges & Meldungen -------------------------------------------------- */
.badge { --badge: #64748b; display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px;
  font-size: .76rem; font-weight: 600; color: var(--badge); background: color-mix(in srgb, var(--badge) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--badge) 30%, transparent); white-space: nowrap; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--c, #64748b); }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.msg { padding: .7rem 1rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  border-left: 4px solid var(--info); }
.msg.success { border-left-color: var(--success); }
.msg.error { border-left-color: var(--danger); }
.msg.warning { border-left-color: var(--warning); }
.alert { padding: .75rem 1rem; border-radius: 8px; border: 1px solid; margin-bottom: 1rem; }
.alert-danger { border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.alert-warning { border-color: color-mix(in srgb, var(--warning) 35%, transparent);
  background: color-mix(in srgb, var(--warning) 8%, var(--surface)); }
.alert-info { border-color: color-mix(in srgb, var(--info) 35%, transparent);
  background: color-mix(in srgb, var(--info) 7%, var(--surface)); }
.alert-success { border-color: color-mix(in srgb, var(--success) 35%, transparent);
  background: color-mix(in srgb, var(--success) 7%, var(--surface)); }

/* Filter, Tabs, Pagination -------------------------------------------- */
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }
.toolbar input[type="search"] { max-width: 300px; }
.toolbar select { width: auto; max-width: 220px; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.pagination { display: flex; gap: .3rem; justify-content: center; align-items: center; margin-top: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }

/* Kalender ------------------------------------------------------------ */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dow { padding: .45rem; font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--surface-2);
  text-transform: uppercase; border-bottom: 1px solid var(--border); }
.cal .day { min-height: 118px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: .3rem; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.out { background: var(--surface-2); opacity: .6; }
.cal .day.today .num { background: var(--primary); color: var(--primary-contrast); border-radius: 999px; padding: 0 .45rem; }
.cal .num { font-size: .8rem; font-weight: 600; align-self: flex-start; }
.ev { --c: #64748b; display: block; font-size: .74rem; padding: 1px 5px; border-radius: 4px; color: var(--text);
  background: color-mix(in srgb, var(--c) 18%, transparent); border-left: 3px solid var(--c); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.ev:hover { text-decoration: none; filter: brightness(.95); }
.planner td { min-width: 120px; height: 64px; }
.planner td.weekend { background: var(--surface-2); }
.planner td.today { outline: 2px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: -2px; }
.planner .ev { white-space: normal; margin-bottom: 2px; }

/* Positionseditor ----------------------------------------------------- */
.pos-table td { padding: .3rem .25rem; vertical-align: top; }
.pos-table input, .pos-table select, .pos-table textarea { padding: .35rem .45rem; font-size: .88rem; }
.pos-table .w-order { width: 64px; }
.pos-table .w-kind { width: 130px; }
.pos-table .w-article { width: 190px; }
.pos-table .w-num { width: 88px; }
.pos-table .w-sm { width: 70px; }
.pos-table .w-total { width: 110px; text-align: right; font-weight: 600; padding-top: .7rem; white-space: nowrap; }
.pos-table tr.pos-heading { background: var(--surface-2); }
.pos-table tr.pos-heading textarea { font-weight: 700; }
.pos-table tr.deleted { opacity: .35; }
.pos-table textarea { min-height: 34px; }
.sum-box { margin-left: auto; max-width: 360px; }
.sum-box table td { border: 0; padding: .25rem .4rem; }
.sum-box .grand td { font-size: 1.1rem; font-weight: 700; border-top: 2px solid var(--text); }

/* Scanner ------------------------------------------------------------- */
.scanner { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3;
  max-height: 360px; margin-bottom: .8rem; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 18% 12%; border: 3px solid rgba(255,255,255,.85); border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }
.scan-input { font-size: 1.2rem; padding: .75rem; font-family: var(--mono); }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.mode-switch label { display: block; text-align: center; padding: .8rem; border: 2px solid var(--border); border-radius: 10px;
  cursor: pointer; font-size: 1rem; font-weight: 600; }
.mode-switch input { display: none; }
.mode-switch input:checked + span { color: var(--primary); }
.mode-switch label:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.flash-ok { animation: flash 0.6s; }
@keyframes flash { from { background: color-mix(in srgb, var(--success) 35%, transparent); } to { background: transparent; } }

/* Etiketten ----------------------------------------------------------- */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(62mm, 1fr)); gap: 4mm; }
.qr-label { border: 1px dashed #999; border-radius: 4px; padding: 3mm; display: flex; gap: 3mm; align-items: center;
  page-break-inside: avoid; background: #fff; color: #000; }
.qr-label img { width: 22mm; height: 22mm; }
.qr-label .t { font-weight: 700; font-size: 10pt; line-height: 1.2; }
.qr-label .c { font-family: var(--mono); font-size: 9pt; }
.qr-label .s { font-size: 8pt; color: #444; }

/* Login --------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--primary) 25%, var(--bg)), var(--bg) 60%); }
.auth .card { width: 100%; max-width: 400px; padding: 2rem; }
.auth .logo { text-align: center; margin-bottom: 1.2rem; }
.auth .logo img { max-height: 70px; max-width: 220px; }

/* Timeline / Verlauf -------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-size: .78rem; }
.changes { font-size: .8rem; color: var(--muted); margin: .2rem 0 0; padding-left: 1rem; }

/* Responsive ---------------------------------------------------------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: .5rem .8rem; }
  .content { padding: 1rem .8rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .cal .day { min-height: 70px; }
  .cal .ev { font-size: .66rem; }
  .hide-mobile { display: none !important; }
  .kv { grid-template-columns: 1fr; gap: .1rem; }
  .kv dd { margin-bottom: .5rem; }
}
@media print {
  .sidebar, .topbar, .no-print, .messages, .actions { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  body { background: #fff; color: #000; }
  .qr-label { border-color: #ccc; }
}
a.card { color: inherit; text-decoration: none; display: flex; }
a.card:hover { border-color: var(--primary); text-decoration: none; }
.grid { margin-bottom: 1.1rem; }
.grid > .card, .grid > div > .card:last-child { margin-bottom: 0; }
.pos-table { min-width: 1180px; }
.pos-table td:nth-child(4) { min-width: 240px; }
.pos-table th { padding: .45rem .3rem; }
/* Branding */
.brand-stack { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.brand img.wordmark { max-width: 190px; max-height: none; width: 100%; height: auto; background: none; padding: 0; border-radius: 0; }
.brand-stack small { color: #94a3b8; font-weight: 500; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer img { vertical-align: -2px; opacity: .8; }
.auth .logo img { max-width: 260px; max-height: 80px; width: 100%; height: auto; }
.auth .powered { text-align: center; color: var(--muted); font-size: .78rem; margin: 1.2rem 0 0; }
.auth .powered img { vertical-align: -2px; }
