/* Technoid Website Intelligence
   Type: Poppins throughout, to match technoid.ae.
   Colour: cool paper, deep ink, indigo for actions, amber only for "check this". */

@font-face {
  font-family: "Poppins";
  src: url("../fonts/poppins-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("../fonts/poppins-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("../fonts/poppins-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("../fonts/poppins-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f1f4f8;
  --surface: #ffffff;
  --ink: #0f1b2d;
  --muted: #55627a;
  --line: #d6dde8;
  --brand: #2438c9;
  --brand-ink: #ffffff;
  --wash: #e6ebfa;
  --good: #0b7a4b;
  --bad: #b8322a;
  --flag: #e8a93a;
  --flag-bg: #fff4d6;
  --flag-ink: #5c4000;
  --series-1: #2a78d6;
  --track: #e3e8f0;

  --display: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-control: 10px;
  --r-panel: 18px;
  --page: 1120px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0c1322;
  --surface: #131c30;
  --ink: #e8edf7;
  --muted: #9ba8c0;
  --line: #25314a;
  --brand: #8fa0ff;
  --brand-ink: #0c1322;
  --wash: #1a2545;
  --good: #4cc38a;
  --bad: #ff8a80;
  --flag: #e8a93a;
  --flag-bg: #2e260e;
  --flag-ink: #f4d58a;
  --series-1: #3987e5;
  --track: #1f2a42;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--text);
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3 {
  font-family: var(--display);
  line-height: 1.12;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.015em;
}
h1 {
  font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.9rem);
}
h2 {
  font-size: 1.35rem;
}
h3 {
  font-size: 1.05rem;
  font-family: var(--text);
  font-weight: 600;
  letter-spacing: 0;
}
p {
  margin: 0;
}
a {
  color: var(--brand);
  text-underline-offset: 0.18em;
}
small {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 400;
}
code {
  font-size: 0.9em;
  background: var(--wash);
  padding: 0.1em 0.35em;
  border-radius: 5px;
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  padding: 0.6rem 1rem;
  z-index: 10;
}
.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}
.lede {
  color: var(--muted);
  font-size: 1.06rem;
  max-width: 62ch;
}
.fine {
  color: var(--muted);
  font-size: 0.86rem;
  max-width: 75ch;
}
[hidden] {
  display: none !important;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.8rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  width: 0.95rem;
  height: 0.95rem;
  align-self: center;
  display: inline-block;
  background: var(--brand);
  border-radius: 4px 4px 4px 0;
  transform: rotate(45deg) scale(0.85);
}
.brand-name {
  font: 700 1.15rem var(--display);
  letter-spacing: -0.02em;
}
.brand-sub {
  color: var(--muted);
  font-size: 0.9rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--line);
  line-height: 1.1;
}
.brand-logo {
  height: 1.7rem;
  width: auto;
  display: block;
}
.logo-dark {
  display: none;
}
:root[data-theme="dark"] .logo-light {
  display: none;
}
:root[data-theme="dark"] .logo-dark,
.logo-dark.logo-forced {
  display: block;
}
.nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.nav a {
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
}
.nav a:hover {
  color: var(--ink);
  background: var(--track);
}
.nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.topbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.who {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  text-align: right;
}
.who small {
  font-size: 0.76rem;
}
.icon-btn {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

/* ---------- page scaffolding ---------- */

.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2.5rem) 5rem;
}
.page-head {
  margin-bottom: 2rem;
  display: grid;
  gap: 0.5rem;
}
.page-head-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-head-row > div {
  display: grid;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.05rem;
  border-radius: var(--r-control);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 600 0.95rem var(--text);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--muted);
}
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}
.btn-primary:hover {
  filter: brightness(1.08);
  border-color: var(--brand);
}
.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-quiet:hover {
  color: var(--ink);
  border-color: var(--line);
}
.btn-danger {
  color: var(--bad);
}
.btn-block {
  width: 100%;
  padding-block: 0.8rem;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.flash {
  padding: 0.8rem 1rem;
  border-radius: var(--r-control);
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  background: var(--surface);
  max-width: 80ch;
}
.flash-success {
  border-color: var(--good);
}
.flash-success::before {
  content: "✓ ";
  color: var(--good);
  font-weight: 700;
}
.flash-error {
  border-color: var(--bad);
}
.flash-error::before {
  content: "! ";
  color: var(--bad);
  font-weight: 700;
}
.flash-info {
  background: var(--wash);
  border-color: transparent;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: clamp(1.25rem, 3vw, 2rem);
}
.stack {
  display: grid;
  gap: 1.25rem;
}
.split {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1.6fr) minmax(16rem, 1fr);
  align-items: start;
}
.aside {
  display: grid;
  gap: 1.1rem;
  padding-top: 0.5rem;
}
.aside h2 {
  font-size: 1.1rem;
}
.form-narrow {
  max-width: 40rem;
}
.plain {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  display: grid;
  gap: 0.45rem;
  font-size: 0.93rem;
}
.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- forms ---------- */

