:root {
    color-scheme: light;
    --background: #f4f5ef;
    --paper: #fff;
    --ink: #20291e;
    --muted: #555f51;
    --line: #dce1d6;
    --light: #edf2e9;
    --green: #294634;
    --green-hover: #1c3628;
    --ring: #3b7853;
    font-family: "Segoe UI", system-ui, sans-serif;
    line-height: 1.55;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); }
button, input, select, textarea { font: inherit; }
a { color: var(--green); }
button, summary, select { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
[id] { scroll-margin-top: 16px; }
h1, h2, h3, p { margin: 0; }
h1 { font: 500 clamp(2rem, 4.6vw, 3.3rem)/1.07 Georgia, serif; letter-spacing: -.042em; overflow-wrap: anywhere; }
h2 { font: 500 1.65rem/1.15 Georgia, serif; letter-spacing: -.026em; }
h3 { font-size: 1rem; }
small { font-size: .82rem; }
.muted, small { color: var(--muted); }
.wrap { width: min(1280px, calc(100% - 72px)); margin-inline: auto; }
.topbar { background: var(--green-hover); color: #fafff5; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 15px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font: 600 1.25rem Georgia, serif; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; background: #dce7c9; color: #234330; width: 33px; height: 33px; border-radius: 9px; font-size: 1.22rem; font-style: italic; }
.brand small { color: #c6d5c6; font: 500 .79rem "Segoe UI", system-ui, sans-serif; margin-left: 7px; }
.account { display: flex; gap: 15px; align-items: center; white-space: nowrap; font-size: .84rem; }
.account > span { color: #dce7c9; }
.text-button { padding: 0; background: transparent; border: 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.main { padding-block: 54px 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 31px; }
.panel { border: 1px solid var(--line); background: var(--paper); border-radius: 14px; box-shadow: 0 2px 8px #20291e07; min-width: 0; }
.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) 318px; align-items: start; gap: 25px; }

.button { text-decoration: none; display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 42px; border-radius: 8px; border: 1px solid transparent; padding: 8px 15px; font-size: .91rem; font-weight: 650; white-space: nowrap; }
.primary { background: var(--green); color: white; }
.primary:hover { background: var(--green-hover); }
.secondary { border-color: var(--line); background: white; color: var(--green); }
.secondary:hover { background: var(--light); }
.outline-danger { color: #8f2929; background: white; border-color: #e5cccc; }
.outline-danger:hover { background: #fbefee; }
.danger { background: #8f2929; color: white; }
.danger:hover { background: #741d1d; }
.plus { font-size: 1.25rem; line-height: 1; }
.small-button { min-height: 33px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--green); font-size: .82rem; font-weight: 650; }
.small-button:hover { background: var(--light); }

input:not([type="checkbox"], [type="file"], [type="hidden"]), textarea, select {
    width: 100%; min-width: 0; padding: 9px 11px; color: var(--ink); background: #fff;
    border: 1px solid #cdd6c8; border-radius: 8px;
}
input[type="checkbox"] { accent-color: var(--green); width: 1rem; height: 1rem; margin: 0; }
input[type="file"] { width: 100%; min-width: 0; font-size: .86rem; }
input::file-selector-button { padding: 6px 10px; margin-right: 8px; border-radius: 6px; color: var(--green); background: var(--light); border: 1px solid var(--line); cursor: pointer; }
.ticket-filters { display: grid; gap: 14px; padding: 20px 22px; }
.search-row { display: flex; gap: 8px; }
.search { flex: 1; position: relative; min-width: 0; }
.search::before { content: ""; position: absolute; top: 15px; left: 14px; width: 10px; height: 10px; border: 1.5px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search::after { content: ""; position: absolute; top: 24px; left: 23px; height: 1.5px; width: 5px; background: var(--muted); transform: rotate(45deg); pointer-events: none; }
.search input[type="search"] { padding-left: 35px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter { position: relative; }
.filter summary { list-style: none; color: var(--green); background: #fafbf8; border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; font-size: .84rem; white-space: nowrap; }
.filter summary::-webkit-details-marker { display: none; }
.filter summary::after { content: "⌄"; margin-left: 7px; color: var(--muted); }
.filter[open] summary { border-color: #819782; background: var(--light); }
.filter-count { background: #e0e9dc; padding: 1px 5px; border-radius: 7px; }
.filter-options { position: absolute; z-index: 2; top: calc(100% + 6px); left: 0; width: max-content; max-width: 17rem; max-height: 17rem; overflow: auto; padding: 5px; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 5px 17px #20291e1d; }
.filter-options label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; font-size: .85rem; cursor: pointer; overflow-wrap: anywhere; }
.filter-options input { flex-shrink: 0; }
.filter-options label:hover { background: var(--light); }
.sort { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: .84rem; white-space: nowrap; }
.sort select { width: auto; padding: 6px; }
.list-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 22px; border-block: 1px solid var(--line); background: #f8faf6; color: var(--muted); font-weight: 600; font-size: .83rem; }
.list-header a, .pages { font-weight: 400; }
.empty { padding: 53px 22px; text-align: center; color: var(--muted); }
.ticket-list { list-style: none; padding: 0; margin: 0; }
.ticket-list li + li { border-top: 1px solid var(--line); }
.ticket-list li:last-child a { border-radius: 0 0 14px 14px; }
.ticket-row { display: flex; align-items: center; gap: 10px; padding: 16px 20px 16px 22px; color: var(--ink); text-decoration: none; }
.ticket-row:hover { background: #f8faf6; }
.ticket-label { flex: 1; min-width: 0; }
.ticket-label strong, .ticket-label small { display: block; overflow-wrap: anywhere; }
.ticket-label strong { line-height: 1.35; margin-bottom: 3px; }
.ticket-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ticket-row .ticket-badges { justify-content: end; max-width: 62%; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; white-space: nowrap; border-radius: 6px; font-size: .75rem; font-weight: 650; background: #eef0eb; color: #465344; }
.category-tag { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.badge[class*="status-"]::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-open { background: #e5edfd; color: #234d8e; }
.status-done { background: #e5f1e6; color: #29563b; }
.status-cancelled { background: #eef0eb; color: #4d5149; }
.priority-4 { background: #fae7e5; color: #872c2b; }
.priority-3 { background: #f8ecd9; color: #79451d; }
.priority-2 { background: #f2f1e4; color: #5b5437; }
.priority-1 { background: #edf3ea; color: #465c3f; }
.row-arrow { color: var(--muted); font-size: 1.4rem; padding-left: 2px; }
.pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; padding: 14px; border-top: 1px solid var(--line); font-size: .83rem; }

.sites { padding: 18px 19px 4px; }
.sites h2 { margin-bottom: 15px; }
.site { padding: 13px 0; border-top: 1px solid var(--line); }
.site h3 a { display: flex; justify-content: space-between; color: var(--ink); text-underline-offset: 3px; }
.site h3 a span { color: var(--green); }
.site-url { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; margin: 2px 0 9px; }
.site-login { margin: 0 0 7px; font-size: .83rem; }
.site-login div { display: grid; grid-template-columns: 93px minmax(0, 1fr); align-items: center; min-height: 24px; }
.site-login dt { color: var(--muted); }
.site-login dd { margin: 0; }
.site-login code { font-size: .89rem; }
.site-login input[data-password] { border: 0; padding: 0; border-radius: 0; font: .87rem ui-monospace, monospace; }
.credential-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.credential-actions small { font-size: .75rem; }

.login-page { background: #edf1e7; }
.login-panel { width: min(100%, 435px); padding: 32px; margin: min(6vh, 50px) auto 0; }
.login-panel h1 { font-size: 2.45rem; }
.login-panel > p { margin: 8px 0 22px; }
.login-panel .stack > .button { width: 100%; }
.narrow { max-width: 880px; margin: auto; }
.back { display: inline-block; margin-bottom: 16px; font-weight: 650; font-size: .9rem; text-underline-offset: 3px; }
.content-panel { padding: clamp(18px, 4vw, 33px); }
.content-panel h1 { font-size: clamp(2rem, 4.2vw, 2.9rem); margin-bottom: 18px; }
.content-panel > p { margin: 0 0 12px; }
.stack { display: grid; gap: 17px; justify-items: start; }
.field { display: grid; gap: 5px; width: 100%; }
.field label { font-size: .91rem; font-weight: 650; }
.priority-field { max-width: 235px; }
.category-picker { width: 100%; min-width: 0; margin: 0; border: 0; padding: 0; }
.category-picker legend { margin: 0 0 5px; padding: 0; font-size: .91rem; font-weight: 650; }
.category-picker > div { display: flex; flex-wrap: wrap; gap: 7px; }
.category-choice { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--green); font-size: .86rem; cursor: pointer; overflow-wrap: anywhere; }
.category-choice input { flex-shrink: 0; }
.category-choice:hover, .category-choice:has(input:checked) { background: var(--light); border-color: #9cb298; }
.category-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-bottom: 18px; }
.category-form .field { flex: 1 1 240px; }
.category-list { list-style: none; padding: 0; margin: 0; }
.category-list li { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); padding-block: 11px; }
.category-list strong { overflow-wrap: anywhere; }
.category-list small { display: block; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.upload { border: 1px dashed #b6c5af; border-radius: 8px; padding: 11px 13px; background: #f8faf6; }
.editor { width: 100%; border: 1px solid #cdd6c8; border-radius: 8px; }
.editor:focus-within { border-color: var(--ring); }
.editor-tools { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; background: #f7f9f5; padding: 5px 8px; border-radius: 8px 8px 0 0; border-bottom: 1px solid var(--line); }
.editor-tools button { font-size: .83rem; background: none; border: 0; border-radius: 4px; min-width: 29px; min-height: 32px; }
.editor-tools button:hover { background: var(--light); }
.editor-tools span { margin-left: auto; color: var(--muted); font-size: .77rem; padding-inline: 4px; }
.editor textarea { display: block; border: 0; border-radius: 0 0 8px 8px; resize: vertical; min-height: 105px; }
.message { margin: 0 0 14px; padding: 10px 14px; border: 1px solid; border-radius: 8px; font-size: .91rem; }
.error { color: #812d2d; border-color: #e9c7c2; background: #fff3f0; }
.success { color: #284f32; border-color: #ccddc9; background: #edf5eb; }
.detail-heading { border-bottom: 1px solid var(--line); padding-bottom: 17px; margin-bottom: 20px; }
.detail-heading h1 { margin-bottom: 13px; }
.detail-meta { margin-top: 10px; font-size: .84rem; }
.detail-section, .detail-actions { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 19px; }
.detail-section h2 { margin-bottom: 12px; }
.detail-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.status-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .9rem; }
.status-form select { width: auto; }
.add-images summary { margin-top: 12px; color: var(--green); font-size: .9rem; font-weight: 650; }
.add-images form { margin-top: 8px; }
.markdown { overflow: auto; overflow-wrap: anywhere; }
.markdown > * + * { margin-top: .7rem; }
.markdown ol, .markdown ul { margin-bottom: 0; padding-left: 1.45rem; }
.markdown blockquote { padding: 3px 12px; margin-left: 0; border-left: 3px solid #a7bba2; color: var(--muted); }
.markdown pre { overflow: auto; padding: 10px; background: var(--light); border-radius: 7px; }
.markdown table { border-collapse: collapse; font-size: .91rem; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 5px 9px; }
.markdown th { background: #f3f6f0; }
.markdown img { max-width: 100%; }
.comments { margin-top: 18px; }
.comments h2 span { font: 600 .85rem "Segoe UI", system-ui, sans-serif; color: var(--muted); display: inline-block; vertical-align: middle; padding: 3px 8px; border-radius: 6px; background: var(--light); }
.comment { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.comment-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.comment-meta time { color: var(--muted); font-size: .79rem; }
.comment-form { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 15px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 220px)); gap: 8px; margin: 10px 0; }
.gallery-item { display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; text-decoration: none; }
.gallery-item img { width: 100%; height: 112px; object-fit: contain; background: var(--background); }
.gallery-item span { padding: 2px 7px 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .81rem; }
.lightbox { max-width: min(1100px, 94vw); max-height: 94vh; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.lightbox::backdrop { background: #18201bd4; }
.lightbox form { text-align: right; margin-bottom: 8px; }
.lightbox img { display: block; max-width: 100%; max-height: 78vh; margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 1050px) {
    .dashboard { grid-template-columns: minmax(0, 1fr) 278px; gap: 14px; }
    .ticket-row { display: grid; grid-template-columns: 1fr auto; }
    .ticket-row .ticket-badges { grid-row: 2; justify-content: start; max-width: 100%; }
    .row-arrow { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 790px) {
    .wrap { width: calc(100% - 34px); }
    .main { padding-block: 31px 38px; }
    .dashboard { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .page-heading { margin-bottom: 19px; }
}
@media (max-width: 520px) {
    .topbar-inner { min-height: 56px; }
    .brand { gap: 7px; font-size: 1.06rem; }
    .brand small { display: none; }
    .brand-mark { width: 28px; height: 28px; }
    .account { gap: 8px; font-size: .76rem; }
    .page-heading { align-items: flex-start; flex-direction: column; gap: 13px; }
    .ticket-filters, .ticket-row, .list-header { padding-inline: 12px; }
    .filter-options { max-width: min(16rem, calc(100vw - 72px)); }
    .filter:nth-child(2) .filter-options { left: -60px; }
    .filter:nth-child(3) .filter-options { left: auto; right: 0; }
    .sort { margin-left: 0; }
    .editor-tools span { margin-left: 0; }
    .login-panel { padding: 24px; }
}
