:root {
    --blue: #1565c0;
    --blue-dark: #0d47a1;
    --green: #689f38;
    --red: #f44336;
    --amber: #f5a623;
    --ink: rgba(0, 0, 0, .87);
    --muted: rgba(0, 0, 0, .54);
    --line: #e0e0e0;
    --soft: #f5f7fa;
    --panel: #ffffff;
    --shadow: 0 2px 4px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .06);
    --radius: 4px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

html {
    font-size: 62.5%;
}

body {
    color: var(--ink);
    background: #fafafa;
    font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1.4rem;
    line-height: 1.43;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

.site-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 70px;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 0 32px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.logo-full {
    display: block;
    width: 160px;
    height: 40px;
    object-fit: contain;
    object-position: left center;
}

.logo-simple {
    display: none;
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s;
}
.hamburger-btn:hover { border-color: #bbb; }

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.main-nav a {
    color: var(--muted);
    padding: 24px 12px 21px;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    font-weight: 500;
}

.main-nav a.active,
.main-nav a:hover {
    color: var(--blue);
    border-bottom-color: var(--blue);
    text-decoration: none;
}

.account-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    max-width: 180px;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Profile menu ─────────────────────────────────────────────── */

.profile-wrap {
    position: relative;
}

.profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 10px 0 4px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-size: 1.4rem;
    font-weight: 500;
    transition: border-color .15s, box-shadow .15s;
}

.profile-btn:hover {
    border-color: #bbb;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.avatar-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-img.lg {
    width: 42px;
    height: 42px;
}

.avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: .03em;
    text-transform: uppercase;
    user-select: none;
}

.avatar-initials.lg {
    width: 42px;
    height: 42px;
    font-size: 1.5rem;
}

.profile-name {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chevron {
    color: var(--muted);
    transition: transform .2s;
    flex-shrink: 0;
}

.chevron.open {
    transform: rotate(180deg);
}

.dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 100;
    min-width: 230px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.08);
    overflow: hidden;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fafafa;
}

.profile-header-name {
    font-weight: 600;
    line-height: 1.3;
}

.profile-header-email {
    color: var(--muted);
    font-size: 1.2rem;
    margin-top: 1px;
}

.dropdown-divider {
    height: 1px;
    background: var(--line);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    color: var(--ink);
    font-size: 1.4rem;
    transition: background .1s;
}

.dropdown-item:hover {
    background: var(--soft);
    text-decoration: none;
}

.dropdown-item svg {
    color: var(--muted);
    flex-shrink: 0;
}

/* ──────────────────────────────────────────────────────────────── */

.button {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 0 16px;
    background: #f1f1f1;
    color: var(--ink);
    cursor: pointer;
    font-weight: 500;
    text-align: center;
    transition: background .12s, box-shadow .12s, transform .1s;
}

.button:hover {
    text-decoration: none;
    background: #e8e8e8;
}

.button:active {
    transform: scale(.97);
}

.button.primary {
    background: var(--blue);
    color: #fff;
}

.button.primary:hover {
    background: var(--blue-dark);
    box-shadow: 0 2px 8px rgba(21,101,192,.3);
}

.button.subtle {
    background: #fff;
    border-color: var(--line);
    color: var(--muted);
}

.button.block {
    width: 100%;
}

.hc-hero {
    min-height: 338px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 24px;
    color: #fff;
    background-color: var(--blue);
    background-image: linear-gradient(rgba(21, 101, 192, .88), rgba(21, 101, 192, .9)), url("assets/images/pattern.svg");
    background-size: 300px 300px;
}

.hero-inner {
    width: min(900px, 100%);
    text-align: center;
}

.hero-inner h1 {
    margin: 0;
    font-size: 4.2rem;
    font-weight: 400;
}

.hero-inner p {
    margin: 10px 0 32px;
    color: rgba(255, 255, 255, .86);
    font-size: 1.8rem;
}

.searchbar {
    display: flex;
    width: min(780px, 100%);
    height: 58px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 4px;
    background: #fff;
    box-shadow: var(--shadow);
}

.searchbar.inline {
    height: 46px;
    margin: 20px 0 0;
}

.searchbar input {
    min-width: 0;
    flex: 1;
    border: 0;
    padding: 0 20px;
    outline: none;
    color: var(--ink);
}

.searchbar button {
    border: 0;
    padding: 0 24px;
    background: var(--green);
    color: #fff;
    cursor: pointer;
    font-weight: 500;
}

.content-band {
    width: min(1180px, calc(100% - 48px));
    margin: 38px auto 72px;
}

.content-band.narrow {
    width: min(920px, calc(100% - 48px));
}

.section-heading,
.workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.workspace-header.compact {
    margin-bottom: 14px;
}

.section-heading h2,
.workspace-header h1 {
    margin: 0;
    font-size: 2.4rem;
    font-weight: 500;
}

.workspace-header p {
    margin: 4px 0 0;
    color: var(--muted);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.category-card,
.table-panel,
.admin-panel,
.stat-card,
.ticket-main,
.ticket-tips,
.ticket-thread,
.ticket-sidebar,
.article-content {
    border: 1px solid rgba(0, 0, 0, .06);
    border-radius: 4px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.category-card {
    min-height: 270px;
    padding: 24px;
    transition: box-shadow .15s, transform .15s;
}

.category-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.1);
    transform: translateY(-2px);
}

.category-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
    border-radius: 4px;
    background: #edf4fb;
}

.category-icon img {
    width: 22px;
    height: 22px;
}

.category-card h3 {
    font-size: 1.9rem;
}

.category-card p {
    min-height: 42px;
    margin: 0 0 18px;
    color: var(--muted);
}

