/* ============================================================
   Painel administrativo — tema "tech" + Kanban
   Escopado ao layout de admin (.admin-body); não afeta o site público.
   ============================================================ */
:root {
    --adm-bg: #0b1020;
    --adm-bg-soft: #0f1730;
    --adm-surface: #ffffff;
    --adm-text: #1b2440;
    --adm-muted: #5b6680;
    --adm-line: #e3e8f3;
    --adm-brand: #4f7cff;
    --adm-brand-2: #22d3ee;
    --adm-shadow: 0 18px 48px rgba(11, 16, 32, 0.12);

    --st-open: #2563eb;
    --st-in_progress: #0ea5a3;
    --st-waiting_customer: #d97706;
    --st-resolved: #16a34a;
    --st-closed: #64748b;

    --pr-low: #64748b;
    --pr-normal: #2563eb;
    --pr-high: #d97706;
    --pr-urgent: #e11d48;
}

.admin-body {
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(34, 211, 238, 0.10), transparent 60%),
        radial-gradient(900px 500px at -10% 0%, rgba(79, 124, 255, 0.12), transparent 55%),
        #eef2fb;
    color: var(--adm-text);
    min-height: 100vh;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

/* ---------- Topbar ---------- */
.admin-topbar {
    background: linear-gradient(100deg, var(--adm-bg) 0%, var(--adm-bg-soft) 55%, #15224a 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 24px rgba(11, 16, 32, 0.28);
}

.admin-topbar .navbar-brand,
.admin-topbar .nav-link {
    color: #e7ecff;
}

.admin-topbar .nav-link:hover,
.admin-topbar .nav-link.active {
    color: #fff;
}

.admin-topbar .nav-link.active {
    position: relative;
}

.admin-topbar .nav-link.active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 2px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--adm-brand), var(--adm-brand-2));
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--adm-brand), var(--adm-brand-2));
    box-shadow: 0 6px 18px rgba(79, 124, 255, 0.45);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
    font-weight: 700;
}

.brand-sub {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--adm-brand-2);
    margin-top: 3px;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
    color: #06122e;
    background: linear-gradient(135deg, var(--adm-brand-2), #a7f3d0);
}

/* ---------- Cabeçalho de página ---------- */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.page-head .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 12px;
    font-weight: 700;
    color: var(--adm-brand);
    margin: 0 0 4px;
}

.page-head h1 {
    margin: 0;
    font-weight: 800;
    font-size: clamp(24px, 3vw, 34px);
}

.page-head .sub {
    color: var(--adm-muted);
    margin: 6px 0 0;
}

/* ---------- Cards / superfícies ---------- */
.surface {
    background: var(--adm-surface);
    border: 1px solid var(--adm-line);
    border-radius: 16px;
    box-shadow: var(--adm-shadow);
}

.toolbar-card {
    padding: 14px 16px;
    margin-bottom: 18px;
}

/* ---------- Métricas ---------- */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric {
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--adm-surface);
    border: 1px solid var(--adm-line);
    box-shadow: 0 8px 22px rgba(11, 16, 32, 0.06);
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-left: 4px solid var(--accent, var(--adm-brand));
}

.metric .metric-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.1;
}

