:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --text: #1f2430;
    --muted: #6b7280;
    --border: #e2e5ea;
    --primary: #3d5afe;
    --primary-dark: #2e46d9;
    --open: #2563eb;
    --pending: #d97706;
    --resolved: #16a34a;
    --closed: #6b7280;
    --urgent: #dc2626;
    --high: #ea580c;
    --normal: #2563eb;
    --low: #6b7280;
}

* { box-sizing: border-box; }

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

.wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

header.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header.topbar .brand {
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
    text-decoration: none;
}

header.topbar nav a {
    color: var(--muted);
    text-decoration: none;
    margin-left: 16px;
    font-size: 14px;
}

header.topbar nav a:hover { color: var(--primary); }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}

h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 12px; }
p.subtitle { color: var(--muted); margin-top: 0; }

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    margin-top: 16px;
}

input[type=text], input[type=email], input[type=password], textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}

textarea { min-height: 120px; resize: vertical; }

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    margin-top: 18px;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn.secondary:hover { background: #f0f1f3; color: var(--text); }

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert.success { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }
.alert.error { background: #fef3f2; color: #b42318; border: 1px solid #fda29b; }

table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 5px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.2;
}
th { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 600; padding-bottom: 8px; }

.timeago { display: inline-block; line-height: 1.15; }
.timeago .d { font-size: 11px; color: var(--muted); }
tr:hover td { background: #fafbfc; }
td a { color: var(--text); text-decoration: none; font-weight: 500; }
td a:hover { color: var(--primary); }

.badge {
    display: inline-block;
    padding: 1px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    text-transform: capitalize;
    line-height: 1.5;
}
.close-form { display: inline; margin-left: 6px; }
.close-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--muted);
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
}
.close-link:hover { color: var(--primary); }
.badge.open { background: var(--open); }
.badge.pending { background: var(--pending); }
.badge.resolved { background: var(--resolved); }
.badge.closed { background: var(--closed); }

/* Status-badge gekleurd op prioriteit (i.p.v. status) in het ticketoverzicht */
.badge.prio-low { background: var(--low); }
.badge.prio-normal { background: var(--normal); }
.badge.prio-high { background: var(--high); }
.badge.prio-urgent { background: var(--urgent); }

.priority { font-weight: 600; text-transform: capitalize; }
.priority.urgent { color: var(--urgent); }
.priority.high { color: var(--high); }
.priority.normal { color: var(--normal); }
.priority.low { color: var(--low); }

.meta-row { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; color: var(--muted); font-size: 14px; }
.meta-row strong { color: var(--text); }

.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filters a {
    padding: 6px 14px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
}
.filters a.active { background: var(--text); color: #fff; border-color: var(--text); }

.reply {
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}
.reply.agent { background: #eef2ff; }
.reply.customer { background: #f9fafb; }
.reply.internal-note { background: #fff8e1; border: 1px dashed #e0b400; }
.reply .reply-head { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.reply .reply-head strong { color: var(--text); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }

.status-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.status-form > div { flex: 1; min-width: 140px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .two-col { grid-template-columns: 1fr; } }

.attachments { margin-top: 10px; font-size: 13px; }
.attachments ul { list-style: none; padding: 0; margin: 6px 0 0; }
.attachments li { padding: 4px 0; }
.attachments a { color: var(--text); text-decoration: underline; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Mobiel: grotere letters en grotere, makkelijker te raken knoppen/links */
@media (max-width: 768px) {
    .wrap { padding: 16px 12px 60px; }

    body { font-size: 16px; }

    header.topbar { padding: 12px 14px; flex-wrap: wrap; gap: 8px 16px; }
    header.topbar .brand { font-size: 18px; }
    header.topbar nav a {
        font-size: 15px;
        margin-left: 0;
        margin-right: 14px;
        padding: 6px 0;
        display: inline-block;
    }

    h1 { font-size: 21px; }
    h2 { font-size: 17px; }

    label { font-size: 14px; margin-top: 14px; }

    input[type=text], input[type=email], input[type=password], textarea, select {
        font-size: 16px; /* voorkomt automatisch inzoomen op iOS */
        padding: 12px 14px;
    }

    .btn {
        display: block;
        width: 100%;
        text-align: center;
        font-size: 16px;
        padding: 14px 18px;
        min-height: 48px;
    }
    .status-form .btn { width: auto; display: inline-block; }

    .filters a {
        font-size: 14px;
        padding: 10px 16px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    .card { padding: 16px; }

    th, td { font-size: 14px; padding: 6px 10px; }
    td a { display: inline-block; }

    .meta-row { font-size: 14px; gap: 12px 20px; }

    input[type=file] { font-size: 14px; }
}
