:root {
    /* Brand burgundy from banksouthmortgage.com (#520919) */
    --hd-navy: #520919;
    --hd-navy-deep: #3a0612;
    --hd-blue: #520919;
    --hd-blue-hover: #3a0612;
    --hd-blue-soft: #f7ebee;
    --hd-blue-border: #e0b8c0;
    --hd-text: #331015;
    --hd-text-muted: #6b5560;
    --hd-border: #e8e0e2;
    --hd-border-strong: #d4c4c8;
    --hd-bg: #f7f4f5;
    --hd-surface: #ffffff;
    --hd-danger: #b42318;
    --hd-danger-soft: #fef3f2;
    --hd-success: #067647;
    --hd-success-soft: #ecfdf3;
    --hd-warning: #b54708;
    --hd-warning-soft: #fffaeb;
    --hd-radius: 10px;
    --hd-radius-sm: 8px;
    --hd-shadow: 0 1px 2px rgba(82, 9, 25, 0.08);
    --hd-font: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: var(--hd-font);
    font-size: 14px;
    line-height: 1.45;
    color: var(--hd-text);
    background: var(--hd-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--hd-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
    color: var(--hd-navy);
    font-weight: 650;
    letter-spacing: -0.01em;
    margin: 0 0 12px;
}

h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 16px; margin-top: 20px; }

.muted { color: var(--hd-text-muted); }

/* Shell */
.app-header {
    background: #fff;
    color: var(--hd-text);
    padding: 0 20px;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--hd-border);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 650;
    font-size: 15px;
    letter-spacing: 0.01em;
    color: var(--hd-navy);
    text-decoration: none;
}

.app-brand:hover { text-decoration: none; color: var(--hd-navy); }

.app-brand-logo {
    display: block;
    height: 40px;
    width: auto;
}

.app-brand-title {
    color: var(--hd-navy);
    font-size: 14px;
    font-weight: 650;
    line-height: 1.2;
    border-left: 1px solid var(--hd-border-strong);
    padding-left: 12px;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.app-nav a {
    color: var(--hd-text);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 500;
}

.app-nav a:hover {
    background: var(--hd-blue-soft);
    color: var(--hd-navy);
    text-decoration: none;
}

.app-user {
    color: var(--hd-text-muted);
    font-size: 13px;
    margin-left: 8px;
}

form.inline { display: inline; margin: 0; }

form.inline button {
    margin: 0 0 0 8px;
    background: transparent;
    border: 1px solid var(--hd-border-strong);
    color: var(--hd-navy);
    border-radius: 8px;
    padding: 6px 12px;
}

form.inline button:hover {
    background: var(--hd-blue-soft);
    color: var(--hd-navy);
}

.app-main {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 16px 40px;
}

/* Surfaces */
.card {
    background: var(--hd-surface);
    border: 1px solid var(--hd-border);
    border-radius: 12px;
    padding: 20px 22px;
    box-shadow: var(--hd-shadow);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.toolbar h1 { margin: 0; }

.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.toolbar-actions .button-link {
    margin-top: 0;
}

.home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.requester-list-intro {
    margin: 0 0 12px;
}

.requester-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}

.empty-state {
    border: 1px dashed var(--hd-border-strong);
    border-radius: var(--hd-radius);
    background: #faf7f8;
    padding: 22px 20px;
    margin: 8px 0 4px;
}

.empty-state-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    color: var(--hd-navy);
}

.empty-state .muted {
    margin: 0 0 14px;
}

.empty-state .home-actions,
.empty-state p:last-child {
    margin-bottom: 0;
}

.ticket-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ticket-table-wrap .ticket-table {
    min-width: 640px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    margin: 4px 0 14px;
    border-bottom: 1px solid var(--hd-border);
}

.tabs a {
    color: var(--hd-text-muted);
    text-decoration: none;
    padding: 10px 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-weight: 550;
}

.tabs a:hover {
    color: var(--hd-navy);
    text-decoration: none;
}

