:root {
    color-scheme: dark;
    --bg: #0f1419;
    --sidebar: #121820;
    --sidebar-strong: #0c1117;
    --panel: #151b21;
    --panel-soft: #1a222b;
    --text: #f4f7fb;
    --muted: #9aa7b5;
    --line: #2a333d;
    --primary: #1683ff;
    --primary-hover: #0f6ed8;
    --danger: #dc2626;
    --danger-soft: #32181d;
    --warning: #332711;
    --success: #0f2b1d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

a {
    color: #8bb6ff;
    text-decoration: none;
}

a:hover {
    color: #ffffff;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    width: 280px;
    overflow-y: auto;
    background: var(--sidebar);
    border-right: 1px solid var(--line);
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    height: 56px;
    padding: 0 16px;
    color: #ffffff;
    font-size: 18px;
    font-weight: 800;
    border-bottom: 1px solid var(--line);
    padding-right: 52px;
}

.brand-mark {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 6px;
    background: #0f172a;
    color: #60a5fa;
    font-size: 12px;
    font-weight: 900;
}

.side-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 14px 12px 22px;
}

.nav-group {
    display: flex;
    flex-direction: column;
    padding: 8px 0 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-group:last-child {
    border-bottom: 0;
}

.nav-title {
    display: block;
    order: -1000;
    margin: 0 4px 7px;
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.side-nav a {
    display: block;
    padding: 8px 12px;
    border-radius: 5px;
    color: #d6deea;
    font-weight: 600;
}

.side-nav a.active,
.side-nav a:hover {
    background: #222b36;
    color: #ffffff;
}

.sidebar-tools {
    position: absolute;
    z-index: 3;
    top: 13px;
    right: 12px;
    display: flex;
    gap: 4px;
}

.sidebar-customize-actions {
    display: flex;
    gap: 4px;
}

.sidebar-customize-actions[hidden],
.sidebar-tools > [hidden] {
    display: none;
}

.sidebar-tool-button {
    display: grid;
    width: 30px;
    height: 30px;
    padding: 0;
    place-items: center;
    border: 1px solid #334155;
    border-radius: 5px;
    background: #151d27;
    color: #a9bad0;
    cursor: pointer;
}

.sidebar-tool-button:hover,
.sidebar-tool-button:focus-visible {
    border-color: #1683ff;
    background: #1d2a38;
    color: #ffffff;
}

.sidebar-tool-button svg,
.sidebar-drag-handle svg,
.sidebar-emoji-close svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.sidebar-nav-item {
    display: grid;
    order: var(--nav-order, 0);
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
}

.sidebar-nav-item > a {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
}

.sidebar-link-icon {
    display: inline-flex;
    flex: 0 0 20px;
    align-items: center;
    justify-content: center;
    font-family: "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
    font-size: 17px;
    line-height: 1;
}

.sidebar-link-icon:empty {
    display: none;
}

.sidebar-link-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-drag-handle,
.sidebar-emoji-trigger {
    display: none;
}

.sidebar.is-customizing .sidebar-tools {
    right: 8px;
}

.sidebar.is-customizing .sidebar-nav-item {
    grid-template-columns: 24px minmax(0, 1fr) 34px;
    gap: 5px;
    margin: 2px 0;
    padding: 3px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: #121a23;
}

.sidebar.is-customizing .sidebar-nav-item:hover {
    border-color: #334155;
}

.sidebar.is-customizing .sidebar-nav-item > a {
    padding: 7px 5px;
    pointer-events: none;
}

.sidebar.is-customizing .sidebar-drag-handle {
    display: grid;
    width: 24px;
    height: 30px;
    padding: 0;
    place-items: center;
    border: 0;
    background: transparent;
    color: #7f93aa;
    cursor: grab;
    touch-action: none;
}

.sidebar.is-customizing .sidebar-drag-handle:active {
    cursor: grabbing;
}

.sidebar.is-customizing .sidebar-emoji-trigger {
    display: grid;
    width: 32px;
    height: 32px;
    padding: 0;
    place-items: center;
    border: 1px solid #334155;
    border-radius: 5px;
    background: #182332;
    color: #cbd5e1;
    font-family: "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}

.sidebar.is-customizing .sidebar-emoji-trigger:hover,
.sidebar.is-customizing .sidebar-emoji-trigger:focus-visible {
    border-color: #1683ff;
    background: #223248;
    color: #ffffff;
}

.sidebar-sortable-ghost {
    border-color: #1683ff !important;
    background: rgba(22, 131, 255, 0.15) !important;
    opacity: 0.35;
}

.sidebar-sortable-chosen {
    border-color: #1683ff !important;
}

.sidebar-sortable-drag {
    display: grid !important;
    z-index: 10001 !important;
    width: 240px;
    padding: 3px;
    align-items: center;
    grid-template-columns: 24px minmax(0, 1fr) 34px;
    gap: 5px;
    border: 1px solid #1683ff !important;
    border-radius: 5px;
    background: #182332 !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    opacity: 0.96;
}

.sidebar-sortable-drag > a {
    display: flex;
    min-width: 0;
    padding: 7px 5px;
    align-items: center;
    gap: 9px;
}

.sidebar-sortable-drag .sidebar-drag-handle,
.sidebar-sortable-drag .sidebar-emoji-trigger {
    display: grid;
}

.sidebar-emoji-picker {
    position: fixed;
    z-index: 10020;
    width: 238px;
    max-height: min(360px, calc(100vh - 16px));
    overflow: hidden;
    border: 1px solid #334155;
    border-radius: 7px;
    background: #111923;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
}

.sidebar-emoji-picker[hidden] {
    display: none;
}

.sidebar-emoji-picker-head {
    display: flex;
    min-height: 38px;
    padding: 7px 8px 7px 12px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #29384a;
    color: #e8eef7;
}

.sidebar-emoji-close {
    display: grid;
    width: 26px;
    height: 26px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #91a4ba;
    cursor: pointer;
}

.sidebar-emoji-close:hover,
.sidebar-emoji-close:focus-visible {
    background: #223248;
    color: #ffffff;
}

.sidebar-emoji-grid {
    display: grid;
    max-height: 310px;
    padding: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
}

.sidebar-emoji-option {
    display: grid;
    width: 33px;
    height: 33px;
    padding: 0;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: #d5dfec;
    font-family: "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.sidebar-emoji-option:hover,
.sidebar-emoji-option:focus-visible {
    border-color: #3b82f6;
    background: #223248;
}

.sidebar-emoji-option.is-active {
    border-color: #1683ff;
    background: #173b63;
}

.sidebar-emoji-option.is-empty {
    font-family: "Segoe UI", sans-serif;
    font-size: 17px;
    font-weight: 800;
}

.support-status {
    margin-top: auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #111820;
}

.support-status strong,
.support-status small {
    display: block;
}

.support-status strong {
    margin-top: 8px;
    font-size: 18px;
}

.support-status small {
    margin-top: 2px;
    color: var(--muted);
    font-weight: 700;
}

.support-status-calm {
    border-color: #22c55e;
    background: rgba(21, 51, 35, 0.88);
}

.support-status-calm strong {
    color: #86efac;
}

.support-status-busy {
    border-color: #f59e0b;
    background: rgba(53, 43, 22, 0.92);
}

.support-status-busy strong {
    color: #fbbf24;
}

.support-status-very-busy {
    border-color: #ef4444;
    background: rgba(59, 29, 34, 0.95);
}

.support-status-very-busy strong {
    color: #fca5a5;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    min-height: 56px;
    margin-left: 280px;
    padding: 8px 18px 8px 28px;
    background: #121820;
    border-bottom: 1px solid var(--line);
}

.breadcrumb {
    color: #cbd5e1;
    font-size: 14px;
}

.user-chip {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #0b1016;
    color: #ffffff;
    font-weight: 800;
}

.container {
    width: auto;
    max-width: none;
    margin: 0 0 0 280px;
    padding: 20px 28px 26px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    min-width: 0;
    box-shadow: none;
}

.intro {
    max-width: 620px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.section-head.compact {
    align-items: center;
}

.section-head.compact h2 {
    margin: 0;
}

.checkbox-line {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 12px 0;
}

.checkbox-line input {
    width: auto;
    margin: 0;
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 7px;
    font-size: 24px;
    line-height: 1.2;
}

h2 {
    font-size: 19px;
}

h3 {
    font-size: 16px;
}

p {
    color: var(--muted);
}

label {
    display: block;
    margin-bottom: 13px;
    color: #e5e7eb;
    font-weight: 700;
}

input,
select,
textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 9px 11px;
    border: 1px solid #33404d;
    border-radius: 6px;
    background: #202832;
    color: #ffffff;
    font: inherit;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #1683ff;
    box-shadow: 0 0 0 2px rgba(22, 131, 255, 0.18);
}

input::placeholder,
textarea::placeholder {
    color: #aab4c4;
}

.field-hint {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.ticket-terms {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #121920;
    padding: 14px;
    margin: 16px 0;
}

.ticket-terms h2 {
    margin-top: 0;
}

.ticket-terms ul {
    max-height: 260px;
    overflow-y: auto;
    margin: 0 0 14px;
    padding-left: 22px;
}

.ticket-terms li {
    margin-bottom: 8px;
    color: #dbe2ed;
}

textarea {
    resize: vertical;
}

.button {
    display: inline-block;
    border: 0;
    border-radius: 6px;
    background: var(--primary);
    color: #ffffff;
    padding: 9px 13px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.button:hover {
    background: var(--primary-hover);
    color: #ffffff;
}

.button.small {
    padding: 7px 11px;
}

.button.danger {
    background: var(--danger);
}

.button.secondary {
    background: #334155;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.my-tickets-table .ticket-status-text {
    font-weight: 600;
}

.my-tickets-table .ticket-status-waiting {
    color: #ffb454;
}

.my-tickets-table .ticket-status-open {
    color: #9be7b2;
}

.my-tickets-table .ticket-status-in-progress {
    color: #7ec8ff;
}

.my-tickets-table .ticket-status-received {
    color: #49d17d;
}

.my-tickets-table .ticket-status-closed {
    color: #ffffff;
}

th,
td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: #aebccd;
    background: #19212a;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
}

.sort-link {
    color: inherit;
    text-decoration: none;
}

.sort-link:hover,
.sort-link.active {
    color: #93c5fd;
}

tbody tr {
    background: #151b21;
}

tbody tr:nth-child(even) {
    background: #171e26;
}

tbody tr:hover {
    background: #1d2630;
}

tr.clickable-row {
    cursor: pointer;
}

.ticket-conversation {
    overflow: hidden;
    margin: 20px 0;
    border: 1px solid #2b4055;
    border-radius: 7px;
    background: #0f161e;
}

.ticket-conversation-head,
.ticket-reply-head {
    display: flex;
    min-height: 48px;
    padding: 12px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #2b4055;
    background: #182330;
}

.ticket-conversation-head h2 {
    margin: 0;
    font-size: 18px;
}

.ticket-conversation-head span {
    color: #8fa6bd;
    font-size: 13px;
    font-weight: 700;
}

.ticket-conversation-body {
    padding: 6px 14px 10px;
}

.ticket-conversation .message {
    margin: 10px 0;
}

.ticket-reply-head {
    margin: 24px 0 0;
    justify-content: flex-start;
    border: 1px solid #28527a;
    border-bottom: 0;
    border-radius: 7px 7px 0 0;
    background: #15283a;
    color: #e8f4ff;
}

.ticket-reply-head svg {
    width: 18px;
    height: 18px;
    color: #55aaff;
}

.ticket-reply-form {
    padding: 16px;
    border: 1px solid #28527a;
    border-radius: 0 0 7px 7px;
    background: #101922;
}

.ticket-reply-form label:first-of-type {
    margin-top: 0;
}

.ticket-quick-replies {
    padding: 0 0 16px;
    margin: 0 0 16px;
    border-bottom: 1px solid #263a4d;
}

.ticket-quick-replies-label {
    display: block;
    margin-bottom: 8px;
    color: #a9bfd5;
    font-size: 13px;
    font-weight: 800;
}

.ticket-quick-replies-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.ticket-quick-reply-button {
    display: flex;
    min-height: 42px;
    padding: 9px 10px;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    border: 1px solid #31506d;
    border-radius: 6px;
    background: #172536;
    color: #e7f2ff;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.ticket-quick-reply-button:hover,
.ticket-quick-reply-button:focus-visible,
.ticket-quick-reply-button.is-active {
    border-color: #1683ff;
    background: #1d4264;
    color: #ffffff;
    outline: none;
}

.ticket-quick-reply-button svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: #55aaff;
}

.ticket-quick-reply-button.is-active svg {
    color: #ffffff;
}

.message {
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 12px;
    margin: 10px 0;
    background: #141b23;
}

.message-staff {
    background: #14263b;
    border-color: #1d5f9e;
}

.message-resident {
    background: #1a222c;
    border-color: #33404d;
}

.message p {
    white-space: pre-wrap;
}

.message-attachments {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin: 10px 0;
}

.message-attachment {
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.03);
    color: #bfdbfe;
    text-decoration: none;
    cursor: zoom-in;
}

.message-attachment img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-bottom: 1px solid var(--line);
}

.message-attachment span {
    display: block;
    overflow: hidden;
    padding: 8px;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.image-popout-open {
    overflow: hidden;
}

.image-popout[hidden] {
    display: none;
}

.image-popout {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(3, 8, 15, 0.88);
    backdrop-filter: blur(4px);
}

.image-popout-panel {
    display: flex;
    flex-direction: column;
    width: min(1200px, 94vw);
    height: min(820px, 90vh);
    overflow: hidden;
    border: 1px solid #3b4b5f;
    border-radius: 10px;
    background: #111923;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}

.image-popout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 9px 10px 9px 16px;
    border-bottom: 1px solid #334155;
    background: #17212d;
}

.image-popout-header strong {
    overflow: hidden;
    color: #dbeafe;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-popout-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #090e14;
}

.image-popout-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #475569;
    border-radius: 7px;
    background: #202d3c;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.image-popout-close:hover,
.image-popout-close:focus-visible {
    border-color: #60a5fa;
    background: #1e3a5f;
    outline: none;
}

.attachment-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 160px));
    gap: 10px;
    margin: -4px 0 12px;
}

.attachment-preview-item {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.03);
}

