/* Masindi AI back office: UNIVEN navy and gold, Public Sans. */
:root {
  --navy: #154175; --navy-dark: #0e2f57; --gold: #bea65d; --ink: #161922; --muted: #46546b;
  --line: #dfe4ec; --mist: #f3f5f9; --bg: #f7f8fb; --card: #ffffff; --bad: #a3261f; --good: #1f6b3a;
  --s-faq: #a8790f; --s-ai: #3a72c0; --s-handoff: #cf5a39;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--navy); } a:hover { color: var(--navy-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

.top { background: var(--navy); color: #fff; border-bottom: 3px solid var(--gold); }
.top-inner { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.badge { width: 40px; height: 40px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.badge img { width: 34px; height: 34px; object-fit: contain; }
.brand { display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 16px; } .brand span { font-size: 12.5px; color: #dce4f0; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: #dce4f0; flex-wrap: wrap; }
.who a { color: #fff; }

nav.tabs { background: #fff; border-bottom: 1px solid var(--line); }
nav.tabs .inner { max-width: 1200px; margin: 0 auto; padding: 0 8px; display: flex; gap: 2px; overflow-x: auto; }
nav.tabs button { border: 0; background: none; padding: 12px 14px; min-height: 44px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
nav.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--navy); }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 17px; margin: 0 0 10px; } h3 { font-size: 15px; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile .l { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.warn { background: #fdf3e6; border: 1px solid #f0d3a8; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; }
.error { background: #fbecea; border: 1px solid #f0c3be; color: var(--bad); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.ok { background: #e9f4ec; border: 1px solid #bfdcc8; color: var(--good); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }

.btn { border: 1px solid var(--navy); background: var(--navy); color: #fff; border-radius: 10px; padding: 0 14px; min-height: 40px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--navy-dark); }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.secondary:hover { background: var(--mist); }
.btn.danger { background: #fff; color: var(--bad); border-color: #e3b3ae; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=number], input[type=password], input[type=search], select, textarea {
  border: 1px solid #c9d2df; border-radius: 8px; padding: 8px 10px; background: #fff; min-height: 40px; font-weight: 400; color: var(--ink); }
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 500; color: var(--ink); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 12.5px; color: var(--muted); font-weight: 600; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

.tag { display: inline-block; border-radius: 999px; padding: 0 8px; font-size: 12px; border: 1px solid var(--line); background: #fff; white-space: nowrap; }
.tag.down, .tag.needs { color: var(--bad); border-color: #e3b3ae; }
.tag.up, .tag.resolved { color: var(--good); border-color: #bfdcc8; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

.conv { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.conv .q { font-weight: 600; margin: 6px 0 4px; }
.conv .a { white-space: pre-wrap; word-wrap: break-word; color: #2a2f3a; }
.conv .comment { margin-top: 6px; padding: 6px 8px; background: #fdf1f0; border-radius: 6px; font-size: 14px; }
.conv details { margin-top: 6px; font-size: 13px; color: var(--muted); }
.conv details a { word-break: break-all; }
.conv .review { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

.topic { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fff; }
.topic > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; gap: 10px; align-items: center; min-height: 48px; }
.topic > summary::-webkit-details-marker { display: none; }
.topic[open] > summary { border-bottom: 1px solid var(--line); }
.topic .body { padding: 14px; display: grid; gap: 12px; }
.links-edit .link-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; margin-bottom: 6px; }
@media (max-width: 640px) { .links-edit .link-row { grid-template-columns: 1fr; } }
.count { font-size: 12px; color: var(--muted); text-align: right; }

/* Chart */
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-wrap .axis text { font-size: 11px; fill: var(--muted); }
.chart-wrap .grid line { stroke: #e9edf3; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 6px 0 4px; }
.tooltip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 18px rgba(21,65,117,.14); min-width: 150px; display: none; z-index: 2; }
.tooltip b { display: block; margin-bottom: 4px; }
.tooltip .r { display: flex; justify-content: space-between; gap: 12px; }

/* Sign-in */
.login { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.login .card { padding: 24px; }
.ms-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 48px; border: 1px solid #8c8c8c; background: #fff; color: #1f1f1f; border-radius: 8px; font-weight: 600; text-decoration: none; }
.ms-btn:hover { background: #f5f5f5; color: #1f1f1f; }
.sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 16px 0; }
.sep::before, .sep::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
