.hd-portal {
    /* Mirrors byjenke.com's Bricks theme: Lexend is self-hosted and
       loaded site-wide by the active theme, so it's referenced by name
       here rather than bundled — this inherits it instead of duplicating
       it. Falls back to the system stack wherever it isn't present. */
    --hd-font: 'Lexend', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --hd-border: #d6d6d6;
    --hd-bg: #f2f2f2;
    --hd-text: #0d0d0d;
    --hd-text-muted: #46464a;
    --hd-primary: #0d0d0d;
    --hd-primary-dark: #2b2b2b;
    --hd-accent: #ff5314;
    --hd-radius: 10px;
    --hd-radius-pill: 999px;

    max-width: 880px;
    margin: 0 auto;
    color: var(--hd-text);
    font-family: var(--hd-font);
    font-size: 15px;
    line-height: 1.5;
}

/* Sits above .hd-portal, outside its scope, so it repeats the alignment
   (max-width/centering) and font rather than relying on .hd-portal's CSS
   variables. */
.hd-customer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 880px;
    margin: 0 auto 20px;
    padding: 10px 10px 10px 14px;
    border: 1px solid #d6d6d6;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(13, 13, 13, 0.05);
    font-family: 'Lexend', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #0d0d0d;
}

.hd-customer-bar__user {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-weight: 600;
}

.hd-customer-bar__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #0d0d0d;
    color: #f2f2f2;
}

.hd-customer-bar__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hd-customer-bar__logout {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #ff5314;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.hd-customer-bar__logout:hover {
    background: rgba(255, 83, 20, 0.08);
    border-color: rgba(255, 83, 20, 0.3);
}

.hd-customer-bar__logout:focus-visible {
    outline: 3px solid #ff5314;
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .hd-customer-bar {
        padding: 8px 8px 8px 12px;
    }

    .hd-customer-bar__logout span {
        display: none;
    }
}

.hd-portal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.hd-portal__header h2 {
    margin: 0 0 8px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hd-pill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 20px;
}

.hd-portal__subheading {
    margin: 0 0 12px;
    font-size: 17px;
}

.hd-button {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    gap: 6px;
    min-height: 40px;
    padding: 9px 18px;
    border-radius: var(--hd-radius-pill);
    border: 1px solid var(--hd-border);
    background: #fff;
    color: var(--hd-text);
    text-decoration: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.hd-button:hover {
    background: var(--hd-bg);
    color: var(--hd-text);
}

.hd-button:focus-visible {
    outline: 3px solid var(--hd-accent);
    outline-offset: 2px;
}

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

.hd-button--primary:hover {
    background: var(--hd-primary-dark);
    border-color: var(--hd-primary-dark);
    color: #fff;
}

.hd-button[disabled] {
    opacity: 0.6;
    cursor: default;
}

/* Ticket table */

.hd-ticket-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    background: #fff;
}

.hd-ticket-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.hd-ticket-table th,
.hd-ticket-table td {
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
}

.hd-ticket-table th {
    color: var(--hd-text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--hd-border);
}

.hd-ticket-table tbody tr:not(:last-child) td {
    border-bottom: 1px solid var(--hd-border);
}

.hd-ticket-table tbody tr:hover {
    background: var(--hd-bg);
}

.hd-ticket-table__row {
    cursor: pointer;
}

.hd-ticket-table__id {
    color: var(--hd-text-muted);
}

.hd-ticket-table__subject {
    display: block;
    color: inherit;
    font-weight: 600;
    text-decoration: none;
    border: none;
}

.hd-ticket-table__subject:hover {
    text-decoration: underline;
}

.hd-ticket-table__excerpt {
    margin-top: 2px;
    color: var(--hd-text-muted);
    font-size: 12px;
    font-weight: 400;
}

.hd-ticket-table__updated {
    color: var(--hd-text-muted);
}

.hd-empty {
    padding: 32px;
    text-align: center;
    color: var(--hd-text-muted);
    border: 1px dashed var(--hd-border);
    border-radius: var(--hd-radius);
}

/* Queue highlight */

.hd-queue-highlight {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
}

.hd-queue-highlight strong {
    font-weight: 700;
}

.hd-queue-highlight__icon {
    display: inline-flex;
    flex-shrink: 0;
}

.hd-queue-highlight--blue {
    border-color: rgba(37, 99, 235, 0.3);
    background: rgba(59, 130, 246, 0.1);
    color: #1e3a8a;
}

.hd-queue-highlight--blue .hd-queue-highlight__icon {
    color: #2563eb;
}

.hd-queue-highlight--yellow {
    border-color: rgba(202, 138, 4, 0.3);
    background: rgba(250, 204, 21, 0.18);
    color: #854d0e;
}

.hd-queue-highlight--yellow .hd-queue-highlight__icon {
    color: #ca8a04;
}

.hd-queue-highlight--red {
    border-color: rgba(255, 83, 20, 0.3);
    background: rgba(255, 83, 20, 0.08);
    color: #7a2c0f;
}

.hd-queue-highlight--red .hd-queue-highlight__icon {
    color: var(--hd-accent);
}

/* Stat widgets */

.hd-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 0 0 20px;
}

.hd-stat-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    background: #fff;
}

.hd-stat-card__value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
}

.hd-stat-card__label {
    font-size: 13px;
    color: var(--hd-text-muted);
}

@media (max-width: 600px) {
    .hd-stat-grid {
        grid-template-columns: 1fr;
    }
}