.tabs a.active {
    color: var(--hd-blue);
    border-bottom-color: var(--hd-blue);
}

.ops-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.ops-preset {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid var(--hd-border-strong);
    border-radius: var(--hd-radius-sm);
    background: #fff;
    color: var(--hd-text);
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
    line-height: 1.2;
}

.ops-preset:hover {
    background: #faf7f8;
    text-decoration: none;
    color: var(--hd-navy);
}

.ops-preset.active {
    background: var(--hd-blue-soft);
    border-color: var(--hd-blue-border);
    color: var(--hd-blue);
}

.report-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 22px;
}

.report-stat {
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-sm);
    background: #faf7f8;
    padding: 14px 16px;
}

.report-stat-label {
    display: block;
    font-size: 12px;
    font-weight: 650;
    color: var(--hd-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.report-stat-value {
    display: block;
    margin-top: 6px;
    font-size: 28px;
    font-weight: 700;
    color: var(--hd-navy);
    line-height: 1.1;
}

.report-section-title {
    margin: 22px 0 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--hd-navy);
}

.report-count {
    text-align: right;
    width: 96px;
}

@media (max-width: 720px) {
    .report-summary {
        grid-template-columns: 1fr;
    }
}

/* Filters — collapsible panel; equal columns so pairs align across rows */
.filters-panel {
    margin: 0 0 16px;
    width: 100%;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    background: #faf7f8;
}

.filters-panel .collapse-toggle {
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hd-text-muted);
}

.filters-panel .collapse-body {
    padding: 0 14px 14px;
    border-top: 1px solid var(--hd-border);
    background: #faf7f8;
}

.filters-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filters-active-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--hd-blue-soft);
    border: 1px solid var(--hd-blue-border);
    color: var(--hd-blue);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.filter-row {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 14px;
    align-items: end;
    padding: 12px 0 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.filter-row .filter-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
}

.filter-row label {
    display: block;
    margin: 0;
    color: var(--hd-text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    line-height: 1.2;
}

.filter-row select,
.filter-row .filter-search {
    width: 100%;
    max-width: none;
    height: 40px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--hd-border-strong);
    border-radius: var(--hd-radius-sm);
    background: #fff;
    font: inherit;
    color: inherit;
    line-height: 1.2;
    box-sizing: border-box;
}

.filter-row .filter-search {
    -webkit-appearance: none;
    appearance: none;
}

.filter-row .filter-field-label {
    display: block;
    height: 14.4px;
    line-height: 1.2;
}

.filter-row .filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    color: var(--hd-text);
    cursor: pointer;
    white-space: nowrap;
}

.filter-row .filter-checkbox input {
    margin: 0;
}

.filter-row .filter-field-actions .filter-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 40px;
    width: 100%;
}

.filter-row .filter-apply {
    margin: 0 0 0 auto;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--hd-blue);
    border-radius: var(--hd-radius-sm);
    background: var(--hd-blue);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex: 0 0 auto;
}

.filter-row .filter-clear {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .filter-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .filter-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

.default-list-panel {
    margin: 14px 0 0 auto;
    width: fit-content;
    max-width: 100%;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-sm);
    background: #fbfcfe;
}

.default-list-panel .collapse-toggle {
    width: auto;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hd-text-muted);
    gap: 12px;
}

.default-list-panel .collapse-body {
    padding: 10px 12px 12px;
    min-width: 200px;
}

.default-list-form {
    margin: 0;
}

.default-list-form label {
    display: block;
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--hd-text-muted);
}

.default-list-form select {
    width: 100%;
    margin: 0;
    background: #fff;
}

/* Forms */
.required-mark {
    color: #b42318;
    font-weight: 700;
}

.required-fields-note {
    margin-top: 6px;
}

.create-project-priority-row {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    max-width: 760px;
}

.create-project-priority-row .create-field {
    min-width: 0;
}

.create-project-priority-row .create-field-project {
    flex: 1 1 200px;
}

