/* ── Variables ─────────────────────────────────────────────────────── */
:root {
    --teal:        #5ebdd5;
    --teal-dark:   #397180;
    --teal-mid:    #4a91a3;
    --teal-light:  #95c9d6;
    --teal-pale:   #e8f6fa;

    --pink:        #ff2d78;
    --pink-light:  #ff5a9e;
    --pink-pale:   #fce4ec;

    --navy:        #0f1b2d;
    --navy-light:  #1a2d4a;

    --green:       #22c55e;
    --amber:       #f59e0b;
    --purple:      #8b5cf6;

    --bg:          #fafbfc;
    --surface:     #ffffff;
    --surface-alt: #cbd5e1;
    --border:      #e2e8f0;
    --text:        #1e293b;
    --text-mid:    #475569;
    --text-light:  #94a3b8;

    --radius:      10px;
    --radius-sm:   6px;
    --shadow:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg:   0 4px 12px rgba(0,0,0,0.08);
}

/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--teal-dark); text-decoration: none; }
a:hover { color: var(--teal); }

/* ── Container ────────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Header ───────────────────────────────────────────────────────── */
.header {
    background: var(--navy);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
}
.logo img { display: block; }

.header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-link {
    color: var(--teal-light);
    font-size: 14px;
    font-weight: 500;
}
.header-link:hover {
    color: #fff;
}

.header-email {
    color: var(--text-light);
    font-size: 14px;
}

/* ── Main ─────────────────────────────────────────────────────────── */
.main {
    flex: 1;
    padding-top: 32px;
    padding-bottom: 60px;
}

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
    padding: 20px 0;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

/* ── Card ─────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* ── Page Title ───────────────────────────────────────────────────── */
.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 28px;
}

/* ── Section ──────────────────────────────────────────────────────── */
.account-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    font-size: 22px;
    color: var(--teal);
}

/* ── Table ────────────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    margin: 0 -24px -24px;
    padding: 0 24px 24px;
}

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

.table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-mid);
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 12px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--teal-pale);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.td-product {
    font-weight: 600;
    color: var(--navy);
}

.cell-date {
    white-space: nowrap;
}

/* ── Badges ───────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-green  { background: #dcfce7; color: #166534; }
.badge-teal   { background: var(--teal-pale); color: var(--teal-dark); }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-red    { background: var(--pink-pale); color: #9f1239; }
.badge-grey   { background: #e2e8f0; color: #475569; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-slate  { background: #f1f5f9; color: #64748b; }

/* ── Server Status ───────────────────────────────────────────────── */
.server-status {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    padding: 12px 16px;
    margin-top: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-mid);
}

.server-status-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.server-status-item .label {
    font-weight: 600;
    color: var(--text);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.green  { background: var(--green); }
.status-dot.amber  { background: var(--amber); }
.status-dot.grey   { background: #9ca3af; }
.status-dot.red    { background: #ef4444; }

.status-dot.green {
    animation: status-dot-pulse 1.8s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6);
}

@keyframes status-dot-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .status-dot.green { animation: none; }
}

/* ── Office Status ───────────────────────────────────────────────── */
.office-status-bar {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.office-status-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 8px;
    padding-bottom: 8px;
    flex-wrap: wrap;
}

.office-status {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-mid);
    flex-wrap: wrap;
}

.office-status .status-dot {
    align-self: center;
    transform: translateY(1px);
}

.office-status-heading {
    font-weight: 600;
    color: var(--text);
}

.office-status-sep {
    color: var(--text-mid);
}

.office-status--open .office-status-heading {
    color: #166534;
}

.office-status--closed .office-status-heading {
    color: #9f1239;
}

/* ── Upgrade Options ─────────────────────────────────────────────── */
.upgrade-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upgrade-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.upgrade-option h4 {
    margin: 0 0 2px;
    font-size: 16px;
    color: var(--navy);
}

.upgrade-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--teal-dark);
    margin: 0;
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}

.btn-sm {
    padding: 7px 16px;
    font-size: 13px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-primary {
    background: var(--teal);
    color: #fff;
}
.btn-primary:hover {
    background: var(--teal-dark);
    color: #fff;
}

.btn-success {
    background: var(--green);
    color: #fff;
}
.btn-success:hover {
    background: #16a34a;
    color: #fff;
}

.btn-danger {
    background: var(--pink);
    color: #fff;
}
.btn-danger:hover {
    background: #e0265e;
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--teal);
    border: 1px solid var(--teal);
}
.btn-outline:hover {
    background: var(--teal);
    color: #fff;
}

