/* HE Connect - Support Portal */
:root {
  --navy: #0b2a5b;
  --navy2: #0f3d82;
  --blue: #1e7bf0;
  --blue-d: #1d4fa8;
  --red: #e5373a;
  --orange: #f08c00;
  --green: #16a34a;
  --cyan: #0ea5e9;
  --purple: #7c3aed;
  --pink: #ec4899;
  --ink: #0f1f3d;
  --muted: #64748b;
  --line: #e3e9f2;
  --bg: #f1f5fb;
  --card: #fff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 31, 61, .06), 0 4px 14px rgba(15, 31, 61, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--blue-d); text-decoration: none; }
a:hover { text-decoration: underline; }
h2, h3, h4 { margin: 0 0 12px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.ic { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }

/* ---------- top bar ---------- */
.topbar { background: linear-gradient(100deg, #082150 0%, #0c3577 55%, #0f4796 100%); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.topbar-inner { display: flex; align-items: center; gap: 22px; padding: 12px 28px; max-width: 1640px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand:hover { text-decoration: none; }
.logo { font: italic 900 38px/1 "Arial Black", Arial, sans-serif; letter-spacing: -3px; color: #fff; padding-right: 12px; border-right: 2px solid rgba(255,255,255,.7); transform: skewX(-8deg); }
.brand-co { font-weight: 700; font-size: 15px; line-height: 1.15; letter-spacing: .3px; }
.sep { width: 1px; align-self: stretch; background: rgba(255,255,255,.35); }
.app-name { font-weight: 800; font-size: 28px; letter-spacing: .5px; white-space: nowrap; }
.page-title .t1 { font-size: 22px; font-weight: 600; line-height: 1.1; }
.page-title .t2 { font-size: 14px; opacity: .85; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.role-chip { display: flex; align-items: center; gap: 10px; border: 1px solid rgba(255,255,255,.35); border-radius: 40px; padding: 6px 18px 6px 12px; }
.role-chip .ic { width: 26px; height: 26px; }
.role-chip b { display: block; font-size: 14px; }
.role-chip small { display: block; font-size: 12px; opacity: .85; }
.bell, .avatar { position: relative; color: #fff; display: inline-flex; }
.bell .ic { width: 26px; height: 26px; }
.bell .dot { position: absolute; top: -7px; right: -8px; background: var(--red); border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 6px; border: 2px solid #0c3577; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.92); color: var(--navy2); align-items: center; justify-content: center; }
.staff-link { color: #fff; display: inline-flex; align-items: center; gap: 6px; opacity: .9; font-weight: 600; }
.subnav { display: flex; gap: 4px; padding: 0 28px; max-width: 1640px; margin: 0 auto; }
.subnav a { color: rgba(255,255,255,.8); padding: 8px 14px 10px; display: inline-flex; gap: 6px; align-items: center; border-bottom: 3px solid transparent; font-weight: 600; }
.subnav a .ic { width: 16px; height: 16px; }
.subnav a:hover { color: #fff; text-decoration: none; }
.subnav a.on { color: #fff; border-color: #5aa9ff; }

/* Microsoft button */
.ms-btn { display: inline-flex; align-items: center; gap: 10px; background: #fff; color: #2b2b2b; border: 1px solid #8c8c8c; border-radius: 4px; padding: 7px 14px; font-weight: 600; white-space: nowrap; }
.ms-btn:hover { background: #f3f3f3; text-decoration: none; }
.ms-btn .ic { width: 18px; height: 18px; }
.ms-btn-lg { padding: 11px 20px; font-size: 15px; }
.ms-btn.block { display: flex; justify-content: center; }
.or { text-align: center; margin: 16px 0; border-top: 1px solid var(--line); }
.or span { position: relative; top: -10px; background: #fff; padding: 0 10px; color: var(--muted); font-size: 12px; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: 1640px; margin: 0 auto; padding: 18px 28px 30px; flex: 1; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card.narrow { max-width: 560px; margin: 30px auto; }
.card.center { text-align: center; }
.card-h { display: flex; align-items: center; gap: 10px; font-size: 19px; }
.card-h .ic { width: 24px; height: 24px; color: var(--navy2); }
.card-h .ic.red { color: var(--red); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.card-top .card-h { margin: 0; }
.portal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.portal-grid.wide-side { grid-template-columns: minmax(0, 1fr) 320px; }
.side { display: flex; flex-direction: column; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 16px; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form .full { grid-column: 1 / -1; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid #cfd8e6; border-radius: 8px; padding: 9px 11px; background: #fff; width: 100%; }
input[type=checkbox] { width: auto; }
input[type=file] { padding: 7px; background: #f8fafd; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,123,240,.15); }
textarea { resize: vertical; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.signed-as { display: flex; align-items: center; gap: 8px; background: #f2f7ff; border: 1px solid #d6e5fb; border-radius: 8px; padding: 10px 12px; }
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--navy2); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #0b3270; text-decoration: none; }
.btn .ic { width: 17px; height: 17px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-ghost { background: #fff; color: var(--navy2); border: 1px solid #c8d5ea; }
.btn-ghost:hover { background: #f2f6fd; }
.btn-ok { background: var(--green); } .btn-ok:hover { background: #128a3e; }
.btn-danger { background: var(--red); } .btn-danger:hover { background: #c92b2e; }
.btn.block { width: 100%; justify-content: center; }
.row-btns { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-btns.spread { justify-content: space-between; }
.row-btns input[type=file] { width: auto; flex: 1; min-width: 200px; }
form.inline { display: inline; }
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert-error { background: #fdecec; border-color: #f5c2c2; color: #8f1d1f; }
.alert-success { background: #e8f7ee; border-color: #b9e5c9; color: #135c2f; }
.alert-info { background: #eaf3ff; border-color: #c6dcfb; color: #123f80; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #eef2f7; color: #334155; }
.st-new { background: #e6eefc; color: var(--blue-d); }
.st-in-progress { background: #e3f1ff; color: #0f6fd6; }
.st-pending-user { background: #fff3dd; color: #a65f00; }
.st-on-hold { background: #f0e9ff; color: #6d28d9; }
.st-awaiting-approval { background: #fdebd2; color: #b45309; }
.st-escalated { background: #fde3e3; color: #c0262a; }
.st-resolved { background: #e3f6ea; color: #15803d; }
.st-closed { background: #eceff3; color: #475569; }
.prio { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 20px; font-size: 12.5px; font-weight: 600; }
.prio i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.pr-critical { background: #fde5e5; color: #d32f2f; }
.pr-high { background: #fff0dc; color: #e07800; }
.pr-medium { background: #e6effd; color: #1d5fc9; }
.pr-low { background: #eef1f5; color: #64748b; }
.pill { background: #eef2f7; color: #334155; border-radius: 20px; padding: 3px 12px; font-size: 12.5px; font-weight: 600; }
.pill-red { background: #fde2e2; color: #c62828; }
.pill-purple { background: #7c5cd6; color: #fff; }
.late { color: var(--red); font-weight: 700; }
.ontime { color: var(--green); font-weight: 600; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12.5px; color: #334155; background: #eef3fa; padding: 9px 10px; font-weight: 700; white-space: nowrap; }
.tbl th:first-child { border-radius: 8px 0 0 8px; } .tbl th:last-child { border-radius: 0 8px 8px 0; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.compact td { padding: 7px 10px; }
.tbl td input, .tbl td select { padding: 6px 8px; }
.tbl .ellip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: #f6f9fe; }
tr.dim td { opacity: .55; }
.pager { display: flex; gap: 14px; justify-content: center; margin-top: 14px; align-items: center; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { padding: 7px 14px; border-radius: 20px; background: #fff; border: 1px solid var(--line); color: #334155; font-weight: 600; }
.tabs a.on { background: var(--navy2); color: #fff; border-color: var(--navy2); }
.tabs a:hover { text-decoration: none; }

/* ---------- filter bar ---------- */
.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 10px 14px; margin-bottom: 14px; }
.filterbar select { width: auto; min-width: 140px; }
.filterbar label { display: flex; align-items: center; gap: 8px; }
.filterbar label.grow { flex: 1; min-width: 220px; }
.dash-filters { gap: 18px; background: #f7f9fd; }
.dash-filters .ic { color: var(--navy2); width: 22px; height: 22px; }
.dash-filters select { min-width: 150px; max-width: 210px; }
.updated { margin-left: auto; font-size: 12.5px; color: #334155; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.updated .ic { width: 18px; height: 18px; color: var(--navy2); }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.kpi { display: flex; gap: 16px; align-items: center; border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--line); border-left: 4px solid; box-shadow: var(--shadow); color: var(--ink); }
.kpi:hover { text-decoration: none; transform: translateY(-1px); }
.kpi > .ic { width: 46px; height: 46px; stroke-width: 1.7; }
.kpi h4 { margin: 0; font-size: 16px; }
.kpi strong { display: block; font-size: 36px; line-height: 1.1; font-weight: 800; }
.kpi small { font-size: 13.5px; color: #334155; }
.k-blue { background: linear-gradient(135deg, #f3f8ff, #e4efff); border-left-color: var(--blue); } .k-blue > .ic { color: var(--blue); }
.k-red { background: linear-gradient(135deg, #fff5f5, #ffe5e5); border-left-color: var(--red); } .k-red > .ic { color: var(--red); }
.k-orange { background: linear-gradient(135deg, #fffaf2, #ffefd9); border-left-color: var(--orange); } .k-orange > .ic { color: var(--orange); }
.k-green { background: linear-gradient(135deg, #f4fcf6, #e2f6e8); border-left-color: var(--green); } .k-green > .ic { color: var(--green); }
.k-cyan { background: linear-gradient(135deg, #f2faff, #e0f2fe); border-left-color: var(--cyan); } .k-cyan > .ic { color: #0b6fc2; }
.k-purple { background: linear-gradient(135deg, #f8f5ff, #ede6ff); border-left-color: var(--purple); } .k-purple > .ic { color: var(--purple); }

/* ---------- charts ---------- */
.hbars { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 80px; gap: 12px; align-items: center; color: var(--ink); font-size: 15px; }
.hbar:hover { text-decoration: none; }
.hb-track { height: 18px; background: #e8edf5; border-radius: 3px; overflow: hidden; }
.hb-track span { display: block; height: 100%; background: linear-gradient(90deg, #1a6fe0, #2b8cff); border-radius: 3px; }
.hb-v { font-size: 14px; } .hb-v em { font-style: normal; color: #334155; }
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 210px; flex: none; }
.donut .dl { fill: #fff; font-size: 12px; font-weight: 700; text-anchor: middle; }
.donut .dc1 { font-size: 30px; font-weight: 800; text-anchor: middle; fill: var(--ink); }
.donut .dc2 { font-size: 11.5px; text-anchor: middle; fill: #334155; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.legend i, .legend-inline i { display: inline-block; width: 13px; height: 13px; border-radius: 3px; margin-right: 8px; vertical-align: -2px; }
.legend-inline { display: flex; gap: 16px; font-size: 13px; }
.legend-inline i { border-radius: 50%; }
.line { width: 100%; height: auto; }
.line .grid { stroke: #e3e9f2; }
.line .ya { font-size: 12px; fill: #475569; text-anchor: end; }
.line .xa { font-size: 12px; fill: #475569; text-anchor: middle; }

/* ---------- team / health ---------- */
.team-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 6px 0 12px; }
.tt { border: 1px solid; border-radius: 10px; padding: 14px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink); }
.tt:hover { text-decoration: none; }
.tt .ic { width: 28px; height: 28px; }
.tt strong { font-size: 28px; font-weight: 800; line-height: 1.2; }
.tt span { font-size: 14px; color: #334155; }
.t-blue { background: #f3f8ff; border-color: #cfe0fa; } .t-blue .ic { color: var(--blue); }
.t-red { background: #fff5f5; border-color: #f7cccc; } .t-red .ic { color: var(--red); }
.t-green { background: #f3fbf6; border-color: #c7ebd3; } .t-green .ic { color: var(--green); }
.t-cyan { background: #f2f9ff; border-color: #cbe5f8; } .t-cyan .ic { color: #0b6fc2; }
.health { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.hc { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 10px; border: 1px solid; color: var(--ink); }
.hc:hover { text-decoration: none; }
.hc .hc-ic { width: 36px; height: 36px; color: #1677d9; }
.hc b { display: block; font-size: 14.5px; }
.hc span { display: flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 600; }
.hc span .ic { width: 17px; height: 17px; }
.hc-ok { background: #f3fbf6; border-color: #c7ebd3; } .hc-ok span { color: var(--green); }
.hc-warn { background: #fff8ee; border-color: #f8d9a8; } .hc-warn span { color: #d97706; }
.hc-bad { background: #fff3f3; border-color: #f5c0c0; } .hc-bad span { color: var(--red); }
.phase2 { background: linear-gradient(135deg, #faf8ff, #f1ecff); }
.p2 { display: flex; gap: 20px; align-items: center; }
.p2-l { display: flex; align-items: center; gap: 12px; padding-right: 20px; border-right: 1px solid #d9d0f2; white-space: nowrap; }
.p2-l .ic { width: 38px; height: 38px; color: var(--navy2); }
.p2 p { margin: 0; color: #334155; }

/* ---------- ticket conversation ---------- */
.ticket-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 14px; }
.ticket-head h2 { margin: 2px 0 0; }
.head-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.msg { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.msg-h { display: flex; gap: 10px; align-items: center; padding: 8px 14px; background: #f6f8fc; font-size: 13px; }
.msg-h span { margin-left: auto; color: var(--muted); }
.msg-b { padding: 12px 14px; white-space: normal; overflow-wrap: anywhere; }
.msg-staff { border-color: #cfe0fa; } .msg-staff .msg-h { background: #edf4ff; }
.msg-internal { border-color: #f8d9a8; border-style: dashed; } .msg-internal .msg-h { background: #fff6e8; }
.tag { font-style: normal; font-size: 11px; background: #f8d9a8; color: #7a4200; padding: 1px 8px; border-radius: 10px; }
.msg-sys { font-size: 12.5px; color: var(--muted); padding: 4px 14px 12px; border-left: 3px solid var(--line); margin: 0 0 12px 8px; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 12px; }
.att { display: inline-flex; align-items: center; gap: 6px; background: #f2f6fc; border: 1px solid #dbe4f2; border-radius: 6px; padding: 5px 10px; font-size: 13px; }
.att .ic { width: 15px; height: 15px; }
.reply { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 6px; margin-bottom: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.approval-box { background: #fff8ee; border: 1px solid #f8d9a8; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.kv { display: grid; grid-template-columns: 100px 1fr; gap: 8px 10px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.back { font-weight: 600; }

/* portal */
.success-card { text-align: center; }
.big-check .ic { width: 64px; height: 64px; color: var(--green); }
.ticket-no { font-size: 34px; font-weight: 800; color: var(--navy2); letter-spacing: 1px; margin-bottom: 8px; }
.sla-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.sla-list li { display: flex; justify-content: space-between; align-items: center; }

/* ---------- responsive ---------- */
@media (max-width: 1400px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .health { grid-template-columns: 1fr 1fr; }
  .app-name { font-size: 22px; }
}
@media (max-width: 1000px) {
  .grid-3, .grid-2, .portal-grid, .portal-grid.wide-side { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; padding: 10px 16px; gap: 12px; }
  .sep, .page-title { display: none; }
  .wrap { padding: 14px; }
  .subnav { padding: 0 10px; overflow-x: auto; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .updated { margin-left: 0; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { flex-direction: column; align-items: flex-start; gap: 6px; }
  .kpi strong { font-size: 28px; }
  .form.grid2 { grid-template-columns: 1fr; }
  .team-tiles, .health { grid-template-columns: 1fr 1fr; }
  .donut-wrap { flex-direction: column; }
  .hbar { grid-template-columns: 100px 1fr 70px; font-size: 13px; }
  .role-chip small { display: none; }
  .p2 { flex-direction: column; align-items: flex-start; }
  .p2-l { border: 0; }
}
