/* ============================================
   Oktopus Ticket System – CSS (Zammad-Style)
   ============================================ */

:root {
    --primary:      #1f73b7;
    --primary-dark: #145591;
    --primary-light:#e8f4fd;
    --success:      #2da44e;
    --warning:      #e8a100;
    --danger:       #cc3340;
    --bg:           #f3f4f6;
    --surface:      #ffffff;
    --border:       #d8dcde;
    --text:         #2f3941;
    --text-muted:   #68737a;
    --text-light:   #87929d;
    --sidebar-bg:   #1f2d3d;
    --sidebar-text: #c2ccd6;
    --sidebar-hover:#2e4057;
    --sidebar-active:#1f73b7;
    --radius:       8px;
    --shadow:       0 1px 4px rgba(0,0,0,.1);
    --shadow-md:    0 4px 12px rgba(0,0,0,.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

/* ── Login ─────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a2a3a 0%, #1f73b7 100%);
}

.login-container {
    background: var(--surface);
    border-radius: 12px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-md);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo .logo-icon { font-size: 48px; display: block; }
.login-logo h1         { font-size: 26px; font-weight: 700; color: var(--text); margin: 8px 0 4px; }
.login-logo p          { color: var(--text-muted); }

.login-form .form-group { margin-bottom: 16px; }

.login-hints {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.8;
}

/* ── App Layout ─────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────── */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .logo-icon { font-size: 22px; }

.sidebar-nav-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}
.sidebar-nav {
    padding: 12px 8px;
    height: 100%;
    overflow-y: auto;
    transition: transform .25s ease;
}
.sidebar-admin-nav {
    position: absolute;
    inset: 0;
    padding: 12px 8px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform .25s ease;
}
.admin-nav-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--sidebar-text);
    padding: 8px 12px 14px;
    opacity: .6;
}
.sidebar.admin-open .sidebar-nav     { transform: translateX(-100%); }
.sidebar.admin-open .sidebar-admin-nav { transform: translateX(0); }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 2px;
    transition: background .15s, color .15s;
    position: relative;
}
.nav-item:hover   { background: var(--sidebar-hover); color: #fff; }
.nav-item.active  { background: var(--sidebar-active); color: #fff; }

.ajax-navigation-status {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #111827;
    color: #fff;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .24);
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
}

.ajax-navigation-status.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ajax-navigation-status.is-error { background: #b91c1c; }
.ajax-navigation-status.is-error .ajax-navigation-spinner { display: none; }

.ajax-navigation-spinner {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ajax-navigation-spin .7s linear infinite;
}

body.ajax-navigating .sidebar .nav-item,
body.ajax-navigating #adminToggleBtn {
    cursor: progress;
}

body.ajax-navigating main {
    opacity: .72;
    pointer-events: none;
    transition: opacity .15s ease;
}

@keyframes ajax-navigation-spin { to { transform: rotate(360deg); } }
.nav-icon         { font-size: 16px; width: 20px; text-align: center; }

/* Sidebar-Trennstrich */
.nav-separator {
    height: 1px;
    background: rgba(255,255,255,.15);
    margin: 6px 12px;
    border: none;
}

/* Icon-Picker */
.icon-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    user-select: none;
    transition: border-color .15s, box-shadow .15s;
    position: relative;
}
.icon-trigger:hover  { border-color: var(--primary); }
.icon-trigger:focus  { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.icon-trigger[aria-expanded="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.icon-trigger-preview { font-size: 20px; line-height: 1; }
.icon-trigger-label   { font-size: 13px; color: var(--text-muted); flex: 1; }
.icon-trigger-arrow   { font-size: 11px; color: var(--text-muted); transition: transform .15s; }
.icon-trigger[aria-expanded="true"] .icon-trigger-arrow { transform: rotate(180deg); }

.icon-picker-dropdown {
    position: absolute;
    z-index: 200;
    left: 0;
    top: calc(100% + 4px);
    width: max-content;
    min-width: 100%;
    max-width: 320px;
    max-height: 260px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 8px;
}
.icon-picker-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin: 8px 0 4px;
}
.icon-picker-section-label:first-child { margin-top: 0; }
.icon-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}
.icon-option {
    font-size: 20px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: background .1s;
}
.icon-option:hover    { background: var(--primary-light); }
.icon-option.selected { background: var(--primary-light); outline: 2px solid var(--primary); }

/* Trennstrich-Vorschau in Tabelle */
.view-separator-preview {
    display: inline-block;
    width: 120px;
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    vertical-align: middle;
    margin-right: 8px;
}

/* Drag & Drop Sortierung */
.drag-col   { width: 32px; }
.drag-handle {
    cursor: grab;
    color: var(--text-light);
    font-size: 14px;
    text-align: center;
    padding: 0 8px;
    user-select: none;
}
.drag-handle:active { cursor: grabbing; }
.drag-ghost  { opacity: .4; background: var(--primary-light) !important; }
.drag-chosen { box-shadow: 0 4px 16px rgba(0,0,0,.15); background: var(--surface); }

/* Formular-Hinweis */
.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}
.form-hint code {
    background: var(--bg-alt, #f4f4f5);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: monospace;
}
.mt-1 { margin-top: 6px; }

/* ── Modal ──────────────────────────────── */
@keyframes modalBackdropIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalBackdropOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes modalPopIn {
    0%   { opacity: 0; transform: translateY(16px) scale(.97); }
    100% { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes modalPopOut {
    0%   { opacity: 1; transform: translateY(0)    scale(1); }
    100% { opacity: 0; transform: translateY(12px) scale(.97); }
}
@keyframes modalNudge {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.018); }
    70%  { transform: scale(.993); }
    100% { transform: scale(1); }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 35, .55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalBackdropIn .18s ease both;
}
.modal-backdrop.is-closing {
    animation: modalBackdropOut .18s ease both;
}

.modal {
    background: var(--surface);
    border-radius: 14px;
    box-shadow:
        0 2px 6px rgba(0,0,0,.08),
        0 12px 40px rgba(0,0,0,.22),
        inset 0 1px 0 rgba(255,255,255,.9);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalPopIn .28s cubic-bezier(0, 0, .2, 1) both;
}
.modal-backdrop.is-closing .modal {
    animation: modalPopOut .18s cubic-bezier(.4, 0, 1, 1) both;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
}
.modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.01em;
}
.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-muted);
    transition: background .12s, color .12s;
    flex-shrink: 0;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body {
    padding: 22px;
    overflow-y: auto;
    flex: 1;
    background: var(--surface);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}