.attachment-preview-item img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-bottom: 1px solid var(--line);
}

.attachment-preview-item span {
    display: block;
    overflow: hidden;
    padding: 7px;
    color: #bfdbfe;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-content {
    margin-top: 8px;
    color: #cfe0f4;
    line-height: 1.55;
    white-space: normal;
}

.ticket-field-label {
    display: inline-block;
    margin-top: 8px;
    color: #ffffff;
    font-weight: 800;
}

.ticket-content .ticket-field-label:first-child {
    margin-top: 0;
}

.ticket-inline-clip {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

.ticket-source-link {
    min-width: 0;
    color: #93c5fd;
    overflow-wrap: anywhere;
}

.ticket-source-link:hover {
    color: #dbeafe;
}

.ticket-inline-archive {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border: 1px solid #2563eb;
    border-radius: 6px;
    padding: 3px 8px;
    background: #123867;
    color: #dbeafe;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.ticket-inline-archive:hover {
    border-color: #60a5fa;
    background: #1d4f91;
    color: #ffffff;
}

.ticket-inline-archive-status {
    flex: 0 0 auto;
}

.ticket-user-card {
    padding-bottom: 16px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.ticket-user-card dl {
    margin: 0;
}

.ticket-user-card div {
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ticket-user-card dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.ticket-user-card dd {
    margin: 3px 0 0;
    color: #ffffff;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.ticket-log-panel {
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.ticket-log-entry {
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ticket-log-entry strong,
.ticket-log-entry small {
    display: block;
}

.ticket-log-entry small,
.muted-text {
    color: var(--muted);
}

.ticket-log-entry p {
    margin: 4px 0 0;
}

.chat-status {
    min-height: 20px;
    margin: 8px 0 0;
    color: var(--muted);
}

.warning,
.flash {
    border: 1px solid #8a6a20;
    background: var(--warning);
    color: #fde68a;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
}

.success-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    pointer-events: none;
    animation: successModalFade 2.8s ease forwards;
}

.success-modal-card {
    min-width: min(520px, calc(100vw - 40px));
    padding: 28px 36px;
    border: 1px solid #22c55e;
    border-radius: 9px;
    background: rgba(21, 51, 35, 0.96);
    color: #bbf7d0;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
    text-align: center;
}

.success-modal-card strong {
    display: block;
    font-size: 25px;
    line-height: 1.2;
}

@keyframes successModalFade {
    0%,
    72% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(0.96);
        visibility: hidden;
    }
}

.ticket-fields[hidden] {
    display: none;
}

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.staff-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;
}

.staff-action-card {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    gap: 8px;
    justify-content: flex-start;
    min-width: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(29, 40, 54, 0.55);
}

.staff-action-card-head {
    min-height: 0;
}

.staff-action-card-head strong,
.staff-action-card-head span {
    display: block;
}

.staff-action-card-head strong {
    color: var(--text);
    font-size: 15px;
    line-height: 1.3;
}

.staff-action-card-head span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.staff-action-card select,
.staff-action-card textarea {
    min-width: 0;
    width: 100%;
}

.staff-action-card textarea {
    min-height: 62px;
    resize: vertical;
}

.staff-action-card .button {
    align-self: flex-start;
    margin-top: 2px;
}

.staff-action-close {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(127, 29, 29, 0.12);
}

.staff-action-release {
    background: rgba(51, 65, 85, 0.42);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.staff-member-list {
    display: grid;
    gap: 12px;
}

.staff-member-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto auto;
    gap: 14px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel-soft);
}

.staff-member-identity {
    align-self: center;
    min-width: 0;
}

.staff-member-identity strong,
.staff-member-identity small {
    display: block;
    overflow-wrap: anywhere;
}

.staff-member-identity small {
    color: var(--muted);
}

.staff-member-active {
    align-self: center;
    margin: 0;
    white-space: nowrap;
}

.staff-layout,
.ticket-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
    align-items: start;
    min-width: 0;
}

