:root {
    --p: #4f46e5;
    --p2: #7c3aed;
    --bg: #f1f5f9;
    --card: #fff;
    --tx: #0f172a;
    --mut: #64748b;
    --bd: #e2e8f0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--tx);
    line-height: 1.5;
}

/* Layout */
.hero {
    background: linear-gradient(135deg, var(--p), var(--p2));
    color: #fff;
    padding: 36px 16px 80px;
}
.wrap { max-width: 640px; margin: 0 auto; }
.card {
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
    padding: 28px;
    margin: -56px auto 40px;
    max-width: 640px;
}
body.admin .wrap,
body.admin .card { max-width: 980px; }

/* Nav + hero text */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    font-size: 14px;
}
.nav a { color: #fff; text-decoration: none; opacity: .9; margin-left: 16px; }
.nav a:hover { opacity: 1; }
.logo { font-weight: 700; font-size: 16px; }
.hero h1 { margin: 0; font-size: 28px; }
.hero p { margin: 6px 0 0; opacity: .85; }

/* Form */
label { display: block; margin: 16px 0 6px; font-weight: 600; font-size: 14px; }
input, select, textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--bd);
    border-radius: 10px;
    font: inherit;
    background: #fff;
    transition: .15s;
}
input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--p);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
input.invalid, select.invalid, textarea.invalid { border-color: #dc2626; }
.field-error { color: #b91c1c; font-size: 13px; margin-top: 6px; }
input[type="file"] { padding: 9px; background: #f8fafc; }
.hint { color: var(--mut); font-size: 12px; margin-top: 6px; }
.attachment img, .attachment video {
    display: block;
    max-width: 100%;
    max-height: 420px;
    border: 1px solid var(--bd);
    border-radius: 10px;
    margin: 8px 0;
}
.attachment .muted a { color: var(--p); font-weight: 600; text-decoration: none; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Buttons */
button, .btn {
    display: inline-block;
    margin-top: 22px;
    padding: 12px 22px;
    background: var(--p);
    color: #fff;
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .btn:hover { background: #4338ca; }
.btn-full { width: 100%; }
.btn-ghost { background: #e2e8f0; color: var(--tx); }
.btn-ghost:hover { background: #cbd5e1; }

/* Admin filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.filters input { flex: 2 1 220px; width: auto; }
.filters select { flex: 1 1 140px; width: auto; }
.filters button, .filters .btn { margin-top: 0; padding: 11px 18px; }
.status-form { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--bd); }
.status-form button { margin-top: 0; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.ok { background: #dcfce7; color: #166534; }
.err { background: #fee2e2; color: #991b1b; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.b-low { background: #e2e8f0; color: #475569; }
.b-medium { background: #dbeafe; color: #1d4ed8; }
.b-high { background: #ffedd5; color: #c2410c; }
.b-urgent { background: #fee2e2; color: #b91c1c; }
.b-open { background: #fef9c3; color: #a16207; }
.b-replied { background: #dcfce7; color: #15803d; }
.b-closed { background: #e2e8f0; color: #475569; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    text-align: left;
    color: var(--mut);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 10px;
    border-bottom: 2px solid var(--bd);
}
td { padding: 14px 10px; border-bottom: 1px solid var(--bd); vertical-align: middle; }
tr:hover td { background: #f8fafc; }
td a { color: var(--p); font-weight: 600; text-decoration: none; }

/* Ticket view */
.muted { color: var(--mut); font-size: 13px; }
.msg {
    background: #f8fafc;
    border: 1px solid var(--bd);
    border-radius: 10px;
    padding: 14px;
    white-space: pre-wrap;
    margin: 8px 0;
}
.msg.reply { background: #eef2ff; border-color: #c7d2fe; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 16px; }
.back { color: var(--p); text-decoration: none; font-weight: 600; font-size: 14px; }
.center { text-align: center; padding: 20px 0; }
.empty { text-align: center; color: var(--mut); padding: 30px 0; }
.check { font-size: 48px; }
.mt { margin-top: 14px; }

@media (max-width: 600px) {
    .row { grid-template-columns: 1fr; }
    .card { padding: 20px; }
}