.badge-count {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 100px;
}

.sidebar-user {
    display: flex;
    align-items: stretch;
    border-top: 1px solid rgba(255,255,255,.08);
    position: relative;
    user-select: none;
    min-height: 56px;
}

/* Linker Profil-Bereich – eigener Hover */
.sidebar-user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    cursor: pointer;
    transition: background .15s;
}
.sidebar-user-profile:hover { background: var(--sidebar-hover); }
.sidebar-user .user-name { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-user .user-role { font-size: 11px; color: var(--sidebar-text); }
.user-info-wrap { flex: 1; min-width: 0; }
.user-info-wrap .user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Rechter Gear-Button – eigener Hover, volle Höhe */
.sidebar-icon-btn {
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 48px;
    border: none;
    border-left: 1px solid rgba(255,255,255,.1);
    padding: 0;
    cursor: pointer;
    background: rgba(255,255,255,.04);
    transition: background .15s, color .15s;
}
.sidebar-icon-btn:hover {
    color: #fff;
    background: rgba(255,255,255,.14);
    border-left-color: rgba(255,255,255,.22);
}
.sidebar.admin-open .sidebar-icon-btn {
    color: #fff;
    background: rgba(255,255,255,.12);
}

/* Profil-Menü Popup */
.profile-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--sidebar-bg);
    border-top: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 -4px 16px rgba(0,0,0,.3);
    z-index: 110;
    transform: translateY(8px);
    opacity: 0;
    visibility: hidden;
    transition: transform .2s ease, opacity .2s ease, visibility 0s linear .2s;
}
.profile-menu.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    transition: transform .2s ease, opacity .2s ease, visibility 0s linear 0s;
}
.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13px;
    transition: background .15s, color .15s;
}
.profile-menu-item:hover { background: var(--sidebar-hover); color: #fff; }
.profile-menu-item .nav-icon { font-size: 15px; width: 18px; text-align: center; }
.profile-menu-divider { height: 1px; background: rgba(255,255,255,.1); margin: 4px 0; }
.profile-menu-logout:hover { background: rgba(204,51,64,.25); color: #ff8080; }

/* ── Main Content ───────────────────────────── */
.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 24px;
    max-width: calc(100vw - 240px);
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
}
.page-header h2 { font-size: 20px; font-weight: 700; color: var(--text); }

.ticket-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

/* ── Cards ──────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }

/* ── Buttons ────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost    { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b02030; }
.btn-full     { width: 100%; justify-content: center; }
.btn-sm       { padding: 4px 10px; font-size: 12px; }

/* ── Forms ──────────────────────────────────── */
.form-group { margin-bottom: 16px; position: relative; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31,115,183,.15);
}
textarea { resize: vertical; }

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

