/* =====================================================================
   Maxi Chiptuning – gemeinsamer Racing-Stil
   (Datenverwaltung, Admin, Login, Passwort-Seiten)
   ===================================================================== */
@font-face { font-family: "Heros Cn"; src: url("fonts/heroscn-regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Heros Cn"; src: url("fonts/heroscn-bold.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Heros Cn"; src: url("fonts/heroscn-bolditalic.woff") format("woff"); font-weight: 700; font-style: italic; font-display: swap; }

:root {
    --asphalt: #080c14; --tarmac: #111827; --groove: #1c2536; --line: #222c3e; --field: #0a0f19;
    --blue: #008dd2; --chrome: #c9d1dc; --dim: #6b7689; --white: #f1f4f8; --red: #e5231b;
    --amber: #f5a623; --green: #2ecc71;
    --rail: 236px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: radial-gradient(ellipse 50% 40% at 70% 30%, rgba(0,141,210,.07), transparent 70%), var(--asphalt);
    background-attachment: fixed;
    color: var(--chrome);
    font: 400 16px/1.4 "Heros Cn", "Arial Narrow", "Roboto Condensed", sans-serif;
    min-height: 100vh;
}
a { color: var(--blue); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- Seitenleiste ---------------- */
.rail {
    position: fixed; inset: 0 auto 0 0; width: var(--rail);
    background: #0b1019; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 26px 18px 22px; gap: 6px; z-index: 10;
}
.rail .logo { width: 100%; height: auto; margin: 0 0 30px; }
.rail a, .rail button {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px;
    font: 700 17px/1 "Heros Cn", "Arial Narrow", sans-serif; letter-spacing: .01em;
    color: var(--dim); text-decoration: none; text-align: left;
    background: transparent; border: 1px solid transparent; border-radius: 3px; cursor: pointer;
    transform: skewX(-8deg);
}
.rail a > span, .rail button > span { transform: skewX(8deg); display: inline-block; }
.rail a:hover, .rail button:hover { color: var(--white); background: var(--tarmac); }
.rail a:focus-visible, .rail button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.rail .active { color: var(--white); background: var(--tarmac); border-color: var(--line); box-shadow: inset 4px 0 0 var(--blue); }
.rail .ico { width: 18px; text-align: center; color: var(--blue); }
.rail .badge { margin-left: auto; transform: skewX(8deg); background: var(--red); color: #fff; font-size: 12px; padding: 3px 7px; border-radius: 2px; }
.rail .badge.credit { background: #12351f; color: #82e0aa; border: 1px solid #1f5a3a; white-space: nowrap; }
.rail .spacer { flex: 1; }
.rail .out { color: #c0504a; }
.rail .out .ico { color: var(--red); }
.rail .out:hover { color: #ff8a83; background: #1d1114; }
.rail .who { transform: none; font-size: 13px; color: #4a5468; padding: 0 16px 10px; line-height: 1.3; }

/* ---------------- Hauptbereich ---------------- */
.stage-area { margin-left: var(--rail); padding: 34px 40px 60px; }
.wrap { max-width: 1240px; }
h1.big {
    margin: 0; font-weight: 700; font-style: italic; white-space: nowrap; padding-right: .08em;
    font-size: clamp(40px, 7vw, 104px); line-height: .86; letter-spacing: -.02em; text-transform: uppercase;
    color: transparent;
    background: linear-gradient(180deg, #f4f7fb 0%, var(--chrome) 48%, #7d8899 52%, #b8c1cd 100%);
    -webkit-background-clip: text; background-clip: text;
}
.lead { margin: 10px 0 0; font-size: 19px; color: var(--dim); }

.panel { background: var(--tarmac); border: 1px solid var(--line); border-radius: 4px; padding: 24px 26px; margin-top: 26px; }
.panel-head { display: flex; align-items: baseline; gap: 16px; margin: 0 0 18px; flex-wrap: wrap; }
.panel-head .num { font-weight: 700; font-style: italic; font-size: 52px; line-height: .7; color: var(--blue); }
.panel-head h2 { margin: 0; font-weight: 700; font-style: italic; font-size: 28px; color: var(--white); }
.panel-head .aside { margin-left: auto; color: var(--dim); font-size: 15px; }

/* ---------------- Formulare ---------------- */
.input-group { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.input-group label { font-size: 14px; color: var(--dim); font-weight: 700; }
.input-group input, .input-group select, .input-group textarea {
    width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 3px;
    padding: 13px 14px; color: var(--white); font: 400 17px "Heros Cn", "Arial Narrow", sans-serif;
}
.input-group input::placeholder { color: #465063; }
.input-group input:focus, .input-group select:focus, .input-group textarea:focus { outline: none; border-color: var(--blue); box-shadow: inset 3px 0 0 var(--blue); }
.input-group input.pf-valid { border-color: var(--green) !important; background: rgba(46,204,113,.14) !important; }
.input-group input.pf-invalid { border-color: #e74c3c !important; background: rgba(231,76,60,.16) !important; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--dim); cursor: pointer; font: 700 13px "Heros Cn", sans-serif; padding: 8px; }
.pw-eye:hover { color: var(--white); }

.rules { list-style: none; margin: -6px 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; }
.rules li { color: #ff7b6e; }
.rules li::before { content: "✕ "; }
.rules li.ok { color: var(--green); }
.rules li.ok::before { content: "✓ "; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px; border: 1px solid transparent; border-radius: 3px; cursor: pointer;
    font: 700 16px/1 "Heros Cn", "Arial Narrow", sans-serif; letter-spacing: .02em; text-decoration: none; white-space: nowrap;
    transform: skewX(-8deg); transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn > span { transform: skewX(8deg); display: inline-block; }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { box-shadow: 0 0 18px rgba(0,141,210,.5); }
.btn-ghost { background: transparent; color: var(--chrome); border-color: #2c3850; }
.btn-ghost:hover { border-color: var(--blue); color: var(--white); }
.btn-red { background: transparent; color: #ff8a83; border-color: #5a2226; }
.btn-red:hover { background: #2a1215; border-color: var(--red); }
.btn-go { background: var(--green); color: #06210f; }
.btn-go:hover { box-shadow: 0 0 18px rgba(46,204,113,.45); }
.btn-wide { width: 100%; padding: 15px 18px; font-size: 18px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------------- Meldungen ---------------- */
.note { padding: 12px 14px; border-radius: 3px; font-size: 15px; border: 1px solid; margin-bottom: 18px; }
.note.ok   { background: rgba(46,204,113,.12); border-color: var(--green); color: #82e0aa; }
.note.warn { background: rgba(243,156,18,.12); border-color: #f39c12; color: #f8c471; }
.note.err  { background: rgba(231,76,60,.12); border-color: #e74c3c; color: #ff9f95; }

/* ---------------- Startampel (Status) ---------------- */
.lights { display: inline-flex; gap: 5px; vertical-align: middle; }
.lights i { width: 13px; height: 13px; border-radius: 50%; background: #1a2232; box-shadow: inset 0 1px 2px rgba(0,0,0,.6); }
.lights.red   i:nth-child(1) { background: var(--red);   box-shadow: 0 0 9px var(--red); }
.lights.amber i:nth-child(2) { background: var(--amber); box-shadow: 0 0 9px var(--amber); }
.lights.green i:nth-child(3) { background: var(--green); box-shadow: 0 0 9px var(--green); }
.status { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--white); white-space: nowrap; }

/* ---------------- Tabellen / Auftragszeilen ---------------- */
.runs { display: flex; flex-direction: column; gap: 10px; }
.run {
    display: grid; align-items: center; gap: 18px;
    background: var(--field); border: 1px solid var(--line); border-radius: 3px; padding: 16px 20px;
    border-left: 4px solid var(--groove);
}
.run.done { border-left-color: var(--green); }
.run.wip  { border-left-color: var(--amber); }
.run.open { border-left-color: var(--red); }
.run .id { font-size: 13px; color: var(--dim); }
.run .veh { font-weight: 700; font-style: italic; font-size: 21px; color: var(--white); line-height: 1.1; }
.run .meta { font-size: 14px; color: var(--dim); margin-top: 3px; }
.run .acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.empty { text-align: center; color: var(--dim); padding: 40px 20px; font-size: 18px; }

/* ---------------- Fenster (Modal) ---------------- */
.modal { display: none; position: fixed; inset: 0; background: rgba(6,11,25,.88); z-index: 2147483000; justify-content: center; align-items: center; padding: 20px; }
.modal.open { display: flex; }
.modal .card { background: var(--tarmac); border: 1px solid var(--line); border-radius: 4px; padding: 28px; width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow-y: auto; position: relative; box-shadow: 0 30px 60px rgba(0,0,0,.5); }

/* ---------------- Login-Seiten ohne Leiste ---------------- */
.solo { min-height: 100vh; display: grid; place-items: center; padding: 30px 16px; }
.solo .card { width: 100%; max-width: 460px; background: var(--tarmac); border: 1px solid var(--line); border-radius: 4px; padding: 34px 32px 28px; }
.solo .logo { display: block; width: 260px; max-width: 80%; margin: 0 auto 26px; }
.solo h1.big { font-size: 52px; text-align: center; padding: 0 .08em; }
.solo .lead { text-align: center; margin-bottom: 26px; }
.solo .foot { margin-top: 18px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 15px; }
.solo .foot a { color: var(--dim); text-decoration: none; }
.solo .foot a:hover { color: var(--white); }

/* ---------------- kleinere Bildschirme ---------------- */
@media (max-width: 1100px) {
    :root { --rail: 0px; }
    .rail { position: sticky; top: 0; inset: auto; width: 100%; height: auto; flex-direction: row; align-items: center; gap: 4px; padding: 10px 14px; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); }
    .rail .logo { width: 150px; margin: 0 14px 0 0; flex: none; }
    .rail a, .rail button { width: auto; flex: none; padding: 10px 12px; font-size: 15px; }
    .rail .spacer, .rail .who { display: none; }
}
@media (max-width: 640px) {
    .stage-area { padding: 22px 16px 40px; }
    .panel { padding: 18px 16px; }
    .run { grid-template-columns: 1fr !important; gap: 10px; }
    .run .acts { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* versteckte Zeilen wirklich ausblenden (display:grid würde [hidden] sonst überschreiben) */
.run[hidden], .empty[hidden], [hidden] { display: none !important; }

/* ---------- Nachrichten zu einem Auftrag (order-chat.js) ---------- */
.oc-wrap { position: fixed; inset: 0; z-index: 2147483000; background: rgba(4, 7, 13, .82); display: flex; align-items: center; justify-content: center; padding: 16px; }
.oc-wrap[hidden] { display: none; }
.oc { width: 100%; max-width: 640px; height: min(760px, calc(100vh - 32px)); display: flex; flex-direction: column; background: #0d1422; border: 1px solid #2c3850; border-radius: 4px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.oc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.oc-title { font-weight: 700; font-style: italic; font-size: 21px; color: var(--white); }
.oc-sub { color: var(--dim); font-size: 14px; margin-top: 2px; }
.oc-x { background: none; border: 0; color: var(--dim); font-size: 30px; line-height: 1; cursor: pointer; padding: 0 4px; }
.oc-x:hover, .oc-x:focus-visible { color: var(--white); }
.oc-list { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.oc-msg { max-width: 82%; padding: 10px 13px; border-radius: 4px; font-size: 15px; line-height: 1.45; }
.oc-msg.them { align-self: flex-start; background: #141d2d; border: 1px solid #22304a; color: var(--chrome); }
.oc-msg.me { align-self: flex-end; background: #0f2a45; border: 1px solid #1d4f7a; color: #e6f2fb; }
.oc-meta { font-size: 12px; color: var(--dim); margin-bottom: 4px; }
.oc-text { white-space: pre-wrap; word-break: break-word; }
.oc-att { display: inline-block; margin-top: 6px; color: #9fd8f5; text-decoration: none; border: 1px solid #1d4f7a; padding: 4px 9px; border-radius: 3px; font-size: 14px; word-break: break-all; }
.oc-att span { color: var(--dim); font-size: 12px; }
.oc-att:hover { background: rgba(0,141,210,.15); }
.oc-empty { color: var(--dim); text-align: center; margin: auto; max-width: 380px; font-size: 15px; }
.oc-form { border-top: 1px solid var(--line); padding: 12px 18px 16px; }
.oc-form textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 64px; padding: 10px 12px; background: #070b13; border: 1px solid #2c3850; color: var(--white); border-radius: 3px; font: inherit; font-size: 15px; }
.oc-form textarea:focus { outline: none; border-color: var(--blue); }
.oc-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.oc-file { position: relative; color: var(--chrome); font-size: 14px; cursor: pointer; border: 1px dashed #2c3850; padding: 8px 12px; border-radius: 3px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.oc-file.has { border-style: solid; border-color: var(--blue); color: var(--white); }
.oc-file:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.oc-err { color: #ff9f95; font-size: 14px; margin-bottom: 8px; }
.oc-btn { position: relative; }
.oc-badge { position: absolute; top: -7px; right: -7px; transform: skewX(8deg); min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; font-style: normal; }
@media (max-width: 600px) { .oc { height: calc(100vh - 16px); } .oc-wrap { padding: 8px; } .oc-msg { max-width: 92%; } }