.article-list {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.article-list a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meta {
    color: var(--muted);
    font-size: 1.2rem;
}

.hc-page-header {
    padding: 42px max(24px, calc((100vw - 920px) / 2)) 34px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.hc-page-header.compact h1 {
    margin: 0;
    font-size: 3rem;
    font-weight: 400;
}

.search-results {
    display: grid;
    gap: 12px;
}

.result-row {
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
}

.result-row p {
    max-width: 760px;
    margin: 8px 0;
    color: var(--muted);
}

.result-title {
    font-size: 1.8rem;
    font-weight: 500;
}

.article-layout {
    width: min(1500px, 100%);
    min-height: calc(100vh - 70px);
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 250px;
    gap: 24px;
    margin: 0 auto;
    padding: 34px 24px;
}

.article-side,
.article-actions {
    position: sticky;
    top: 92px;
    align-self: start;
}

.article-side {
    padding-right: 18px;
    border-right: 1px solid var(--line);
}

.back-link {
    display: inline-block;
    margin-bottom: 22px;
    color: var(--muted);
    font-weight: 500;
}

.side-section {
    display: grid;
    gap: 10px;
    margin-bottom: 24px;
}

.side-section h3 {
    margin: 0 0 4px;
    color: var(--ink);
    font-size: 1.5rem;
}

.side-section a,
.side-link {
    color: var(--muted);
}

.article-content {
    padding: 42px 56px;
}

.article-content h1 {
    margin: 8px 0 16px;
    font-size: 3.4rem;
    font-weight: 400;
}

.article-meta {
    color: var(--muted);
    font-size: 1.2rem;
}

.lead {
    color: var(--muted);
    font-size: 1.7rem;
}

.rich-text {
    color: rgba(0, 0, 0, .78);
    font-size: 1.6rem;
    line-height: 1.7;
}

.rich-text h2 {
    margin-top: 32px;
}

.article-actions {
    display: grid;
    gap: 10px;
}

.workspace-page,
.ticket-create,
.ticket-detail,
.mailbox,
.admin-layout {
    width: min(1180px, calc(100% - 48px));
    margin: 32px auto 72px;
}

.ticket-create {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
}

.ticket-main,
.ticket-tips {
    padding: 28px;
}

.ticket-main h1,
.ticket-tips h2 {
    margin: 0 0 24px;
}

.field {
    display: grid;
    gap: 6px;
    margin-bottom: 20px;
}

.field span {
    color: var(--ink);
    font-weight: 500;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
}

.field textarea {
    resize: vertical;
}

.validation-message,
.field-error,
.field-validation-error,
.form-error {
    color: var(--red);
    font-size: 1.2rem;
}

.form-error {
    margin: 0 0 16px;
    font-size: 1.4rem;
}

.validation-summary-errors {
    color: var(--red);
    background: #fff5f5;
    border: 1px solid #ffc0c0;
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 18px;
}

.validation-summary-errors ul {
    margin: 6px 0 0;
    padding-left: 20px;
}

.validation-summary-errors li {
    margin-bottom: 4px;
}

.field input.input-validation-error,
.field select.input-validation-error,
.field textarea.input-validation-error {
    border-color: var(--red);
}

.upload-list {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.upload-list li,
.file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 9px 0;
}

.upload-list span,
.file-row small {
    color: var(--muted);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.data-table th,
.data-table td {
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.data-table th {
    color: var(--muted);
    font-size: 1.2rem;
    font-weight: 500;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 3px;
    padding: 0 8px;
    background: #eceff5;
    color: #68717b;
    font-size: 1.2rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-pill.open {
    background: #eaf4e2;
    color: var(--green);
}

.status-pill.pending {
    background: #fff4dc;
    color: #9a6500;
}

.status-pill.closed {
    background: #eceff5;
    color: #68717b;
}

.ticket-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
}

.ticket-thread,
.ticket-sidebar {
    padding: 26px;
}

.ticket-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.ticket-title-row h1 {
    margin: 0 0 6px;
    font-weight: 400;
}

.reply {
    border-top: 1px solid var(--line);
    padding: 18px 0;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
}

.mailbox,
.admin-layout {
    width: min(1420px, 100%);
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 0;
    margin-top: 0;
}

.mailbox-side,
.admin-side {
    min-height: calc(100vh - 70px);
    padding: 26px 20px;
    border-right: 1px solid var(--line);
    background: #fff;
}

.mailbox-main,
.admin-main {
    min-width: 0;
    padding: 30px;
}

.side-link {
    display: block;
    border-radius: 4px;
    padding: 11px 12px;
    transition: background .1s, color .1s;
}

.side-link.active,
.side-link:hover {
    background: #edf4fb;
    color: var(--blue);
    text-decoration: none;
}

.ticket-list {
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.ticket-row {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    transition: background .12s, box-shadow .12s;
}

.ticket-row:last-child { border-bottom: 0; }

.ticket-row:hover {
    background: #f0f7ff;
    box-shadow: inset 3px 0 0 var(--blue);
    text-decoration: none;
}

.ticket-row strong,
.ticket-row small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-row small,
.ticket-row time {
    color: var(--muted);
}

.ticket-row time {
    white-space: nowrap;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #9099a1;
}

.status-dot.open {
    background: var(--green);
}

.status-dot.pending {
    background: var(--amber);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 22px;
}

.stat-card span {
    display: block;
    color: var(--muted);
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 3rem;
    font-weight: 400;
}

.admin-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 24px;
}

.admin-panel {
    padding: 24px;
}

.admin-panel h2 {
    margin: 0 0 18px;
}

.admin-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
    padding: 13px 0;
}

.admin-list-row small {
    display: block;
    color: var(--muted);
}

.save-note {
    margin-left: 12px;
    color: var(--green);
    font-weight: 500;
}

.auth-page,
.not-found,
.empty-state,
.loading-panel {
    display: grid;
    place-items: center;
    text-align: center;
}

.auth-page {
    min-height: calc(100vh - 70px);
}

.auth-panel {
    width: min(400px, calc(100% - 48px));
    border: 1px solid #ededed;
    border-radius: 4px;
    padding: 32px 36px;
    background: #fff;
    box-shadow: var(--shadow);
}

.auth-logo {
    width: 200px;
    margin: 0 auto 28px;
}

.not-found,
.empty-state,
.loading-panel {
    min-height: 280px;
    padding: 36px;
}

.empty-state img,
.not-found img {
    max-width: 180px;
    margin-bottom: 18px;
}

/* ── Admin toolbar (shown on public pages for admins) ─────────── */

.admin-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 24px;
    background: #fff8e1;
    border-bottom: 1px solid #ffe082;
}

.admin-toolbar-label {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #f57f17;
    margin-right: 4px;
}

/* ── Category card header (icon + admin quick-add) ────────────── */

.category-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.category-card-header h3 {
    flex: 1;
    margin: 0;
}

.category-admin-actions {
    flex-shrink: 0;
    margin-left: auto;
}

/* ── Status / tag chips ───────────────────────────────────────── */

.status-chip {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 3px;
    background: #eceff5;
    color: #68717b;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 6px;
}

.status-chip.published { background: #eaf4e2; color: var(--green); }
.status-chip.draft     { background: #fff4dc; color: #9a6500; }
.status-chip.hidden    { background: #eceff5; color: #68717b; }

.tag-chip {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 11px;
    background: #e8f0fe;
    color: #1565c0;
    font-size: 1.2rem;
    font-weight: 500;
    white-space: nowrap;
}

/* ── Checkbox / toggle field ──────────────────────────────────── */

.field.check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.field.check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--blue);
    flex-shrink: 0;
}

.field.check span { font-weight: 400; }

/* ── Alert boxes ──────────────────────────────────────────────── */

.alert {
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 1.4rem;
}

.alert.error   { background: #fff5f5; border: 1px solid #ffc0c0; color: #c62828; }
.alert.success { background: #f1f8e9; border: 1px solid #c5e1a5; color: #2e7d32; }
.alert.info    { background: #e3f2fd; border: 1px solid #90caf9; color: #1565c0; }

/* ── Article edit page ────────────────────────────────────────── */

.article-edit-layout,
.article-edit-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 24px;
    align-items: start;
}

.article-edit-main,
.article-edit-body {
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 4px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 28px;
}

.article-edit-side {
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 4px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 20px;
    position: sticky;
    top: 90px;
}

.code-area,
.code-editor {
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace !important;
    font-size: 1.3rem !important;
    line-height: 1.6 !important;
    resize: vertical;
}

@media (max-width: 860px) {
    .article-edit-layout,
    .article-edit-form {
        grid-template-columns: 1fr;
    }
}

/* ── Search-as-you-type ────────────────────────────────────────── */

.searchbar-wrap {
    position: relative;
    width: min(780px, 100%);
    margin: 0 auto;
}

.searchbar-wrap .searchbar {
    width: 100%;
    margin: 0;
}

.suggestions-backdrop {
    position: fixed;
    inset: 0;
    z-index: 48;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,.1);
    margin-top: 4px;
    overflow: hidden;
}

.suggestion-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    transition: background .1s;
}

.suggestion-row:last-child {
    border-bottom: 0;
}

.suggestion-row:hover {
    background: var(--soft);
    text-decoration: none;
}

.suggestion-title {
    font-weight: 500;
}

.suggestion-category {
    color: var(--muted);
    font-size: 1.2rem;
}

/* ── Ticket thread (notes + compose) ──────────────────────────── */

.reply-note {
    background: #fffcf0;
    border-radius: 4px;
    padding: 14px;
    margin: 0 -14px;
    border-top: 0 !important;
}

.note-badge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 7px;
    border-radius: 3px;
    background: #fff4dc;
    color: #9a6500;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.reply-body {
    margin-top: 10px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.reply-compose {
    border-top: 2px solid var(--line);
    padding-top: 20px;
    margin-top: 6px;
}

.reply-type-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.tab-btn {
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 6px 14px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.3rem;
    font-weight: 500;
    transition: all .15s;
}

.tab-btn.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.canned-replies {
    margin-bottom: 12px;
}

.canned-replies select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 8px 12px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
}

/* ── Sidebar sections ─────────────────────────────────────────── */

.sidebar-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.sidebar-section:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

.sidebar-section h3 {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.sidebar-section select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 8px 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

/* ── Status button group ──────────────────────────────────────── */

.status-btns {
    display: flex;
    gap: 5px;
}

.status-btn {
    flex: 1;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--muted);
    transition: all .12s;
    padding: 0;
}

.status-btn:hover { background: var(--soft); color: var(--ink); }

.status-btn.is-open    { background: #eaf4e2; border-color: var(--green); color: var(--green); }
.status-btn.is-pending { background: #fff8e6; border-color: var(--amber); color: #9a6500;     }
.status-btn.is-closed  { background: #eceff5; border-color: #9099a1;      color: #68717b;     }

/* ── Sidebar assign row ───────────────────────────────────────── */

.assign-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.assign-row select { flex: 1; min-width: 0; }

/* ── Sidebar save feedback ────────────────────────────────────── */

.sidebar-save-note {
    display: block;
    margin-top: 7px;
    font-size: 1.2rem;
    color: var(--green);
    min-height: 17px;
    opacity: 0;
    transition: opacity .2s;
}

.sidebar-save-note.show { opacity: 1; }
.sidebar-save-note.err  { color: var(--red); opacity: 1; }

/* ── Sidebar meta list ────────────────────────────────────────── */

.sidebar-meta dt {
    color: var(--muted);
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: 10px;
}

.sidebar-meta dt:first-child { margin-top: 0; }

.sidebar-meta dd {
    margin: 3px 0 0 0;
    font-size: 1.4rem;
}

/* ── Reply with avatar ────────────────────────────────────────── */

.reply {
    display: grid;
    grid-template-columns: 34px minmax(0,1fr);
    gap: 12px;
    border-top: 1px solid var(--line);
    padding: 16px 0;
    align-items: flex-start;
}

.reply.reply-note {
    background: #fffcf0;
    border-radius: 4px;
    padding: 14px;
    margin: 0 -14px;
    border-top: 0;
    grid-template-columns: 34px minmax(0,1fr);
}

.reply-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: .02em;
    user-select: none;
    background: var(--blue);
    color: #fff;
}

.reply-avatar.agent  { background: var(--blue); }
.reply-avatar.customer { background: #78909c; }
.reply-avatar.note   { background: #f57f17; }

.reply-content { min-width: 0; }

.reply-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.reply-author { font-weight: 600; font-size: 1.4rem; }

.reply-time {
    color: var(--muted);
    font-size: 1.2rem;
    margin-left: auto;
    white-space: nowrap;
}

.reply-actions {
    display: flex;
    gap: 4px;
    margin-left: 6px;
    opacity: 0;
    transition: opacity .15s;
}

.empty-note {
    color: var(--muted);
    font-size: 1.3rem;
    margin: 4px 0;
}

/* ── Admin panels (help center) ───────────────────────────────── */

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.panel-header small {
    display: block;
    color: var(--muted);
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.form-panel {
    margin-bottom: 24px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.button.small {
    min-height: 30px;
    padding: 0 12px;
    font-size: 1.2rem;
}

.button.danger {
    background: #fff;
    border-color: var(--red);
    color: var(--red);
}

.button.danger:hover {
    background: #fff5f5;
}

/* ── User management ──────────────────────────────────────────── */

.role-badge {
    display: inline-flex;
    height: 20px;
    align-items: center;
    padding: 0 7px;
    border-radius: 3px;
    background: #eceff5;
    color: #444;
    font-size: 1.1rem;
    font-weight: 600;
    margin-right: 4px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.role-badge.admin { background: #fce4ec; color: #c2185b; }
.role-badge.agents { background: #e8f5e9; color: #388e3c; }
.role-badge.operator { background: #e3f2fd; color: #1565c0; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,.36);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal {
    width: min(480px, 100%);
    border-radius: 8px;
    background: #fff;
    padding: 28px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.24);
}

.modal h2 {
    margin: 0 0 20px;
    font-size: 2rem;
    font-weight: 500;
}

.role-checklist {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 1.4rem;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--blue);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ── Mailbox filters (button-style side links) ────────────────── */

.side-link[type],
button.side-link {
    width: 100%;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
    color: var(--muted);
    font-size: 1.4rem;
}

.ticket-row-info {
    min-width: 0;
}

.assignee-chip {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 11px;
    background: #e8f5e9;
    color: #388e3c;
    font-size: 1.2rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Mailbox search + filter bar ─────────────────────────────── */

.mailbox-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.mailbox-search {
    flex: 1;
    min-width: 0;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.mailbox-search:focus {
    outline: 2px solid var(--blue);
    outline-offset: -1px;
}

/* ── Reply edit / delete actions ─────────────────────────────── */

.reply-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity .15s;
}

.reply:hover .reply-actions {
    opacity: 1;
}

.reply-action-btn {
    border: 0;
    background: none;
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: background .1s, color .1s;
}

.reply-action-btn:hover { background: var(--soft); color: var(--ink); }
.reply-action-btn.delete:hover { background: #fff5f5; color: var(--red); }

.reply-edit-form {
    margin-top: 10px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.reply-edit-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 10px 12px;
    resize: vertical;
    font: inherit;
    color: var(--ink);
    margin-bottom: 8px;
}

.reply-edit-actions {
    display: flex;
    gap: 8px;
}

/* ── Article feedback ─────────────────────────────────────────── */

.article-feedback {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.article-feedback p {
    margin: 0;
    font-weight: 500;
    color: var(--muted);
}

.feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: 1.3rem;
    transition: all .15s;
}

.feedback-btn.yes:hover, .feedback-btn.yes.voted { background: #eaf4e2; border-color: #c5e1a5; color: var(--green); }
.feedback-btn.no:hover, .feedback-btn.no.voted   { background: #fff5f5; border-color: #ffc0c0; color: var(--red); }

/* ── Reports ──────────────────────────────────────────────────── */

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.report-card {
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 4px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 22px;
}

.report-card h3 {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.report-card .report-num {
    font-size: 4rem;
    font-weight: 300;
    line-height: 1;
    color: var(--ink);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.4rem;
}

.report-table th, .report-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.report-table th { color: var(--muted); font-size: 1.2rem; font-weight: 600; }
.report-table td:last-child { text-align: right; }

/* ── Color swatch input ───────────────────────────────────────── */

.color-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-field input[type="color"] {
    width: 36px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 2px;
    cursor: pointer;
}

.color-field input[type="text"] {
    flex: 1;
}

/* ── Tag preview chip ─────────────────────────────────────────── */

.tag-preview {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: 3px;
    font-size: 1.2rem;
    font-weight: 500;
}

/* ── Breadcrumb ───────────────────────────────────────────────── */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 1.3rem;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb-sep { color: #bbb; }

/* ── Side section divider ─────────────────────────────────────── */

.side-section-divider {
    height: 1px;
    background: var(--line);
    margin: 10px 0;
}

/* ── Empty ticket list CTA ────────────────────────────────────── */

.empty-tickets-cta {
    padding: 56px 32px;
    text-align: center;
    color: var(--muted);
}

.empty-tickets-cta h2 { color: var(--ink); margin: 0 0 8px; }
.empty-tickets-cta p  { margin: 0 0 20px; }

/* ── Article admin list ───────────────────────────────────────── */

.admin-list {
    display: grid;
    gap: 0;
}

/* ── Reorder buttons ──────────────────────────────────────────── */

.reorder-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: background .1s, color .1s;
}

.reorder-btn:hover { background: var(--soft); color: var(--ink); }

/* ──────────────────────────────────────────────────────────────── */

@media (max-width: 980px) {
    .topbar {
        height: auto;
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px 18px;
    }

    .main-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

    .main-nav a {
        padding: 10px 8px;
    }

    .account-nav {
        margin-left: auto;
    }
}

/* ── Mobile nav (hamburger) ────────────────────────────────── */
@media (max-width: 640px) {
    .topbar {
        height: 56px;
        flex-wrap: nowrap;
        gap: 10px;
        padding: 0 16px;
        overflow: visible;
    }

    /* swap logos */
    .logo-full   { display: none; }
    .logo-simple { display: block; }

    /* nav becomes a full-width dropdown below topbar */
    .main-nav {
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        z-index: 19;
        display: none;
        flex-direction: column;
        gap: 0;
        background: #fff;
        border-bottom: 1px solid var(--line);
        box-shadow: 0 6px 20px rgba(0,0,0,.1);
        order: unset;
        width: auto;
        overflow-x: unset;
        flex: unset;
    }

    .main-nav.open { display: flex; }

    .main-nav a {
        padding: 15px 20px;
        border-bottom: 1px solid var(--line);
        border-left: none;
        font-size: 1.5rem;
    }

    .main-nav a:last-child { border-bottom: none; }

    .main-nav a:hover,
    .main-nav a.active {
        border-bottom-color: var(--line);
        background: var(--bg);
    }

    /* profile: hide name to save space, keep avatar */
    .profile-name { display: none; }
    .profile-btn  { padding: 0 6px; gap: 4px; }

    /* profile dropdown: fixed so it always anchors to viewport right */
    .profile-dropdown {
        position: fixed;
        top: 64px;
        right: 12px;
        left: auto;
    }

    /* show hamburger */
    .hamburger-btn { display: flex; }

    .account-nav { margin-left: auto; }
}

@media (max-width: 980px) {

    .category-grid,
    .stats-grid,
    .admin-panels,
    .ticket-create,
    .ticket-detail,
    .article-layout,
    .mailbox,
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .article-side,
    .article-actions {
        position: static;
    }

    .article-side {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 0 0 18px;
    }

    .mailbox-side,
    .admin-side {
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 16px 20px;
    }

    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .sidebar-header h2 { margin: 0; font-size: 2rem; }

    .sidebar-collapse-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: #fff;
        color: var(--muted);
        cursor: pointer;
        transition: background .1s, color .1s;
        flex-shrink: 0;
    }

    .sidebar-collapse-btn:hover { background: var(--soft); color: var(--ink); }

    .sidebar-links {
        margin-top: 10px;
    }

    .mailbox-main,
    .admin-main {
        padding: 20px;
    }
}

@media (max-width: 640px) {
    .content-band,
    .content-band.narrow,
    .workspace-page,
    .ticket-create,
    .ticket-detail {
        width: calc(100% - 24px);
    }

    .hero-inner h1 {
        font-size: 3.2rem;
    }

    .searchbar {
        height: auto;
        flex-direction: column;
    }

    .searchbar input,
    .searchbar button {
        min-height: 50px;
    }

    .section-heading,
    .workspace-header,
    .ticket-title-row,
    .admin-list-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .article-content,
    .ticket-main,
    .ticket-tips,
    .ticket-thread,
    .ticket-sidebar,
    .admin-panel {
        padding: 22px;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table thead {
        display: none;
    }

    .data-table td {
        padding: 10px 14px;
    }
}

/* ── Ticket title meta row ────────────────────────────────────── */

.ticket-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    font-size: 1.3rem;
    color: var(--muted);
}

.meta-sep { display: flex; align-items: center; }
.meta-sep + .meta-sep::before {
    content: '·';
    margin-right: 6px;
    color: var(--muted);
}

.category-badge {
    background: #f0f4ff;
    color: var(--blue);
    border-radius: 99px;
    padding: 1px 8px;
    font-size: 1.2rem;
    font-weight: 500;
}

.ticket-tags-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

/* ── Sidebar tags section ─────────────────────────────────────── */

.sidebar-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
    min-height: 22px;
}

.sidebar-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 99px;
    padding: 2px 8px 2px 10px;
    font-size: 1.2rem;
    font-weight: 500;
    line-height: 1.5;
}

.tag-remove-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
    opacity: .55;
    font-size: 1.3rem;
    line-height: 1;
    display: flex;
    align-items: center;
    transition: opacity .12s;
}
.tag-remove-btn:hover { opacity: 1; }

.no-tags-hint {
    color: var(--muted);
    font-size: 1.3rem;
    font-style: italic;
}

.tag-add-row {
    display: flex;
    gap: 7px;
    align-items: center;
    margin-top: 2px;
}
.tag-add-row select { flex: 1; min-width: 0; }

/* ── Mailbox row tags ─────────────────────────────────────────── */

.ticket-row-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 2px;
}

.meta-divider { color: var(--muted); }

.row-tag-chip {
    display: inline-block;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 99px;
    padding: 0 7px;
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.7;
    color: var(--ink);
}

.assignee-chip.unassigned {
    background: #fff8e6;
    color: #9a6500;
    border-color: var(--amber);
    opacity: .85;
}

/* ── Reply compose footer & attachments ───────────────────────── */

.reply-compose-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: var(--muted);
    font-size: 1.3rem;
    padding: 6px 10px;
    border-radius: var(--radius);
    transition: background .12s, color .12s;
}
.attach-btn:hover { background: var(--soft); color: var(--ink); }
.attach-btn input[type=file] { display: none; }

.attach-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.attach-item {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 3px 10px;
    font-size: 1.2rem;
    color: var(--ink);
}

/* ── Attachments sidebar improvements ────────────────────────── */

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--soft);
    border-radius: 99px;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--muted);
    vertical-align: middle;
    margin-left: 4px;
}

.file-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: var(--ink);
    font-size: 1.3rem;
    transition: color .12s;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { color: var(--blue); }

.file-icon { width: 18px; height: 18px; flex-shrink: 0; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 700; color: #fff; }
.file-icon-pdf  { background: #e53935; }
.file-icon-img  { background: #43a047; }
.file-icon-zip  { background: #f57c00; }
.file-icon-doc  { background: #1e88e5; }
.file-icon-xls  { background: #2e7d32; }
.file-icon-file { background: #90a4ae; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--muted); font-size: 1.1rem; flex-shrink: 0; }

/* ── Animations ───────────────────────────────────────────────── */

@keyframes pulse-open {
    0%, 100% { box-shadow: 0 0 0 0 rgba(104, 159, 56, .45); }
    50%       { box-shadow: 0 0 0 5px rgba(104, 159, 56, 0); }
}

.status-dot.open {
    animation: pulse-open 2.8s ease-in-out infinite;
}

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Pusher notification bar ──────────────────────────────────── */

.pusher-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin-bottom: 16px;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: var(--radius);
    color: #1565c0;
    font-size: 1.4rem;
    animation: slide-down .22s ease;
}

.pusher-bar svg { flex-shrink: 0; }

.pusher-bar-link {
    font-weight: 600;
    color: var(--blue);
    margin-left: 2px;
}

.pusher-bar-link:hover { text-decoration: underline; }

.pusher-bar-close {
    margin-left: auto;
    border: 0;
    background: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 1.8rem;
    line-height: 1;
    padding: 0 2px;
    transition: color .1s;
}

.pusher-bar-close:hover { color: var(--ink); }

/* ── Sidebar header (desktop: just h2, mobile: h2 + toggle btn) ── */

.sidebar-header {
    display: block;
}

.sidebar-header h2 {
    margin: 0 0 18px;
    font-size: 2.2rem;
    font-weight: 500;
}

.sidebar-collapse-btn {
    display: none;
}

.side-section-label {
    padding: 8px 12px 4px;
    color: var(--muted);
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0;
}

/* ── Mailbox toolbar responsive ───────────────────────────────── */

@media (max-width: 640px) {
    .mailbox-toolbar {
        flex-wrap: wrap;
    }

    .mailbox-search {
        width: 100%;
        flex: none;
    }

    .ticket-row {
        grid-template-columns: 10px minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        gap: 10px 12px;
        padding: 14px 16px;
    }

    /* assignee chip moves into second row under subject */
    .ticket-row .assignee-chip {
        grid-column: 2;
        grid-row: 2;
        font-size: 1.1rem;
        height: 20px;
        padding: 0 7px;
    }

    /* time sits in third column spanning both rows */
    .ticket-row time {
        grid-column: 3;
        grid-row: 1 / 3;
        align-self: center;
        font-size: 1.1rem;
    }

    .mailbox,
    .admin-layout {
        width: 100%;
        margin: 0;
    }

    .mailbox-main,
    .admin-main {
        padding: 16px;
    }
}

/* ── Suggestion row animation ─────────────────────────────────── */

.search-suggestions {
    animation: slide-down .15s ease;
}

/* ── Stat card hover ──────────────────────────────────────────── */

.stat-card {
    transition: box-shadow .15s, transform .15s;
}

.stat-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.1);
    transform: translateY(-1px);
}

/* ── Input focus ring ─────────────────────────────────────────── */

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid var(--blue);
    outline-offset: -1px;
    border-color: var(--blue);
}

/* ── Suggestion row pointer ───────────────────────────────────── */

.suggestion-row {
    cursor: pointer;
}

/* ── Table row hover ──────────────────────────────────────────── */

.data-table tbody tr {
    transition: background .1s;
}

.data-table tbody tr:hover {
    background: #fafcff;
}

/* ── Admin list row hover ─────────────────────────────────────── */

.admin-list-row {
    transition: background .1s;
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
    border-radius: 4px;
}

.admin-list-row:hover {
    background: var(--soft);
}

/* ── Toast notifications ──────────────────────────────────────── */

.toast-wrap {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 500;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    background: #2e7d32;
    color: #fff;
    border-radius: 6px;
    font-size: 1.4rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    animation: toast-in .24s cubic-bezier(.22,.61,.36,1) both;
    max-width: 380px;
    min-width: 200px;
}

.toast.warn { background: #e65100; }
.toast.info { background: #1565c0; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(10px) scale(.97); }
}

.toast-close {
    margin-left: auto;
    background: none;
    border: 0;
    color: rgba(255,255,255,.7);
    cursor: pointer;
    font-size: 1.9rem;
    line-height: 1;
    padding: 0 0 0 10px;
    flex-shrink: 0;
    transition: color .1s;
}
.toast-close:hover { color: #fff; }

/* ── Article feedback score (reports table) ───────────────────── */

.feedback-score {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 99px;
    font-size: 1.2rem;
    font-weight: 600;
}

.feedback-score.good { background: #eaf4e2; color: var(--green); }
.feedback-score.mid  { background: #fff4dc; color: #9a6500; }
.feedback-score.bad  { background: #fff5f5; color: var(--red); }

/* ── Inline feedback counts (help center admin list) ──────────── */

.article-feedback-counts {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    font-size: 1.2rem;
    font-weight: 600;
    vertical-align: middle;
}

.fb-yes { color: var(--green); }
.fb-no  { color: var(--red); }

@media (max-width: 640px) {
    .toast-wrap {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
    .toast { max-width: 100%; }
}

/* ── Ticket grid: widen first column for select wrap ──────────── */

.ticket-row {
    grid-template-columns: 18px minmax(0, 1fr) auto auto;
}

@media (max-width: 980px) {
    .ticket-row {
        grid-template-columns: 18px minmax(0, 1fr) auto;
    }
}

/* ── Bulk checkbox overlay ────────────────────────────────────── */

.ticket-select-wrap {
    position: relative;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ticket-cb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.ticket-select-wrap .status-dot {
    pointer-events: none;
    transition: opacity .12s;
}

.ticket-row:hover .ticket-cb,
.ticket-cb:checked {
    opacity: 1;
}

.ticket-row:hover .status-dot,
.ticket-cb:checked ~ .status-dot {
    opacity: 0;
}

.ticket-row.bulk-selected {
    background: #f0f7ff;
    box-shadow: inset 3px 0 0 var(--blue);
}

/* ── Bulk action bar ──────────────────────────────────────────── */

.bulk-bar {
    position: fixed;
    bottom: -72px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1a1a2e;
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.3);
    z-index: 100;
    transition: bottom .22s cubic-bezier(.34,1.56,.64,1);
    white-space: nowrap;
}

.bulk-bar.visible {
    bottom: 28px;
}

.bulk-count {
    font-size: 1.3rem;
    font-weight: 600;
    color: #a5b4fc;
    min-width: 72px;
}

.bulk-sep {
    width: 1px;
    height: 22px;
    background: rgba(255,255,255,.15);
    margin: 0 4px;
}

.bulk-sel {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    border-radius: var(--radius);
    padding: 5px 10px;
    font-size: 1.3rem;
    cursor: pointer;
    min-width: 130px;
}

.bulk-sel option {
    background: #1a1a2e;
    color: #fff;
}

.bulk-all-btn,
.bulk-clear-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    border-radius: var(--radius);
    padding: 5px 12px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: background .1s;
}

.bulk-all-btn:hover,
.bulk-clear-btn:hover {
    background: rgba(255,255,255,.12);
}

/* ── Trigger toggle switch ────────────────────────────────────── */

.trig-toggle {
    position: relative;
    width: 38px;
    height: 22px;
    background: #d0d5dd;
    border: none;
    border-radius: 99px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background .18s;
}

.trig-toggle.on {
    background: var(--green);
}

.trig-toggle-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: transform .18s;
    pointer-events: none;
}

.trig-toggle.on .trig-toggle-knob {
    transform: translateX(16px);
}

/* ── Trigger list item ────────────────────────────────────────── */

.trigger-list-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}

.trigger-list-item:last-child {
    border-bottom: 0;
}

.trig-toggle-wrap {
    padding-top: 2px;
    flex-shrink: 0;
}

.trig-info {
    flex: 1;
    min-width: 0;
}

.trig-name {
    font-weight: 600;
    font-size: 1.45rem;
    margin-bottom: 3px;
}

.trig-desc {
    color: var(--muted);
    font-size: 1.3rem;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trig-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 1.2rem;
    color: var(--muted);
}

.trig-meta-sep {
    color: var(--line);
}

.trig-fired {
    color: var(--blue);
    font-weight: 500;
}

.trig-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Trigger editor ───────────────────────────────────────────── */

.trig-editor h2 {
    margin: 0 0 20px;
    font-size: 1.6rem;
}

.trig-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 4px;
}

.trig-match-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.trig-match-label {
    font-size: 1.35rem;
    font-weight: 500;
    color: var(--muted);
}

.trig-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.35rem;
    cursor: pointer;
    font-weight: 500;
}

.trig-section {
    margin-bottom: 22px;
}

.trig-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.trig-section-title {
    font-weight: 600;
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}

.trig-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.trig-row:last-child {
    border-bottom: 0;
}

.trig-sel {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 1.35rem;
    background: #fff;
    min-width: 140px;
}

.trig-text-inp {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 1.35rem;
    min-width: 180px;
    flex: 1;
}

.trig-val-wrap {
    display: flex;
    align-items: center;
    flex: 1;
}

.trig-remove {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
    transition: color .1s;
}

.trig-remove:hover {
    color: var(--red);
}

.trig-empty-hint {
    color: var(--muted);
    font-size: 1.3rem;
    font-style: italic;
    margin: 8px 0 0;
}

/* ── Alert banner ─────────────────────────────────────────────── */

.alert-banner {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 1.35rem;
}

.alert-banner.error {
    background: #fff5f5;
    color: var(--red);
    border: 1px solid #fca5a5;
}

/* ── Priority badges (mailbox list) ─────────────────────────────── */

.ticket-subject-line {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.priority-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    flex-shrink: 0;
}

.priority-badge.high {
    background: #fff3e0;
    color: #e65100;
}

.priority-badge.urgent {
    background: #ffebee;
    color: #c62828;
}

/* ── Unread state ────────────────────────────────────────────────── */

.unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--blue);
    display: inline-block;
    flex-shrink: 0;
}

.ticket-unread-subject {
    font-weight: 700;
}

/* ── Priority buttons (ticket sidebar) ──────────────────────────── */

.priority-btns {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.prio-btn {
    padding: 5px 10px;
    font-size: 1.2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--soft);
    cursor: pointer;
    color: var(--muted);
    transition: all .15s;
}

.prio-btn:hover {
    background: #e8eaf6;
    color: var(--ink);
}

.prio-btn.prio-active {
    background: var(--soft);
    color: var(--ink);
    font-weight: 600;
    border-color: #9e9e9e;
}

.prio-btn.prio-active.low {
    background: #f1f8e9;
    border-color: #7cb342;
    color: #33691e;
}

.prio-btn.prio-active.normal {
    background: #e3f2fd;
    border-color: var(--blue);
    color: var(--blue);
}

.prio-btn.prio-active.high {
    background: #fff3e0;
    border-color: #e65100;
    color: #e65100;
}

.prio-btn.prio-active.urgent {
    background: #ffebee;
    border-color: #c62828;
    color: #c62828;
}

/* ── Activity timeline (ticket sidebar) ─────────────────────────── */

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #bdbdbd;
    flex-shrink: 0;
    margin-top: 4px;
}

.activity-dot.act-status   { background: var(--blue); }
.activity-dot.act-assign   { background: #43a047; }
.activity-dot.act-tag      { background: #00acc1; }
.activity-dot.act-priority { background: #e65100; }
.activity-dot.act-trigger  { background: #7b1fa2; }

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    display: block;
    font-size: 1.2rem;
    color: var(--muted);
    line-height: 1.4;
}

.activity-time {
    display: block;
    font-size: 1.1rem;
    color: #9e9e9e;
    margin-top: 1px;
}


/* ── Priority cards (new ticket form) ───────────────────────────── */

.prio-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.prio-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 2px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
    position: relative;
    user-select: none;
}

.prio-card:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

.prio-card input[type=radio] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.prio-card-icon { flex-shrink: 0; }
.prio-card-body { display: flex; flex-direction: column; gap: 1px; }
.prio-card-name { font-size: 1.35rem; font-weight: 600; }
.prio-card-desc { font-size: 1.15rem; color: var(--muted); line-height: 1.3; }

/* base (unselected) per-level colours */
.prio-card.low    { border-color: #aed581; background: #f9fce8; }
.prio-card.low    .prio-card-icon { color: #7cb342; }
.prio-card.low    .prio-card-name { color: #558b2f; }

.prio-card.normal { border-color: #90caf9; background: #e8f4fd; }
.prio-card.normal .prio-card-icon { color: #1e88e5; }
.prio-card.normal .prio-card-name { color: #1565c0; }

.prio-card.high   { border-color: #ffb74d; background: #fff8f0; }
.prio-card.high   .prio-card-icon { color: #e65100; }
.prio-card.high   .prio-card-name { color: #bf360c; }

.prio-card.urgent { border-color: #ef9a9a; background: #fff5f5; }
.prio-card.urgent .prio-card-icon { color: #c62828; }
.prio-card.urgent .prio-card-name { color: #b71c1c; }

/* checked: deepen border + background */
.prio-card.low.is-checked    { border-color: #7cb342; background: #dcedc8; box-shadow: 0 0 0 1px #7cb342; }
.prio-card.normal.is-checked { border-color: #1e88e5; background: #bbdefb; box-shadow: 0 0 0 1px #1e88e5; }
.prio-card.high.is-checked   { border-color: #e65100; background: #ffe0b2; box-shadow: 0 0 0 1px #e65100; }
.prio-card.urgent.is-checked { border-color: #c62828; background: #ffcdd2; box-shadow: 0 0 0 1px #c62828; }

@media (max-width: 640px) {
    .prio-cards { grid-template-columns: 1fr 1fr; }
}

/* ── Drop-zone file input ────────────────────────────────────────── */

.field-hint {
    font-weight: 400;
    color: var(--muted);
    font-size: 1.2rem;
    margin-left: 6px;
}

.drop-zone {
    border: 2px dashed var(--line);
    border-radius: 8px;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-align: center;
    background: var(--bg);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--blue);
    background: #e8f0fe;
}

.drop-zone.has-files { padding-bottom: 20px; }

.drop-zone input[type=file] { display: none; }

.drop-zone-icon { color: var(--muted); transition: color .15s; }
.drop-zone:hover .drop-zone-icon,
.drop-zone.drag-over .drop-zone-icon { color: var(--blue); }

.drop-zone-text {
    font-size: 1.4rem;
    color: var(--muted);
    margin: 0;
}

.drop-zone-browse {
    color: var(--blue);
    text-decoration: underline;
}

.drop-zone-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.drop-zone-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 1.3rem;
}

.dzi-icon   { color: var(--muted); flex-shrink: 0; }
.dzi-name   { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.dzi-size   { color: var(--muted); white-space: nowrap; flex-shrink: 0; font-size: 1.2rem; }
.dzi-remove {
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    transition: background .12s, color .12s;
}
.dzi-remove:hover { background: #fee2e2; color: #c62828; }

/* ── Pagination ──────────────────────────────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 0 4px;
}

.page-btn {
    display: inline-block;
    padding: 7px 18px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    font-size: 1.3rem;
    background: var(--panel);
    transition: background .12s;
}

.page-btn:hover {
    background: var(--soft);
    text-decoration: none;
}

.page-info {
    font-size: 1.3rem;
    color: var(--muted);
}