.inline-select { padding: 7px 10px; font-size: 13px; }

/* ── Alerts ─────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-error   { background: #fde8e8; border: 1px solid #f5c2c2; color: #a00; }
.alert-success { background: #e6f5eb; border: 1px solid #b7dfbf; color: #1a6030; }
.alert-info    { background: var(--primary-light); border: 1px solid #b8d8f0; color: #0d4b7c; }

/* ── Badges ─────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.badge-new     { background: #e0f0ff; color: #0070cc; }
.badge-open    { background: #e6f5eb; color: #1a7034; }
.badge-pending { background: #fff8e0; color: #8a6000; }
.badge-closed  { background: #f3f4f6; color: #68737a; }

.badge-priority-low    { background: #f3f4f6; color: #68737a; }
.badge-priority-normal { background: #e0f0ff; color: #0070cc; }
.badge-priority-high   { background: #fff0e0; color: #b85c00; }
.badge-priority-urgent { background: #fde8e8; color: #cc1100; }

.badge-category { background: #f0eaff; color: #5b21b6; }

.badge-role-customer { background: #e0f0ff; color: #0070cc; }
.badge-role-agent    { background: #e6f5eb; color: #1a7034; }
.badge-role-admin    { background: #fde8e8; color: #cc1100; }

/* ── Ticket ID ──────────────────────────────── */
.ticket-id { font-family: monospace; font-weight: 700; color: var(--text-muted); font-size: 12px; }

/* ── Stats Grid ─────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow .15s, transform .15s;
    box-shadow: var(--shadow);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-number     { font-size: 28px; font-weight: 700; }
.stat-label      { font-size: 12px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

.stat-new     .stat-number { color: var(--primary); }
.stat-open    .stat-number { color: var(--success); }
.stat-pending .stat-number { color: var(--warning); }
.stat-closed  .stat-number { color: var(--text-muted); }

/* ── Filter Bar ─────────────────────────────── */
.filter-bar { padding: 14px 16px; }
.filter-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-form input, .filter-form select { flex: 1; min-width: 140px; max-width: 220px; margin-bottom: 0; }

/* ── Ticket Table ───────────────────────────── */
.table-card { padding: 0; overflow: hidden; }
.table-card h3 { padding: 16px 20px 0; }

.ticket-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ticket-table th {
    padding: 10px 14px;
    text-align: left;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .4px;
}
.ticket-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.ticket-table tbody tr:last-child td { border-bottom: none; }
.ticket-table tbody tr:hover { background: var(--bg); }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }

/* ── Ticket List (Kunden-Dashboard) ────────── */
.ticket-list { display: flex; flex-direction: column; gap: 10px; }

.ticket-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-decoration: none;
    color: var(--text);
    display: block;
    transition: border-color .15s, box-shadow .15s;
    box-shadow: var(--shadow);
}
.ticket-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}
.ticket-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ticket-subject     { font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.ticket-meta        { display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--text-muted); }
.ticket-date        { margin-left: auto; }

/* ── Empty State ────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; }
.empty-state p  { color: var(--text-muted); margin-bottom: 20px; }

/* ── Ticket Detail Layout ───────────────────── */
.ticket-detail-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ticket-detail-layout.two-col {
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
}

.conversation-col { flex: 1; min-width: 0; }
.ticket-sidebar   { width: 280px; min-width: 280px; }

.ticket-detail-main .main-content { display: flex; flex-direction: column; }

