/* D2D Hub — Data to Decisions Kenya brand system (see globals.css tokens) */
:root {
  --magenta: #CE65B0;
  --magenta-dark: #B55A9D;
  --magenta-text: #A94F92;
  --navy: #2D2A45;
  --navy-light: #3D3959;
  --lavender: #D4CFE0;
  --surface: #F4F5F7;
  --muted: #6B6B7B;
  --green: #25D366;
  --card-shadow: 0 1px 3px rgba(45,42,69,.08), 0 8px 24px rgba(45,42,69,.08);
  --card-shadow-hover: 0 2px 6px rgba(45,42,69,.1), 0 16px 40px rgba(45,42,69,.14);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Raleway', Helvetica, Arial, sans-serif;
  background: var(--surface);
  color: var(--navy);
  font-size: 15px;
  line-height: 1.55;
}

h1 { font-weight: 800; font-size: 1.7rem; line-height: 1.15; margin: 0 0 .25rem; }
h2 { font-weight: 800; font-size: 1.05rem; margin: 0 0 .75rem; }
a { color: var(--magenta-text); font-weight: 700; text-decoration: none; }
a:hover { color: var(--magenta-dark); text-decoration: underline; }
code { font-family: Consolas, monospace; font-size: .85em; background: var(--surface); padding: .1em .35em; border-radius: 4px; }

:focus-visible { outline: 3px solid var(--magenta); outline-offset: 2px; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; gap: .6rem; align-items: center; padding: 1.1rem 1rem .9rem; }
.side-logo { width: 36px; height: 36px; object-fit: contain; }
.side-title { font-weight: 800; font-size: 1.05rem; }
.side-sub { font-size: .68rem; color: var(--lavender); }
.side-nav { display: flex; flex-direction: column; padding: .4rem .6rem; gap: 2px; flex: 1; overflow-y: auto; }
.side-nav a {
  color: var(--lavender); font-weight: 600; padding: .5rem .7rem; border-radius: 8px;
  display: flex; align-items: center; gap: .5rem;
}
.side-nav a:hover { color: #fff; background: var(--navy-light); text-decoration: none; }
.side-nav a.on { color: #fff; background: linear-gradient(135deg, var(--magenta), var(--navy-light)); }
.side-sep { font-size: .65rem; text-transform: uppercase; letter-spacing: .12em; color: var(--lavender); opacity: .7; padding: .8rem .7rem .2rem; font-weight: 700; }
.side-foot { padding: .8rem .6rem; border-top: 1px solid var(--navy-light); }
.side-user { display: flex; gap: .55rem; align-items: center; color: #fff; padding: .4rem .5rem; border-radius: 8px; text-decoration: none; }
.side-user:hover { background: var(--navy-light); text-decoration: none; color: #fff; }
.side-user.on { background: var(--navy-light); }
.side-user-name { display: block; font-weight: 700; font-size: .85rem; }
.side-user-role { display: block; font-size: .68rem; color: var(--lavender); font-weight: 400; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--magenta); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0;
}
.avatar.sm { width: 26px; height: 26px; font-size: .75rem; }
.logout-form { margin: .4rem 0 0; }

.main { flex: 1; padding: 1.6rem 2rem 3rem; max-width: 1200px; min-width: 0; }

/* Auth screens */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: linear-gradient(135deg, rgba(206,101,176,.12), rgba(45,42,69,.12)), var(--surface); }
.auth-main { width: 100%; max-width: 430px; }
.auth-card { text-align: center; }
.auth-logo { max-width: 220px; margin: 0 auto 1rem; display: block; }
.auth-card form { text-align: left; }

/* Cards */
.card {
  background: #fff; border-radius: 16px; box-shadow: var(--card-shadow);
  padding: 1.25rem 1.4rem; margin-bottom: 1.2rem;
  border: 1px solid rgba(45,42,69,.06);
}

/* Page head */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.eyebrow { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--magenta-text); margin: 0 0 .15rem; }
.eyebrow a { font-size: inherit; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-bottom: 1.2rem; }
.grid-chat { display: grid; grid-template-columns: 2fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 980px) {
  .grid-2, .grid-3, .grid-chat { grid-template-columns: 1fr; }
  .sidebar { width: 200px; }
  .main { padding: 1rem; }
}

/* Stats */
.stat-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1.2; }
.stat-unit { font-size: .75rem; font-weight: 600; color: var(--muted); margin-left: .45rem; }
.stat-link { font-size: .8rem; }

