/* BXJ Technologies — Autotask Archive theme
   Brand blue sampled from the BXJ wordmark. All colors are declared as CSS
   custom properties on :root so Bootstrap component overrides stay thin. */

:root {
    --bxj-blue: #1F3DB6;
    --bxj-blue-700: #182FA1;
    --bxj-blue-800: #122B8C;
    --bxj-blue-050: #EEF1FB;
    --bxj-ink: #1B1F2A;
    --bxj-ink-soft: #475069;
    --bxj-muted: #6B7589;
    --bxj-canvas: #F4F6FB;
    --bxj-card: #FFFFFF;
    --bxj-border: #E2E6EF;
    --bxj-success: #198754;
    --bxj-warn: #B45309;
    --bxj-danger: #B91C1C;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04), 0 1px 1px rgba(17, 24, 39, 0.03);
    --shadow-md: 0 4px 10px rgba(17, 24, 39, 0.06), 0 2px 4px rgba(17, 24, 39, 0.04);
    --shadow-lg: 0 10px 25px rgba(17, 24, 39, 0.08), 0 4px 8px rgba(17, 24, 39, 0.04);

    /* Bootstrap primary override */
    --bs-primary: var(--bxj-blue);
    --bs-primary-rgb: 31, 61, 182;
    --bs-link-color: var(--bxj-blue);
    --bs-link-hover-color: var(--bxj-blue-800);
}

/* --------------------------------- Base --------------------------------- */

html, body {
    height: 100%;
}

body {
    font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    background: var(--bxj-canvas);
    color: var(--bxj-ink);
    font-feature-settings: "ss01", "cv11";
    letter-spacing: -0.005em;
}