.create-project-priority-row .create-field-priority {
    flex: 0 0 140px;
}

.create-project-priority-row .create-field-issue-type {
    flex: 0 0 180px;
}

.create-project-priority-row .create-field label {
    margin-top: 14px;
}

.create-project-priority-row .create-field select {
    width: 100%;
    margin: 0;
}

@media (max-width: 640px) {
    .create-project-priority-row {
        flex-direction: column;
        align-items: stretch;
    }

    .create-project-priority-row .create-field-priority,
    .create-project-priority-row .create-field-issue-type {
        flex: 1 1 auto;
        width: 100%;
    }
}

label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hd-text-muted);
}

input[type=email],
input[type=password],
input[type=text],
select,
textarea {
    width: 100%;
    max-width: 520px;
    padding: 10px 12px;
    border: 1px solid var(--hd-border-strong);
    border-radius: var(--hd-radius-sm);
    background: #fff;
    color: var(--hd-text);
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--hd-blue);
    box-shadow: 0 0 0 3px rgba(82, 9, 25, 0.15);
}

textarea { max-width: 100%; min-height: 120px; resize: vertical; }

button,
.button-link,
.secondary-btn {
    margin-top: 16px;
    padding: 9px 16px;
    background: var(--hd-blue);
    color: #fff;
    border: 0;
    border-radius: var(--hd-radius);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
}

button:hover,
.button-link:hover {
    background: var(--hd-blue-hover);
    color: #fff;
    text-decoration: none;
}

.home-create {
    margin-left: 24px;
}

.button-link.secondary,
.secondary-btn {
    background: #fff;
    color: var(--hd-navy);
    border: 1px solid var(--hd-border-strong);
}

.button-link.secondary:hover,
.secondary-btn:hover {
    background: #f8fafc;
    color: var(--hd-navy);
}

.link-btn {
    background: none !important;
    border: 0;
    color: var(--hd-blue);
    padding: 0;
    margin: 0;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: none;
}

.link-btn:hover,
.link-btn:focus {
    text-decoration: none;
    background: none !important;
    color: #800020;
    box-shadow: none;
}

.validation-summary-errors,
.flash.error {
    color: var(--hd-danger);
    background: var(--hd-danger-soft);
    border: 1px solid #fecdca;
    border-radius: var(--hd-radius-sm);
    padding: 10px 12px;
    margin-bottom: 14px;
}

.flash.success {
    color: var(--hd-success);
    background: var(--hd-success-soft);
    border: 1px solid #abefc6;
    border-radius: var(--hd-radius-sm);
    padding: 10px 12px;
    margin-bottom: 14px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    text-transform: none;
    font-weight: 500;
    color: var(--hd-text);
    letter-spacing: 0;
    font-size: 14px;
}

.checkbox input { width: auto; }

.reply-box .private-note {
    width: 100%;
    justify-content: flex-end;
    margin-bottom: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--hd-border);
}

/* Ticket table / list */
.ticket-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.ticket-table th {
    text-align: left;
    padding: 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--hd-text-muted);
    border-bottom: 1px solid var(--hd-border);
    font-weight: 650;
}

button.sort-header {
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    background: none;
    color: inherit;
    border: 0;
    border-radius: 0;
    cursor: pointer;
    text-align: left;
    font: inherit;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.2;
}

button.sort-header:hover {
    background: none;
    color: var(--hd-navy);
    text-decoration: none;
}

button.sort-header[data-direction="asc"]::after,
button.sort-header[data-direction="desc"]::after {
    content: "";
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

button.sort-header[data-direction="asc"]::after {
    border-bottom: 5px solid currentColor;
}

button.sort-header[data-direction="desc"]::after {
    border-top: 5px solid currentColor;
}

.ticket-table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--hd-border);
    vertical-align: top;
}

.ticket-table tbody tr:nth-child(odd) {
    background: #fff;
}

.ticket-table tbody tr:nth-child(even) {
    background: #f7f4f5;
}

