/* ==========================================================================
   Portal design system — palette from the legacy portal (colors only).
   White background, slate text #4e5259, green accents #00e64d/#ccffdd/
   #f0fff5, warning mistyrose/#FFF6F5, hairline borders #F4F6F6/#e9ebec,
   osTicket blue #2a67ac and orange #fc9f41. Roboto-first font stack.
   Unbranded: no provider logo/wordmark anywhere.
   ========================================================================== */

:root {
    --p-bg:          #ffffff;
    --p-text:        #4e5259;
    --p-accent:      #00e64d;
    --p-accent-soft: #ccffdd;
    --p-accent-faint:#f0fff5;
    --p-warn-bg:     #FFF6F5;
    --p-warn-border: #ffe4e1;   /* mistyrose */
    --p-row-border:  #F4F6F6;
    --p-border:      #e9ebec;
    --p-gray:        #f5f5f5;
    --p-blue:        #2a67ac;
    --p-orange:      #fc9f41;
    --p-font:        "Roboto", Helvetica, Arial, sans-serif;

    /* Sidebar palette — extracted 2026-08-27 from console.vultr.com's shipped
       CSS variables (--vtw-sidebar-*, --vultr-navy-*). Content area keeps the
       legacy portal palette; only the sidebar/mobile bar use this scheme. */
    --p-side-bg:           #031059;   /* vultr-navy-500 */
    --p-side-border:       #316f99;   /* --vtw-sidebar-border */
    --p-side-text:         #999ebd;   /* --vtw-sidebar-foreground */
    --p-side-text-dim:     #cdcfde;   /* vultr-navy-100 */
    --p-side-active-bg:    #316f99;   /* layer2 (active item) */
    --p-side-section-bg:   #003165;   /* layer1 (open section) */
    --p-side-hover-bg:     rgba(0, 98, 202, 0.5);   /* accent 50% */
    --p-side-hover-muted:  rgba(49, 111, 153, 0.5); /* accent-muted 50% */
    --p-side-decor:        #68709b;   /* --vtw-sidebar-decor */
    --p-side-accent:       #007bfc;   /* vultr brand blue */
    --p-side-accent-light: #51b9ff;   /* vultr brand light blue */
    --p-side-white:        #ffffff;
}

body {
    color: var(--p-text);
    background: var(--p-bg);
    font-family: var(--p-font);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- shell: sidebar + content ---- */
.portal-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}
.portal-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ---- sidebar (offcanvas below lg, static at lg+) ---- */
.portal-sidebar {
    --bs-offcanvas-width: 280px;
    background: var(--p-side-bg);
    border-right: 1px solid var(--p-side-border);
}
@media (min-width: 992px) {
    .portal-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        width: 250px;
        flex: 0 0 250px;
        z-index: 10;
        /* Bootstrap's .offcanvas-lg sets background-color:transparent!important
           at lg+ — force the sidebar palette back over it. */
        background-color: var(--p-side-bg) !important;
    }
}
.portal-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem 0.75rem 0.75rem;
}
.portal-offcanvas-header { justify-content: flex-end; }
.portal-sidebar .btn-close {
    filter: invert(1) grayscale(100%);
    opacity: 0.8;
}
.portal-navlist {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    overflow-y: auto;
}
.portal-navlink {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.65rem;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 6px;
    background: none;
    color: var(--p-side-text);
    font-size: 0.95rem;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}
.portal-navlink:hover {
    color: var(--p-side-white);
    background: var(--p-side-hover-bg);
}
.portal-navlink.active {
    color: var(--p-side-white);
    font-weight: 500;
    background: var(--p-side-active-bg);
    border-left-color: var(--p-side-accent);
}
.portal-nav-icon { width: 1.25em; margin-right: 0.45rem; text-align: center; }
.portal-menugroup-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--p-side-text);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-align: left;
    cursor: pointer;
}
.portal-menugroup-btn:hover {
    color: var(--p-side-white);
    background: var(--p-side-hover-bg);
}
.portal-menugroup-btn[aria-expanded="true"] {
    background: var(--p-side-section-bg);
    color: var(--p-side-white);
}
.portal-menugroup-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    opacity: 0.8;
    transition: transform 0.2s ease;
}
.portal-menugroup-btn[aria-expanded="true"] .portal-menugroup-chevron {
    transform: rotate(90deg);
}
.portal-sublinks {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0 4px 1.05rem;
}
.portal-sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid rgba(49, 111, 153, 0.4);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.portal-sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.45rem 0.65rem;
    color: var(--p-side-text-dim);
    opacity: 0.85;
    font-size: 0.85rem;
}

