/* Incidencias - keyB Inc — Global Styles */

:root {
    --bg: #111;
    --bg2: #1a1a1a;
    --bg3: #222;
    --border: #333;
    --text: #eee;
    --text-muted: #999;
    --accent: #FFD600;
    --accent-hover: #ffe033;
    --danger: #e53935;
    --success: #43a047;
    --info: #1e88e5;
    --warning: #fb8c00;
    --bg-card: #1e1e1e;
    --bg-input: #2a2a2a;
    --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Public page ─────────────────────── */
.pub-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.pub-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
}
.lang-switcher { display: flex; gap: 8px; }
.lang-btn {
    background: none;
    border: 1px solid #444;
    color: #aaa;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: .8rem;
    transition: all .2s;
}
.lang-btn:hover, .lang-btn.active {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-login-top {
    background: var(--accent);
    color: #111;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: .9rem;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}
.btn-login-top:hover { background: var(--accent-hover); }

.pub-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
}
.pub-hero img { height: 80px; margin-bottom: 16px; }
.pub-hero h1 { color: var(--accent); font-size: 1.6rem; margin-bottom: 8px; }
.pub-hero p { color: var(--text-muted); margin-bottom: 8px; }
.pub-hero p:last-of-type { margin-bottom: 32px; }
.btn-report {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}
.btn-report:hover {
    background: var(--accent);
    color: #111;
}

.pub-footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: .8rem;
    border-top: 1px solid #222;
}

/* ── Modals ─────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}
.modal-box h2 { color: var(--accent); margin-bottom: 20px; font-size: 1.2rem; }
.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.4rem;
    cursor: pointer;
}
.modal-close:hover { color: var(--accent); }

/* ── Forms ──────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; color: #aaa; font-size: .85rem; margin-bottom: 4px; }
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg3);
    border: 1px solid #444;
    border-radius: 6px;
    color: var(--text);
    font-size: .95rem;
    font-family: inherit;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-group select option { background: var(--bg3); }
.form-group input[type="file"] { padding: 8px; }

.captcha-row {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-size: 1.1rem;
}
.captcha-row .captcha-question {
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
}
.captcha-row input { width: 80px; color-scheme: dark; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}
.btn-primary { background: var(--accent); color: #111; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #333; color: #eee; }
.btn-secondary:hover { background: #444; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: .9rem;
}
.alert-error { background: #5a1a1a; border: 1px solid #a33; color: #faa; }
.alert-success { background: #1a3a1a; border: 1px solid #3a3; color: #afa; }

/* ── Auth layout ────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo img { max-height: 48px; max-width: 180px; object-fit: contain; }
.sidebar-client-name {
    display: block;
    margin-top: 6px;
    font-size: .75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #bbb;
    font-size: .9rem;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.sidebar-nav a:hover { background: #252525; color: var(--text); text-decoration: none; }
.sidebar-nav a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: rgba(255,214,0,.05);
}
.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: .85rem;
    color: var(--text-muted);
}
.sidebar-user strong { color: var(--text); display: block; }
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-brand-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}
.sidebar-brand-info {
    min-width: 0;
}
.sidebar-brand-info strong {
    display: block;
    color: var(--text);
    font-size: .82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-brand-info span {
    font-size: .72rem;
    color: var(--text-muted);
}

/* ── Client selector ───────────────── */
.client-selector {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 28px 6px 10px;
    border-radius: 6px;
    font-size: .82rem;
    cursor: pointer;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.client-selector:focus { outline: none; border-color: var(--accent); }

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
}
.topbar h2 { font-size: 1.1rem; color: var(--accent); }
.topbar-actions { display: flex; gap: 12px; align-items: center; }