.metric .metric-label {
    font-size: 12px;
    color: var(--adm-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

/* ---------- Badges ---------- */
.badge-status,
.badge-priority {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.badge-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.st-open            { color: var(--st-open);            background: rgba(37, 99, 235, 0.12); }
.st-in_progress     { color: var(--st-in_progress);     background: rgba(14, 165, 163, 0.14); }
.st-waiting_customer{ color: var(--st-waiting_customer);background: rgba(217, 119, 6, 0.14); }
.st-resolved        { color: var(--st-resolved);        background: rgba(22, 163, 74, 0.14); }
.st-closed          { color: var(--st-closed);          background: rgba(100, 116, 139, 0.16); }

.pr-low     { color: var(--pr-low);     background: rgba(100, 116, 139, 0.14); }
.pr-normal  { color: var(--pr-normal);  background: rgba(37, 99, 235, 0.12); }
.pr-high    { color: var(--pr-high);    background: rgba(217, 119, 6, 0.14); }
.pr-urgent  { color: var(--pr-urgent);  background: rgba(225, 29, 72, 0.14); }

/* ---------- Toggle de visão ---------- */
.view-switch .btn {
    border-radius: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   KANBAN
   ============================================================ */
.kanban {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(280px, 1fr);
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x proximity;
}

.kanban-col {
    background: rgba(255, 255, 255, 0.66);
    backdrop-filter: blur(4px);
    border: 1px solid var(--adm-line);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    min-height: 220px;
    scroll-snap-align: start;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.kanban-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--adm-line);
    font-weight: 700;
}

.kanban-col-head .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.col-open    .dot { background: var(--st-open); }
.col-in_progress .dot { background: var(--st-in_progress); }
.col-waiting_customer .dot { background: var(--st-waiting_customer); }
.col-resolved .dot { background: var(--st-resolved); }
.col-closed  .dot { background: var(--st-closed); }

.kanban-col-head .count {
    background: #eef2fb;
    color: var(--adm-muted);
    font-size: 12px;
    min-width: 26px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 700;
}

.kanban-list {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    overflow-y: auto;
    /* Garante ~5 cards (~135px + 10px gap) visíveis antes de rolar a coluna. */
    max-height: max(720px, calc(100vh - 210px));
}

.kanban-col.drop-target {
    border-color: var(--adm-brand);
    box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.18);
    background: rgba(79, 124, 255, 0.06);
}

/* ---------- Card de chamado ---------- */
.ticket-card {
    display: block;
    background: #fff;
    border: 1px solid var(--adm-line);
    border-left: 4px solid var(--card-accent, var(--adm-brand));
    border-radius: 12px;
    padding: 12px;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(11, 16, 32, 0.05);
    cursor: grab;
    transition: transform .12s, box-shadow .12s, border-color .12s;
}

.ticket-card:hover {
    text-decoration: none;
    color: inherit;
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(11, 16, 32, 0.12);
    border-color: #cdd7ee;
}

.ticket-card.dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.pa-low     { --card-accent: var(--pr-low); }
.pa-normal  { --card-accent: var(--pr-normal); }
.pa-high    { --card-accent: var(--pr-high); }
.pa-urgent  { --card-accent: var(--pr-urgent); }

.ticket-card .tc-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.ticket-card .tc-code {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--adm-brand);
    letter-spacing: 0.02em;
}

.ticket-card .tc-title {
    font-weight: 700;
    font-size: 14px;
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ticket-card .tc-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--adm-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-card .tc-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--adm-line);
}

.ticket-card .tc-date {
    color: var(--adm-muted);
    font-size: 11px;
}

.kanban-empty {
    color: var(--adm-muted);
    font-size: 13px;
    text-align: center;
    padding: 18px 8px;
    border: 1px dashed var(--adm-line);
    border-radius: 10px;
}

/* ============================================================
   Detalhe do chamado
   ============================================================ */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.msg {
    border: 1px solid var(--adm-line);
    border-left: 4px solid var(--adm-brand);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}

.msg.admin    { border-left-color: var(--st-resolved); background: #f6fbf8; }
.msg.customer { border-left-color: var(--adm-brand); }

.msg-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--adm-muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.msg-head strong { color: var(--adm-text); }

.status-change {
    font-size: 12px;
    font-weight: 700;
    color: var(--pr-high);
}

.attachments {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.attachment {
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--adm-line);
    border-radius: 10px;
    background: #fafbff;
    color: var(--adm-text);
    text-decoration: none;
    overflow: hidden;
}

.attachment:hover { color: var(--adm-text); border-color: #cdd7ee; }

.attachment img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--adm-line);
}

.attachment span {
    font-size: 12px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.attachment small { color: var(--adm-muted); }

/* ---------- Login ---------- */
.login-wrap {
    min-height: calc(100vh - 160px);
    display: grid;
    place-items: center;
}

.login-card {
    width: min(420px, 100%);
    padding: 30px;
}

/* ---------- Responsivo ---------- */
@media (max-width: 720px) {
    .kanban {
        grid-auto-columns: 86%;
    }
    .kanban-list { max-height: none; }
}
