/* ==========================================================================
   Takween — visual identity layer (Brand Identity Guidelines 2026)
   Loaded after the compiled stylesheet; overrides tokens and key surfaces.
   Colours: Takween Blue #024DFD · Sky #2A97FB · Ice #AACFF2
            Ink #050505 · Charcoal #373737 · Mist #ECECEC
   Usage ratio: 50% mist/white · 30% blue · 15% ink · 5% sky
   Typeface: Readex Pro
   ========================================================================== */

:root {
  --tk-blue: #024dfd;
  --tk-blue-600: #0139c4;
  --tk-blue-800: #011f6b;
  --tk-sky: #2a97fb;
  --tk-ice: #aacff2;
  --tk-ink: #050505;
  --tk-charcoal: #373737;
  --tk-mist: #ececec;
  --tk-gradient: linear-gradient(90deg, #024dfd 0%, #2a97fb 55%, #aacff2 100%);
  --tk-radius-lg: 24px;
  --tk-radius: 18px;
  --tk-radius-sm: 12px;

  --bg: #f3f4f6;
  --panel: #ffffff;
  --border: #e3e3e3;
  --text: #373737;
  --heading: #050505;
  --muted: #7d7d7d;
  --accent: #024dfd;
  --accent-dark: #0139c4;
  --sidebar: #050505;
  --sidebar-muted: #9a9a9a;
  --tk-hover-row: #f4f7ff;
  --tk-input-bg: #f6f6f6;
  --tk-frame: #ffffff;
  --tk-shell: #f3f4f6;
  --tk-hatch: #b7bfcc;
  --font-sans: "Readex Pro", "Segoe UI", system-ui, sans-serif;
}

body.dark-mode {
  --bg: #0c0d0f;
  --panel: #16171b;
  --border: #24262b;
  --text: #e6e6e6;
  --heading: #ffffff;
  --muted: #9a9ca3;
  --accent: #2a97fb;
  --accent-dark: #aacff2;
  --sidebar: #000000;
  --sidebar-muted: #8a8a8a;
  --tk-hover-row: #16181d;
  --tk-input-bg: #1e2025;
  --tk-frame: #000000;
  --tk-shell: #0c0d0f;
  --tk-hatch: #3a3e47;
}

.adv-app-shell,
.contractors-app-shell {
  --font-sans: "Readex Pro", "Segoe UI", system-ui, sans-serif;
  --adv-brand-deep: #024dfd;
  --adv-brand-mid: #0139c4;
  --adv-brand-soft: #2a97fb;
  --adv-brand-tint: #aacff2;
  --adv-brand-gradient: linear-gradient(135deg, #024dfd, #2a97fb);
  --adv-brand-gradient-soft: linear-gradient(90deg, #024dfd, #2a97fb);
}

/* ---------- Base ---------- */
html { letter-spacing: 0 !important; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
body input,
body textarea,
body [contenteditable="true"] { caret-color: var(--tk-blue) !important; }
h1, h2, h3, h4 { color: var(--heading); font-family: var(--font-sans); }
::selection { background: var(--tk-ice); color: var(--tk-ink); }
a { color: var(--tk-blue); }
body.dark-mode a { color: var(--tk-sky); }

* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--tk-blue) 55%, transparent) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--tk-blue) 45%, transparent); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Buttons ---------- */
button:hover { box-shadow: 0 8px 18px rgba(2, 77, 253, .16); }
button.primary,
.add-user-btn,
.users-search-btn,
.login-submit-btn {
  background: var(--tk-blue) !important;
  color: #fff !important;
  border: 0;
  border-radius: var(--tk-radius-sm);
  font-family: var(--font-sans);
  font-weight: 600;
}
button.primary:hover,
.add-user-btn:hover,
.users-search-btn:hover,
.login-submit-btn:hover:not(:disabled) { background: var(--tk-blue-600) !important; }
button.secondary,
.btn-secondary {
  background: var(--tk-input-bg);
  color: var(--heading);
  border: 1px solid var(--border);
  border-radius: var(--tk-radius-sm);
}
.action-btn { border-radius: 10px; }
.action-btn.edit { background: rgba(2, 77, 253, .09); color: var(--tk-blue); }
.action-btn.edit:hover { background: var(--tk-blue); color: #fff; }
.action-btn.view, .action-btn.print { background: rgba(42, 151, 251, .12); color: #0a6fd6; }
.action-btn.view:hover, .action-btn.print:hover { background: var(--tk-sky); color: #fff; }
.action-btn.delete:hover { background: #ef4444; color: #fff; }
body.dark-mode .action-btn.edit { color: var(--tk-sky); }
body.dark-mode .action-btn.view, body.dark-mode .action-btn.print { color: var(--tk-ice); }

/* ---------- Cards, tables, forms ---------- */
.users-card,
.modal-content,
.user-form,
.report-card,
.detail-card {
  border-radius: var(--tk-radius-lg);
  border: 0;
  box-shadow: none;
}
.modal, .modal-overlay {
  background: rgba(5, 5, 5, .42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal-content { box-shadow: 0 30px 60px rgba(5, 5, 5, .22); }
.modal-header h3 { font-weight: 600; }

.users-table th,
.users-table thead th {
  background: var(--tk-input-bg) !important;
  color: var(--heading) !important;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 0;
  white-space: nowrap;
}
.users-table thead th:first-child { border-start-start-radius: var(--tk-radius-sm); border-end-start-radius: var(--tk-radius-sm); }
.users-table thead th:last-child { border-start-end-radius: var(--tk-radius-sm); border-end-end-radius: var(--tk-radius-sm); }
.users-table td { border-bottom: 1px solid var(--border); }
.users-table tbody tr { transition: background .15s ease; }
.users-table tbody tr:hover td { background: var(--tk-hover-row) !important; }

.users-search-input,
.form-group input,
.form-group select,
.form-group textarea,
.adv-fin-filter-select {
  background: var(--tk-input-bg);
  border: 1.5px solid transparent;
  border-radius: var(--tk-radius-sm);
  font-family: var(--font-sans);
}
.users-search-input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  background: var(--panel);
  border-color: var(--tk-blue);
  box-shadow: 0 0 0 3px rgba(2, 77, 253, .12);
}
.form-group input.error, .form-group select.error, .form-group textarea.error { border-color: #ef4444; }
.form-group label { font-weight: 500; color: var(--heading); }

.status-badge { border-radius: 999px; font-weight: 500; }
.status-badge.due { background: rgba(2, 77, 253, .1); color: var(--tk-blue); }
body.dark-mode .status-badge.due { color: var(--tk-sky); }

.breadcrumbs, .users-breadcrumb { color: var(--muted); }
.users-management .users-breadcrumb a:hover { color: var(--tk-blue); }

.toast { border-radius: var(--tk-radius-sm); font-family: var(--font-sans); }

/* ---------- Login ---------- */
.login-page {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: stretch;
  justify-items: stretch;
  gap: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--tk-mist);
}
body.dark-mode .login-page { background: #0b0b0c; }

.tk-hero {
  position: relative;
  overflow: hidden;
  width: auto;
  max-width: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0;
  padding: 56px 64px;
  text-align: right;
  background: var(--tk-ink);
  color: #fff;
  animation: none;
}
.tk-hero-thread {
  /* the thread enters and leaves the frame in the lower half, below the copy */
  position: absolute;
  inset: auto 0 0 0;
  height: 52%;
  background: url("/brand/thread.svg") left bottom / cover no-repeat;
  pointer-events: none;
}
.tk-hero > *:not(.tk-hero-thread) { position: relative; }
.tk-hero-logo { width: 230px; height: auto; display: block; }
.tk-hero-copy { margin-top: clamp(48px, 11vh, 120px); }
.tk-hero .login-brand-title {
  margin: 0;
  color: #fff;
  font-size: clamp(2.2rem, 4.2vw, 3.7rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0;
}
.tk-hero-en {
  margin: 14px 0 18px;
  color: var(--tk-sky);
  font-size: clamp(1.05rem, 1.7vw, 1.45rem);
  font-weight: 300;
}
.tk-hero .login-brand-subtitle { color: #bdbdbd; font-size: .98rem; font-weight: 400; }
.tk-hero-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #8a8a8a;
  font-size: 13px;
}

.login-container {
  align-self: center;
  justify-self: center;
  width: min(440px, calc(100% - 40px));
  margin: 40px 0;
  padding: 40px 36px 32px;
  background: var(--panel);
  border: 0;
  border-radius: var(--tk-radius-lg);
  box-shadow: none;
  animation: none;
}
.login-container:before { display: none; }
.tk-form-logo { display: none; width: 170px; height: auto; margin: 0 0 26px; }
body.dark-mode .tk-form-logo { content: url("/brand/logo-white.png"); }
.tk-form-title { margin: 0 0 6px; font-size: 1.65rem; font-weight: 700; color: var(--heading); }
.tk-form-lead { margin: 0 0 28px; color: var(--muted); font-size: .95rem; }
.login-form { gap: 10px; }
.login-label { font-weight: 500; color: var(--heading); font-size: .85rem; }
.login-input {
  padding: .9rem 1rem;
  border-radius: var(--tk-radius-sm);
  border: 1.5px solid transparent;
  background: var(--tk-input-bg);
  font-size: .95rem;
}
.login-input:focus {
  border-color: var(--tk-blue);
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(2, 77, 253, .12);
}
.login-submit-btn { margin-top: 12px; padding: .95rem 1rem; font-size: 1rem; }
.login-password-toggle { color: var(--muted); }
.login-theme-toggle,
.login-theme-toggle-inline {
  background: transparent;
  border: 0;
  color: var(--muted);
  box-shadow: none;
}
.login-theme-toggle:hover { color: var(--tk-blue); box-shadow: none; }
.login-theme-toggle i { color: inherit; }
.login-error { border-radius: var(--tk-radius-sm); }

@media (max-width: 1024px) {
  .login-page { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .tk-hero { padding: 36px 32px 40px; min-height: 340px; }
  .tk-hero-copy { margin-top: 28px; }
  .tk-hero-thread { height: 45%; }
  .tk-hero-logo { width: 180px; }
  .tk-hero-foot { display: none; }
}
@media (max-width: 640px) {
  .tk-hero { display: none; }
  .login-page {
    grid-template-rows: 1fr;
    background:
      linear-gradient(to bottom, rgba(236, 236, 236, .2), var(--tk-mist) 70%),
      url("/brand/pattern-blue-16.png") center top / 110px 110px repeat,
      var(--tk-mist);
  }
  body.dark-mode .login-page {
    background:
      linear-gradient(to bottom, rgba(11, 11, 12, .3), #0b0b0c 70%),
      url("/brand/pattern-blue-55.png") center top / 110px 110px repeat,
      #0b0b0c;
  }
  .login-container { padding: 32px 22px 24px; margin: 24px 0; }
  .tk-form-logo { display: block; }
}

/* ==========================================================================
   Layout v2 — reference dashboard style (approved 2026-10-26):
   white outer frame · light-gray panels (sidebar + content) · white rounded cards
   ========================================================================== */

/* ---------- Sidebar: light panel, blue lockup, edge bar on the active page ---------- */
.sidebar--branded {
  background: var(--tk-shell);
  color: var(--text);
  border-inline-start: 0;
  padding: 26px 18px 18px;
  gap: 18px;
}
.sidebar--branded .brand { padding: 0 8px 14px; margin: 0; border-bottom: 0; }
.sidebar--branded .brand-main { flex-direction: column; align-items: flex-start; gap: 0; }
.sidebar--branded .brand-logo {
  width: auto;
  height: 46px;
  max-width: 190px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  object-fit: contain;
}
body.dark-mode .sidebar--branded .brand-logo { content: url("/brand/logo-white.png"); }
.sidebar--branded .brand-title,
.sidebar--branded .brand-subtitle-sidebar { display: none; }
.sidebar--branded .sidebar-nav { gap: 4px; }
.sidebar--branded .section-title {
  display: block;
  margin: 12px 14px 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  color: #9a9a9a;
}
.sidebar--branded .sidebar-link,
.sidebar--branded .sidebar-section button {
  position: relative;
  color: #7a7a7a;
  font-size: 15px;
  font-weight: 400;
  border: 0;
  border-radius: 14px;
  background: transparent;
  transition: background .18s ease, color .18s ease;
}
body.dark-mode .sidebar--branded .sidebar-link,
body.dark-mode .sidebar--branded .sidebar-section button { color: #9a9ca3; }
.sidebar--branded .sidebar-icon { color: inherit; font-size: 17px; width: 22px; text-align: center; opacity: 1; }
.sidebar--branded .sidebar-link:hover,
.sidebar--branded .sidebar-dropdown-toggle:hover {
  background: var(--panel);
  color: var(--heading);
  box-shadow: none;
  transform: none;
}
.sidebar--branded .sidebar-link.active:not(.sidebar-submenu-link),
.sidebar--branded .sidebar-dropdown-toggle.active,
.sidebar--branded .sidebar-dropdown-toggle.open {
  background: transparent;
  color: var(--heading);
  font-weight: 600;
}
.sidebar--branded .sidebar-link.active .sidebar-icon,
.sidebar--branded .sidebar-dropdown-toggle.active .sidebar-icon { color: var(--tk-blue); }
body.dark-mode .sidebar--branded .sidebar-link.active .sidebar-icon,
body.dark-mode .sidebar--branded .sidebar-dropdown-toggle.active .sidebar-icon { color: var(--tk-sky); }
.sidebar--branded .sidebar-link.active:not(.sidebar-submenu-link)::before,
.sidebar--branded .sidebar-dropdown-toggle.active::before {
  content: "";
  position: absolute;
  inset-block: 9px;
  inset-inline-start: -18px;
  width: 5px;
  border-start-end-radius: 6px;
  border-end-end-radius: 6px;
  background: var(--tk-blue);
}
body.dark-mode .sidebar--branded .sidebar-link.active:not(.sidebar-submenu-link)::before,
body.dark-mode .sidebar--branded .sidebar-dropdown-toggle.active::before { background: var(--tk-sky); }
.sidebar--branded .sidebar-submenu {
  margin: 2px 0 6px;
  margin-inline-start: 24px;
  padding: 2px 0;
  background: transparent;
  border: 0;
  border-inline-start: 2px solid var(--border);
  border-radius: 0;
}
.sidebar--branded .sidebar-submenu-link { color: #8a8a8a; font-size: 14px !important; font-weight: 400 !important; }
.sidebar--branded .sidebar-submenu-link.active {
  background: transparent !important;
  color: var(--tk-blue) !important;
  font-weight: 600 !important;
}
body.dark-mode .sidebar--branded .sidebar-submenu-link.active { color: var(--tk-sky) !important; }
.sidebar-close-btn { color: var(--heading); background: var(--panel); border-radius: 12px; }

/* bottom card (the reference's "download our app" spot) */
.tk-promo {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  margin-top: auto;
  padding: 20px 18px 18px;
  border-radius: 22px;
  background: var(--tk-ink);
  color: #fff;
}
.tk-promo-thread {
  /* runs under the button, below the title and text */
  position: absolute;
  inset: auto -30% -26% -20%;
  height: 62%;
  background: url("/brand/thread-loop.svg") center / cover no-repeat;
  pointer-events: none;
}
.tk-promo > :not(.tk-promo-thread) { position: relative; }
.tk-promo-symbol { display: block; width: 34px; height: 34px; margin-bottom: 14px; }
.tk-promo-title { margin: 0; font-size: 1.2rem; font-weight: 600; line-height: 1.3; color: #fff; }
.tk-promo-text { margin: 4px 0 16px; font-size: 13px; color: #bdbdbd; }
.tk-promo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  border-radius: 999px;
  background: var(--tk-blue);
  color: #fff !important;
  font-weight: 500;
  text-decoration: none;
  transition: background .18s ease;
}
.tk-promo-btn:hover { background: var(--tk-blue-600); }

/* ---------- Top bar: flat on the panel, round controls, initial avatar ---------- */
.topbar {
  background: transparent !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.search-field {
  background: var(--panel);
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
}
.search-field:focus-within {
  background: var(--panel);
  border-color: var(--tk-blue);
  box-shadow: 0 0 0 3px rgba(2, 77, 253, .12);
}
.search-field i { color: var(--tk-blue); }
.topbar .icon-button,
.topbar .icon-button.subtle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: var(--panel);
  color: var(--heading);
}
.topbar .icon-button.subtle:hover:not(:disabled),
.sidebar-toggle:hover {
  background: var(--tk-blue);
  color: #fff;
  box-shadow: none;
  transform: none;
}
.topbar .sync-toggle i, .topbar .fullscreen-toggle i, .topbar .theme-toggle i { filter: none; }
.user-trigger {
  gap: 10px;
  padding: 4px 6px 4px 12px !important;
  border: 0;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: none;
  color: var(--heading);
  font-weight: 600;
}
.user-trigger:hover { background: var(--panel); box-shadow: 0 0 0 2px rgba(2, 77, 253, .18); }
.topbar .tk-avatar {
  width: 40px;
  height: 40px;
  font-size: 16px;
  background: var(--tk-blue);
  color: #fff;
}
.user-menu { border-radius: 18px; border-color: var(--border); box-shadow: 0 18px 40px rgba(5, 5, 5, .14); }
.user-menu i { color: var(--tk-blue); }
body.dark-mode .user-menu i { color: var(--tk-sky); }

/* ---------- Frame (desktop): white outer frame, sidebar + content as rounded panels ---------- */
@media (min-width: 1025px) {
  body { background: var(--tk-frame); }
  .adv-app-shell {
    box-sizing: border-box;
    min-height: 100vh;
    padding: 14px;
    column-gap: 14px;
    grid-template-columns: 272px minmax(0, 1fr);
    background: var(--tk-frame);
  }
  .adv-app-shell.is-sidebar-closed { grid-template-columns: minmax(0, 1fr); }
  .adv-app-shell .sidebar--branded {
    position: sticky;
    top: 14px;
    align-self: start;
    box-sizing: border-box;
    height: calc(100vh - 28px);
    overflow: hidden;
    border-radius: 28px;
  }
  /* only the menu scrolls, so the quick-invoice card stays pinned at the bottom;
     widened by the active bar's offset so the bar is not clipped by the scroll box */
  .adv-app-shell .sidebar--branded .sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin-inline: -18px;
    padding-inline: 18px;
  }
  .adv-app-shell .main-area {
    min-height: calc(100vh - 28px);
    padding: 0 30px 34px;
    border-radius: 28px;
    background: var(--tk-shell);
  }
  .adv-app-shell .topbar {
    margin: 0 -30px 18px !important;
    padding: 16px 30px !important;
    min-height: 78px !important;
  }
  .search-field { min-width: 300px !important; }
}

/* ---------- Dashboard ---------- */
.tk-dash { display: flex; flex-direction: column; gap: 18px; }
.tk-dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.tk-dash-title { margin: 0; font-size: clamp(1.9rem, 2.8vw, 2.6rem); font-weight: 600; line-height: 1.15; color: var(--heading); }
.tk-dash-lead { margin: 8px 0 0; font-size: 1rem; color: var(--muted); }
.tk-dash-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.tk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.tk-btn--primary { background: var(--tk-blue); color: #fff !important; }
.tk-btn--primary:hover { background: var(--tk-blue-600); }
.tk-btn--outline { background: transparent; border-color: var(--tk-blue); color: var(--tk-blue) !important; }
.tk-btn--outline:hover { background: var(--tk-blue); color: #fff !important; }
body.dark-mode .tk-btn--outline { border-color: var(--tk-sky); color: var(--tk-sky) !important; }
body.dark-mode .tk-btn--outline:hover { background: var(--tk-sky); color: var(--tk-ink) !important; }
.tk-btn--sm { height: 40px; padding: 0 16px; font-size: 14px; }
.tk-btn--block { width: 100%; height: 56px; font-size: 16px; margin-top: auto; }

.tk-period {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
}
.tk-period input {
  border: 0;
  background: transparent;
  color: var(--heading);
  font: inherit;
  font-size: 14px;
  outline: none;
}
body.dark-mode .tk-period input { color-scheme: dark; }
.tk-period i { color: var(--tk-blue); }

.tk-alert { margin: 0; padding: 12px 16px; border-radius: 16px; background: #fdecec; color: #b42318; }
.tk-link-btn { border: 0; background: none; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

.tk-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border-radius: 24px;
  background: var(--panel);
  color: var(--text);
}
.tk-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tk-card-title { margin: 0; font-size: 1.25rem; font-weight: 500; color: var(--heading); }
.tk-card-meta { font-size: 13px; color: var(--muted); }
.tk-empty { margin: auto 0; padding: 18px 0; text-align: center; color: var(--muted); }

/* stat cards */
.tk-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tk-kpi { gap: 12px; min-height: 212px; padding: 24px 26px; }
.tk-kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tk-kpi-label { margin: 0; font-size: 1.15rem; font-weight: 500; color: var(--heading); }
.tk-kpi-link {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1.5px solid var(--heading);
  border-radius: 50%;
  color: var(--heading) !important;
  transition: background .18s ease, color .18s ease;
}
.tk-kpi-link:hover { background: var(--heading); color: var(--panel) !important; }
.tk-arrow { width: 20px; height: 20px; transform: scaleX(-1); }
.tk-arrow path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tk-kpi-amount { display: flex; align-items: baseline; gap: 8px; margin: auto 0 0; }
.tk-kpi-value {
  font-size: clamp(2.4rem, 3.4vw, 3.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}
.tk-kpi-unit { font-size: 1rem; color: var(--muted); }
.tk-kpi-foot { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13.5px; color: var(--tk-blue); }
body.dark-mode .tk-kpi-foot { color: var(--tk-sky); }
.tk-trend {
  padding: 0 6px;
  border: 1.5px solid currentColor;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}
.tk-trend.is-bad { color: #d92d20; }
.tk-kpi.is-loading .tk-kpi-value { color: var(--border); }
.tk-kpi--filled {
  background: linear-gradient(150deg, #024dfd 0%, #0139c4 62%, #011f6b 100%);
  color: #fff;
}
.tk-kpi--filled .tk-kpi-label,
.tk-kpi--filled .tk-kpi-value { color: #fff; }
.tk-kpi--filled .tk-kpi-unit,
.tk-kpi--filled .tk-kpi-foot { color: var(--tk-ice); }
.tk-kpi--filled .tk-trend.is-bad { color: #ffd6d2; }
.tk-kpi--filled .tk-kpi-link { background: #fff; border-color: #fff; color: var(--tk-blue) !important; }
.tk-kpi--filled .tk-kpi-link:hover { background: var(--tk-ice); border-color: var(--tk-ice); }

/* board: chart · waiting · latest invoices / customers · gauge · treasuries */
.tk-board {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-areas:
    "chart chart chart chart chart chart wait wait wait list list list"
    "team team team team team gauge gauge gauge gauge list list list"
    "team team team team team gauge gauge gauge gauge cash cash cash";
  gap: 16px;
}
.tk-area-chart { grid-area: chart; }
.tk-area-wait { grid-area: wait; }
.tk-area-list { grid-area: list; }
.tk-area-team { grid-area: team; }
.tk-area-gauge { grid-area: gauge; }
.tk-area-cash { grid-area: cash; }

/* sales pills */
.tk-pills {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: clamp(8px, 1.4vw, 18px);
  height: 230px;
  padding-top: 8px;
}
.tk-pill-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.tk-pill-track {
  position: relative;
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.tk-pill {
  width: 100%;
  max-width: 78px;
  border-radius: 999px;
  background: var(--tk-blue);
  transition: height .35s ease;
}
.tk-pill.is-top { background: var(--tk-sky); }
.tk-pill.is-now { background: var(--tk-blue-800); }
body.dark-mode .tk-pill.is-now { background: var(--tk-ice); }
.tk-pill--empty {
  background: repeating-linear-gradient(-45deg, var(--tk-hatch) 0 3px, transparent 3px 10px);
  box-shadow: inset 0 0 0 1.5px var(--tk-hatch);
}
.tk-pill--empty.is-now { background: repeating-linear-gradient(-45deg, var(--tk-hatch) 0 3px, transparent 3px 10px); }
.tk-pill-tip {
  padding: 2px 8px;
  border: 1.5px solid var(--tk-blue);
  border-radius: 8px;
  background: color-mix(in srgb, var(--tk-ice) 30%, var(--panel));
  color: var(--tk-blue);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
body.dark-mode .tk-pill-tip { color: var(--tk-ice); border-color: var(--tk-sky); }
.tk-pill-label { font-size: 14px; color: var(--muted); }

/* waiting for payment (the reference's reminder card) */
.tk-wait { gap: 8px; }
.tk-wait-number {
  margin: 8px 0 2px;
  font-size: clamp(1.5rem, 2vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--tk-blue);
  direction: ltr;
  text-align: end;
}
body.dark-mode .tk-wait-number { color: var(--tk-sky); }
.tk-wait-meta { margin: 0; color: var(--muted); font-size: 14px; }
.tk-wait-meta strong { color: var(--heading); }
.tk-wait-total { margin: 6px 0 14px; font-size: 13px; color: var(--muted); }
.tk-wait-total strong { color: var(--heading); }

/* lists (latest invoices, customers) */
.tk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.tk-list-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tk-list-icon,
.tk-avatar {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 17px;
  font-weight: 600;
}
.tk-list-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tk-list-text strong { font-size: 15px; font-weight: 500; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-list-text small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-list-text small b { font-weight: 600; color: var(--text); }
.tk-tone-0 { background: var(--tk-blue); color: #fff; }
.tk-tone-1 { background: color-mix(in srgb, var(--tk-sky) 22%, var(--panel)); color: #0a6fd6; }
.tk-tone-2 { background: var(--tk-ink); color: #fff; }
.tk-tone-3 { background: color-mix(in srgb, var(--tk-ice) 45%, var(--panel)); color: var(--tk-blue-600); }
body.dark-mode .tk-tone-2 { background: #2a2c33; }
body.dark-mode .tk-tone-1 { color: var(--tk-sky); }
body.dark-mode .tk-tone-3 { color: var(--tk-ice); }
.tk-chip {
  flex-shrink: 0;
  padding: 2px 10px;
  border: 1px solid currentColor;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
}
.tk-chip--paid, .tk-chip--done { color: #12805c; background: #e8f6f0; }
.tk-chip--partial, .tk-chip--part { color: #b54708; background: #fef4e6; }
.tk-chip--due { color: #c01048; background: #fdeef3; }
.tk-chip--draft { color: var(--muted); background: var(--tk-input-bg); }
body.dark-mode .tk-chip--paid, body.dark-mode .tk-chip--done { color: #6ce9a6; background: rgba(18, 128, 92, .18); }
body.dark-mode .tk-chip--partial, body.dark-mode .tk-chip--part { color: #fdb022; background: rgba(181, 71, 8, .2); }
body.dark-mode .tk-chip--due { color: #fd6f8e; background: rgba(192, 16, 72, .2); }

/* collection gauge */
.tk-gauge-card { align-items: stretch; }
.tk-gauge-wrap { position: relative; width: min(100%, 330px); margin: 6px auto 0; }
.tk-gauge { display: block; width: 100%; height: auto; overflow: visible; }
.tk-gauge-track,
.tk-gauge-value { fill: none; stroke-width: 34; stroke-linecap: round; }
.tk-gauge-track { stroke: url(#tk-gauge-hatch); }
.tk-gauge-value { stroke: var(--tk-blue); }
body.dark-mode .tk-gauge-value { stroke: var(--tk-sky); }
.tk-hatch-bg { fill: transparent; }
.tk-hatch-line { stroke: var(--tk-hatch); stroke-width: 3.5; }
.tk-gauge-center {
  position: absolute;
  inset: auto 0 2px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tk-gauge-center strong {
  font-size: clamp(2.4rem, 3.4vw, 3.3rem);
  font-weight: 600;
  line-height: 1;
  color: var(--heading);
  direction: ltr;
}
.tk-gauge-center span { font-size: 13px; color: var(--tk-blue); }
body.dark-mode .tk-gauge-center span { color: var(--tk-sky); }
.tk-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  margin: 6px 0 0;
  padding: 0;
  font-size: 14px;
  color: var(--muted);
}
.tk-legend li { display: flex; align-items: center; gap: 8px; }
.tk-legend b { color: var(--heading); font-weight: 600; }
.tk-dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; }
.tk-dot--paid { background: var(--tk-blue); }
body.dark-mode .tk-dot--paid { background: var(--tk-sky); }
.tk-dot--open { background: repeating-linear-gradient(-45deg, var(--tk-hatch) 0 2.5px, transparent 2.5px 6px); box-shadow: inset 0 0 0 1.5px var(--tk-hatch); }

/* treasury balance (the reference's dark time-tracker card) */
.tk-cash {
  position: relative;
  overflow: hidden;
  min-height: 250px;
  background: var(--tk-ink);
  color: #fff;
}
body.dark-mode .tk-cash { background: #000; box-shadow: inset 0 0 0 1px #1d1f24; }
.tk-cash-thread {
  /* loops through the lower part, under the round buttons rather than the amount */
  position: absolute;
  inset: 58% -14% -24% -10%;
  background: url("/brand/thread-loop.svg") center / cover no-repeat;
  opacity: .9;
  pointer-events: none;
}
.tk-cash > :not(.tk-cash-thread) { position: relative; }
.tk-cash .tk-card-title { color: #fff; }
.tk-cash-amount { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: auto 0 0; }
.tk-cash-value {
  font-size: clamp(2.1rem, 2.8vw, 2.9rem);
  font-weight: 600;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.tk-cash-unit { color: var(--tk-ice); }
.tk-cash-sub { margin: 0; text-align: center; font-size: 13px; color: #bdbdbd; }
.tk-cash-actions { display: flex; justify-content: center; gap: 14px; margin-top: 6px; }
.tk-round {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  font-size: 20px;
  text-decoration: none;
  transition: transform .18s ease;
}
.tk-round:hover { transform: translateY(-2px); }
.tk-round--light { background: #fff; color: var(--tk-blue) !important; }
.tk-round--blue { background: var(--tk-blue); color: #fff !important; }

/* responsive */
@media (max-width: 1440px) {
  .tk-board {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas:
      "chart chart chart chart wait wait"
      "team team team list list list"
      "gauge gauge gauge cash cash cash";
  }
}
@media (max-width: 1180px) {
  .tk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .tk-board {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "chart" "wait" "list" "team" "gauge" "cash";
  }
  .tk-dash-head { align-items: stretch; }
  .tk-dash-actions { width: 100%; }
  .tk-dash-actions .tk-btn { flex: 1; }
  .tk-period { width: 100%; justify-content: space-between; }
}
@media (max-width: 560px) {
  .tk-kpis { grid-template-columns: minmax(0, 1fr); }
  .tk-kpi { min-height: 0; }
  .tk-card { padding: 20px; border-radius: 22px; }
  .tk-pills { height: 190px; }
}
@media (min-width: 1025px) and (max-height: 940px) {
  /* short laptop screens: keep the quick-invoice card, drop its symbol and text line */
  .tk-promo { padding: 14px 16px; }
  .tk-promo-symbol, .tk-promo-text { display: none; }
  .tk-promo-title { margin-bottom: 10px; font-size: 1.05rem; }
}

/* ---------- Supplier services & accounts (2026-10-26) ---------- */
.tk-brand-symbol { display: block; object-fit: contain; }
/* service source: two-way choice, computed sale price, profit line */
.tk-source-toggle { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--tk-mist); }
.tk-source-toggle button {
  border: 0; background: transparent; color: var(--tk-ink); font: inherit; font-size: .92rem;
  padding: 8px 18px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s;
}
.tk-source-toggle button[aria-pressed="true"] { background: var(--tk-blue); color: #fff; }
.tk-svc-markup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; }
.tk-computed-price { background: var(--tk-mist) !important; color: var(--tk-ink); font-weight: 600; cursor: default; }
.tk-svc-hint { display: block; margin-top: 6px; color: #5b6475; font-size: .8rem; }
.tk-svc-profit { margin: -4px 0 14px; color: var(--tk-blue); font-weight: 600; font-size: .9rem; }
.tk-source-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--tk-mist); color: var(--tk-ink); font-size: .8rem; white-space: nowrap; }
.tk-source-tag.is-supplier { background: #eaf1ff; color: var(--tk-blue); }
@media (max-width: 560px) { .tk-svc-markup { grid-template-columns: minmax(0, 1fr); } }
/* supplier accounts page */
.tk-acc-title { margin: 0 0 14px; font-size: 1.25rem; font-weight: 600; color: var(--tk-ink); }
.tk-acc-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.tk-acc-figure { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: var(--tk-radius-sm); background: #f5f8ff; border: 1px solid #dfe6f3; }
.tk-acc-figure:last-child { background: var(--tk-blue); border-color: var(--tk-blue); color: #fff; }
.tk-acc-figure-label { font-size: .85rem; opacity: .8; }
.tk-acc-figure-value { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tk-acc-figure-value small { font-size: .8rem; font-weight: 500; opacity: .8; }
.tk-acc-due { color: var(--tk-blue); font-weight: 600; }
.tk-acc-statement-link, .tk-auto-po-link {
  display: inline-block; padding: 4px 12px; border-radius: 999px; background: #eaf1ff; color: var(--tk-blue);
  font-size: .82rem; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.tk-acc-statement-link:hover, .tk-auto-po-link:hover { background: var(--tk-blue); color: #fff; }
@media (max-width: 640px) { .tk-acc-figures { grid-template-columns: minmax(0, 1fr); } }