/* ── Conversation ───────────────────────────── */
.conversation {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    min-height: 300px;
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.message {
    max-width: 80%;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.6;
    position: relative;
}

.message-agent {
    background: var(--bg);
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.message-own {
    background: var(--primary-light);
    border: 1px solid #b8d8f0;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.message-internal {
    background: #fffbe6;
    border: 1px dashed #f0cc3e;
    align-self: flex-start;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
}
.message-author { font-weight: 700; color: var(--text); }
.message-time   { color: var(--text-muted); margin-left: auto; }
.internal-badge {
    background: #ffe68a;
    color: #7a5500;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}
.message-body { color: var(--text); }

/* ── Reply Box ──────────────────────────────── */
.reply-box { margin-bottom: 0; }
.reply-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.reply-tab {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
    transition: background .15s, color .15s;
}
.reply-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Ticket Sidebar Info ────────────────────── */
.sidebar-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 14px; }

.customer-info { display: flex; align-items: center; gap: 12px; }
.user-avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}
.user-avatar.large { width: 44px; height: 44px; font-size: 18px; }
.user-avatar.small { width: 28px; height: 28px; font-size: 11px; }
.user-name  { font-weight: 600; }
.user-email { font-size: 12px; color: var(--text-muted); }

.info-table { width: 100%; font-size: 13px; }
.info-table td { padding: 5px 0; }
.info-table td:first-child { color: var(--text-muted); width: 90px; }

.user-inline { display: flex; align-items: center; gap: 8px; }

.update-msg { margin-top: 8px; font-size: 13px; }
.update-msg.success { color: var(--success); }
.update-msg.error   { color: var(--danger); }

/* ── Dashboard Bar Chart ────────────────────── */
.dash-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 100px;
    padding-top: 20px;
}
.dash-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.dash-bar {
    width: 100%;
    background: var(--primary);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: background .15s;
}
.dash-bar-col:hover .dash-bar { background: var(--primary-dark); }
.dash-bar-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    min-height: 16px;
}
.dash-bar-label {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Admin Two-Col ──────────────────────────── */
.two-col-admin {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
    align-items: flex-start;
}

/* ── Sidebar Toggle-Tab ─────────────────────── */
.sidebar-tab {
    display: none;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 56px;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 3px 0 8px rgba(0,0,0,.35);
    z-index: 102;
    transition: left .25s ease;
}
.sidebar-tab-arrow {
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    transition: color .15s;
}
.sidebar-tab:hover .sidebar-tab-arrow { color: #fff; }

/* ── Overlay ────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 900px) {
    .app-layout { display: block; }

    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 240px;
        min-width: 240px;
        transform: translateX(-240px);
        transition: transform .25s ease, box-shadow .25s ease;
        z-index: 100;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, .35);
    }

    .sidebar-tab { display: flex; }

    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 16px;
    }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .ticket-detail-layout.two-col { flex-direction: column; }
    .ticket-sidebar { width: 100%; min-width: unset; }
    .two-col-admin { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .filter-form { flex-direction: column; }
    .filter-form input,
    .filter-form select { max-width: 100%; }
}

/* -- Admin Objects / Modals ------------------- */
.modal-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.modal-section-label + * { margin-top: 0; }
.color-dot {
    display: inline-block;
    width: 12px; height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.15);
    vertical-align: middle;
    margin-right: 6px;
}
.value-slug {
    font-family: monospace;
    font-size: 12px;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
}
.type-key-badge {
    font-family: monospace;
    font-size: 11px;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--text-muted);
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 0;
}
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--border); }
.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.color-input-wrap input[type="color"] {
    width: 40px; height: 36px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    background: var(--surface);
}
.color-input-wrap input[type="text"] { flex: 1; }
.ticket-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
}
.ticket-count-badge.has-tickets { color: var(--warning); font-weight: 600; }
.toggle-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 12px;
}
.toggle-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--surface);
    cursor: pointer;
    user-select: none;
    gap: 10px;
}
.toggle-card-header:hover { background: var(--bg); }
.toggle-card-label {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
}
.toggle-card-label svg { flex-shrink: 0; color: var(--text-muted); }
.toggle-switch {
    position: relative;
    width: 36px; height: 20px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
    position: absolute; inset: 0;
    background: var(--border);
    border-radius: 20px;
    transition: background 0.2s;
    pointer-events: none;
}
.toggle-track::after {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    top: 3px; left: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-track { background: var(--primary); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle-card-body {
    border-top: 1px solid var(--border);
    padding: 14px;
    background: var(--bg);
}
.toggle-card-body .form-group { margin-bottom: 0; }
.outline-icon-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    max-height: 190px;
    overflow-y: auto;
}
.outline-icon-opt {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s, border-color 0.15s;
}
.outline-icon-opt:hover { background: var(--primary-light); border-color: var(--primary); }
.outline-icon-opt.selected { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* -- Permissions grid (admin-roles.php) -- */
.perm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
    margin-bottom: 14px;
}
.perm-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    padding: 5px 8px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .12s;
    user-select: none;
}
.perm-item:hover { background: var(--bg); }
.perm-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 15px; height: 15px;
    flex-shrink: 0;
    cursor: pointer;
    margin: 0;
}
.perm-item.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }

/* -- Group chip selector -- */
.group-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.group-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    transition: border-color .15s, background .15s, color .15s;
    user-select: none;
    line-height: 1.4;
}
.group-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.group-chip input[type="checkbox"] {
    display: none;
}
.group-chip.is-checked {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}
.group-chip.is-checked .chip-check {
    display: inline-block;
}
.chip-check {
    display: none;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

/* -- Conditions builder (admin-views.php) -- */
.conditions-section {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}
.conditions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg);
    border-bottom: 1.5px solid var(--border);
}
.conditions-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.conditions-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 6px;
}
.conditions-match-toggle {
    display: flex;
    gap: 0;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.match-btn {
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface);
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.match-btn + .match-btn {
    border-left: 1.5px solid var(--border);
}
.match-btn.active {
    background: var(--primary);
    color: #fff;
}
.conditions-list {
    display: flex;
    flex-direction: column;
}
.conditions-empty {
    padding: 14px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}
.condition-row {
    display: grid;
    grid-template-columns: 140px 140px 1fr auto;
    gap: 0;
    align-items: stretch;
    border-bottom: 1px solid var(--border);
}
.condition-row:last-child { border-bottom: none; }
.condition-row select {
    border: none;
    border-right: 1px solid var(--border);
    border-radius: 0;
    font-size: 13px;
    padding: 8px 10px;
    background: var(--surface);
    color: var(--text);
    outline: none;
    width: 100%;
    cursor: pointer;
}
.condition-row select:focus { background: var(--primary-light); }
.condition-row .cond-field {
    background: var(--bg);
    font-weight: 600;
    color: var(--text);
}
.cond-val-wrap {
    display: flex;
    align-items: stretch;
    border-right: 1px solid var(--border);
}
.cond-val-wrap select,
.cond-val-wrap input[type="text"] {
    border-right: none;
    flex: 1;
    min-width: 0;
}
/* User-Suche */
.cond-user-search {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.cond-user-name {
    border: none;
    border-radius: 0;
    font-size: 13px;
    padding: 8px 10px;
    background: var(--surface);
    color: var(--text);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}
.cond-user-name:focus { background: var(--primary-light); }
.cond-user-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    z-index: 200;
    max-height: 200px;
    overflow-y: auto;
}
.cond-user-result {
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
}
.cond-user-result:hover { background: var(--primary-light); }
.cond-user-result small { color: var(--text-muted); font-size: 11px; margin-left: 4px; }
.cond-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: color .12s, background .12s;
}
.cond-remove:hover { color: var(--danger); background: #fff0f0; }
.conditions-footer {
    padding: 10px 14px;
    border-top: 1.5px solid var(--border);
    background: var(--bg);
}


/* -- admin-translations.php ----------------------------------------------- */

/* Sprach-Karten */
.lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    padding: 20px;
}
.lang-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow .15s, border-color .15s;
}
.lang-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); border-color: var(--primary); }
.lang-card.lang-card--active { border-color: var(--primary); background: var(--primary-light); }
.lang-card-flag { font-size: 32px; line-height: 1; }
.lang-card-body { flex: 1; }
.lang-card-body strong { display: block; font-size: 15px; color: var(--text); }
.lang-card-meta { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.lang-card-code {
    font-size: 11px;
    font-family: monospace;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    color: var(--text-muted);
}
.lang-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.lang-badge--default  { background: var(--primary-light); color: var(--primary); }
.lang-badge--inactive { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.lang-badge--missing  { background: #fff3cd; color: #856404; }
.lang-card-actions { display: flex; gap: 6px; }
.lang-card-add {
    border: 2px dashed var(--border);
    background: transparent;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 13px;
    min-height: 120px;
    transition: border-color .15s, color .15s;
}
.lang-card-add:hover { border-color: var(--primary); color: var(--primary); }
.lang-card-add-icon { font-size: 28px; line-height: 1; }

/* �bersetzungs-Editor */
.trans-editor { margin-top: 24px; }
.trans-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}
.trans-editor-title { display: flex; align-items: center; gap: 10px; }
.trans-editor-title h3 { margin: 0; font-size: 16px; }
.trans-editor-actions { display: flex; gap: 8px; }

/* Kategorie-Accordion */
.trans-category { border-bottom: 1px solid var(--border); }
.trans-category:last-child { border-bottom: none; }
.trans-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    cursor: pointer;
    user-select: none;
    gap: 12px;
    transition: background .12s;
}
.trans-category-header:hover { background: var(--bg); }
.trans-category-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}
.trans-category-count {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1px 8px;
}
.trans-category-chevron {
    color: var(--text-muted);
    font-size: 13px;
    transition: transform .2s;
    flex-shrink: 0;
}
.trans-category-header.open .trans-category-chevron { transform: rotate(180deg); }
.trans-category-body { display: none; padding: 4px 20px 20px; }
.trans-category-body.open { display: block; }