.ticket-table tbody tr.ticket-row {
    cursor: pointer;
}

.ticket-table tbody tr:hover {
    background: var(--hd-blue-soft);
}

.ticket-table tbody tr.unread {
    background: var(--hd-blue-soft);
}

.ticket-table tbody tr.unread:hover {
    background: #efdce1;
}

.ticket-table a {
    font-weight: 650;
    color: var(--hd-navy);
}

.ticket-table a:hover { color: var(--hd-blue); }

.admin-search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
}

.admin-search-row label {
    margin: 0;
    color: var(--hd-text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-search-row input[type=search] {
    min-width: 220px;
    height: 40px;
    margin: 0;
    padding: 0 12px;
    box-sizing: border-box;
}

.admin-search-row .filter-apply {
    margin: 0;
    height: 40px;
    align-self: center;
}

.admin-search-row .filter-clear {
    align-self: center;
}

.admin-issue-type-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 0 16px;
    max-width: 520px;
}

.admin-issue-type-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 10px;
}

.admin-issue-type-row label {
    margin: 0;
    color: var(--hd-text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-issue-type-row select,
.admin-issue-type-row input[type=text] {
    width: 100%;
    height: 40px;
    margin: 0;
    padding: 0 12px;
    box-sizing: border-box;
}

/* Project dropdown spans the same width as Name textbox + Add. */
.admin-issue-type-row select {
    grid-column: 2 / 4;
}

.admin-issue-type-row .filter-apply {
    margin: 0;
    height: 40px;
}

.admin-table th {
    padding: 10px 12px;
}

.admin-table td {
    padding: 14px 12px;
}

.admin-table select {
    margin: 0;
    max-width: 140px;
}

.admin-inline-form {
    display: inline;
    margin: 0;
}

.ticket-slug-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.ticket-slug-cell .badge {
    margin-left: 0;
}

.badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    background: #fff;
    color: var(--hd-blue);
    border: 1px solid var(--hd-blue-border);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
}

.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.02em;
    background: #eef2f6;
    color: var(--hd-navy);
    border: 1px solid var(--hd-border);
    white-space: nowrap;
}