.field {
  display: grid;
  gap: 0.4rem;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.field > span,
.field > legend {
  font-weight: 600;
  padding: 0;
}
.field > legend {
  margin-bottom: 0.4rem;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: var(--r-control);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-offset: 0;
  border-color: var(--brand);
}
.field-inline {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 0.6rem;
}
.filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.filters .field-inline:first-child {
  flex: 1 1 18rem;
}
.inline-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.options {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}
.option,
.check {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  cursor: pointer;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
}
.option:has(input:checked),
.check:has(input:checked) {
  border-color: var(--brand);
  background: var(--wash);
}
.option input,
.check input {
  margin-top: 0.3rem;
  accent-color: var(--brand);
}
.checks {
  display: grid;
  gap: 0.5rem;
}

.pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.pills button,
.pills-radio label span {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 500 0.92rem var(--text);
}
.pills button[aria-pressed="true"],
.pills-radio input:checked + span {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.pills-radio input {
  position: absolute;
  opacity: 0;
}
.pills-radio input:focus-visible + span {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}
.date-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.working {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border-radius: var(--r-control);
  background: var(--wash);
}
.working p {
  color: var(--muted);
  font-size: 0.92rem;
}
.spinner {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  flex: none;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- dashboard ---------- */

.choices {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  margin-bottom: 2rem;
}
.choice {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  min-height: 11rem;
  padding: 1.6rem;
  border-radius: var(--r-panel);
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}
.choice h2 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
}
.choice p {
  color: var(--muted);
  max-width: 34ch;
}
.choice-meta {
  align-self: end;
  font-size: 0.88rem;
  font-weight: 600;
  margin-top: 1rem;
}
.choice-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}
.choice-primary p {
  color: inherit;
  opacity: 0.85;
}
.choice:hover {
  border-color: var(--ink);
}
.choice-primary:hover {
  filter: brightness(1.08);
}

.quota {
  display: grid;
  gap: 1rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin-bottom: 3rem;
}
.quota .fine {
  grid-column: 1 / -1;
}
.meter {
  display: grid;
  gap: 0.4rem;
}
.meter-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.92rem;
  color: var(--muted);
}
.meter-top strong {
  color: var(--ink);
}
.meter-track {
  height: 8px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}
.meter-track span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  min-width: 0;
}

.block {
  margin-bottom: 3rem;
}
.block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.rows li {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.row-main {
  flex: 1 1 16rem;
  display: grid;
  text-decoration: none;
  color: var(--ink);
}
.row-main strong {
  font-size: 1.05rem;
}
.row-main span {
  color: var(--muted);
  font-size: 0.92rem;
}
.row-main:hover strong {
  color: var(--brand);
}
.row-meta {
  text-align: right;
  font-size: 0.92rem;
}
.tag,
.status {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.status-on {
  color: var(--good);
  border-color: var(--good);
}
.status-bad {
  color: var(--bad);
  border-color: var(--bad);
}

.empty {
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--r-panel);
  text-align: center;
  display: grid;
  gap: 0.9rem;
  justify-items: center;
  color: var(--muted);
}
.empty h1 {
  color: var(--ink);
  font-size: 1.6rem;
}

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}
table.data th,
table.data td {
  padding: 0.65rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data tbody tr:last-child > * {
  border-bottom: 0;
}
table.data thead th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
  background: var(--paper);
}
table.data tbody th {
  font-weight: 600;
  max-width: 26rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
table.data .num {
  text-align: right;
  white-space: nowrap;
}
table.data thead th button {
  all: unset;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
table.data thead th button:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}
table.data thead th[aria-sort="ascending"] button::after {
  content: " ↑";
}
table.data thead th[aria-sort="descending"] button::after {
  content: " ↓";
}
table.data-list tbody th a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
}
table.data-list tbody th a:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* ---------- sign in ---------- */