/* ---- mobile top bar ---- */
.portal-mobilebar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--p-side-border);
    background: var(--p-side-bg);
    flex-shrink: 0;
}
.portal-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--p-side-border);
    border-radius: 6px;
    background: transparent;
    color: var(--p-side-text-dim);
}
.portal-mobilebar-spacer { flex: 1 1 auto; }

.portal-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--p-accent-soft);
    color: var(--p-blue);
}
.portal-brand-mark-lg { width: 44px; height: 44px; border-radius: 12px; font-size: 1.25rem; }

.portal-accountbar {
    background: var(--p-gray);
    border-bottom: 1px solid var(--p-row-border);
    padding: 0.4rem 0;
    font-size: 0.9rem;
}
.portal-accountbar-label { color: var(--p-text); opacity: 0.8; }

/* ---- page scaffolding ---- */
.portal-main { flex: 1 0 auto; padding: 1.5rem 1rem 2.5rem; }
.portal-page-title { font-size: 1.6rem; font-weight: 500; margin-bottom: 0.2rem; }
.portal-page-sub { color: var(--p-text); opacity: 0.75; margin-bottom: 1.25rem; }

.portal-footer {
    border-top: 1px solid var(--p-row-border);
    color: var(--p-text);
    opacity: 0.7;
    padding: 0.75rem 0;
    font-size: 0.85rem;
}

