/* NSPOH Helpdesk - basisstijl (thema-onafhankelijk, gebruikt CSS-variabelen uit /assets/themes/*.css) */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    font-size: 15px;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; color: var(--color-text); }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

.skip-link {
    position: absolute; left: -999px; top: 0; background: var(--color-primary); color: #fff;
    padding: .5rem 1rem; z-index: 1000;
}
.skip-link:focus { left: 0; }

/* Layout shell */
.app-shell { display: flex; min-height: 100vh; }
.app-nav {
    width: 240px; flex-shrink: 0; background: var(--color-primary);
    color: #fff; display: flex; flex-direction: column;
}
.app-nav .brand {
    display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.2rem;
    font-weight: 800; font-size: 1.05rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.12);
}
.app-nav .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); }
.app-nav nav { padding: .75rem; display: flex; flex-direction: column; gap: .15rem; flex: 1; overflow-y: auto; }
.app-nav a.nav-link {
    color: rgba(255,255,255,.85); padding: .55rem .75rem; border-radius: 8px; font-size: .92rem;
    display: flex; align-items: center; gap: .55rem; font-weight: 500;
}
.app-nav a.nav-link:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.app-nav a.nav-link.active { background: var(--color-accent); color: #fff; }
.app-nav .nav-section { text-transform: uppercase; font-size: .68rem; letter-spacing: .06em; color: rgba(255,255,255,.5);
    padding: .9rem .75rem .25rem; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .75rem 1.5rem; background: var(--color-surface); border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; z-index: 10;
}
.app-content { padding: 1.5rem; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: .6rem; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex-shrink: 0;
}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: .4rem; border: 1px solid transparent; border-radius: 8px;
    padding: .5rem 1rem; font-size: .9rem; font-weight: 600; cursor: pointer; background: var(--color-surface-alt);
    color: var(--color-text); line-height: 1.2;
}
.btn:hover { text-decoration: none; filter: brightness(0.97); }
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); }
.btn-secondary { background: var(--color-primary); color: #fff; }
.btn-secondary:hover { background: var(--color-primary-dark); }
.btn-outline { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Cards */
.card {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 1.25rem;
}
.card + .card { margin-top: 1rem; }
.card-title { font-weight: 700; margin-bottom: .75rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem;}
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stat-tile { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.stat-tile .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--color-primary); }
.stat-tile .stat-label { color: var(--color-text-muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

/* Forms */
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.form-group { margin-bottom: 1rem; }
.form-hint { font-size: .78rem; color: var(--color-text-muted); margin-top: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel],
input[type=number], input[type=date], input[type=file], select, textarea {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--color-border); border-radius: 8px;
    background: var(--color-surface); color: var(--color-text); font-size: .9rem; font-family: inherit;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--color-primary); }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 200px; }
.checkbox-row { display: flex; align-items: center; gap: .5rem; }
.checkbox-row input { width: auto; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
th { color: var(--color-text-muted); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: var(--color-surface-alt); }
.table-wrap { overflow-x: auto; }

/* Badges */
.badge { display: inline-block; padding: .18rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.badge-low, .badge-new { background: var(--color-info-bg); color: var(--color-info); }
.badge-medium, .badge-open { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-high, .badge-in_progress, .badge-pending { background: #ffe9e0; color: var(--color-accent-hover); }
.badge-critical, .badge-rejected { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-resolved, .badge-closed, .badge-implemented, .badge-approved { background: var(--color-success-bg); color: var(--color-success); }
.badge-scheduled { background: var(--color-primary-light); color: var(--color-primary); }
.badge-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-text-muted); }

/* Alerts */
.alert { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .88rem; border: 1px solid transparent; }
.alert-success { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success); }
.alert-error { background: var(--color-danger-bg); color: var(--color-danger); border-color: var(--color-danger); }

/* Auth pages */
.auth-shell {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--color-primary);
    background-image: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    padding: 1rem;
}
.auth-card {
    width: 100%; max-width: 380px; background: var(--color-surface); border-radius: 14px; padding: 2rem;
    box-shadow: var(--shadow-md);
}
.auth-card .brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.15rem; margin-bottom: 1.4rem; color: var(--color-primary); }
.auth-card .brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--color-accent); }
.auth-links { display: flex; justify-content: space-between; font-size: .82rem; margin-top: .9rem; }

/* Ticket body / rich text */
.rich-body {
    min-height: 160px; border: 1px solid var(--color-border); border-radius: 8px; padding: .7rem;
    background: var(--color-surface); overflow-wrap: anywhere;
}
.rich-body img { max-width: 100%; border-radius: 6px; margin: .4rem 0; }
.rich-body:empty:before { content: attr(data-placeholder); color: var(--color-text-muted); }

.ticket-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.ticket-meta .item .label { font-size: .72rem; text-transform: uppercase; color: var(--color-text-muted); font-weight: 700; }
.ticket-meta .item .value { font-weight: 600; }

.comment { border-left: 3px solid var(--color-border); padding: .6rem .9rem; margin-bottom: .7rem; border-radius: 0 8px 8px 0; background: var(--color-surface-alt); }
.comment.internal { border-color: var(--color-warning); }
.comment .comment-head { display: flex; justify-content: space-between; font-size: .78rem; color: var(--color-text-muted); margin-bottom: .3rem; }

.timeline-item { display: flex; gap: .6rem; font-size: .82rem; padding: .4rem 0; border-bottom: 1px dashed var(--color-border); }
.timeline-item .field { font-weight: 700; }

.attachment-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.attachment-list li { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.attachment-list a { display: flex; align-items: center; gap: .4rem; }

.dropzone {
    border: 2px dashed var(--color-border); border-radius: 10px; padding: 1rem; text-align: center;
    color: var(--color-text-muted); font-size: .85rem; cursor: pointer;
}
.dropzone.dragover { border-color: var(--color-accent); color: var(--color-accent); }

.tag-row { display: flex; gap: .4rem; flex-wrap: wrap; }

.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: .82rem; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }

.pagination { display: flex; gap: .4rem; margin-top: 1rem; }

@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .app-nav { width: 100%; flex-direction: row; overflow-x: auto; }
    .app-nav nav { flex-direction: row; }
    .app-nav .nav-section { display: none; }
}