body.auth {
  min-height: 100vh;
  display: grid;
}
.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(20rem, 1fr);
  min-height: 100vh;
}
.auth-grid-single {
  grid-template-columns: minmax(0, 32rem);
  justify-content: center;
}
.auth-side {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(2rem, 5vw, 4rem);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 2rem;
  overflow: hidden;
}
:root[data-theme="dark"] .auth-side {
  background: #070b15;
  color: var(--ink);
}
.auth-brand {
  font: 700 1.2rem var(--display);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.auth-side .brand-mark {
  background: #8fa0ff;
}
.auth-line {
  width: 100%;
  height: 100%;
  min-height: 10rem;
  align-self: center;
}
.auth-line path {
  fill: none;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.auth-line-prev {
  stroke: #55627a;
  stroke-width: 2;
  stroke-dasharray: 4 7;
}
.auth-line-now {
  stroke: #8fa0ff;
  stroke-width: 3;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw 1.6s 0.2s ease-out forwards;
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
.auth-claim {
  font: 500 clamp(1.5rem, 1rem + 2vw, 2.4rem)/1.15 var(--display);
  letter-spacing: -0.02em;
  max-width: 18ch;
}
.auth-form {
  align-self: center;
  padding: clamp(1.5rem, 5vw, 4rem);
  display: grid;
  gap: 1.25rem;
  max-width: 30rem;
  width: 100%;
}

/* ---------- report: toolbar and sharing ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.toolbar-meta {
  color: var(--muted);
  font-size: 0.92rem;
}
.toolbar-end {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.share {
  display: grid;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
}
.share h2 {
  font-size: 1.05rem;
  font-family: var(--text);
  letter-spacing: 0;
  margin-bottom: 0.3rem;
}
.share-state p {
  color: var(--muted);
  max-width: 80ch;
}
.share-link {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.share-link input {
  flex: 1 1 20rem;
  font-size: 0.9rem;
  background: var(--paper);
}
.share-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- report ---------- */

.topbar-public {
  position: static;
}
.src {
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  margin-left: 0.4rem;
  white-space: nowrap;
}

.pairs {
  margin: 0;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}
.pairs > div {
  display: grid;
  grid-template-columns: minmax(8rem, 18rem) 1fr;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.pairs dt {
  color: var(--muted);
}
.pairs dd {
  margin: 0;
  font-weight: 500;
}
.defs {
  margin: 1rem 0 0;
  display: grid;
  gap: 0.9rem;
}
.defs dt {
  font-weight: 600;
}
.defs dd {
  margin: 0;
  color: var(--muted);
  max-width: 75ch;
}

.fold > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand);
  padding: 0.3rem 0;
  width: fit-content;
}
.fold[open] > summary {
  margin-bottom: 0.9rem;
}
.notes {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.5rem;
  max-width: 80ch;
}
.callout {
  background: var(--flag-bg);
  color: var(--flag-ink);
  padding: 0.9rem 1.1rem;
  border-radius: var(--r-control);
  border-left: 6px solid var(--flag);
  max-width: 80ch;
}
.report-foot {
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
  color: var(--muted);
  font-size: 0.88rem;
  max-width: 80ch;
}

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .split {
    grid-template-columns: 1fr;
  }
  .auth-grid {
    grid-template-columns: 1fr;
  }
  .auth-side {
    min-height: 0;
    grid-template-rows: auto;
    padding-block: 1.5rem;
  }
  .auth-line,
  .auth-claim {
    display: none;
  }
  .topbar {
    position: static;
    gap: 0.75rem;
  }
  .brand-sub {
    display: none;
  }
  .who small {
    display: none;
  }
}
@media (max-width: 560px) {
  .pairs > div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
  .date-pair {
    grid-template-columns: 1fr;
  }
  .row-meta {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-line-now {
    animation: none;
    stroke-dashoffset: 0;
  }
  .spinner {
    animation-duration: 2.5s;
  }
}

/* ---------- print / save as PDF ---------- */

@media print {
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --paper: #fff;
    --surface: #fff;
    --ink: #000;
    --muted: #444;
    --line: #bbb;
    --track: #e6e6e6;
    --good: #0b7a4b;
    --bad: #b8322a;
    --flag-bg: #fff4d6;
    --flag-ink: #5c4000;
    --series-1: #2a78d6;
  }
  .no-print,
  .topbar,
  .pills,
  .flash,
  .fold > summary {
    display: none !important;
  }
  .page {
    padding: 0;
    max-width: none;
  }
  table.data tr {
    break-inside: avoid;
  }
  .table-wrap {
    overflow: visible;
  }
  body {
    font-size: 11pt;
  }
}