.status-pill.todo { background: #fff1f3; color: #c01048; border-color: #fecdd3; }
.status-pill.inprogress,
.status-pill.techreview { background: #eff8ff; color: #175cd3; border-color: #b2ddff; }
.status-pill.awaiting,
.status-pill.usersignoff { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.status-pill.done { background: #ecfdf3; color: #067647; border-color: #abefc6; }
.status-pill.dismissed { background: #f2f4f7; color: #344054; border-color: #d0d5dd; }
.status-pill.sysaid-pill {
    margin-left: 8px;
    background: #f4f3ff;
    color: #5925dc;
    border-color: #d9d6fe;
}

.priority-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.02em;
    background: #eef2f6;
    color: var(--hd-navy);
    border: 1px solid var(--hd-border);
    white-space: nowrap;
}

.priority-pill.priority-low {
    background: #ecfdf3;
    color: #0d5c2e;
    border-color: #abefc6;
}

.priority-pill.priority-medium {
    background: #f2f4f7;
    color: #344054;
    border-color: #d0d5dd;
}

.priority-pill.priority-high {
    background: #fef3f2;
    color: #8b1a1a;
    border-color: #fecdca;
}

.status-select {
    border-width: 2px;
    font-weight: 600;
}

.status-select-todo {
    border-color: #c01048;
    background: #fff1f3;
    color: #c01048;
}

.status-select-inprogress,
.status-select-techreview {
    border-color: #175cd3;
    background: #eff8ff;
    color: #175cd3;
}

.status-select-awaiting,
.status-select-usersignoff {
    border-color: #b54708;
    background: #fffaeb;
    color: #b54708;
}

.status-select-done {
    border-color: #067647;
    background: #ecfdf3;
    color: #067647;
}

.status-select-dismissed {
    border-color: #344054;
    background: #f2f4f7;
    color: #344054;
}

select.status-select:disabled {
    opacity: 0.65;
    cursor: default;
}

.status-editor .status-control-wrap {
    display: inline-flex;
    min-width: 0;
}

.status-editor .status-control-wrap:first-child {
    flex: 1 1 auto;
}

.status-editor .status-control-wrap:first-child select {
    width: 100%;
}

.status-editor .field-action-row.status-locked,
.status-editor .field-action-row.status-locked .status-control-wrap,
.status-editor .field-action-row.status-locked select.status-select:disabled,
.status-editor .field-action-row.status-locked .action-btn:disabled {
    cursor: default;
}

.attachment-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
}

.attachment-list li {
    margin: 4px 0;
}

.attachment-list a {
    color: var(--hd-blue);
    font-weight: 600;
}

input[type=file] {
    display: block;
    margin-top: 4px;
    max-width: 100%;
}

label .label-rest {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

.file-picker {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.file-input-offscreen {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

button.choose-file {
    margin-top: 0;
    padding: 6px 12px;
    background: #f8fafc;
    color: var(--hd-navy);
    border: 1px solid var(--hd-border-strong);
    font-weight: 600;
}

button.choose-file:hover,
button.choose-file:focus {
    background: #eef2f6;
    color: var(--hd-navy);
}

.file-picker-name {
    color: var(--hd-text-muted);
    font-size: 14px;
}

.reply-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

button.reply-cancel[hidden] {
    display: none;
}

.prop-item.completed-on {
    background: #ecfdf3;
    border: 2px solid #067647;
    max-width: 100%;
    box-sizing: border-box;
}
.prop-item .prop-value.completed-on { color: #067647; }
.prop-item .prop-value.priority-low { color: #0d5c2e; }
.prop-item .prop-value.priority-medium { color: #111111; }
.prop-item .prop-value.priority-high { color: #8b1a1a; }

/* Detail layout */
.ticket-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: start;
}

.ticket-sidebar {
    display: grid;
    gap: 12px;
    align-content: start;
    min-width: 0;
}

.sidebar-panel {
    padding: 0;
    min-width: 0;
    max-width: 100%;
    border-radius: 12px;
}

.sidebar-panel .collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 14px 16px;
    border: 0;
    border-radius: 12px 12px 0 0;
    background: transparent;
    color: var(--hd-navy);
    font-size: 14px;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}

.sidebar-panel .collapse-toggle[aria-expanded="false"] {
    border-radius: 12px;
}

.sidebar-panel .collapse-toggle:hover {
    background: #faf7f8;
    text-decoration: none;
}

.sidebar-panel .collapse-chevron {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--hd-text-muted);
    border-bottom: 2px solid var(--hd-text-muted);
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
}

.sidebar-panel .collapse-toggle[aria-expanded="true"] .collapse-chevron {
    transform: rotate(45deg);
}

.sidebar-panel .collapse-body {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--hd-border);
    min-width: 0;
}

.sidebar-panel .collapse-body[hidden] {
    display: none;
}

.activity-empty {
    margin: 0;
    font-size: 13px;
}

.activity-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.activity-item {
    min-width: 0;
    padding-left: 12px;
    border-left: 2px solid var(--hd-blue-border);
}

.activity-summary {
    font-size: 13px;
    font-weight: 600;
    color: var(--hd-text);
    line-height: 1.35;
    word-break: break-word;
}

.activity-meta {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    font-size: 12px;
    color: var(--hd-text-muted);
}

.associated-ticket-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.associated-ticket-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.associated-ticket-list a {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.35;
    word-break: break-word;
}

.associated-ticket-row .status-pill {
    flex: 0 0 auto;
    max-width: 42%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sysaid-transfer-fields {
    display: grid;
    gap: 8px;
}

.sysaid-transfer-fields label {
    margin: 0;
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hd-text-muted);
}

.sysaid-transfer-fields input[readonly] {
    width: 100%;
    margin: 0;
    background: #f3f1f2;
    color: var(--hd-navy);
    cursor: default;
}

.sysaid-transfer-actions {
    display: flex;
    justify-content: center;
    align-items: center;
}

.sysaid-transfer-fields .action-btn {
    margin-top: 0;
    width: auto;
    max-width: none;
    white-space: nowrap;
}

.canned-reply-picker {
    display: grid;
    gap: 6px;
    margin: 0 0 12px;
}

.canned-reply-picker label {
    font-size: 13px;
    font-weight: 650;
    color: var(--hd-navy);
}

.canned-reply-picker select {
    max-width: 420px;
}

.admin-canned-form {
    display: grid;
    gap: 12px;
    margin: 0 0 20px;
    padding: 14px;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-sm);
    background: #faf7f8;
}

.admin-canned-row {
    display: grid;
    gap: 6px;
}

.admin-canned-row-actions {
    grid-template-columns: minmax(0, 140px) auto;
    align-items: end;
    gap: 10px;
}

.admin-canned-row-actions label {
    grid-column: 1 / -1;
}

.admin-canned-body {
    max-width: 420px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
}

.sysaid-transfer-help {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.45;
}

.sysaid-transfer-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.sysaid-mark-done {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--hd-text);
}

.sysaid-mark-done input {
    margin: 0;
}

.sysaid-transfer-fields .action-btn:disabled,
.sysaid-transfer-fields .action-btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.ticket-hero {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.ticket-meta {
    color: var(--hd-text-muted);
    font-size: 13px;
    margin: 0 0 6px;
}

.ticket-body,
.comment-body {
    white-space: pre-wrap;
    margin: 0;
}

.ticket-body-box,
.comment {
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    padding: 14px 16px;
    background: #fff;
    margin: 12px 0;
}

.comment.private {
    background: #fffbeb;
    border-color: #f5d0a9;
}

.comment {
    position: relative;
}

.comment.has-note-menu {
    padding-right: 52px;
}

.note-menu-wrap {
    position: absolute;
    top: 8px;
    right: 8px;
}

button.note-menu-btn {
    margin: 0;
    min-width: 32px;
    height: 28px;
    padding: 0 8px;
    background: transparent;
    color: var(--hd-navy);
    border: 0;
    border-radius: 6px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
}

button.note-menu-btn:hover,
button.note-menu-btn:focus,
button.note-menu-btn[aria-expanded="true"] {
    background: #eef2f6;
    color: var(--hd-navy);
}

.note-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 5;
    min-width: 190px;
    background: #fff;
    border: 1px solid var(--hd-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 26, 68, 0.12);
    padding: 4px;
}

.note-menu[hidden] {
    display: none;
}

.note-menu form {
    margin: 0;
}

button.note-menu-item {
    display: block;
    width: 100%;
    margin: 0;
    padding: 8px 10px;
    background: transparent;
    color: var(--hd-navy);
    border: 0;
    border-radius: 6px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

button.note-menu-item:hover,
button.note-menu-item:focus {
    background: #f8fafc;
    color: var(--hd-navy);
}

button.note-menu-item.note-delete-action {
    color: #b42318;
}

button.note-menu-item.note-delete-action:hover,
button.note-menu-item.note-delete-action:focus {
    background: #fef3f2;
    color: #912018;
}

.comment-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 26, 68, 0.45);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-dialog {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--hd-border);
    border-radius: 12px;
    padding: 20px 22px;
}

.modal-dialog h2 {
    margin-bottom: 8px;
}

.modal-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
}

.page-loading-modal {
    background: rgba(100, 100, 100, 0.55);
    z-index: 2000;
}

.page-loading-dialog {
    max-width: 360px;
    text-align: center;
}

.page-loading-dialog h2 {
    margin: 14px 0 6px;
}

.page-loading-dialog p {
    margin: 0;
}

.page-loading-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto;
    border: 3px solid var(--hd-blue-border);
    border-top-color: var(--hd-navy);
    border-radius: 50%;
    animation: page-loading-spin 0.8s linear infinite;
}

@keyframes page-loading-spin {
    to { transform: rotate(360deg); }
}

.inline-confirm {
    display: inline;
    margin: 0;
}

.btn-proceed,
.btn-cancel {
    margin-top: 0;
    padding: 6px 12px;
    border-radius: 8px;
    color: #fff;
    font-weight: 700;
}

.btn-proceed {
    background: #067647;
}

.btn-proceed:hover {
    background: #05603a;
    color: #fff;
}

.btn-cancel {
    background: #b42318;
}

.btn-cancel:hover {
    background: #912018;
    color: #fff;
}

button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--hd-blue);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex: 0 0 auto;
}

