/* CommunityCraft shared theme. Load after osTicket and widget styles.
 * Font and logo assets originate from the CommunityCraft texture selector.
 * Scope rules to branded pages; preserve explicit formatting in received email HTML.
 */
html:has(> body.cc-theme) { background: #100b06; color-scheme: dark; }
.cc-theme {
    color-scheme: dark;
    --cc-bg: #100b06;
    --cc-panel: #1e180f;
    --cc-raised: #282117;
    --cc-edge: #4b3c2a;
    --cc-text: #c5c0b9;
    --cc-white: #f6f3ec;
    --cc-accent: #ffa52f;
    background: radial-gradient(ellipse at 80% 0, #6e3b1026, transparent 50%), var(--cc-bg);
    color: var(--cc-text);
    font: 14px/1.65 Montserrat, Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
}
.cc-theme *, .cc-theme *::before, .cc-theme *::after { box-sizing: border-box; }
.cc-theme h1, .cc-theme h2, .cc-theme h3, .cc-theme h4 {
    font-family: Poppins, Arial, sans-serif;
    color: var(--cc-white);
    font-weight: 600;
    line-height: 1.3;
    float: none;
}
.cc-theme h1 { font-size: clamp(28px, 4vw, 46px); letter-spacing: -1px; }
.cc-theme h2 { font-size: 23px; }
.cc-theme a { color: var(--cc-accent); }
.cc-theme a:hover { color: #ffd18f; }
.cc-theme :is(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--cc-accent);
    outline-offset: 3px;
}
.cc-theme #container {
    width: calc(100% - 64px);
    min-width: 0;
    max-width: 1320px;
    margin: 0 auto;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}
.cc-theme #header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    height: auto;
    min-height: 104px;
    padding: 18px 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--cc-edge);
}
.cc-theme #header #logo {
    display: flex;
    align-items: center;
    gap: 14px;
    width: auto;
    height: auto;
    float: none;
    text-decoration: none;
    order: -1;
}
.cc-theme #logo img { width: 68px; height: 64px; max-height: 64px; object-fit: contain; }
.cc-theme .cc-brand { font: 700 16px/1.4 Poppins, Arial, sans-serif; color: var(--cc-accent); }
.cc-theme .cc-brand small { display: block; font: 500 10px/1.8 Montserrat, Arial, sans-serif; color: var(--cc-text); letter-spacing: 2px; }
.cc-theme #header p, .cc-theme #header .pull-right { width: auto; float: none; padding: 0; margin: 0; color: var(--cc-text); background: transparent; border: 0; }
.cc-theme #header #info { max-width: 100%; font-size: 12px; }
.cc-theme #header .valign-helper { display: none; }
.cc-theme #nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start !important; /* Legacy client theme centers #container #nav. */
    height: auto;
    min-height: 58px;
    padding: 12px 0;
    margin: 0;
    background: none;
    border: 0;
    box-shadow: none;
    list-style: none;
}
.cc-theme #nav li { float: none; margin: 0; padding: 0; list-style: none; }
.cc-theme #container #nav li a {
    display: flex;
    align-items: center;
    gap: 8px;
    float: none;
    height: auto;
    min-width: 0;
    min-height: 42px;
    padding: 10px 16px;
    margin: 0;
    line-height: 1.4;
    border: 0;
    border-radius: 7px;
    background: transparent !important;
    color: var(--cc-text) !important;
    font: 500 12px/1.4 Poppins, Arial, sans-serif;
    text-decoration: none;
}
.cc-theme #container #nav li :is(a.active, a:hover), .cc-theme #container #nav li.active > a { background: var(--cc-raised) !important; color: var(--cc-accent) !important; }
.cc-theme #content { padding: 26px 0 48px; margin: 0; min-height: 55vh; width: auto; background: transparent; border: 0; overflow-wrap: anywhere; display: flow-root; }
.cc-theme #content > h1 { margin: 12px 0; }
.cc-theme #content > p { margin: 0 0 28px; color: var(--cc-text); }
.cc-theme #footer { clear: both; border: 0; border-top: 1px solid var(--cc-edge); color: var(--cc-text); padding: 22px 0; margin: 0; background: none; font-size: 11px; }
.cc-theme :is(.button, button[type="submit"], input[type="submit"], input[type="button"], input[type="reset"], .action-button) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border: 1px solid var(--cc-edge);
    border-radius: 7px;
    background: var(--cc-raised);
    color: var(--cc-white);
    font: 600 12px/1.5 Poppins, Arial, sans-serif;
    text-decoration: none;
    text-shadow: none;
    box-shadow: none;
    cursor: pointer;
}
.cc-theme :is(input[type="submit"], button[type="submit"], .cc-primary, .blue.button) { background: var(--cc-accent); border-color: var(--cc-accent); color: #241607; }
.cc-theme :is(.button, input[type="submit"], input[type="button"], input[type="reset"]):hover { filter: brightness(1.12); }
.cc-theme button.link.button:hover { padding: 10px 18px; font-size: 12px; line-height: 1.5; border: 1px solid var(--cc-edge); }
.cc-theme :disabled { opacity: .5; cursor: not-allowed; }
.cc-theme :is(input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="tel"], input[type="number"], input[type="url"], select, textarea) {
    background: var(--cc-bg);
    color: var(--cc-white);
    border: 1px solid var(--cc-edge);
    border-radius: 7px;
    padding: 11px 13px;
    max-width: 100%;
    font: inherit;
    min-height: 44px;
}
.cc-theme input::placeholder, .cc-theme textarea::placeholder { color: #a99b88; opacity: 1; }
.cc-theme input[type="file"] { color: var(--cc-text); font: inherit; max-width: 100%; }
.cc-theme input[type="file"]::file-selector-button { padding: 8px 12px; background: var(--cc-raised); color: var(--cc-white); border: 1px solid var(--cc-edge); border-radius: 5px; margin-right: 10px; }
.cc-theme label { color: var(--cc-white); }
.cc-theme :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--cc-accent); }
.cc-theme hr { border: 0; border-top: 1px solid var(--cc-edge); }
.cc-theme :is(.dialog, #loading, .action-dropdown, .select2-dropdown, .ui-datepicker) { background: var(--cc-panel); color: var(--cc-text); border: 1px solid var(--cc-edge); border-radius: 10px; }
.cc-theme #loading { height: auto; max-width: calc(100vw - 32px); padding: 16px; overflow: visible; text-align: center; }
.cc-theme #loading :is(h1, h4), .cc-theme #popup-loading h1 { margin: 0; font-size: 16px; line-height: 1.5; letter-spacing: 0; font-weight: 600; }
.cc-theme #loading :is(h1, h4) { display: inline; vertical-align: middle; }
.cc-theme :is(#loading, #popup-loading) .icon-spinner { float: none; margin-right: 8px; font-size: 20px; vertical-align: middle; }
.cc-theme .action-dropdown a { color: var(--cc-white); }
.cc-theme .select2-container--default .select2-selection--single,
.cc-theme .select2-container--default .select2-selection--multiple { background: var(--cc-bg); border-color: var(--cc-edge); color: var(--cc-white); min-height: 42px; }
.cc-theme .select2-container--default .select2-selection__rendered { color: var(--cc-white); }
.cc-theme .select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--cc-accent); color: #241607; }
.cc-theme .select2-container--default .select2-results__option[aria-selected=true] { background: var(--cc-raised); }
.cc-theme .faded, .cc-theme .cc-muted { color: #a99b88; }
.cc-theme #content :is(#msg_error, .error-banner, .error_bar) { color: #ffd1ca; background: #421c17; border: 1px solid #b85849; height: auto; }
.cc-theme #content :is(#msg_notice, .notice-banner, .success-banner, .notice_bar) { color: #d3efd8; background: #183221; border: 1px solid #4c8c5d; height: auto; }
.cc-theme #content :is(#msg_warning, .warning-banner, .warning_bar) { color: #ffe1af; background: #382813; border: 1px solid #a97830; height: auto; }
.cc-theme .error { color: #ffaaa0; }
.cc-theme .cc-eyebrow { font: 600 10px/1.6 Poppins, Arial, sans-serif; color: var(--cc-accent); letter-spacing: 1.8px; text-transform: uppercase; }
.cc-theme .cc-hero { padding: 38px 0 30px; max-width: 760px; }
.cc-theme .cc-hero h1 { margin: 15px 0; font-weight: 700; }
.cc-theme .cc-hero p { max-width: 580px; }
.cc-theme .cc-home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.cc-theme #landing_page .main-content { width: auto; float: none; margin: 0; display: flex; flex-direction: column; min-width: 0; }
.cc-theme .cc-home-grid > .main-content { grid-column: 1; grid-row: 1; }
.cc-theme .cc-home-grid > .sidebar { grid-column: 2; grid-row: 1; }
.cc-theme #landing_page .sidebar { width: auto; float: none; margin: 0; padding: 24px; background: var(--cc-panel); border: 1px solid var(--cc-edge); border-radius: 12px; }
.cc-theme #landing_page .sidebar .content { background: none; margin: 24px 0 0; border: 0; }
.cc-theme #landing_page .sidebar .header { background: none; color: var(--cc-white); border: 0; padding: 0; }
.cc-theme #landing_page .sidebar section { margin-bottom: 20px; }
.cc-theme #landing_page .search-form { padding: 0; margin: 0 0 24px; float: none; width: 100%; }
.cc-theme #landing_page .search-form form { display: flex; gap: 10px; }
.cc-theme #landing_page .search-form input { flex: 1; width: auto; min-width: 0; }
.cc-theme #landing_page .featured-category { width: auto; float: none; display: block; margin: 20px 0; padding: 22px; background: var(--cc-panel); border: 1px solid var(--cc-edge); border-radius: 10px; }
.cc-theme #landing_page .thread-body { background: var(--cc-panel); color: var(--cc-text); padding: 28px; border: 1px solid var(--cc-edge); border-radius: 12px; }
.cc-theme #landing_page .thread-body h1 { font-size: 26px; }
.cc-theme #ticketForm { background: var(--cc-panel) !important; color: var(--cc-text) !important; border: 1px solid var(--cc-edge); border-radius: 12px; padding: 28px; margin: 0; max-width: 900px; box-shadow: none; }
.cc-theme #ticketForm :is(label, td, th) { color: var(--cc-white) !important; }
.cc-theme #ticketForm > table { width: 100%; table-layout: fixed; }
.cc-theme #ticketForm td { padding: 7px 0; }
.cc-theme #ticketForm :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="reset"]):not([type="button"]), select, textarea) { width: 100%; max-width: 100%; }
.cc-theme #ticketForm :is(input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], input[type="search"], input[type="url"], select, textarea) {
    background: var(--cc-bg) !important;
    color: var(--cc-white) !important;
    border: 1px solid var(--cc-edge) !important;
}
.cc-theme #ticketForm .form-header { margin: 12px 0; }
.cc-theme #ticketForm .form-header h3 { font-size: 18px; }
.cc-theme #ticketForm label { margin-bottom: 8px; }
.cc-theme #ticketForm .buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; }
/* Conversation and composer share a calm dark reading surface. Screen only;
 * print/PDF keep their own styles.
 */
.cc-theme .thread-body:not(#landing_page .thread-body), .cc-theme .redactor-editor, .cc-theme .redactor-in {
    color-scheme: dark;
    background: var(--cc-bg);
    color: var(--cc-text);
    font: 14px/1.65 Montserrat, Arial, sans-serif;
    border-radius: 0 0 8px 8px;
}
.cc-theme .thread-body :is(p, div, ul, ol, dl), .cc-theme .thread-body > div > pre:first-child { font-family: inherit; font-size: inherit; line-height: inherit; }
.cc-theme .thread-body a { color: var(--cc-accent); }
/* Email clients commonly hardcode black text and white table backgrounds.
 * Theme only the rendered message; retain stored HTML and print formatting.
 */
@media screen {
    .cc-theme .thread-entry .thread-body > div:first-child,
    .cc-theme .thread-entry .thread-body > div:first-child * {
        color: inherit !important;
        background-color: transparent !important;
    }
    .cc-theme .thread-entry .thread-body > div:first-child a {
        color: var(--cc-accent) !important;
    }
}
.cc-theme .redactor-box { background: var(--cc-bg); border: 1px solid var(--cc-edge); border-radius: 8px; overflow: hidden; }
.cc-theme .redactor-statusbar { background: var(--cc-raised); color: var(--cc-text); border-top: 1px solid var(--cc-edge); font-family: inherit; }
.cc-theme .redactor-statusbar li { color: var(--cc-text); border-right-color: var(--cc-edge); }
.cc-theme .redactor-statusbar li:last-child { border-right-color: transparent; }
.cc-theme .redactor-statusbar a { color: var(--cc-accent); }
.cc-theme .redactor-toolbar-wrapper, .cc-theme .redactor-box.redactor-styles-on .redactor-toolbar { background: var(--cc-raised); border-color: var(--cc-edge); }
.cc-theme .redactor-toolbar a { color: var(--cc-white); background: transparent; }
.cc-theme .redactor-toolbar a:hover { background: var(--cc-panel); color: var(--cc-accent); }
.cc-theme .redactor-placeholder::before { color: #a99b88; }
.cc-theme .thread-body .attachments, .cc-theme .filedrop { background: var(--cc-panel); color: var(--cc-text); border-color: var(--cc-edge); }
.cc-theme .redactor-dropdown { color-scheme: light; }
.cc-theme .redactor-modal { color-scheme: dark; background: var(--cc-panel); color: var(--cc-text); border: 1px solid var(--cc-edge); max-width: calc(100vw - 32px); }
.cc-theme .redactor-modal :is(.redactor-modal-header, .redactor-modal-body, .redactor-modal-footer) { background: var(--cc-panel); color: var(--cc-white); border-color: var(--cc-edge); }
.cc-theme .redactor-modal :is(label, .desc, .redactor-close, .upload-redactor-placeholder) { color: var(--cc-text); }
.cc-theme .redactor-modal .redactor-close { opacity: 1; }
.cc-theme .redactor-modal :is(input:not([type="checkbox"]), textarea, select, .upload-redactor-box) { background: var(--cc-bg); color: var(--cc-white); border-color: var(--cc-edge); }
.cc-theme .redactor-modal button { background: var(--cc-raised); color: var(--cc-accent); border-color: var(--cc-edge); }
.cc-theme .redactor-modal button:hover, .cc-theme .redactor-modal-tabs a:is(:hover, .active) { color: var(--cc-accent); border-color: var(--cc-accent); }
.cc-theme .redactor-modal-tabs { border-color: var(--cc-edge); }
.cc-theme .redactor-modal-tabs a { color: var(--cc-text); }
/* Staff retains PJAX, the existing ticket actions and navigation boundaries. */
.cc-staff #container { max-width: 1600px; }
.cc-staff #content { padding-top: 22px; }
.cc-staff #sub_nav { margin: 0; padding: 10px 0; background: none; border-color: var(--cc-edge); height: auto; }
.cc-staff #sub_nav a { color: var(--cc-text); }
.cc-staff .cc-ticket-detail { background: var(--cc-panel); border: 1px solid var(--cc-edge); border-radius: 12px; padding: 24px; }
.cc-staff .sticky.bar, .cc-staff .sticky.bar .content { background: var(--cc-panel); border-color: var(--cc-edge); }
.cc-staff .sticky.bar .content { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cc-staff .sticky.bar h2 { margin-right: auto; }
.cc-staff .sticky.bar .action-button { padding: 9px 12px; min-height: 38px; float: none; }
.cc-staff .tixTitle { border-color: var(--cc-edge); margin: 20px 0; padding-bottom: 16px; }
.cc-staff .ticket_info { width: 100%; color: var(--cc-text); border-color: var(--cc-edge); background: var(--cc-raised); border-radius: 8px; margin: 16px 0; }
.cc-staff .ticket_info td { padding: 8px 12px; vertical-align: top; }
.cc-staff .ticket_info th { color: var(--cc-white); width: 130px; }
.cc-staff .tabs { border-color: var(--cc-edge); background: transparent; }
.cc-staff ul.tabs:not(.vertical) { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; height: auto; box-shadow: none; }
.cc-staff ul.tabs li, .cc-staff ul.tabs.clean li.active { height: auto; bottom: 0; min-width: 0; background: transparent; border-color: var(--cc-edge); box-shadow: none; }
.cc-staff .tabs li a { background: transparent; color: var(--cc-text); border-color: var(--cc-edge); padding: 12px 18px; }
.cc-staff .tabs li.active a { background: var(--cc-raised); color: var(--cc-accent); border-color: var(--cc-edge); }
.cc-theme .thread-entry { border-color: var(--cc-edge); border-radius: 8px; margin-bottom: 20px; }
.cc-theme .thread-entry::before, .cc-theme .thread-entry::after,
.cc-theme .thread-entry .header::before, .cc-theme .thread-entry .header::after { content: none; display: none; }
.cc-theme .thread-entry .thread-body { border: 0; box-shadow: none; }
.cc-theme .thread-entry .header { background: var(--cc-raised); color: var(--cc-white); border: 0; padding: 12px 16px; }
.cc-theme .thread-entry.note .header { background: #3b2c17; }
.cc-staff #response { background: transparent; border-color: var(--cc-edge); }
.cc-staff #response textarea { color: var(--cc-text); }
.cc-staff table.form_table { width: 100%; }
.cc-staff table.form_table td { background: transparent; color: var(--cc-text); }
.cc-staff table.form_table .section-break { background: var(--cc-raised); }
.cc-staff .cc-ticket-detail img { max-width: 100%; }
@media (max-width: 900px) {
    .cc-theme #container { width: calc(100% - 32px); }
    .cc-theme .cc-home-grid { grid-template-columns: 1fr; }
    .cc-theme #landing_page .sidebar { order: -1; }
    .cc-theme .cc-home-grid > .main-content, .cc-theme .cc-home-grid > .sidebar { grid-column: auto; grid-row: auto; }
    .cc-staff .ticket_info > tbody > tr { display: grid; grid-template-columns: minmax(0, 1fr); }
    .cc-staff .ticket_info > tbody > tr > td { width: 100%; }
    .cc-staff .ticket_info table { width: 100%; }
}
@media (max-width: 600px) {
    .cc-theme #header { gap: 14px; padding: 16px 0; }
    .cc-theme #header .pull-right { text-align: left; font-size: 12px; }
    .cc-theme #logo img { width: 52px; height: 50px; }
    .cc-theme .cc-brand { font-size: 14px; }
    .cc-theme #container #nav li a { padding: 10px 12px; }
    .cc-theme #content { padding-top: 12px; }
    .cc-theme .cc-hero { padding-top: 24px; }
    .cc-theme #ticketForm, .cc-staff .cc-ticket-detail { padding: 18px; }
    .cc-theme #ticketForm .captcha-entry { width: 100%; }
    .cc-staff .ticket_info td { padding: 6px 0; }
}
@media (prefers-reduced-motion: reduce) {
    .cc-theme *, .cc-theme *::before, .cc-theme *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