.ticket-layout {
    height: calc(100vh - 102px);
    height: calc(100dvh - 102px);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    overflow: hidden;
}

.ticket-main-scroll,
.ticket-layout > .staff-notes-panel {
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
}

.side-panel,
.staff-notes-panel {
    position: sticky;
    top: 72px;
}

.dashboard-side-stack {
    display: grid;
    gap: 16px;
}

.box-link {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}

.box-link.active {
    color: #4da3ff;
    font-weight: 800;
}

.overdue-list {
    margin-top: 24px;
}

.overdue-ticket {
    display: block;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.overdue-ticket strong,
.overdue-ticket span,
.overdue-ticket small {
    display: block;
}

.overdue-ticket strong {
    color: #fca5a5;
}

.overdue-hours {
    color: #fca5a5;
}

.overdue-ticket span,
.overdue-ticket small,
.note small,
.refund-card small {
    color: var(--muted);
}

.note {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 12px;
}

.note small {
    display: block;
}

.search-form {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 14px;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.process-all-actions {
    display: flex;
    justify-content: flex-end;
    margin: 18px 0 6px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.stats-detail-row td {
    padding-top: 0;
    background: #111820;
}

.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 10px;
    margin: 12px 0 16px;
}

.stats-summary-card,
.stats-payout-card {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #1a222b;
    padding: 12px;
}

.stats-summary-card span,
.stats-payout-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.stats-summary-card strong,
.stats-payout-card strong {
    display: block;
    color: var(--text);
    font-size: 20px;
    line-height: 1.2;
}

.stats-summary-card.highlight,
.stats-payout-card {
    border-color: rgba(22, 131, 255, 0.55);
    background: rgba(22, 131, 255, 0.10);
}

.stats-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 12px;
    align-items: start;
}

.stats-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
    padding: 8px 0 10px;
}