.properties.sidebar-panel {
    padding: 0;
}

.prop-list {
    display: grid;
    gap: 10px;
    margin: 0 0 14px;
    min-width: 0;
    max-width: 100%;
}

.prop-item {
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-sm);
    padding: 10px 12px;
    background: #fbfcfe;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.prop-item .prop-label {
    display: block;
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hd-text-muted);
    margin-bottom: 4px;
}

.prop-item .prop-value {
    color: var(--hd-navy);
    font-weight: 550;
    word-break: break-word;
}

.prop-item.include-cc-item .include-cc-form {
    margin: 0;
}

.prop-item.include-cc-item .field-action-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.prop-item.include-cc-item .field-action-row input[type=text] {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    margin: 0;
}

.prop-item.include-cc-item .field-action-row .action-btn {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    margin-top: 0;
    white-space: nowrap;
}

a.tidalwave-link,
a.tidalwave-link:hover,
a.tidalwave-link:focus {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

button.loan-copy {
    margin: 0;
    padding: 0;
    background: none;
    color: var(--hd-navy);
    border: 0;
    border-radius: 0;
    font: inherit;
    font-weight: 550;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
}

button.loan-copy:hover {
    background: none;
    color: var(--hd-blue);
    text-decoration: none;
}

.copy-toast {
    margin-left: 8px;
    font-size: 12px;
    font-weight: 650;
    color: #067647;
}

.prop-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    width: 100%;
    align-items: stretch;
}