/* �bersetzungs-Eintr�ge (2-spaltig) */
.trans-entries {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
}
@media (max-width: 860px) { .trans-entries { grid-template-columns: 1fr; } }
.trans-entry-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.trans-entry-key {
    font-family: monospace;
    font-size: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
    color: var(--text-muted);
}
.trans-entry input[type="text"] {
    width: 100%;
    box-sizing: border-box;
}

/* Sticky-Save-Bar */
.trans-save-bar {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 10;
    box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.trans-save-bar-info { font-size: 13px; color: var(--text-muted); }

/* -- admin-email.php -------------------------------------------------------- */

/* Info-Kacheln */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    padding: 16px 20px;
}
.info-tile {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.info-tile-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 6px; }
.info-tile-value { font-size: 20px; font-weight: 700; color: var(--text); }
.info-tile-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Postfach-Status-Badge */
.account-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 10px;
}
.account-status.active   { background: #dcfce7; color: #15803d; }
.account-status.inactive { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.account-status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Settings-Karte */
.settings-card { padding: 20px; }
.settings-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
}
@media (max-width: 700px) { .settings-form-grid { grid-template-columns: 1fr; } }

/* Ticket-Kennung Vorschau */
.prefix-preview {
    display: inline-flex;
    align-items: center;
    font-family: monospace;
    font-size: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    color: var(--text);
    margin-top: 8px;
}
.prefix-preview .prefix-part { color: var(--primary); font-weight: 700; }
.prefix-preview .sep-part    { color: var(--text-muted); }

/* Cron-Hinweis */
.cron-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-top: 16px;
}
.cron-box code {
    display: block;
    font-family: monospace;
    font-size: 13px;
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: 6px;
    padding: 10px 14px;
    margin-top: 8px;
    overflow-x: auto;
    white-space: nowrap;
}

/* Port-Hint im E-Mail-Modal */
.port-hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── Cron-Accordion (admin-email.php) ───────────────────────────────────── */
.cron-accordion { border-bottom: 1px solid var(--border); }
.cron-accordion:last-child { border-bottom: none; }
.cron-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    list-style: none;
    transition: background .12s;
    gap: 12px;
}
.cron-accordion-header::-webkit-details-marker { display: none; }
.cron-accordion-header:hover { background: var(--bg); }
.cron-accordion[open] .cron-accordion-header { background: var(--bg); }
.cron-accordion-arrow { font-size: 11px; color: var(--text-muted); transition: transform .2s; flex-shrink: 0; }
.cron-accordion[open] .cron-accordion-arrow { transform: rotate(180deg); }
.cron-accordion-body { padding: 4px 16px 16px; }
.cron-hint { font-size: 12px; color: var(--text-muted); margin: 6px 0 4px; line-height: 1.5; }
.cron-steps { font-size: 12px; color: var(--text-muted); padding-left: 18px; line-height: 1.8; }
.cron-steps li { margin-bottom: 2px; }
