/* ===================================================================
   Ticketsystem - Gestaltung
   Ruhige, arbeitsorientierte Oberflaeche. Die Bereichsfarbe ist das
   durchgaengige Erkennungsmerkmal: sie markiert, in wessen Auftrag man
   gerade arbeitet - in Navigation, Karten und Kopfzeilen.
   =================================================================== */

:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #e2e5ea;
    --border-strong: #cbd1da;
    --text: #1c1f24;
    --text-muted: #646b76;
    --accent: #2f5fd0;
    --accent-dark: #23499f;
    --danger: #b3261e;
    --success: #14683b;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20, 24, 31, .06), 0 1px 8px rgba(20, 24, 31, .04);
    --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 600; }
a { color: var(--accent); }

/* ---------- Grundgeruest ---------- */

.shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    font-weight: 650;
    font-size: 16px;
    letter-spacing: -0.01em;
    color: var(--text);
    text-decoration: none;
    padding: 4px 10px 18px;
}

.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }

.nav-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    margin: 18px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 7px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
}

.nav-item:hover { background: #eef0f4; }

.area-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--dot, var(--accent));
    flex: 0 0 auto;
}

.area-dot-lg { width: 14px; height: 14px; }

.sidebar-foot {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 7px;
    text-decoration: none;
    color: var(--text);
}

.user-chip:hover { background: #eef0f4; }

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 600;
}

.user-meta { display: flex; flex-direction: column; line-height: 1.3; overflow: hidden; }
.user-meta strong { font-size: 13px; font-weight: 600; }
.user-meta small { font-size: 11px; color: var(--text-muted); }

.main { padding: 30px 34px 60px; max-width: 1180px; }

/* ---------- Seitenkopf ---------- */

.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 24px; letter-spacing: -0.015em; }
.page-sub { color: var(--text-muted); margin: 5px 0 0; font-size: 14px; }

.area-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--area, var(--accent));
}

/* ---------- Karten ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    margin-bottom: 18px;
}

.card-title {
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.sub-title { font-size: 14px; margin: 22px 0 10px; }

.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    align-items: start;
}

.empty-state { color: var(--text-muted); }
.empty-state h2 { font-size: 16px; color: var(--text); margin-bottom: 6px; }

/* ---------- Bereichsuebersicht ---------- */

.area-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.area-card {
    position: relative;
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 20px 18px;
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
    transition: box-shadow .15s ease, transform .15s ease;
}

.area-card:hover {
    box-shadow: 0 2px 4px rgba(20,24,31,.08), 0 6px 18px rgba(20,24,31,.09);
    transform: translateY(-1px);
}

.area-card-bar {
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--area, var(--accent));
}

.area-card h2 { font-size: 17px; margin-bottom: 14px; }

.area-stats { display: flex; gap: 26px; margin: 0 0 16px; }
.area-stats dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.area-stats dd { margin: 2px 0 0; font-size: 22px; font-weight: 600; }

.area-card-go { font-size: 13px; color: var(--area, var(--accent)); font-weight: 550; }

.hint { color: var(--text-muted); font-size: 13px; margin-top: 16px; }

/* ---------- Formulare ---------- */

.field { margin-bottom: 14px; }
.field-narrow { max-width: 90px; }

.field label, .field legend {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="datetime-local"], select, textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    font: inherit;
    color: var(--text);
    background: #fff;
}

input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

input[disabled] { background: #f1f2f5; color: var(--text-muted); }

input[type="color"] {
    width: 44px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: #fff;
}

.field-hint { font-size: 12px; color: var(--text-muted); margin: 4px 0 0; }

fieldset.field { border: 0; padding: 0; margin: 0 0 14px; }

.checkbox {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 4px;
}

.checkbox input { margin: 0; }

.inline-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.inline-form .field { margin-bottom: 0; }
.actions { margin-top: 14px; }

/* ---------- Schaltflaechen ---------- */

.button {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 550;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}

.button:hover { background: #f3f4f7; }

.button-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.button-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.button-block { display: block; width: 100%; text-align: center; }

.link-button {
    background: none;
    border: 0;
    padding: 4px 0;
    color: var(--accent);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
}

.link-button.danger { color: var(--danger); }
.link-button:hover { text-decoration: underline; }

/* ---------- Listen und Zeilen ---------- */

.rows { display: flex; flex-direction: column; }

.row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.row-item:first-child { border-top: 0; }

.accordion {
    border-top: 1px solid var(--border);
    padding: 4px 0;
}

.accordion:first-of-type { border-top: 0; }

.accordion summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 4px;
    cursor: pointer;
    list-style: none;
    font-size: 14px;
    flex-wrap: wrap;
}

.accordion summary::-webkit-details-marker { display: none; }

.accordion summary::before {
    content: "›";
    color: var(--text-muted);
    font-size: 17px;
    transition: transform .15s ease;
    display: inline-block;
}

.accordion[open] summary::before { transform: rotate(90deg); }

.accordion-body { padding: 8px 4px 18px 22px; }

.divider { height: 1px; background: var(--border); margin: 18px 0; }

.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e7edfb;
    color: var(--accent-dark);
}

.badge-muted { background: #eceef1; color: var(--text-muted); }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }

.tag {
    font-size: 13px;
    padding: 4px 11px;
    border-radius: 999px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--area, var(--accent));
}

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.right { margin-left: auto; }