/* ---- cards & tables ---- */
.portal-card {
    background: var(--p-bg);
    border: 1px solid var(--p-row-border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(78, 82, 89, 0.05);
}
.portal-card .card-header.portal-card-header {
    background: var(--p-bg);
    border-bottom: 1px solid var(--p-row-border);
    font-weight: 500;
    color: var(--p-text);
}
.portal-card-accent { border-left: 4px solid var(--p-accent); }

.portal-table { --bs-table-bg: transparent; }
.portal-table thead th {
    color: var(--p-text);
    opacity: 0.75;
    font-weight: 500;
    border-bottom: 1px solid var(--p-border);
    white-space: nowrap;
}
.portal-table tbody td { border-bottom: 1px solid var(--p-row-border); }
.portal-table tbody tr:last-child td { border-bottom: 0; }
.portal-table tbody tr:hover td { background: var(--p-accent-faint); }

.portal-link { color: var(--p-blue); text-decoration: none; }
.portal-link:hover { text-decoration: underline; }

/* ---- stats ---- */
.portal-stat-label { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.7; }
.portal-stat-value { font-size: 1.5rem; font-weight: 500; color: var(--p-text); margin: 0.15rem 0; }
.portal-stat-hint { font-size: 0.85rem; }
.portal-stat-hint a { color: var(--p-blue); }

.portal-empty-icon { font-size: 2.5rem; color: var(--p-accent); margin-bottom: 0.75rem; }

/* ---- badges ---- */
.portal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
}
.portal-badge-ok   { background: var(--p-accent-soft); color: #0b6b2e; }
.portal-badge-off  { background: var(--p-gray); color: var(--p-text); opacity: 0.8; }
.portal-badge-warn { background: var(--p-warn-bg); color: #a33; border: 1px solid var(--p-warn-border); }
.portal-badge-paid { background: #e8f0f9; color: var(--p-blue); }
.portal-domain { font-family: var(--p-mono, ui-monospace, SFMono-Regular, Menlo, monospace); padding: 0.1rem 0; }

/* ---- order number picker ---- */
.order-picker {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 100;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #ccc;
    background: #fff;
    font-size: 13px;
    text-align: left;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.order-picker-head { font-weight: bold; padding: 4px 6px; background: #f5f5f5; border-bottom: 1px solid #ddd; }
.order-picker-item { cursor: pointer; padding: 4px 8px; border-bottom: 1px solid #eee; }
.order-picker-item:hover { background: #eef4fb; }
.order-picker-empty { padding: 8px; color: #c00; font-weight: bold; }

/* ---- buttons ---- */
.portal-btn-primary {
    background: var(--p-blue);
    border: 1px solid var(--p-blue);
    color: #fff;
}
.portal-btn-primary:hover, .portal-btn-primary:focus {
    background: #23588f;
    border-color: #23588f;
    color: #fff;
}
.portal-btn-ghost {
    background: var(--p-bg);
    border: 1px solid var(--p-border);
    color: var(--p-text);
}
.portal-btn-ghost:hover, .portal-btn-ghost.active {
    background: var(--p-accent-faint);
    border-color: var(--p-accent);
    color: var(--p-text);
}

/* ---- activity feed ---- */
.portal-activity li {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--p-row-border);
}
.portal-activity li:last-child { border-bottom: 0; }
.portal-activity-dot { font-size: 0.5rem; color: var(--p-accent); }

/* ---- alerts ---- */
.portal-alert-danger {
    background: var(--p-warn-bg);
    border: 1px solid var(--p-warn-border);
    color: var(--p-text);
}
.portal-alert-ok {
    background: var(--p-accent-faint);
    border: 1px solid var(--p-accent-soft);
    color: var(--p-text);
}

/* Call recordings status banners (Dave, 2026-08-31) */
.portal-alert-rec-on {
    background: #ccffdd;
    border: 1px solid #57d98a;
    color: #175c33;
}
.portal-alert-rec-off {
    background: #ffe0ea;
    border: 1px solid #ff9cb9;
    color: #7c2240;
}
.portal-alert-rec-off a {
    color: #7c2240;
    text-decoration: underline;
}

/* ---- inline save status (keys grid, htmx) ---- */
.portal-save-ok { color: #1d9e46; }
.portal-save-bad { color: #d64541; }

/* ---- ticket thread ---- */
.portal-thread-entry {
    border-bottom: 1px solid var(--p-row-border);
    padding: 0.85rem 0;
}
.portal-thread-entry:first-child { padding-top: 0; }
.portal-thread-entry:last-child { border-bottom: 0; }
.portal-thread-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.portal-thread-body { color: var(--p-text); }

/* ---- login page ---- */
.portal-login-body {
    background: var(--p-gray);
    display: flex;
    align-items: center;
    justify-content: center;
}
.portal-login-wrap {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}
.portal-login-card {
    background: var(--p-bg);
    border: 1px solid var(--p-row-border);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(78, 82, 89, 0.08);
    padding: 2rem 1.75rem;
}
.portal-login-head { text-align: center; margin-bottom: 1.5rem; }
.portal-login-title { font-size: 1.4rem; font-weight: 500; margin: 0.75rem 0 0.25rem; }
.portal-login-sub { color: var(--p-text); opacity: 0.7; margin: 0; }
.portal-login-foot {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--p-row-border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--p-text);
    opacity: 0.75;
}

/* ---- forms ---- */
.form-control:focus, .form-select:focus {
    border-color: var(--p-blue);
    box-shadow: 0 0 0 0.15rem rgba(42, 103, 172, 0.15);
}

/* ---- mobile refinements ---- */
@media (max-width: 575.98px) {
    .portal-main { padding: 1rem 0.75rem 2rem; }
    .portal-page-title { font-size: 1.35rem; }
    .portal-stat-value { font-size: 1.3rem; }
}

/* Nested sidebar submenu (Support -> Forms -> each form) 2026-08-31 */
.portal-navlink-chevron {
    flex: 0 0 auto;
    width: auto;
    padding-left: 0.35rem;
    padding-right: 0.75rem;
}
.portal-sublinks-nested {
    padding-left: 0.85rem;
    margin-left: 0.85rem;
    border-left: 1px solid rgba(49, 111, 153, 0.4);
}
.portal-sublinks-nested .portal-navlink {
    font-size: 0.88rem;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

/* Portal service forms: instructional info blocks 2026-08-31 */
.portal-form-info {
    padding: 0.75rem 1rem;
    background: rgba(49, 111, 153, 0.08);
    border-left: 3px solid #316f99;
    border-radius: 6px;
    font-size: 0.95rem;
}
.portal-form-info ul {
    margin-bottom: 0;
}
.portal-form-info a {
    word-break: break-all;
}