/* Status pills */

.hd-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.hd-pill--status-open { background: #dbeafe; color: #1e40af; }
.hd-pill--status-in_progress { background: #ede9fe; color: #6d28d9; }
.hd-pill--status-pending_customer { background: #fef3c7; color: #92400e; }
.hd-pill--status-resolved { background: #dcfce7; color: #166534; }
.hd-pill--status-closed { background: #e5e7eb; color: #374151; }

.hd-pill--priority-low { background: #e5e7eb; color: #374151; }
.hd-pill--priority-normal { background: #dbeafe; color: #1e40af; }
.hd-pill--priority-high { background: #ffedd5; color: #9a3412; }
.hd-pill--priority-urgent { background: #fee2e2; color: #991b1b; }

/* Forms */

.hd-form label {
    display: block;
    color: var(--hd-text);
    font-weight: 600;
    margin-bottom: 6px;
}

.hd-input,
.hd-form textarea,
.hd-form select,
.hd-form input[type="text"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--hd-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    color: var(--hd-text);
    box-sizing: border-box;
}

.hd-form textarea {
    resize: vertical;
}

.hd-input:focus-visible,
.hd-form textarea:focus-visible,
.hd-form select:focus-visible,
.hd-form input[type="text"]:focus-visible {
    outline: 3px solid var(--hd-accent);
    outline-offset: 1px;
    border-color: var(--hd-accent);
}

.hd-form small.description {
    display: block;
    margin-top: 6px;
    color: var(--hd-text-muted);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
}

.hd-form input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: none;
    line-height: inherit;
}

.hd-file-input {
    position: relative;
    display: inline-block;
}

.hd-file-input__button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-pill);
    background: #fff;
    color: var(--hd-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.hd-file-input__button:hover {
    background: var(--hd-bg);
    border-color: var(--hd-primary);
}

.hd-form input[type="file"]:focus-visible ~ .hd-file-input__button {
    outline: 3px solid var(--hd-accent);
    outline-offset: 1px;
}

.hd-notice {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.hd-notice--success { background: #dcfce7; color: #166534; }
.hd-notice--error { background: #fee2e2; color: #991b1b; }

/* Thread */

.hd-ticket-thread {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.hd-message {
    padding: 14px 16px;
    border-radius: var(--hd-radius);
    border: 1px solid var(--hd-border);
    background: #fff;
}

.hd-message--agent {
    background: #f0f5ff;
    border-color: #dbe6fe;
}

.hd-message__meta {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--hd-text-muted);
}

.hd-message__role {
    font-weight: 700;
    color: var(--hd-text);
}

.hd-message__body p:first-child {
    margin-top: 0;
}

.hd-message__body p:last-child {
    margin-bottom: 0;
}

.hd-message__attachments {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hd-message__attachments li a {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--hd-border);
    border-radius: 999px;
    font-size: 12px;
    text-decoration: none;
    background: var(--hd-bg);
}

.hd-reply-form {
    padding-top: 8px;
    border-top: 1px solid var(--hd-border);
}

/* Login */

.hd-portal--login {
    max-width: 500px;
    margin: 48px auto;
}

.hd-login-card {
    background: #fff;
    border: 1px solid var(--hd-border);
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: 0 12px 32px rgba(13, 13, 13, 0.1);
}

.hd-login-card__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.hd-login-card__logo {
    display: block;
    height: 22px;
    width: auto;
}

.hd-login-card__eyebrow {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--hd-text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.hd-login-card h2 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.hd-login-card__intro {
    margin: 0 0 28px;
    color: var(--hd-text-muted);
    font-size: 15px;
}

.hd-login-card #loginform p {
    margin: 0 0 16px;
}

.hd-login-card label {
    display: block;
    margin-bottom: 6px;
    color: var(--hd-text);
    font-weight: 600;
    font-size: 13px;
}

.hd-login-card input.input {
    box-sizing: border-box;
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid var(--hd-border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    background: var(--hd-bg);
    color: var(--hd-text);
}

.hd-login-card input.input:focus-visible {
    outline: 3px solid var(--hd-accent);
    outline-offset: 1px;
    border-color: var(--hd-accent);
}

.hd-login-card .login-remember label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    font-size: 14px;
    color: var(--hd-text);
}

.hd-login-card .login-remember input {
    width: 18px;
    height: 18px;
    accent-color: var(--hd-primary);
}

.hd-login-card .login-submit {
    margin: 24px 0 0 !important;
}

.hd-login-card input#wp-submit {
    width: 100%;
    min-height: 48px;
    border: none;
    border-radius: var(--hd-radius-pill);
    background: var(--hd-primary);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.hd-login-card input#wp-submit:hover {
    background: var(--hd-primary-dark);
}

.hd-login-card input#wp-submit:focus-visible {
    outline: 3px solid var(--hd-accent);
    outline-offset: 2px;
}

.hd-login-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 20px 0 0;
    font-size: 14px;
    text-align: center;
}

.hd-login-links a {
    color: var(--hd-text);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--hd-accent);
    text-underline-offset: 3px;
    border: none;
}

.hd-login-links a:hover {
    color: var(--hd-accent);
}

@media (max-width: 600px) {
    .hd-portal__header {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .hd-login-card {
        padding: 28px 20px;
        border-radius: 14px;
    }

    .hd-login-card h2 {
        font-size: 24px;
    }
}