.topbar-user { display: flex; align-items: center; gap: 8px; }
.topbar-avatar {
    width: 32px; height: 32px; min-width: 32px; max-width: 32px; min-height: 32px; max-height: 32px;
    border-radius: 50%; object-fit: cover;
    border: 2px solid var(--accent);
}
.topbar-avatar-initial {
    display: flex; align-items: center; justify-content: center;
    background: var(--bg3); color: var(--accent); font-weight: 700; font-size: .85rem;
}
.topbar-username { font-size: .85rem; color: var(--text); font-weight: 500; }
@media (max-width: 768px) {
    .topbar-username { display: none; }
}

.content { flex: 1; padding: 24px; }

/* ── Dashboard ──────────────────────── */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.stat-card .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}
.stat-card .label { color: var(--text-muted); font-size: .85rem; margin-top: 4px; }

/* ── Tables ─────────────────────────── */
.table-wrap {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}
th { color: var(--text-muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; }
tr:hover { background: rgba(255,255,255,.02); }
tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-open { background: #1e3a5f; color: #64b5f6; }
.badge-in_progress { background: #4a3800; color: #ffb300; }
.badge-closed { background: #333; color: #999; }
.badge-low { background: #222; color: #888; }
.badge-normal { background: #1e3a5f; color: #64b5f6; }
.badge-high { background: #5a3000; color: #ffb74d; }
.badge-urgent { background: #5a1a1a; color: #ef5350; }
.badge-admin { background: #4a3800; color: #FFD600; }
.badge-client { background: #1e3a5f; color: #64b5f6; }
.badge-responsable { background: #1a3a2a; color: #66bb6a; }
.badge-tecnico { background: #1a2a3a; color: #4fc3f7; }
.badge-usuario { background: #1e3a5f; color: #64b5f6; }
.badge-assigned { background: #2a1a3a; color: #ce93d8; }
.badge-pending_third { background: #3a2a1a; color: #ffb74d; }
.badge-completed { background: #1a3a1a; color: #66bb6a; }

/* ── Inline select (list view) ──────── */
.inline-select {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 18px;
}

/* ── Batch action bar ──────────────── */
.batch-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: var(--bg3);
    border: 1px solid var(--accent);
    border-radius: 8px;
    font-size: .85rem;
}
.batch-bar span:first-child {
    color: var(--accent);
    font-weight: 600;
    margin-right: 4px;
    min-width: 150px;
}
.batch-bar select {
    padding: 4px 8px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: .82rem;
    cursor: pointer;
}

/* ── Copy link button ─────────────── */
.copy-link-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .9rem;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    color: var(--text-muted);
    opacity: .6;
    transition: opacity .15s;
}
.copy-link-btn:hover {
    opacity: 1;
    color: var(--accent);
}

/* ── Incident detail ────────────────── */
.incident-detail {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}
.incident-detail h3 { color: var(--accent); margin-bottom: 12px; }
.incident-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    font-size: .85rem;
    color: var(--text-muted);
}
.incident-meta span strong { color: var(--text); }
.incident-desc {
    background: var(--bg3);
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    word-wrap: break-word;
    min-height: 9em;
}
.editable-field {
    cursor: pointer;
    border-radius: 6px;
    transition: outline .15s;
    outline: 2px solid transparent;
}
.editable-field:hover {
    outline: 2px dashed var(--accent);
}
#inc-subject-text.editing {
    outline: 2px solid var(--accent);
    border-radius: 4px;
    padding: 2px 6px;
}
.incident-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.comment-list { margin-top: 16px; }
.comment-item {
    background: var(--bg3);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 8px;
}
.comment-item .comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: .8rem;
    color: var(--text-muted);
}
.comment-item .comment-header strong { color: var(--accent); }
.comment-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.comment-item:hover .comment-actions { opacity: 1; }
.comment-action-btn {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: .85rem; padding: 0 4px; line-height: 1; border-radius: 3px;
}
.comment-action-btn:hover { color: var(--accent); background: var(--bg3); }
.comment-action-del:hover { color: var(--danger); }
.comment-form { margin-top: 16px; display: flex; gap: 8px; }
.comment-form textarea { flex: 1; min-height: 60px; }

.file-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-item {
    background: var(--bg3);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: .8rem;
    color: var(--accent);
}
.file-item:hover { background: #333; text-decoration: none; }

/* ── Hamburger menu ────────────────── */
.hamburger-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    transition: border-color .2s;
}
.hamburger-btn:hover { border-color: var(--accent); }
.hamburger-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: background .2s;
}
.hamburger-btn:hover span { background: var(--accent); }

.hamburger-menu {
    display: none;
    position: absolute;
    top: 56px;
    right: 24px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 200px;
    z-index: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.hamburger-menu.open { display: block; }
.hm-section { padding: 8px 0; border-bottom: 1px solid var(--border); }
.hm-section:last-child { border-bottom: none; }
.hm-label {
    padding: 4px 16px;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    font-weight: 600;
}
.hm-item {
    display: block;
    padding: 8px 16px;
    color: var(--text);
    font-size: .85rem;
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
}
.hm-item:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.hm-danger { color: var(--danger) !important; }
.hm-danger:hover { background: rgba(229,57,53,.1); }

/* ── Avatar ────────────────────────── */
.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 6px;
}
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid var(--border);
}
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-initial {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

/* ── Theme toggle ──────────────────── */
.theme-toggle {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.theme-opt {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: var(--bg3);
    color: var(--text-muted);
    font-size: .85rem;
    cursor: pointer;
    transition: all .2s;
}
.theme-opt:first-child { border-right: 1px solid var(--border); }
.theme-opt.active {
    background: var(--accent);
    color: #111;
    font-weight: 600;
}
.theme-opt:hover:not(.active) { background: rgba(255,255,255,.08); }

/* ── Settings page ─────────────────── */
.settings-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}
.settings-section h3 {
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 12px;
}
.settings-section p {
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 16px;
}

/* ── Events page ───────────────────── */
.events-filters {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}
.filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.filter-group select,
.filter-group input[type="date"] {
    padding: 6px 10px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: .85rem;
    font-family: inherit;
}
.filter-group select:focus,
.filter-group input[type="date"]:focus { outline: none; border-color: var(--accent); }

.badge-event-login { background: #1a3a2a; color: #66bb6a; }
.badge-event-logout { background: #333; color: #999; }
.badge-event-incident { background: #1e3a5f; color: #64b5f6; }
.badge-event-user { background: #4a3800; color: #FFD600; }
.badge-event-access { background: #3a1a4a; color: #ce93d8; }
.badge-event-client { background: #1a3a2a; color: #81c784; }

.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
}
.pagination-info { color: var(--text-muted); font-size: .85rem; }

/* ── Light theme ───────────────────── */
body[data-theme="light"] {
    --bg: #f5f5f5;
    --bg2: #fff;
    --bg3: #eee;
    --border: #ddd;
    --text: #222;
    --text-muted: #777;
    --accent: #c8a800;
    --accent-hover: #b89800;
}
body[data-theme="light"] .sidebar-nav a:hover { background: #f0f0f0; }
body[data-theme="light"] .sidebar-nav a.active { background: rgba(200,168,0,.08); }
body[data-theme="light"] tr:hover { background: rgba(0,0,0,.02); }
body[data-theme="light"] .hamburger-menu { box-shadow: 0 8px 24px rgba(0,0,0,.12); }
body[data-theme="light"] .hm-item:hover { background: rgba(0,0,0,.04); }
body[data-theme="light"] .theme-opt:hover:not(.active) { background: rgba(0,0,0,.06); }
body[data-theme="light"] .alert-error { background: #fdecea; border-color: #e53935; color: #b71c1c; }
body[data-theme="light"] .alert-success { background: #edf7ed; border-color: #43a047; color: #1b5e20; }
body[data-theme="light"] .btn-secondary { background: #e0e0e0; color: #333; }
body[data-theme="light"] .btn-secondary:hover { background: #d0d0d0; }
body[data-theme="light"] .badge-open { background: #e3f2fd; color: #1565c0; }
body[data-theme="light"] .badge-in_progress { background: #fff8e1; color: #e65100; }
body[data-theme="light"] .badge-closed { background: #eee; color: #777; }
body[data-theme="light"] .badge-admin { background: #fff8e1; color: #bf8f00; }
body[data-theme="light"] .badge-client { background: #e3f2fd; color: #1565c0; }
body[data-theme="light"] .badge-responsable { background: #e8f5e9; color: #2e7d32; }
body[data-theme="light"] .badge-tecnico { background: #e1f5fe; color: #0277bd; }
body[data-theme="light"] .badge-usuario { background: #e3f2fd; color: #1565c0; }
body[data-theme="light"] .badge-assigned { background: #f3e5f5; color: #7b1fa2; }
body[data-theme="light"] .badge-pending_third { background: #fff3e0; color: #e65100; }
body[data-theme="light"] .badge-completed { background: #e8f5e9; color: #2e7d32; }
body[data-theme="light"] .badge-low { background: #f5f5f5; color: #616161; }
body[data-theme="light"] .badge-normal { background: #e3f2fd; color: #1565c0; }
body[data-theme="light"] .badge-high { background: #fff3e0; color: #e65100; }
body[data-theme="light"] .badge-urgent { background: #ffebee; color: #c62828; }
body[data-theme="light"] .badge-event-login { background: #e8f5e9; color: #2e7d32; }
body[data-theme="light"] .badge-event-logout { background: #eee; color: #777; }
body[data-theme="light"] .badge-event-incident { background: #e3f2fd; color: #1565c0; }
body[data-theme="light"] .badge-event-user { background: #fff8e1; color: #bf8f00; }
body[data-theme="light"] .badge-event-access { background: #f3e5f5; color: #7b1fa2; }
body[data-theme="light"] .badge-event-client { background: #e8f5e9; color: #2e7d32; }

/* ── Rich text editor ─────────────── */
.rich-editor { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.rich-toolbar {
    display: flex; gap: 2px; padding: 6px 8px;
    background: var(--bg3); border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.rich-toolbar button {
    background: none; border: 1px solid transparent; border-radius: 4px;
    color: var(--text-muted); cursor: pointer; padding: 4px 8px;
    font-size: 14px; line-height: 1; transition: all .15s;
    font-family: inherit;
}
.rich-toolbar button:hover { background: rgba(255,255,255,.1); border-color: var(--border); color: var(--text); }
.rich-sep { width: 1px; background: var(--border); margin: 2px 4px; }
.rich-unlink-btn { position: relative; }
.rich-unlink-x {
    position: absolute; top: -2px; right: 0; font-size: .65rem;
    color: #f44; font-weight: 700; line-height: 1;
}
.rich-color-btn {
    display: inline-flex; align-items: center; cursor: pointer;
    border: 1px solid transparent; border-radius: 4px;
    padding: 4px 6px; font-weight: 700; font-size: .85rem;
    color: var(--text-muted); position: relative;
}
.rich-color-btn:hover { background: rgba(255,255,255,.1); border-color: var(--border); color: var(--text); }
.rich-color-btn input[type="color"] {
    position: absolute; bottom: -2px; left: 0; width: 100%; height: 4px;
    padding: 0; border: none; background: none; cursor: pointer;
    -webkit-appearance: none; appearance: none;
}
.rich-color-btn input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.rich-color-btn input[type="color"]::-webkit-color-swatch { border: none; border-radius: 2px; }
.rich-editable {
    min-height: 80px; padding: 12px; outline: none;
    color: var(--text); font-size: .9rem; line-height: 1.6;
}
.rich-editable:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted); pointer-events: none;
}
.rich-editable a { color: var(--accent); text-decoration: underline; }
.rich-editable ul, .rich-editable ol { margin: .5em 0; padding-left: 1.5em; }

/* ── Link dialog ─────────────────── */
.link-dialog-overlay {
    display: none;
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    z-index: 9999 !important;
    background: rgba(0,0,0,.5);
    justify-content: center; align-items: center;
}
.link-dialog-overlay.open { display: flex !important; }
.link-dialog-box {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 12px; padding: 24px; width: 90%; max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.link-dialog-title {
    font-size: 1rem; font-weight: 600; color: var(--text);
    margin-bottom: 16px;
}
.link-dialog-input {
    width: 100%; padding: 10px 12px;
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); font-size: .9rem;
    font-family: inherit; outline: none;
}
.link-dialog-input:focus { border-color: var(--accent); }
.link-dialog-actions {
    display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px;
}

/* ── Rich content display ──────────── */
.rich-content p { margin: 0 0 .5em; }
.rich-content p:last-child { margin-bottom: 0; }
.rich-content a { color: var(--accent); text-decoration: underline; }
.rich-content ul, .rich-content ol { margin: .5em 0; padding-left: 1.5em; }
.rich-content strong, .rich-content b { font-weight: 700; }
.rich-content em, .rich-content i { font-style: italic; }
.rich-content blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--text-muted); margin: .5em 0; }

/* ── Responsive ─────────────────────── */
@media (max-width: 768px) {
    .app-wrapper { flex-direction: column; }
    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .sidebar-logo { padding: 12px 16px; border-bottom: none; }
    .sidebar-nav { display: flex; padding: 0; overflow-x: auto; }
    .sidebar-nav a { padding: 12px 16px; border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
    .sidebar-nav a.active { border-left-color: transparent; border-bottom-color: var(--accent); }
    .sidebar-user { display: none; }
    .content { padding: 16px; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .incident-actions { flex-direction: column; }
    .hamburger-menu { right: 16px; top: 52px; }
    .report-filters { flex-direction: column; }
    .report-filters .form-group { display: block !important; margin-bottom: 8px; }
    .report-summary { flex-direction: column; }
}

/* ── Reports ─────────────────────── */
.report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; background: var(--card-bg); padding: 16px; border-radius: 8px; border: 1px solid var(--border); }
.report-filters label { display: block; color: var(--text-muted); font-size: .82rem; margin-bottom: 4px; }
.report-filters input[type="date"],
.report-filters select { padding: 7px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: .9rem; }
.report-content { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 24px; }
.report-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--accent); }
.report-header h2 { margin: 0; font-size: 1.2rem; color: var(--text); }
.report-header p { color: var(--text-muted) !important; }
.report-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.report-stat { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px 16px; text-align: center; min-width: 90px; }
.report-stat strong { display: block; font-size: 1.4rem; color: var(--accent); }
.report-stat span { font-size: .78rem; color: var(--text-muted); }
.report-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: .85rem; }
.report-table th { background: var(--bg); text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.report-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.report-table tr:hover { background: var(--bg); }

/* ── Documentation ───────────────── */
.docs-upload-box { background: var(--card-bg); border: 1px dashed var(--border); border-radius: 8px; padding: 16px; }
.doc-actions { white-space: nowrap; }
.doc-actions .btn { padding: 4px 8px; font-size: .78rem; }
.doc-row-folder td { background: var(--bg); }
.doc-row-folder a { color: var(--accent); text-decoration: none; }
.doc-row-folder a:hover { text-decoration: underline; }
#docs-breadcrumb a { color: var(--accent); text-decoration: none; }
#docs-breadcrumb a:hover { text-decoration: underline; }
.docs-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.docs-gallery-item { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; cursor: pointer; transition: border-color .15s; }
.docs-gallery-item:hover { border-color: var(--accent); }
.docs-gallery-item img { width: 100%; height: 140px; object-fit: cover; display: block; }
.docs-gallery-name { padding: 6px 8px; font-size: .78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
