:root {
    color-scheme: dark;
    --bg: #0d1210;
    --surface: #151c18;
    --surface-2: #1c2520;
    --border: #2d3b33;
    --text: #f4f7f5;
    --muted: #aab7af;
    --accent: #6fdb8d;
    --accent-dark: #173f25;
    --warning: #ffcc66;
    --blue: #72a7ff;
    --danger: #ff7f7f;
    --shadow: 0 20px 55px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(111,219,141,.12), transparent 34rem), linear-gradient(180deg,#0d1210 0%,#111713 100%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
}
a { color: var(--accent); }
button,input,textarea,select { font: inherit; }
.site-shell { width: min(920px,calc(100% - 28px)); margin: 0 auto; padding: 34px 0 54px; }
.narrow-shell { width: min(820px,calc(100% - 28px)); }
.hero { padding: 34px; border: 1px solid var(--border); border-radius: 28px; background: linear-gradient(145deg,rgba(111,219,141,.13),transparent 60%),var(--surface); box-shadow: var(--shadow); }
.compact-hero { padding: 25px 30px; }
.hero-badge,.eyebrow { display: inline-block; color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1,h2,h3,h4,p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(2rem,6vw,4rem); line-height: 1.05; }
.compact-hero h1 { font-size: clamp(1.9rem,5vw,3rem); }
h2 { margin-bottom: 10px; line-height: 1.2; }
.hero-lead { max-width: 700px; margin-bottom: 0; color: var(--muted); font-size: 1.1rem; }
.info-card,.form-card,.lookup-card,.privacy-card,.notice,.public-ticket-card { margin-top: 22px; padding: 28px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); }
.notice.success { border-color: rgba(111,219,141,.6); background: rgba(23,63,37,.75); }
.notice.error { border-color: rgba(255,127,127,.55); background: rgba(76,23,23,.72); }
.notice p:last-child { margin-bottom: 0; }
.ticket-reference { font-size: 1.08rem; }
.rules { margin: 18px 0 0; padding-left: 1.25rem; color: var(--muted); }
.rules li + li { margin-top: 6px; }
.section-heading,.admin-header,.ticket-toolbar,.ticket-summary,.admin-actions,.ticket-view-header,.timeline-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.status-dot { padding: 7px 11px; border-radius: 999px; background: var(--accent-dark); color: var(--accent); font-size: .82rem; font-weight: 700; }
form { display: grid; gap: 12px; }
label { margin-top: 10px; font-weight: 750; }
input,textarea,select { width: 100%; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px; outline: none; background: #0f1512; color: var(--text); }
input:focus,textarea:focus,select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111,219,141,.14); }
textarea { resize: vertical; }
.field-help,.optional { color: var(--muted); font-size: .9rem; font-weight: 500; }
.honeypot { position: absolute!important; left: -10000px!important; width: 1px!important; height: 1px!important; overflow: hidden!important; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-columns > div { min-width: 0; }
.consent-row { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); font-weight: 500; }
.consent-row input { width: auto; margin-top: 5px; }
.compact-consent { margin-top: 0; }
.primary-button,.secondary-button,.image-button { display: inline-flex; align-items: center; justify-content: center; width: auto; min-height: 46px; padding: 0 18px; border: 0; border-radius: 12px; text-decoration: none; cursor: pointer; font-weight: 800; }
.primary-button { margin-top: 10px; background: var(--accent); color: #07110a; }
.secondary-button,.image-button { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.inline-button { margin-top: 8px; }
.privacy-card p { margin-bottom: 0; color: var(--muted); }
footer { display: flex; flex-wrap: wrap; gap: 14px 20px; justify-content: center; padding: 30px 10px 0; color: var(--muted); font-size: .9rem; }
.admin-link { color: var(--muted); }
.lookup-form { grid-template-columns: 1fr 1fr auto; align-items: end; }
.lookup-form label { grid-row: 1; }
.lookup-form input,.lookup-form button { grid-row: 2; }
.login-shell { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: min(470px,100%); padding: 30px; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.back-link { display: inline-block; margin-top: 20px; }
.admin-body { background: #0c110e; }
.admin-shell { width: min(1380px,calc(100% - 30px)); margin: 0 auto; padding: 28px 0 60px; }
.admin-header { margin-bottom: 22px; padding: 24px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.admin-header h1 { margin-bottom: 0; font-size: clamp(1.9rem,5vw,3rem); }
.danger-link { color: var(--danger); text-decoration: none; font-weight: 800; }
.stats-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 14px; }
.stat-card { min-height: 148px; padding: 20px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.stat-card span,.stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; margin: 10px 0 4px; font-size: 2.25rem; line-height: 1; }
.ticket-section { margin-top: 22px; padding: 24px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.filter-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-nav a { padding: 8px 11px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); text-decoration: none; }
.filter-nav a.active { border-color: var(--accent); background: var(--accent-dark); color: var(--accent); }
.ticket-list { display: grid; gap: 15px; margin-top: 22px; }
.ticket-card { padding: 20px; border: 1px solid var(--border); border-left: 5px solid var(--warning); border-radius: 16px; background: var(--surface-2); }
.ticket-card.status-received { border-left-color: var(--warning); }
.ticket-card.status-open { border-left-color: #e9b949; }
.ticket-card.status-in_progress { border-left-color: var(--blue); }
.ticket-card.status-ready { border-left-color: #b38cff; }
.ticket-card.status-handed_over,.ticket-card.status-closed { border-left-color: var(--accent); }
.ticket-card.status-spam { border-left-color: var(--danger); opacity: .8; }
.ticket-number { color: var(--accent); font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size: .85rem; }
.ticket-summary h3 { margin: 4px 0 0; font-size: 1.12rem; }
.ticket-status,.large-status { white-space: nowrap; padding: 7px 11px; border-radius: 999px; background: #0f1512; color: var(--muted); font-size: .82rem; font-weight: 800; }
.large-status { color: var(--accent); border: 1px solid var(--border); }
.ticket-meta { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 12px; margin: 18px 0 0; }
.ticket-meta div,.public-ticket-meta div { min-width: 0; padding: 11px; border: 1px solid var(--border); border-radius: 12px; background: rgba(8,12,9,.32); }
.ticket-meta dt,.public-ticket-meta dt { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }
.ticket-meta dd,.public-ticket-meta dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.ticket-details { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.ticket-details summary { cursor: pointer; color: var(--accent); font-weight: 800; }
.ticket-description,.message-panel { margin: 16px 0; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: #0f1512; }
.ticket-description p,.message-panel p { margin: 8px 0 0; }
.update-form { margin-top: 18px; padding: 17px; border: 1px solid var(--border); border-radius: 14px; background: #111813; }
.answer-field textarea { min-height: 110px; }
.admin-history { margin-top: 18px; }
.history-entry { margin-top: 10px; padding: 13px; border-left: 3px solid var(--border); background: rgba(0,0,0,.14); }
.history-entry time { margin-left: 10px; color: var(--muted); font-size: .85rem; }
.history-entry p { margin: 6px 0 0; }
.history-entry small { color: var(--warning); }
.empty-state { margin-top: 20px; padding: 30px; border: 1px dashed var(--border); border-radius: 14px; color: var(--muted); text-align: center; }
.public-ticket-card { border-left: 6px solid var(--warning); }
.public-ticket-card.status-in_progress { border-left-color: var(--blue); }
.public-ticket-card.status-ready { border-left-color: #b38cff; }
.public-ticket-card.status-handed_over,.public-ticket-card.status-closed { border-left-color: var(--accent); }
.public-ticket-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.timeline-section { margin-top: 25px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: 12px; padding-bottom: 18px; }
.timeline li:not(:last-child)::before { content: ''; position: absolute; left: 8px; top: 17px; bottom: -1px; width: 2px; background: var(--border); }
.timeline-point { position: relative; z-index: 1; width: 18px; height: 18px; margin-top: 3px; border: 4px solid var(--surface); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--border); }
.timeline-content { padding: 13px 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); }
.timeline-heading time { color: var(--muted); font-size: .85rem; }
.timeline-content p { margin: 8px 0 0; }
.page-actions { display: flex; align-items: center; gap: 18px; margin-top: 20px; }
.text-link { color: var(--muted); }
code { color: #cdebd5; overflow-wrap: anywhere; }
@media (max-width:1100px) {
    .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .ticket-meta { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width:720px) {
    .site-shell,.admin-shell { width: min(100% - 18px,100%); padding-top: 10px; }
    .hero,.info-card,.form-card,.lookup-card,.privacy-card,.ticket-section,.admin-header,.public-ticket-card { padding: 20px; border-radius: 16px; }
    .section-heading,.admin-header,.ticket-toolbar,.ticket-summary,.admin-actions,.ticket-view-header,.timeline-heading { align-items: flex-start; flex-direction: column; }
    .two-columns,.lookup-form,.public-ticket-meta { grid-template-columns: 1fr; }
    .lookup-form label,.lookup-form input,.lookup-form button { grid-row: auto; }
    .stats-grid,.ticket-meta { grid-template-columns: 1fr; }
    .stat-card { min-height: 0; }
    .page-actions { align-items: stretch; flex-direction: column; }
}
.subject-input {
    max-width: 420px;
}