a { text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { color: var(--bxj-ink); letter-spacing: -0.015em; }

code, pre, kbd {
    font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

/* --------------------------------- Nav ---------------------------------- */

.app-navbar {
    background: #0C1328;
    color: #fff;
    padding: 0.5rem 1rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.app-navbar .brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #fff;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.app-navbar .brand:hover { text-decoration: none; color: #fff; }
.app-navbar .brand img {
    height: 28px;
    width: auto;
    background: #fff;
    padding: 2px 6px;
    border-radius: 4px;
}
.app-navbar .brand .brand-label {
    display: inline-flex;
    flex-direction: column;
    line-height: 1;
}
.app-navbar .brand .brand-label small {
    font-size: 0.65rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.app-navbar .nav-link {
    color: rgba(255,255,255,0.78);
    font-weight: 500;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}
.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.app-navbar .nav-search {
    position: relative;
    min-width: 320px;
}
.app-navbar .nav-search .form-control {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding-left: 2.3rem;
}
.app-navbar .nav-search .form-control::placeholder { color: rgba(255,255,255,0.55); }
.app-navbar .nav-search .form-control:focus {
    background: rgba(255,255,255,0.14);
    border-color: var(--bxj-blue);
    box-shadow: 0 0 0 3px rgba(31, 61, 182, 0.25);
    color: #fff;
}
.app-navbar .nav-search::before {
    content: "";
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: no-repeat center/contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");
}

/* ------------------------------- Buttons -------------------------------- */

.btn-primary {
    background: var(--bxj-blue);
    border-color: var(--bxj-blue);
    font-weight: 500;
    letter-spacing: -0.005em;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--bxj-blue-700);
    border-color: var(--bxj-blue-700);
}
.btn-outline-primary {
    color: var(--bxj-blue);
    border-color: var(--bxj-blue);
}
.btn-outline-primary:hover {
    background: var(--bxj-blue);
    border-color: var(--bxj-blue);
}
.btn, .form-control, .form-select {
    border-radius: var(--radius-sm);
}
.btn { font-weight: 500; }

/* -------------------------------- Cards --------------------------------- */

.card {
    background: var(--bxj-card);
    border: 1px solid var(--bxj-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
}
.stat-card .label {
    font-size: 0.75rem;
    color: var(--bxj-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.stat-card .value {
    font-size: 1.75rem;
    font-weight: 650;
    letter-spacing: -0.025em;
    color: var(--bxj-ink);
}
.stat-card .sub { font-size: 0.8rem; color: var(--bxj-muted); }

.stat-card.good .value { color: var(--bxj-success); }
.stat-card.warn .value { color: var(--bxj-warn); }
.stat-card.bad  .value { color: var(--bxj-danger); }

/* ------------------------------- Progress ------------------------------- */

.progress-row {
    padding: 0.6rem 0;
    display: grid;
    grid-template-columns: 180px 1fr 160px;
    align-items: center;
    gap: 1rem;
}
.progress-row + .progress-row { border-top: 1px solid var(--bxj-border); }
.progress-row .label {
    font-weight: 600;
    color: var(--bxj-ink);
}
.progress-row .meta {
    color: var(--bxj-muted);
    font-size: 0.85rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.progress {
    height: 10px;
    border-radius: 20px;
    background: var(--bxj-blue-050);
}
.progress-bar {
    background: var(--bxj-blue);
    border-radius: 20px;
}
.progress-indeterminate .progress-bar {
    width: 35%;
    animation: slide 1.6s ease-in-out infinite;
    background: linear-gradient(90deg, var(--bxj-blue-700), var(--bxj-blue), var(--bxj-blue-700));
}
@keyframes slide {
    0%   { transform: translateX(-120%); }
    100% { transform: translateX(300%); }
}

/* -------------------------------- Tables -------------------------------- */

.table {
    --bs-table-bg: var(--bxj-card);
    --bs-table-striped-bg: #FAFBFE;
    --bs-table-hover-bg: var(--bxj-blue-050);
    color: var(--bxj-ink);
}
.table thead th {
    background: #F6F8FC;
    border-bottom: 1px solid var(--bxj-border);
    color: var(--bxj-ink-soft);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}
.table tbody td {
    vertical-align: middle;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.table-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--bxj-border);
    background: #fff;
}
.table-card .table { margin-bottom: 0; }

.table-toolbar {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bxj-border);
    background: #FAFBFE;
    align-items: center;
    flex-wrap: wrap;
}
.table-toolbar .filter-input {
    flex: 1 1 300px;
    max-width: 420px;
}
.table-toolbar .count {
    color: var(--bxj-muted);
    font-size: 0.85rem;
}

/* click-to-sort column headers */
.table-sortable thead th[data-sort] {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.4em;
}
.table-sortable thead th[data-sort]::after {
    content: "";
    position: absolute;
    right: 0.5em;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    opacity: 0.4;
    background: no-repeat center/contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'><path d='M7 10l5-5 5 5zm0 4l5 5 5-5z'/></svg>");
}
.table-sortable thead th[data-sort].asc::after {
    opacity: 1;
    background: no-repeat center/contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231F3DB6'><path d='M7 15l5-5 5 5z'/></svg>");
}
.table-sortable thead th[data-sort].desc::after {
    opacity: 1;
    background: no-repeat center/contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231F3DB6'><path d='M7 10l5 5 5-5z'/></svg>");
}

tr.filter-hidden { display: none; }

/* --------------------------------- Modal -------------------------------- */

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    background: var(--bxj-blue);
    color: #fff;
    padding: 1rem 1.25rem;
    border-bottom: none;
}
.modal-header .btn-close {
    filter: brightness(0) invert(1);
}
.modal-title { font-weight: 650; letter-spacing: -0.015em; }

/* ---------------------------- Login viewport ---------------------------- */

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
    background:
        radial-gradient(60rem 60rem at -10% -20%, var(--bxj-blue-050), transparent 60%),
        radial-gradient(50rem 40rem at 110% 110%, #E3EBFF, transparent 60%),
        var(--bxj-canvas);
}
@media (min-width: 900px) {
    .auth-shell { grid-template-columns: 1.1fr 1fr; }
}
.auth-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem clamp(1.5rem, 6vw, 5rem);
    color: var(--bxj-ink);
}
.auth-brand .logo {
    max-width: 180px;
    width: 100%;
    margin-bottom: 2rem;
}
.auth-brand h1 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 650;
    margin-bottom: 1rem;
}
.auth-brand p { color: var(--bxj-ink-soft); max-width: 32rem; }

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem clamp(1.5rem, 6vw, 5rem);
}
.auth-card {
    background: #fff;
    border: 1px solid var(--bxj-border);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.auth-card h2 { margin-bottom: 0.25rem; }
.auth-card .lead { color: var(--bxj-muted); margin-bottom: 1.75rem; }

/* ------------------------------ Ticket detail --------------------------- */

.timeline {
    position: relative;
    margin-left: 0.5rem;
    padding-left: 1.5rem;
    border-left: 2px solid var(--bxj-blue-050);
}
.timeline-item { position: relative; padding: 0.75rem 0 0.75rem 0.5rem; }
.timeline-item::before {
    content: "";
    position: absolute;
    left: -1.95rem;
    top: 1rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bxj-blue);
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--bxj-blue-050);
}
.timeline-item.note::before       { background: var(--bxj-blue); }
.timeline-item.history::before    { background: var(--bxj-warn); }
.timeline-item.time::before       { background: var(--bxj-success); }
.timeline-item.attachment::before { background: #7E22CE; }
.timeline-item .meta {
    font-size: 0.8rem;
    color: var(--bxj-muted);
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}
.timeline-item .body { margin-top: 0.25rem; }
.timeline-item .body pre, .timeline-item .body p { margin-bottom: 0; }

/* ------------------------------ Utility --------------------------------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bxj-blue-050);
    color: var(--bxj-blue-800);
}
.pill.success { background: #E8F5EE; color: var(--bxj-success); }
.pill.warn    { background: #FDF2E1; color: var(--bxj-warn); }
.pill.danger  { background: #FDECEC; color: var(--bxj-danger); }
.pill.ghost   { background: #EEF0F5; color: var(--bxj-ink-soft); }

.breadcrumb { background: transparent; padding: 0; margin-bottom: 1rem; }
.breadcrumb-item + .breadcrumb-item::before { content: "/"; color: var(--bxj-muted); }

.app-footer {
    color: var(--bxj-muted);
    padding: 1.25rem 1rem;
    font-size: 0.85rem;
}
.app-footer a { color: var(--bxj-muted); }