.stats-chip {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 7px 9px;
    background: #1a222b;
}

.stats-chip span {
    color: var(--muted);
}

.stats-chip strong {
    color: var(--text);
}

.stats-payout-card {
    margin-top: 8px;
}

.stats-payout-card small {
    display: block;
    color: #bfdbfe;
    margin-top: 6px;
    line-height: 1.4;
}

.tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 15px;
}

.tab {
    padding: 8px 10px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
}

.tab.active {
    color: #4da3ff;
    border-color: #1683ff;
    font-weight: 800;
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin: 12px 0;
    color: var(--muted);
}

.pagination-size label {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 0;
}

.pagination-size select {
    width: auto;
    min-width: 82px;
    margin-top: 0;
}

.pagination-links {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.absence-form {
    display: grid;
    grid-template-columns: 180px 180px minmax(240px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
}

.status-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-pending {
    background: #4a3914;
    color: #fde68a;
}

.status-approved {
    background: var(--success);
    color: #86efac;
}

.status-rejected {
    background: var(--danger-soft);
    color: #fca5a5;
}

.status-processing {
    background: #1f3b5f;
    color: #93c5fd;
}

.status-failed {
    background: var(--danger-soft);
    color: #fca5a5;
}

.muted-line {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.absence-actions {
    min-width: 240px;
}

.absence-perm-cell {
    min-width: 230px;
}

.absence-perm-cell form {
    margin-top: 8px;
}

.absence-perm-cell input[type="date"] {
    margin-bottom: 6px;
}

.absence-actions form {
    margin: 0 0 8px;
}

.absence-actions input {
    margin: 0 0 6px;
}

#refund-search,
#deduction-search {
    max-width: 520px;
}

.searchable-sanction-native {
    display: none;
}

.searchable-sanction {
    position: relative;
    width: 100%;
    margin-top: 6px;
    font-weight: 400;
}

.searchable-sanction-trigger {
    position: relative;
    display: block;
    width: 100%;
    min-height: 41px;
    padding: 9px 38px 9px 11px;
    border: 1px solid #33404d;
    border-radius: 6px;
    background: #202832;
    color: #ffffff;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.searchable-sanction-trigger::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #dbe5f2;
    border-bottom: 2px solid #dbe5f2;
    transform: translateY(-70%) rotate(45deg);
}

.searchable-sanction.is-open .searchable-sanction-trigger {
    border-color: #1683ff;
    box-shadow: 0 0 0 2px rgba(22, 131, 255, 0.18);
}

.searchable-sanction.is-open .searchable-sanction-trigger::after {
    transform: translateY(-25%) rotate(225deg);
}

.searchable-sanction-panel {
    position: absolute;
    z-index: 100;
    top: calc(100% + 2px);
    left: 0;
    width: 100%;
    border: 1px solid #3b4958;
    border-radius: 6px;
    overflow: hidden;
    background: #202832;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.42);
}

.searchable-sanction-panel[hidden] {
    display: none;
}

.searchable-sanction-search {
    margin: 0;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid #3b4958;
    border-radius: 0;
    background: #18212b;
    box-shadow: none;
}

.searchable-sanction-search:focus {
    border-color: #1683ff;
    box-shadow: inset 0 -1px 0 #1683ff;
}

.searchable-sanction-options {
    max-height: 320px;
    overflow-y: auto;
    padding: 3px 0;
}

.searchable-sanction-option {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #ffffff;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.searchable-sanction-option[hidden] {
    display: none;
}

.searchable-sanction-option:hover,
.searchable-sanction-option:focus {
    background: #26496c;
    outline: none;
}

.searchable-sanction-option.is-selected {
    background: #255b8f;
}

.searchable-sanction-empty {
    padding: 12px;
    border-top: 1px solid #3b4958;
    color: var(--muted);
    text-align: center;
}

.refund-line,
.deduction-line {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 110px auto;
    gap: 8px;
    align-items: start;
    margin-bottom: 10px;
}

.refund-sanction-line {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    gap: 10px;
    align-items: start;
    margin-bottom: 10px;
}

.refund-sanction-line .searchable-sanction {
    margin-top: 0;
}

.refund-line select,
.refund-line input,
.deduction-line select,
.deduction-line input,
.refund-sanction-line select {
    margin-top: 0;
}

.refund-card {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 12px;
}

.refund-card-written {
    border: 1px solid #166534;
    border-radius: 8px;
    background: rgba(22, 101, 52, 0.22);
    padding: 12px;
}

.refund-card-revoked {
    border: 1px solid #991b1b;
    border-radius: 8px;
    background: rgba(127, 29, 29, 0.22);
    padding: 12px;
}

.refund-card small {
    display: block;
}

.refund-card ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.ingame-write-panel {
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    padding-bottom: 18px;
}

.staff-clip-panel {
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    padding-bottom: 18px;
}

.staff-clip-panel p {
    margin: 8px 0 0;
    font-size: 13px;
}

.claim-release-panel {
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    padding-bottom: 18px;
}

.reminder-result {
    display: grid;
    gap: 10px;
}

.reminder-result pre {
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.55);
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.ingame-write-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background: #1d2735;
}

.ingame-write-card.is-written {
    border-color: #166534;
    background: rgba(22, 101, 52, 0.24);
}

.ingame-write-card.is-revoked {
    border-color: #991b1b;
    background: rgba(127, 29, 29, 0.24);
}

.ingame-write-card strong,
.ingame-write-card small {
    display: block;
}

.ingame-write-card p {
    margin: 8px 0 4px;
    color: #86efac;
}

.refund-sanction {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid rgba(147, 197, 253, 0.28);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.28);
}

