:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #101116;
    color: #f2f3f5;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: radial-gradient(ellipse at 15% -20%, #34327a 0, transparent 48%), #101116;
}

button, select { font: inherit; }

.shell { width: min(1200px, calc(100% - 36px)); margin: 0 auto; padding: 36px 0 54px; }
.topbar, .account, .intro, .section-heading { display: flex; align-items: center; }
.topbar, .intro { justify-content: space-between; gap: 20px; }
.topbar { margin-bottom: 34px; }
.eyebrow { margin: 0 0 7px; color: #a8a5ff; font-size: 11px; font-weight: 750; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.04em; }
h2 { margin-bottom: 7px; font-size: 23px; letter-spacing: -.03em; }
h3 { margin-bottom: 5px; font-size: 17px; }
p { color: #a9abb7; line-height: 1.55; }
.account { gap: 14px; color: #d7d8df; font-size: 14px; }
.card { padding: 23px; border: 1px solid #2b2d39; border-radius: 15px; background: rgba(25, 26, 34, .92); box-shadow: 0 16px 40px #0002; }
.login-card { max-width: 570px; margin: 10vh auto; padding: 36px; }
.login-card > p { max-width: 440px; margin-bottom: 23px; }
.icon { display: grid; width: 45px; height: 45px; margin-bottom: 24px; place-items: center; border-radius: 13px; background: #7772f4; font-size: 23px; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 0 15px; border: 0; border-radius: 9px; color: white; font-weight: 700; text-decoration: none; cursor: pointer; transition: filter .15s, transform .15s; }
.button:hover { filter: brightness(1.1); transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.button-primary { background: #6863e8; }
.button-secondary { margin-top: 17px; border: 1px solid #393b4a; background: #252631; }
.button-quiet { min-height: 34px; background: transparent; color: #c5c6d0; }
.intro { margin: 4px 0 18px; }
.intro p { margin-bottom: 0; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.card-wide { grid-column: 1 / -1; }
.ticket-card { padding: 25px; }
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 24px; }
.ticket-fields { min-width: 0; }
.ticket-message-fields { padding: 17px; border: 1px solid #30323f; border-radius: 12px; background: #17181f; }
.field-pair, .field-triple { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-triple { grid-template-columns: 1fr 90px 1fr; }
.category-editor-heading, .category-editor-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.category-editor-heading { margin-top: 17px; }
.category-editor-heading label { margin: 0 0 3px; }
.category-editor-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; }
.category-count { padding: 6px 9px; border: 1px solid #393b49; border-radius: 8px; background: #1b1c24; color: #c5c6d0; font-size: 12px; white-space: nowrap; }
.category-capacity-note { margin: 8px 0 10px; color: #a9abb7; font-size: 12px; }
.category-editor-actions .button { min-height: 38px; }
.category-editor-actions .button:disabled { cursor: not-allowed; opacity: .5; }
.ticket-category-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ticket-category-editor { min-width: 0; padding: 14px; border: 1px solid #383a48; border-radius: 11px; background: #17181f; }
.category-editor-title { margin-bottom: 10px; color: #f2f3f5; font-size: 13px; }
.category-editor-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remove-category { padding: 5px 7px; border: 0; border-radius: 6px; background: transparent; color: #ffabb4; font-size: 11px; cursor: pointer; }
.remove-category:hover { background: #54262d; }
.ticket-category-editor .field-triple { grid-template-columns: 1fr 1fr 75px; gap: 7px; }
.ticket-category-editor input:not([type="checkbox"]) { min-width: 0; padding: 8px; }
.ticket-category-editor textarea { margin-top: 9px; }
.ticket-category-fields { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(100px, .5fr); gap: 2px 10px; }
.ticket-category-fields label { min-width: 0; }
.ticket-category-fields label:last-child { grid-column: 1 / -1; }
.ticket-category-fields select { display: block; margin-top: 7px; }
.ticket-category-fields .role-list { margin-top: 7px; }
.compact-role-list { max-height: 90px; }
.compact-role-list .role-option { padding: 5px 7px; }
.empty-state { grid-column: 1 / -1; margin: 0; padding: 14px; border: 1px dashed #3b3d49; border-radius: 9px; font-size: 12px; }
.preview-label { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: #aeb0bd; font-size: 12px; font-weight: 650; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #69d798; box-shadow: 0 0 10px #69d79888; }
input:not([type="checkbox"]), textarea { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid #383a48; border-radius: 8px; outline: none; background: #17181f; color: #f2f3f5; font: inherit; }
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
input[type="color"] { min-height: 42px; padding: 4px; cursor: pointer; }
input:focus, textarea:focus { border-color: #7772f4; box-shadow: 0 0 0 3px #7772f422; }
.role-list { display: flex; max-height: 140px; flex-wrap: wrap; gap: 7px; overflow: auto; padding: 2px 1px; }
.role-option { display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 7px 9px; border: 1px solid #393b49; border-radius: 8px; background: #1b1c24; color: #d9dae1; font-size: 12px; cursor: pointer; }
.role-option input { accent-color: #7772f4; }
.role-swatch { width: 9px; height: 9px; border-radius: 50%; }
.toggle-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.toggle-option { display: flex; align-items: center; gap: 9px; margin: 0; padding: 10px; border: 1px solid #343641; border-radius: 8px; background: #1b1c24; color: #d9dae1; font-size: 12px; cursor: pointer; }
.toggle-option input { flex: 0 0 auto; accent-color: #7772f4; }
.action-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 17px; }
.action-row .button { margin-top: 0; }
.section-heading { align-items: flex-start; gap: 13px; margin-bottom: 20px; }
.section-heading p { margin-bottom: 0; font-size: 13px; }
.section-icon { display: grid; width: 37px; height: 37px; flex: 0 0 37px; place-items: center; border-radius: 11px; background: #2c2c43; }
label, legend { display: block; margin: 15px 0 7px; color: #d7d8df; font-size: 13px; font-weight: 650; }
select { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid #383a48; border-radius: 8px; outline: none; background: #17181f; color: #f2f3f5; }
select:focus { border-color: #7772f4; box-shadow: 0 0 0 3px #7772f422; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 14px; }
fieldset { margin: 18px 0 0; padding: 0; border: 0; }
legend { margin: 0 0 8px; }
.category-list { display: flex; flex-wrap: wrap; gap: 8px; }
.category-option { display: flex; align-items: center; gap: 7px; padding: 9px 11px; border: 1px solid #393b49; border-radius: 8px; background: #1b1c24; color: #d9dae1; font-size: 13px; cursor: pointer; }
.category-option input { accent-color: #7772f4; }
.hint, .footer-note { margin: 13px 0 0; font-size: 12px; }
code { padding: 2px 5px; border-radius: 4px; background: #101116; color: #cbc9ff; }
.notice { margin: 0 0 16px; padding: 12px 15px; border: 1px solid #3f684f; border-radius: 9px; background: #1a3023; color: #b8efc6; font-size: 14px; }
.notice.is-error, .error { border-color: #75444b; background: #351e23; color: #ffb7bf; }
.error { margin: 15px 0 0 !important; padding: 10px 12px; border: 1px solid; border-radius: 8px; font-size: 13px; }
.footer-note { margin-top: 18px; text-align: center; }
[hidden] { display: none !important; }

@media (max-width: 700px) {
    .shell { width: min(100% - 24px, 540px); padding-top: 24px; }
    .grid { grid-template-columns: 1fr; }
    .card-wide { grid-column: auto; }
    .ticket-layout { grid-template-columns: 1fr; }
    .ticket-category-list { grid-template-columns: 1fr; }
    .category-editor-heading { align-items: flex-start; flex-direction: column; }
    .category-editor-actions { width: 100%; justify-content: space-between; }
    .intro { align-items: flex-start; flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .login-card { margin: 5vh auto; padding: 25px; }
}

@media (max-width: 460px) {
    .field-pair, .field-triple { grid-template-columns: 1fr; gap: 0; }
    .ticket-category-editor .field-triple { grid-template-columns: 1fr 1fr 75px; gap: 7px; }
}
