/* INTECHI visual language, see docs/DESIGN-PRO-CRM.md. Colours of an organization come from --accent and --brand set on <html>. */
:root {
  --brand: #2f86ee;
  --accent: #1c6bc7;
  --menu: color-mix(in srgb, var(--brand) 14%, #fff);
  --bg: #f4f5f2;
  --ink: #15201b;
  --muted: #5a6b7a;
  --line: #dde1da;
  --card: #fff;
  --warn: #b3261e;
  --soft: #f6f7f4;
  --soft2: #eef0ec;
  --grid: #e6e8e3;
  --focus: #f59331;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --mark-other: #a9b0aa;
  --shadow: 0 1px 2px rgba(21, 32, 27, 0.06), 0 8px 20px -10px rgba(21, 32, 27, 0.22);
  --shadow-hover: 0 2px 4px rgba(21, 32, 27, 0.08), 0 14px 28px -10px rgba(21, 32, 27, 0.3);
}
html[data-theme='dark'] {
  color-scheme: dark;
  --menu: color-mix(in srgb, var(--brand) 24%, #0e1311);
  --bg: #0e1311;
  --card: #18201c;
  --ink: #e7ede9;
  --muted: #9daba4;
  --line: #2b3731;
  --soft: #202a25;
  --soft2: #27332d;
  --grid: #2b3731;
  --warn: #ff8a80;
  --link: color-mix(in srgb, var(--accent) 42%, #fff);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 20px -10px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: Manrope, system-ui, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--ink);
}
a {
  color: var(--link, var(--accent));
}
input,
select,
textarea {
  color: var(--ink);
}
.mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* layout: menu 248 px on the left, content on the right */
.shell {
  display: flex;
  min-height: 100vh;
  align-items: flex-start;
}
.topbar {
  display: none;
}
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  width: 248px;
  flex: none;
  background: var(--menu);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.logo-pill {
  padding: 6px 4px;
}
.brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
}
html[data-theme='dark'] .brand-name {
  color: var(--link, var(--accent));
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav a {
  position: relative;
  color: var(--ink);
  text-decoration: none;
  padding: 0 12px;
  min-height: 44px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
}
.nav a:hover {
  background: rgba(21, 32, 27, 0.08);
}
.nav a.on {
  background: color-mix(in srgb, var(--accent) 14%, var(--card));
  color: var(--accent);
  font-weight: 800;
}
.nav a.on::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
}
html[data-theme='dark'] .nav a.on {
  color: var(--link, var(--accent));
}
.userbox {
  margin-top: auto;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.main {
  flex: 1;
  min-width: 0;
  padding: 20px 28px 48px;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.top h1 {
  margin: 0;
  font-size: 24px;
}
.tools,
.langs {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
}
.main > * + * {
  margin-top: 16px;
}
.main > .top {
  margin-top: 0;
}

/* components */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}
.card p {
  margin: 0;
  color: var(--muted);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 6px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.btn:hover {
  filter: brightness(1.1);
}
.btn.secondary {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.danger {
  background: var(--warn);
}
.btn.sm {
  min-height: 34px;
  padding: 0 12px;
}
.chip {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.theme-toggle .moon {
  display: none;
}
html[data-theme='dark'] .theme-toggle .sun {
  display: none;
}
html[data-theme='dark'] .theme-toggle .moon {
  display: inline;
}
.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 600;
  background: var(--soft2);
  color: #4c5a55;
}
.badge.good {
  background: #ddefe6;
  color: #0a4d3f;
}
.badge.warn {
  background: #fcefd3;
  color: #7a4b00;
}
.badge.bad {
  background: #f8dcdc;
  color: #8a1c1c;
}
input,
select,
textarea {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  background: var(--card);
  font-family: inherit;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
th.num,
td.num,
th.date,
td.date {
  text-align: center;
}
td.num {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  transition:
    transform 0.15s,
    border-color 0.15s;
}
.tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* sign-in */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: linear-gradient(135deg, #e8f1fc, #fff);
}
html[data-theme='dark'] .login {
  background: linear-gradient(135deg, #0e1a2b, #0e1311);
}
.lcard {
  width: 100%;
  max-width: 380px;
  background: #2f88ee;
  color: #fff;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 18px 50px rgba(28, 77, 140, 0.25);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lcard h1 {
  margin: 0;
  font-size: 28px;
}
.lcard p {
  margin: 0;
  font-size: 14px;
}
.lcard a.ms {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 6px;
  background: #f59331;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.lcard .dev {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
}
.lcard .dev button {
  min-height: 44px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* phone */
@media (max-width: 860px) {
  .shell {
    flex-direction: column;
  }
  .topbar {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--menu);
  }
  .side {
    display: none;
    position: static;
    width: 100%;
    height: auto;
  }
  .side.open {
    display: flex;
  }
  .main {
    width: 100%;
    padding: 16px;
  }
}
@media (max-width: 640px) {
  .main {
    overflow-x: hidden;
  }
  .card {
    overflow-x: auto;
  }
  /* a table becomes a list of small cards: "label : value" on every line */
  table.cards,
  table.cards tbody,
  table.cards tr,
  table.cards td {
    display: block;
    width: 100%;
  }
  table.cards thead {
    display: none;
  }
  table.cards tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 10px;
  }
  table.cards td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: right;
    border: 0;
    overflow-wrap: anywhere;
  }
  table.cards td::before {
    content: attr(data-label);
    color: var(--muted);
    text-align: left;
  }
}