.prop-row .prop-item {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
}

.prop-row .prop-item-right {
    text-align: left;
}

.status-editor {
    margin-bottom: 10px;
}

.status-editor label {
    margin-top: 0;
}

.prop-actions {
    border-top: 1px solid var(--hd-border);
    padding-top: 12px;
}

.prop-actions label {
    margin-top: 10px;
}

.prop-actions select,
.status-editor select {
    max-width: 100%;
    width: 100%;
}

.prop-actions .field-action-row,
.status-editor .field-action-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.prop-actions .field-action-row select,
.status-editor .field-action-row select {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}

.prop-actions .field-action-row .action-btn,
.prop-actions .field-action-row button.action-btn,
.status-editor .field-action-row .action-btn,
.status-editor .field-action-row button.action-btn {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    margin-top: 0;
    white-space: nowrap;
}

.claim-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 4px 0 8px;
}

.claim-row form { margin: 0; flex: 0 0 auto; }

.claim-row button {
    margin-top: 0;
    width: auto;
}

.claim-row .link-btn {
    margin: 0;
}

.reply-box {
    margin-top: 8px;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    padding: 14px;
    background: #fbfcfe;
}

.reply-box textarea {
    max-width: 100%;
    background: #fff;
}

@media (max-width: 900px) {
    .ticket-layout { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: flex-start; }
    .toolbar-actions { width: 100%; }
    .app-header { flex-wrap: wrap; padding: 12px 16px; }
    .app-nav {
        width: 100%;
        justify-content: flex-start;
    }
    .app-user {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 560px) {
    .app-main {
        margin-top: 12px;
        padding: 0 12px 32px;
    }

    .card {
        padding: 16px;
    }

    .ticket-table-wrap .ticket-table {
        min-width: 560px;
    }
}