/* ── Pagination ───────────────────────────────────────────────────── */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pagination-current {
    cursor: default;
}

/* ── Ticket Conversation ──────────────────────────────────────────── */
.ticket-conversation {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment {
    border-radius: var(--radius);
    padding: 20px 24px;
    width: 100%;
    box-shadow: var(--shadow);
}

.comment-customer {
    background: var(--teal-pale);
    border: 1px solid var(--teal-light);
    border-left: 4px solid var(--teal);
    align-self: flex-end;
}

.comment-agent {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--navy);
    align-self: flex-start;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.comment-customer .comment-meta {
    border-bottom-color: var(--teal-light);
}

.comment-body {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    word-wrap: break-word;
}

.comment-body p { margin: 0 0 8px; }
.comment-body p:last-child { margin-bottom: 0; }
.comment-body a { color: var(--teal-dark); text-decoration: underline; }
.comment-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 8px 0; }

.comment-attachments {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.comment-who {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    user-select: none;
}

.avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Forms ────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

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

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea.form-input {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

.form-input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(94, 189, 213, 0.15);
}

.form-input::placeholder {
    color: var(--text-light);
}

.inline-form {
    display: inline;
}
.action-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}
.action-stack--compact {
    min-width: 70px;
}
.action-stack .inline-form {
    display: block;
}
.action-stack .btn {
    width: 100%;
}
.critical-ticket-option {
    background: #fff8f0;
    border: 1px solid #f0ad4e;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}
.checkbox-label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    cursor: pointer;
    flex-wrap: wrap;
}
.checkbox-label input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}
.critical-badge {
    font-weight: 600;
    color: #c0392b;
    font-size: 14px;
}
.critical-hint {
    font-size: 12px;
    color: var(--text-mid);
    width: 100%;
    padding-left: 22px;
}

/* ── Login ────────────────────────────────────────────────────────── */
.login-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 180px);
}

.login-shortcuts {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 420px;
    margin-bottom: 16px;
}
.login-shortcuts .btn {
    flex: 1;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-mid);
    font-size: 15px;
    margin-bottom: 16px;
}
.login-features {
    color: var(--text-mid);
    font-size: 14px;
    margin: 0 0 28px 20px;
    padding: 0;
    list-style: disc;
    text-align: left;
}
.login-features li {
    margin-bottom: 4px;
}

.login-form .btn {
    margin-top: 8px;
}

/* ── Alerts ───────────────────────────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 24px;
    font-weight: 500;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: var(--pink-pale);
    color: #9f1239;
    border: 1px solid #fecdd3;
}

.alert-info {
    background: var(--teal-pale);
    color: var(--teal-dark);
    border: 1px solid var(--teal-light);
}

/* ── Modal ────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 27, 45, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 36px 40px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    text-align: center;
}

.modal-box h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 12px;
}

.modal-box p {
    color: var(--text-mid);
    line-height: 1.6;
    margin-bottom: 0;
}

/* ── Page header (title + actions row) ────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}
.page-header .page-title { margin-bottom: 0; }
.page-header-actions {
    display: flex;
    gap: 8px;
}

.subs-filter {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-light);
}
.subscription-row--inactive { display: none; }
.card:has(.subs-filter-input:checked) .subscription-row--inactive {
    display: table-row;
}
/* Strip the bottom border from the last visible row when inactive rows are
   hidden (otherwise it applies to a display:none row further down). */
.card:not(:has(.subs-filter-input:checked))
    .table tbody tr:not(.subscription-row--inactive):not(:has(~ tr:not(.subscription-row--inactive))) td {
    border-bottom: none;
}
.page-subtitle {
    font-size: 13px;
}
.page-title--with-sub { margin-top: 8px; }
.page-meta { margin-top: 8px; }
.page-meta .text-muted { margin-left: 8px; }

/* ── Form grid (used across account forms) ────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 500px;
}
.form-grid--end { align-items: end; }
.form-grid--auto {
    grid-template-columns: 1fr auto;
    align-items: end;
}
.form-grid .form-group { margin-bottom: 0; }
.form-grid-full { grid-column: 1 / -1; }
.form-grid-submit { margin-top: 16px; }
.form-group--wide { max-width: 500px; }
.input-upper { text-transform: uppercase; }

/* ── Admin banner & controls ──────────────────────────────────────── */
.admin-banner {
    margin-bottom: 24px;
    padding: 16px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}
