/* ASNA Service Desk — brand colours from the ASNA logo */
:root {
    --brand: #33337a;          /* ASNA navy */
    --brand-dark: #24245a;
    --brand-soft: #ececf6;
    --accent: #dc3236;         /* ASNA red */
    --ink: #2d3540;
    --muted: #7b8794;
    --line: #e1e5ea;
    --bg: #f3f5f8;
    --panel: #e9edf1;          /* grey tiles (sidebar, quick-create) */
    --panel-ink: #6b7785;
    --topbar-h: 64px;
    --sidebar-w: 240px;
}

html { font-size: 15px; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

a { color: var(--brand); }
a:hover { color: var(--accent); }

h1, h2, h3, h4, h5, h6 { color: var(--ink); }

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

.btn { font-weight: 600; }
.btn-primary, .btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover, .btn-primary:focus, .btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-outline-primary, .btn-outline-brand { color: var(--brand); border-color: var(--brand); background: #fff; }
.btn-outline-primary:hover, .btn-outline-brand:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-excel { color: #1d7044; border: 1px solid #5cb85c; background: #fff; }
.btn-excel:hover { background: #eaf6ec; color: #1d7044; border-color: #1d7044; }
.btn-filter { color: #2b6cb0; border: 1px solid #63a4e0; background: #fff; }
.btn-filter:hover, .btn-filter.active { background: #eaf3fc; color: #2b6cb0; border-color: #2b6cb0; }
.btn-icon { background: none; border: none; padding: .35rem; color: var(--ink); line-height: 0; }
.btn-icon:hover { color: var(--brand); }
.btn-icon.dropdown-toggle::after { display: none; }

/* ---------- Top bar ---------- */

.topbar {
    position: sticky; top: 0; z-index: 1030;
    background: #fff;
    border-top: 3px solid var(--accent);
    border-bottom: 1px solid var(--line);
    height: var(--topbar-h);
}
.topbar-inner { height: 100%; display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem; }
.topbar-inner.container { padding: 0 12px; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; flex-shrink: 0; }
.brand img { height: 38px; width: auto; display: block; }
.brand-tag {
    font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted); border-left: 1px solid var(--line); padding-left: .6rem;
}
.topbar-search { flex: 1; max-width: 460px; }
.topbar-search .form-control { background: var(--bg); border-color: transparent; border-radius: 999px; padding-left: 1rem; }
.topbar-search .form-control:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(51,51,122,.12); }
.topbar-links { gap: 1.25rem; margin-left: 1rem; }
.topbar-links a { color: var(--ink); text-decoration: none; font-weight: 600; padding: .25rem 0; border-bottom: 2px solid transparent; }
.topbar-links a:hover, .topbar-links a.active { color: var(--brand); border-bottom-color: var(--accent); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.new-menu .dropdown-item { display: flex; align-items: center; gap: .6rem; padding: .5rem 1rem; }

@media (max-width: 575.98px) {
    .brand-tag { display: none; }
    .brand img { height: 32px; }
}

/* ---------- Shell + sidebar ---------- */

.shell { flex: 1; display: flex; min-width: 0; }
.content { flex: 1; min-width: 0; padding: 1.5rem 1.25rem 2.5rem; }
.has-sidebar .content { padding: 1.5rem 1.75rem 2.5rem; }

.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); }
@media (min-width: 992px) {
    .sidebar { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; }
}
.side-nav { padding: 1rem .9rem 2rem; display: flex; flex-direction: column; gap: .35rem; }
.side-label { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 1rem .35rem .25rem; }
.side-label:first-child { margin-top: 0; }
.side-nav a {
    display: block; padding: .6rem .9rem; border-radius: 4px;
    background: var(--panel); color: var(--panel-ink);
    font-size: 1.05rem; font-weight: 400; text-decoration: none;
    transition: background .12s, color .12s;
}
.side-nav a:hover { background: #dde3e9; color: var(--ink); }
.side-nav a.active { background: var(--brand); color: #fff; }

/* ---------- Footer ---------- */

.app-footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .875rem; padding: 1rem 0; }
.app-footer a { color: var(--muted); }

/* ---------- Building blocks ---------- */

.card { border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header {
    background: #f7f8fa; border-bottom: 1px solid var(--line);
    font-weight: 400; font-size: 1.15rem; color: #5d6875; padding: .75rem 1rem;
}
.card-header .small { font-size: .85rem; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.65rem; font-weight: 400; color: #5d6875; margin: 0; }
.page-head .sub { color: var(--muted); margin: .15rem 0 0; }

.form-label { font-weight: 600; font-size: .9rem; }
.form-text { font-size: .8rem; }
.field-validation-error, .validation-summary-errors { color: #b91c1c; font-size: .85rem; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }

.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.auth-card { max-width: 460px; margin: 2rem auto; }
.auth-card .auth-logo { display: block; margin: 0 auto 1.25rem; height: 44px; }

/* ---------- Tables (issues grid) ---------- */

.grid { margin: 0; }
.grid > :not(caption) > * > * { padding: .55rem .7rem; border-color: var(--line); }
.grid thead th {
    background: #f7f8fa; color: #4a5560; font-weight: 600; font-size: .9rem; white-space: nowrap;
    border-right: 1px solid var(--line);
}
.grid thead th:last-child { border-right: none; }
.grid tbody tr:nth-child(even) > * { background: #fafbfc; }
.grid.table-hover tbody tr { cursor: pointer; }
.grid.table-hover tbody tr:hover > * { background: var(--brand-soft); }
.grid .subject { font-weight: 600; color: var(--ink); text-decoration: none; }
.grid .subject:hover { color: var(--brand); }
.grid .link-soft { color: #2b6cb0; text-decoration: none; }
.grid .link-soft:hover { text-decoration: underline; }
.ticket-num { font-family: ui-monospace, Consolas, monospace; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.sla-late { color: var(--accent); font-size: .75rem; font-weight: 700; white-space: nowrap; }

/* ---------- Status pills, priority dots, type icons ---------- */

.pill {
    display: inline-block; min-width: 96px; text-align: center;
    font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    padding: .28rem .6rem; border-radius: 3px; white-space: nowrap;
}
.pill-open { background: #1f3c88; color: #fff; }
.pill-progress { background: #f5c518; color: #4a3b00; }
.pill-waiting { background: #7c5cd6; color: #fff; }
.pill-resolved { background: #1d6b3a; color: #fff; }
.pill-closed { background: #64748b; color: #fff; }

.prio { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.prio .dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.prio-legend { list-style: none; padding: 0; margin: 0; }
.prio-legend li { display: flex; align-items: center; justify-content: space-between; padding: .4rem 0; font-size: 1.05rem; }
.prio-legend .dot { width: 22px; height: 22px; }

.type-icon {
    width: 22px; height: 22px; border-radius: 50%;
    display: inline-grid; place-items: center; flex-shrink: 0; vertical-align: middle;
}

.badge { font-weight: 600; border-radius: 999px; padding: .35em .7em; }
.badge.text-bg-primary { background-color: var(--brand) !important; }

/* Bootstrap accents in ASNA navy */
.nav-pills .nav-link { color: var(--brand); }
.nav-pills .nav-link.active { background: var(--brand); }
.btn-link { color: var(--brand); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(51,51,122,.15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.page-link { color: var(--brand); }
.active > .page-link, .page-link.active { background-color: var(--brand); border-color: var(--brand); }

/* ---------- Status counter strip ---------- */

.status-strip { display: flex; flex-wrap: wrap; background: #e6eaee; border-radius: 4px; }
.status-strip .item {
    flex: 1 1 140px; padding: .7rem 1.1rem; text-decoration: none; color: var(--ink);
    border-right: 1px solid #d3d9df;
}
.status-strip .item:last-child { border-right: none; }
.status-strip .item:hover { background: #dde3e9; }
.status-strip .label { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #4a5560; }
.status-strip .value { display: flex; align-items: center; gap: .5rem; font-size: 1.75rem; font-weight: 400; line-height: 1.2; }
.status-strip.compact .item { flex: 0 0 auto; padding: .3rem .8rem; }
.status-strip.compact .label { font-size: .62rem; }
.status-strip.compact .value { font-size: 1.15rem; }
.status-strip.compact svg { width: 18px; height: 18px; }

/* ---------- KPI tiles ---------- */

.kpi { display: flex; flex-direction: column; color: #fff; text-decoration: none; border-radius: 2px; overflow: hidden; height: 100%; min-height: 128px; }
.kpi:hover { color: #fff; filter: brightness(1.05); }
.kpi .kpi-title { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .6rem .9rem 0; }
.kpi .kpi-body { flex: 1; display: flex; align-items: center; justify-content: center; gap: .75rem; font-size: 2.3rem; font-weight: 300; padding: .25rem .9rem; }
.kpi .kpi-body svg { opacity: .75; }
.kpi .kpi-foot { font-size: .8rem; padding: .35rem .9rem; background: rgba(0,0,0,.12); opacity: .9; }
.kpi-slate { background: #3d4f63; }
.kpi-orange { background: #e8873a; }
.kpi-sky { background: #85bfe6; }
.kpi-pink { background: #e84a6f; }
.kpi-red { background: #c0392b; }
.kpi-teal { background: #1b8a6b; }

/* ---------- Quick create tiles ---------- */

.quick-new { display: flex; flex-direction: column; gap: .5rem; }
.quick-new a {
    display: flex; align-items: center; gap: .7rem;
    padding: .75rem 1rem; background: var(--panel); color: var(--panel-ink);
    font-size: 1rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
    text-decoration: none; border-radius: 3px; transition: background .12s, color .12s;
}
.quick-new a:hover { background: #dde3e9; color: var(--ink); }
.quick-new.horizontal { flex-direction: row; flex-wrap: wrap; }
.quick-new.horizontal a { flex: 1 1 200px; }

/* ---------- Charts ---------- */

.donut { width: 100%; max-width: 190px; height: auto; }
.donut circle { transition: stroke-width .15s; }
.donut circle:hover { stroke-width: 7.5; }
.donut-total { font-size: 8px; font-weight: 700; fill: var(--ink); text-anchor: middle; }
.donut-label { font-size: 3.2px; fill: var(--muted); text-anchor: middle; text-transform: uppercase; letter-spacing: .2px; }
.legend { list-style: none; padding: 0; margin: 0; }
.legend li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; font-weight: 600; font-size: .92rem; }
.legend .swatch { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.legend .count { margin-left: auto; color: var(--muted); font-weight: 400; }
.bar { height: 8px; border-radius: 4px; background: var(--brand-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); }

/* ---------- Ratings ---------- */

.stars { color: #f59e0b; letter-spacing: 2px; font-size: 1.15rem; white-space: nowrap; }
.stars .off { color: #d4d8de; }
.stars.lg { font-size: 1.6rem; }
.rate-input { display: inline-flex; flex-direction: row-reverse; gap: .15rem; }
.rate-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rate-input label { font-size: 2rem; line-height: 1; color: #d4d8de; cursor: pointer; transition: color .1s; }
.rate-input label:hover, .rate-input label:hover ~ label,
.rate-input input:checked ~ label { color: #f59e0b; }
.rate-input input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }

/* ---------- Home ---------- */

.hero {
    background: #fff; border: 1px solid var(--line); border-radius: 6px;
    padding: 2.25rem 2rem; margin-bottom: 1.5rem; position: relative; overflow: hidden;
}
.hero::after {
    content: ""; position: absolute; right: -80px; top: -80px; width: 280px; height: 280px; border-radius: 50%;
    background: radial-gradient(circle, rgba(220,50,54,.10), transparent 70%);
}
.hero h1 { font-weight: 300; font-size: clamp(1.7rem, 4vw, 2.4rem); color: var(--brand); }
.hero p { color: var(--muted); }
.hero .form-control { padding: .75rem 1rem; }

.action-card { transition: transform .12s ease, box-shadow .12s ease; text-decoration: none; color: inherit; height: 100%; display: block; }
.action-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16,24,40,.08); color: inherit; }

/* ---------- Type picker (new ticket) ---------- */

.type-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; }
.type-picker input { position: absolute; opacity: 0; }
.type-picker label {
    display: flex; flex-direction: column; gap: .35rem; height: 100%;
    padding: .8rem .9rem; border: 2px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer;
    transition: border-color .12s, background .12s;
}
.type-picker label strong { display: flex; align-items: center; gap: .5rem; }
.type-picker label small { color: var(--muted); line-height: 1.3; }
.type-picker input:checked + label { border-color: var(--brand); background: var(--brand-soft); }
.type-picker input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Ticket thread ---------- */

.thread { display: flex; flex-direction: column; gap: 1rem; }
.msg { display: flex; gap: .75rem; }
.avatar {
    flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center; font-size: .8rem; font-weight: 700;
    background: #e5e7eb; color: #374151;
}
.avatar.sm { width: 34px; height: 34px; flex-basis: 34px; }
.avatar.staff { background: var(--brand); color: #fff; }
.msg-body { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: .85rem 1rem; }
.msg.staff .msg-body { border-left: 3px solid var(--brand); }
.msg.internal .msg-body { background: #fffbeb; border-color: #fcd34d; border-left-width: 3px; }
.msg-meta { font-size: .82rem; color: var(--muted); margin-bottom: .35rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.msg-meta strong { color: var(--ink); }
.msg-text { white-space: pre-wrap; word-wrap: break-word; margin: 0; }
.sys-note { text-align: center; font-size: .82rem; color: var(--muted); }
.sys-note span { background: #e6eaee; padding: .25rem .75rem; border-radius: 999px; display: inline-block; }

.attach-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.attach {
    display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem;
    border: 1px solid var(--line); border-radius: 4px; padding: .3rem .6rem; background: #fafbfc;
    text-decoration: none; color: var(--ink); max-width: 100%;
}
.attach:hover { border-color: var(--brand); color: var(--brand); }
.attach img { width: 28px; height: 28px; object-fit: cover; border-radius: 3px; }

/* WhatsApp: a darker green than the brand #25d366 so white text stays readable. */
.badge.badge-wa { background: #0f7a43; color: #fff; }
.btn-wa { background: #0f7a43; border-color: #0f7a43; color: #fff; }
.btn-wa:hover, .btn-wa:focus-visible { background: #0b6537; border-color: #0b6537; color: #fff; }
.wa-status { font-size: .75rem; color: #0f7a43; }
.wa-status.bad { color: #b42318; text-decoration: underline dotted; }
.wa-code {
    font: 700 1.4rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em;
    background: #f0faf4; border: 1px dashed #0f7a43; border-radius: 6px; padding: .6rem 1rem; display: inline-block;
}
.wa-log-body { max-width: 360px; overflow-wrap: anywhere; }

.meta-list dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.meta-list dd { margin-bottom: .75rem; }

/* ---------- Notices ---------- */

.notice-list .alert { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: .6rem; }
.notice-list .alert strong { display: block; }

/* ---------- Knowledge base ---------- */

.kb-body { line-height: 1.7; }
.kb-body h2 { font-size: 1.3rem; margin-top: 1.5rem; }
.kb-body h3 { font-size: 1.1rem; margin-top: 1.25rem; }
.kb-body img { max-width: 100%; height: auto; border-radius: 6px; }
.kb-body table { width: 100%; margin: 1rem 0; border-collapse: collapse; }
.kb-body th, .kb-body td { border: 1px solid var(--line); padding: .5rem .75rem; }
.kb-body th { background: #f7f8fa; }
.kb-body pre { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: 6px; overflow-x: auto; }
.kb-body code { background: #f1f5f9; padding: .1rem .3rem; border-radius: 4px; }
.kb-body pre code { background: none; padding: 0; }

/* ---------- Stats (older pages) ---------- */

.stat { padding: 1rem 1.25rem; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .value { font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