/* ---------- Meldungen ---------- */

.flash {
    padding: 11px 15px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid;
}

.flash-success { background: #e9f6ee; border-color: #bfe3cd; color: var(--success); }
.flash-error { background: #fdecea; border-color: #f5c4bf; color: var(--danger); }

/* ---------- Anmeldeseite ---------- */

body.bare {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.bare-panel {
    width: 100%;
    max-width: 390px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 30px 30px 34px;
}

.bare-brand {
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin: 0 0 18px;
}

.bare-title { font-size: 21px; margin-bottom: 6px; }
.bare-lead { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }
.bare-form { margin-top: 18px; }
.bare-form .button { margin-top: 6px; }

/* ---------- Kleinere Bildschirme ---------- */

@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: column; }
    .main { padding: 22px 18px 50px; }
    .field-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ===================================================================
   Etappe 2: Tickets, Board, Konfiguration
   =================================================================== */

.head-actions { margin-left: auto; display: flex; gap: 8px; }
.area-head-text { min-width: 0; }
.area-head-text .page-sub a { color: var(--text-muted); text-decoration: none; }
.area-head-text .page-sub a:hover { text-decoration: underline; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* Werkzeugleiste */
.toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 18px;
}
.toolbar-group { display: flex; align-items: center; gap: 6px; }
.filter-form { margin-left: auto; }
.filter-form select, .filter-form input[type="search"] { padding: 6px 10px; font-size: 14px; width: auto; }

.chip {
    display: inline-block; padding: 5px 13px; border-radius: 999px;
    border: 1px solid var(--border-strong); background: #fff;
    color: var(--text-muted); text-decoration: none; font-size: 13px; font-weight: 550;
}
.chip:hover { background: #f1f3f6; }
.chip-active { background: var(--text); border-color: var(--text); color: #fff; }

/* Board */
.board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 10px; }
.board-column {
    flex: 1 0 262px; background: #eef0f4; border-radius: var(--radius);
    padding: 12px; border-top: 3px solid var(--col, var(--accent));
}
.board-column-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.board-column-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.board-column-head .count { font-size: 12px; color: var(--text-muted); }
.board-dropzone { min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.board-dropzone.drag-over { outline: 2px dashed var(--accent); outline-offset: 3px; border-radius: 8px; }

.ticket-card {
    background: #fff; border: 1px solid var(--border); border-radius: 8px;
    padding: 11px 12px; box-shadow: var(--shadow); cursor: grab;
}
.ticket-card.dragging { opacity: .45; }
.ticket-card-title { display: block; font-weight: 550; color: var(--text); text-decoration: none; margin: 6px 0; font-size: 14px; }
.ticket-card-title:hover { color: var(--accent); }
.ticket-card-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; }

.pill {
    display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px;
    border-radius: 999px; color: #fff; background: var(--pill, var(--text-muted));
}

.overdue { color: var(--danger); font-weight: 600; }

/* Tabellen */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted); padding: 0 10px 9px; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 11px 10px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table a { text-decoration: none; font-weight: 550; }
.data-table a:hover { text-decoration: underline; }
.right-align { text-align: right; }
.inline-block { display: inline-block; }

/* Ticket-Formular */
.title-input { font-size: 18px; font-weight: 550; }
.editor-grid { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 18px; align-items: start; }
.actions-card { display: flex; gap: 10px; align-items: center; }

.link-list { list-style: none; margin: 0 0 12px; padding: 0; }
.link-list li { margin-bottom: 5px; }
.link-list a { word-break: break-all; font-size: 13px; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border);
}
.checklist li:last-child { border-bottom: 0; }
.checklist li.checked span { text-decoration: line-through; color: var(--text-muted); }
.checklist-toggle { flex: 1; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 14px 14px; font-size: 13px; }
.timeline li::before {
    content: ""; position: absolute; left: -21px; top: 5px; width: 8px; height: 8px;
    border-radius: 50%; background: var(--border-strong);
}
.timeline-meta { color: var(--text-muted); font-size: 12px; }

.danger-zone { border-color: #f0d4d2; }

.icon-button {
    border: 0; background: none; color: var(--text-muted); cursor: pointer;
    font-size: 17px; line-height: 1; padding: 2px 6px; border-radius: 5px;
}
.icon-button:hover:not([disabled]) { background: #f1f3f6; color: var(--danger); }
.icon-button[disabled] { opacity: .3; cursor: default; }

/* Konfigurationsseiten */
.config-rows { display: flex; flex-direction: column; }
.config-row {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 11px 0; border-bottom: 1px solid var(--border);
}
.config-row:last-child { border-bottom: 0; }
.config-row-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.grow { flex: 1; min-width: 140px; }

.template-list { list-style: none; margin: 0 0 12px; padding: 0; }
.template-list li {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}

.placeholder-list { margin: 0 0 16px; }
.placeholder-list > div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 6px 0; font-size: 13px; }
.placeholder-list dt code { background: #eef0f4; padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.placeholder-list dd { margin: 0; color: var(--text-muted); }

@media (max-width: 900px) {
    .editor-grid { grid-template-columns: 1fr; }
    .filter-form { margin-left: 0; width: 100%; flex-wrap: wrap; }
    .placeholder-list > div { grid-template-columns: 1fr; gap: 2px; }
}
