/*
 * OS-2045 — Audit-Log Browser styling.
 *
 * Scoped under .audit-app to coexist with the global terminal/admin styles
 * without leaking. Layout: 280px filter sidebar + flexible result area.
 */

.audit-app {
    height: 100%;
    width: 100%;
    display: block;
    font-family: var(--os-font-mono, 'JetBrains Mono', 'Fira Code', monospace);
    color: var(--os-fg, #d8e4ff);
    background: var(--os-bg, #0c0f1a);
}

.audit-app .audit-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    height: 100%;
    min-height: 0;
}

/* ---- Sidebar ---- */
.audit-app .audit-sidebar {
    border-right: 1px solid color-mix(in srgb, var(--theme-accent) 12%, transparent);
    background: rgba(255, 255, 255, 0.015);
    padding: 16px 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.audit-app .audit-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin: 0 0 4px;
    color: rgba(216, 228, 255, 0.55);
    font-weight: 600;
}

.audit-app .audit-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
}
.audit-app .audit-field > span {
    color: rgba(216, 228, 255, 0.65);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.audit-app .audit-input {
    background: rgba(0, 0, 0, 0.35);
    color: inherit;
    border: 1px solid color-mix(in srgb, var(--theme-accent) 20%, transparent);
    border-radius: 4px;
    padding: 6px 8px;
    font: inherit;
    font-size: 12px;
    outline: none;
    transition: border-color 0.15s;
}
.audit-app .audit-input:focus {
    border-color: color-mix(in srgb, var(--theme-accent) 55%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--theme-accent) 18%, transparent);
}

.audit-app .audit-types {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 2px;
}

.audit-app .audit-type-btn {
    background: color-mix(in srgb, var(--theme-accent) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--theme-accent) 18%, transparent);
    color: rgba(216, 228, 255, 0.75);
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    transition: background 0.12s, color 0.12s;
}
.audit-app .audit-type-btn:hover {
    background: color-mix(in srgb, var(--theme-accent) 18%, transparent);
    color: rgba(216, 228, 255, 1);
}
.audit-app .audit-type-btn.on {
    background: color-mix(in srgb, var(--theme-accent) 20%, transparent);
    border-color: color-mix(in srgb, var(--theme-accent) 55%, transparent);
    color: #fff;
}

.audit-app .audit-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.audit-app .audit-btn {
    flex: 1;
    background: color-mix(in srgb, var(--theme-accent) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--theme-accent) 25%, transparent);
    color: inherit;
    padding: 6px 10px;
    font: inherit;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.audit-app .audit-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--theme-accent) 22%, transparent);
    border-color: color-mix(in srgb, var(--theme-accent) 45%, transparent);
}
.audit-app .audit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.audit-app .audit-btn-primary {
    background: color-mix(in srgb, var(--theme-accent) 22%, transparent);
    border-color: color-mix(in srgb, var(--theme-accent) 55%, transparent);
}
.audit-app .audit-btn-primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--theme-accent) 32%, transparent);
}

/* ---- Main area ---- */
.audit-app .audit-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.audit-app .audit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid color-mix(in srgb, var(--theme-accent) 12%, transparent);
    font-size: 12px;
    background: rgba(255, 255, 255, 0.01);
}
.audit-app .audit-summary {
    color: rgba(216, 228, 255, 0.85);
}
.audit-app .audit-status {
    color: rgba(216, 228, 255, 0.55);
    font-size: 11px;
}

.audit-app .audit-table-wrap {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.audit-app .audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.audit-app .audit-table th {
    position: sticky;
    top: 0;
    background: #14182a;
    border-bottom: 1px solid color-mix(in srgb, var(--theme-accent) 18%, transparent);
    text-align: left;
    padding: 6px 10px;
    font-weight: 600;
    color: rgba(216, 228, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11px;
    z-index: 1;
}
.audit-app .audit-table td {
    padding: 5px 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--theme-accent) 6%, transparent);
    vertical-align: top;
    color: rgba(216, 228, 255, 0.85);
}
.audit-app .audit-row {
    cursor: pointer;
    transition: background 0.08s;
}
.audit-app .audit-row:hover {
    background: color-mix(in srgb, var(--theme-accent) 6%, transparent);
}

.audit-app .audit-cell-time {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: rgba(216, 228, 255, 0.6);
}
.audit-app .audit-cell-action {
    color: rgba(255, 255, 255, 0.92);
}
.audit-app .audit-cell-target {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(216, 228, 255, 0.7);
}
.audit-app .audit-cell-details {
    max-width: 460px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(216, 228, 255, 0.55);
    font-size: 11px;
}

.audit-app .audit-detail td {
    background: rgba(0, 0, 0, 0.25);
    padding: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--theme-accent) 18%, transparent);
}
.audit-app .audit-detail-pre {
    margin: 0;
    padding: 10px 14px;
    color: rgba(216, 228, 255, 0.85);
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow: auto;
}

.audit-app .audit-empty,
.audit-app .audit-muted {
    color: rgba(216, 228, 255, 0.45);
    font-style: italic;
    padding: 14px;
    text-align: center;
}

/* ---- Type badges ---- */
.audit-app .audit-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--theme-accent) 18%, transparent);
    color: rgba(255, 255, 255, 0.85);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.audit-app .audit-badge-auth         { background: rgba(255, 140, 80, 0.28); }
.audit-app .audit-badge-user         { background: color-mix(in srgb, var(--theme-accent) 28%, transparent); }
.audit-app .audit-badge-visitor      { background: rgba(180, 220, 140, 0.28); }
.audit-app .audit-badge-rechnungen   { background: rgba(220, 200, 140, 0.28); }
.audit-app .audit-badge-corvault     { background: rgba(180, 140, 220, 0.28); }
.audit-app .audit-badge-docker       { background: rgba(140, 220, 220, 0.28); }
.audit-app .audit-badge-security     { background: rgba(255, 100, 100, 0.32); }
.audit-app .audit-badge-briefe       { background: rgba(220, 180, 220, 0.28); }
.audit-app .audit-badge-angebot      { background: rgba(220, 200, 140, 0.22); }
.audit-app .audit-badge-eingangsrechnung { background: rgba(220, 160, 100, 0.28); }

.audit-app .audit-footer {
    border-top: 1px solid color-mix(in srgb, var(--theme-accent) 12%, transparent);
    padding: 8px 14px;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.01);
}
.audit-app .audit-footer .audit-btn {
    flex: 0 1 220px;
}

/* ---- Compact mode for narrow windows ---- */
@media (max-width: 800px) {
    .audit-app .audit-layout {
        grid-template-columns: 1fr;
    }
    .audit-app .audit-sidebar {
        border-right: none;
        border-bottom: 1px solid color-mix(in srgb, var(--theme-accent) 12%, transparent);
        max-height: 320px;
    }
}