.refund-sanction span,
.muted {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.refund-mini-table {
    margin-top: 10px;
    font-size: 13px;
}

.refund-mini-table th,
.refund-mini-table td {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.refund-mini-table th {
    background: transparent;
    color: #dbeafe;
}

.refund-mini-table td:last-child,
.refund-mini-table th:last-child {
    text-align: right;
}

.copy-code {
    border: 0;
    background: transparent;
    color: #93c5fd;
    padding: 0;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.copy-code:hover,
.copy-code.copied {
    color: #86efac;
}

.clip-archive {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    margin: 16px 0;
    background: #1d2735;
}

.clip-archive-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.clip-archive-row:first-of-type {
    border-top: 0;
}

.clip-archive-row strong,
.clip-archive-row small {
    display: block;
}

.clip-archive-row small {
    color: var(--muted);
}

.clip-archive-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.clip-archive-actions form {
    margin: 0;
}

@media (max-width: 1180px) {
    .staff-actions {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .staff-layout,
    .ticket-layout {
        grid-template-columns: 1fr;
    }

    .ticket-layout {
        height: auto;
        display: grid;
        grid-template-rows: none;
        overflow: visible;
    }

    .ticket-main-scroll,
    .ticket-layout > .staff-notes-panel {
        max-height: none;
        overflow-y: visible;
        scrollbar-gutter: auto;
    }

    .side-panel,
    .staff-notes-panel {
        position: static;
    }

    table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }

    th,
    td {
        padding: 11px 14px;
    }
}

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: auto;
        max-height: none;
    }

    .topbar,
    .container {
        margin-left: 0;
    }

    .topbar {
        padding: 12px 16px;
    }

    .container {
        padding: 18px 16px 28px;
    }

    .side-nav {
        display: flex;
        gap: 12px;
        overflow-x: auto;
        padding: 12px;
    }

    .nav-group {
        min-width: 180px;
        border-bottom: 0;
    }

    .support-status {
        min-width: 180px;
        margin-top: 0;
    }
}

@media (max-width: 720px) {
    .topbar,
    .section-head,
    .actions,
    .search-form,
    .pagination-bar,
    .staff-layout,
    .ticket-layout,
    .absence-form,
    .refund-line,
    .deduction-line,
    .refund-sanction-line {
        display: block;
    }

    .ticket-quick-replies-grid {
        grid-template-columns: 1fr;
    }

    .stats-summary-grid,
    .stats-detail-layout {
        grid-template-columns: 1fr;
    }

    .staff-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .staff-member-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .pagination-links {
        justify-content: flex-start;
        margin-top: 10px;
    }

    .user-chip {
        margin-left: auto;
    }

    body {
        font-size: 15px;
    }

    .brand {
        height: auto;
        min-height: 58px;
        padding: 10px 16px;
    }

    .container {
        padding: 14px 10px 24px;
    }

    .panel {
        padding: 12px;
        border-radius: 7px;
    }

    h1 {
        font-size: 22px;
    }

    h2 {
        font-size: 18px;
    }

    th,
    td {
        padding: 9px 10px;
    }

    .button {
        max-width: 100%;
        white-space: normal;
    }

    .pagination-size label {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .pagination-size select {
        width: 100%;
    }
}