.admin-banner-form {
    display: inline;
    margin-left: 8px;
}
.admin-switch-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
}
.admin-switch-input {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

/* ── Callout card (e.g. "Set a password") ─────────────────────────── */
.callout-card {
    margin-bottom: 24px;
    border-left: 4px solid #2563eb;
}

/* ── Ticket view ──────────────────────────────────────────────────── */
.reply-card { margin-top: 24px; }
.reply-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
}
.reply-actions-close {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}
.form-input--file {
    padding: 8px 10px;
}
.closed-notice { margin-top: 24px; }

/* ── VAT section ──────────────────────────────────────────────────── */
.vat-current { margin-bottom: 12px; }
.vat-current .badge { margin-left: 6px; }
.vat-help { font-size: 13px; }
.vat-intro { margin-bottom: 12px; }

/* ── Password requirements list ───────────────────────────────────── */
.pw-requirements {
    font-size: 13px;
    margin: 10px 0 14px;
    padding-left: 18px;
}
.pw-requirements .is-pass { color: #16a34a; }

/* ── Modal actions row ────────────────────────────────────────────── */
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* ── Small misc ───────────────────────────────────────────────────── */
.badge-tiny { font-size: 10px; }
.hr-soft {
    margin: 16px 0;
    border: none;
    border-top: 1px solid var(--border);
}
.email-hint {
    margin-top: 12px;
    font-size: 13px;
}
.section-intro { margin-bottom: 16px; }
.login-help {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
}

/* ── Utilities ────────────────────────────────────────────────────── */
.text-muted { color: var(--text-light); }
.hidden { display: none !important; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

/* ── Hamburger ────────────────────────────────────────────────────── */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    z-index: 110;
}
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    margin: 5px 0;
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .hamburger { display: block; }

    .header-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--navy);
        padding: 12px 20px 16px;
        gap: 0;
        border-top: 1px solid var(--navy-light);
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }
    .header-nav.open { display: flex; }
    .header-nav .header-link,
    .header-nav .btn {
        padding: 10px 0;
        font-size: 15px;
        width: 100%;
        text-align: left;
    }
    .header-nav .btn {
        margin-top: 4px;
        text-align: center;
    }

    .login-card { padding: 28px 20px; }

    .table { font-size: 13px; }
    .table th, .table td { padding: 8px; }

    .card { padding: 16px; }
    .table-wrap { margin: 0 -16px -16px; padding: 0 16px 16px; }

    .page-title { font-size: 22px; }
    .section-title { font-size: 17px; }

    .hide-md { display: none; }
    .usage-cell { min-width: 110px; }
    .pagination .btn { padding: 6px 10px; font-size: 13px; }
}

@media (max-width: 640px) {
    .hide-sm { display: none; }
    .card-title { font-size: 16px; }
    .table { font-size: 12px; }
    .table th, .table td { padding: 8px 6px; }
    .badge { font-size: 10px; padding: 2px 6px; }
    .td-product { word-break: break-word; }
    .action-stack { min-width: 0; }
    .action-stack .btn { padding: 6px 8px; font-size: 12px; white-space: normal; }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .page-header-actions { flex-wrap: wrap; }
}

/* ── Accessibility helpers ────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -10000px;
    top: 6px;
    background: #0f172a;
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    z-index: 9999;
    text-decoration: none;
    font-weight: 600;
}
.skip-link:focus {
    left: 16px;
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--teal-dark, #0e7490);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Usage bars (cPanel disk / bandwidth) ─────────────────────────── */
.usage-cell {
    min-width: 140px;
}
.usage-text {
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 4px;
}
.usage-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}
.usage-bar-fill {
    height: 100%;
    background: #22c55e;
    transition: width 0.3s ease;
}
.usage-bar--warn .usage-bar-fill {
    background: #f59e0b;
}
.usage-bar--danger .usage-bar-fill {
    background: #ef4444;
}

.alert-compact {
    padding: 10px 14px;
    font-size: 13px;
    margin: 0;
}
.usage-warning-row td {
    padding-top: 0;
    padding-bottom: 12px;
}