/* Buttons */
button { font-family: inherit; font-size: .9rem; cursor: pointer; }
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger, .btn-ghost-dark {
  border-radius: 8px; padding: .55rem 1.1rem; font-weight: 700; border: 0; display: inline-block; text-decoration: none;
}
.btn-primary { background: var(--magenta); color: #fff; }
.btn-primary:hover { background: var(--magenta-dark); color: #fff; text-decoration: none; }
.btn-secondary { background: var(--navy); color: #fff; }
.btn-secondary:hover { background: var(--navy-light); color: #fff; text-decoration: none; }
.btn-ghost { background: #fff; color: var(--navy); border: 1px solid rgba(45,42,69,.35); }
.btn-ghost:hover { color: var(--magenta-dark); border-color: var(--magenta); text-decoration: none; }
.btn-danger { background: #fff; color: #B3261E; border: 1px solid #B3261E; }
.btn-danger:hover { background: #FCEEEE; }
.btn-ghost-dark { background: transparent; color: var(--lavender); border: 1px solid var(--navy-light); width: 100%; }
.btn-ghost-dark:hover { color: #fff; border-color: var(--lavender); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-mini { background: var(--surface); border: 1px solid rgba(45,42,69,.2); border-radius: 6px; padding: .15rem .5rem; font-size: .75rem; font-weight: 700; color: var(--navy); }
.btn-mini:hover { border-color: var(--magenta); color: var(--magenta-dark); }
.btn-row, .actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: .8rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1rem; }
.form-grid .span2 { grid-column: span 2; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span2 { grid-column: span 1; } }
label { font-weight: 700; font-size: .82rem; display: flex; flex-direction: column; gap: .3rem; }
input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="number"], input[type="search"], select, textarea {
  font-family: inherit; font-size: .92rem; padding: .55rem .7rem; border: 1px solid rgba(45,42,69,.25);
  border-radius: 8px; background: #fff; color: var(--navy); width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--magenta); }
fieldset { border: 1px solid rgba(45,42,69,.15); border-radius: 8px; padding: .7rem .9rem; }
legend { font-weight: 700; font-size: .8rem; padding: 0 .4rem; }
.check { flex-direction: row; align-items: center; gap: .45rem; font-weight: 600; }
.check input { width: auto; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .4rem; }
.input-sm { max-width: 140px; }
.input-xs { max-width: 76px; }
.input-comment { min-width: 160px; }
.mt-xs { margin-top: .3rem; display: block; }
.row-flag { background: #FFFBEB; }
.sla-note { font-style: italic; max-width: 220px; }

/* Resource Center */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.guide-card {
  display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.1rem; border-radius: 12px;
  background: var(--surface); border: 1px solid rgba(45,42,69,.08); text-decoration: none; color: var(--navy);
}
.guide-card:hover { border-color: var(--magenta); text-decoration: none; }
.guide-card strong { color: var(--navy); font-size: .95rem; }
.guide-step { display: flex; gap: 1rem; padding: 1.2rem 0; border-bottom: 1px solid var(--surface); }
.guide-step:last-child { border-bottom: 0; }
.guide-step-num {
  width: 32px; height: 32px; border-radius: 50%; background: var(--magenta); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0;
}
.guide-step-body { flex: 1; min-width: 0; }
.guide-shot {
  max-width: 100%; border-radius: 10px; border: 1px solid rgba(45,42,69,.12);
  box-shadow: 0 1px 3px rgba(45,42,69,.08), 0 8px 20px rgba(45,42,69,.08); margin-top: .5rem;
}
.inline { display: inline; }
.inline-row { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .45rem .6rem; border-bottom: 2px solid var(--surface); }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--surface); vertical-align: top; }
.table .num { text-align: right; }
.table th.num { text-align: right; }
.total-row td { border-top: 2px solid var(--navy); font-weight: 800; }
.row-muted { opacity: .5; }
.nowrap { white-space: nowrap; }

/* Pills & badges */
.pill { display: inline-block; font-size: .68rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; white-space: nowrap; }
.pill-green { background: #ECFDF5; color: #065F46; }
.pill-amber { background: #FFFBEB; color: #92400E; }
.pill-blue { background: #EFF6FF; color: #1E40AF; }
.pill-purple { background: #F3EDF9; color: #6B3FA0; }
.pill-grey { background: var(--surface); color: var(--muted); }
.pill-red { background: #FCEEEE; color: #B3261E; }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px;
  padding: 0 6px; border-radius: 999px; background: var(--magenta); color: #fff;
  font-size: .68rem; font-weight: 800; margin-left: auto;
}

/* Flash */
.flash { border-radius: 8px; padding: .7rem 1rem; margin-bottom: 1rem; font-weight: 600; font-size: .9rem; }
.flash-success { background: #ECFDF5; color: #065F46; }
.flash-error { background: #FCEEEE; color: #B3261E; }
.flash-info { background: #F3EDF9; color: var(--navy); border: 1px solid var(--lavender); }

/* Chips (filters) */
.filter-row { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.chip { font-size: .78rem; font-weight: 700; padding: .3rem .8rem; border-radius: 999px; background: var(--surface); color: var(--navy); }
.chip:hover { text-decoration: none; color: var(--magenta-dark); }
.chip-on { background: var(--navy); color: #fff; }
.chip-on:hover { color: #fff; }
.search { max-width: 320px; }

/* Chat */
.chat-card { display: flex; flex-direction: column; max-height: 72vh; }
.chat-scroll { overflow-y: auto; flex: 1; padding-right: .3rem; }
.msg { padding: .6rem .8rem; border-radius: 12px; background: var(--surface); margin-bottom: .6rem; max-width: 92%; }
.msg-mine { background: #F3EDF9; margin-left: auto; }
.msg-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.msg-body { margin: .15rem 0; }
.msg-foot { display: flex; gap: .8rem; align-items: center; }
.btn-ack { background: #fff; border: 1px solid var(--green); color: #128C4B; border-radius: 999px; font-size: .74rem; font-weight: 700; padding: .18rem .7rem; }
.btn-ack:hover { background: #ECFDF5; }
.acked { color: #128C4B; font-weight: 700; font-size: .78rem; }
.chat-compose { display: flex; gap: .6rem; margin-top: .8rem; align-items: flex-end; }
.chat-compose textarea { flex: 1; }
.chat-readonly { margin-top: .8rem; background: var(--surface); border-radius: 8px; padding: .6rem .9rem; font-size: .82rem; color: var(--muted); font-weight: 600; }

/* Vault */
.dl { display: grid; grid-template-columns: 130px 1fr; gap: .5rem .8rem; margin: 0; }
.dl dt { font-weight: 700; font-size: .8rem; color: var(--muted); }
.dl dd { margin: 0; word-break: break-all; }
.secret { font-family: Consolas, monospace; background: var(--navy); color: #fff; padding: .2rem .6rem; border-radius: 6px; letter-spacing: .1em; }
.secret-inline { background: var(--navy); color: #fff; }
.proposal { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--surface); flex-wrap: wrap; }
.proposal:last-child { border-bottom: 0; }

/* Misc */
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.mt { margin-top: 1.2rem; }
.prewrap { white-space: pre-wrap; }
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.comment { display: flex; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--surface); }
.comment:last-of-type { border-bottom: 0; }
.comment-head { display: flex; gap: .5rem; align-items: baseline; }

/* Task attachment inline preview (ad-hoc proof-of-assignment images) */
.attachment-thumb { max-width: 100%; max-height: 320px; border-radius: 8px; border: 1px solid var(--surface); display: block; }

/* Dashboard "needs attention" widget + who's-free current-assignee highlight */
.attention-card { border-left: 4px solid #B3261E; }
.row-current { background: #F3EDF9; }

/* Task Routing — consultant x work-type specialty matrix */
.skills-scroll { overflow-x: auto; }
.skills-table { min-width: 900px; }
.skills-table th, .skills-table td { white-space: nowrap; }
.skills-col-head { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; vertical-align: bottom; max-height: 140px; font-weight: 700; }
.skills-row-head { font-weight: 700; white-space: nowrap; position: sticky; left: 0; background: #fff; }
.skills-table td.center { text-align: center; }
.skills-table input[type="checkbox"] { width: 16px; height: 16px; }
