/* ==========================================================================
   Gramogear Supplier Portal
   --------------------------------------------------------------------------
   Token layer first, then layout, then components.

   Colour notes
   ------------
   * Chart marks (the pipeline + city bars) use a single-hue ORDINAL blue ramp,
     --seq-1..7, stepped for each surface. One series, one hue - no rainbow.
   * Badge/pill colours are a separate, reserved status palette. Their text
     colours are picked for >= 4.5:1 against their own tinted background, which
     is a stricter requirement than chart marks have.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #fbfbfa;
  --surface-3: #f0efec;
  --border: #e4e3de;
  --border-strong: #d3d2cc;

  --text-primary: #0f0f0e;
  --text-secondary: #52514e;
  --text-muted: #85847e;

  --brand: #2a78d6;
  --brand-strong: #1c5cab;
  --brand-soft: #e8f1fd;
  --on-brand: #ffffff;

  /* Ordinal blue ramp for chart marks (light surface: no lighter than step 250) */
  --seq-1: #86b6ef;
  --seq-2: #5598e7;
  --seq-3: #2a78d6;
  --seq-4: #256abf;
  --seq-5: #1c5cab;
  --seq-6: #184f95;
  --seq-7: #0d366b;

  /* Status hues */
  --c-slate: #52514e;
  --c-blue: #1c5cab;
  --c-amber: #8a5d00;
  --c-violet: #4a3aa7;
  --c-green: #0f6b2f;
  --c-orange: #9a4318;
  --c-red: #b3261e;

  --good: #0f6b2f;
  --warning: #8a5d00;
  --critical: #b3261e;

  --shadow-sm: 0 1px 2px rgb(15 15 14 / 0.06), 0 1px 3px rgb(15 15 14 / 0.04);
  --shadow-md: 0 4px 12px rgb(15 15 14 / 0.08), 0 1px 3px rgb(15 15 14 / 0.05);
  --shadow-lg: 0 18px 48px rgb(15 15 14 / 0.18), 0 4px 12px rgb(15 15 14 / 0.08);

  --r-sm: 7px;
  --r: 11px;
  --r-lg: 16px;

  --sidebar-w: 258px;
  --topbar-h: 58px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;

    --bg: #111110;
    --surface: #1a1a19;
    --surface-2: #202020;
    --surface-3: #282826;
    --border: #32322e;
    --border-strong: #45443f;

    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #8e8d84;

    --brand: #3987e5;
    --brand-strong: #5598e7;
    --brand-soft: #16273d;
    --on-brand: #ffffff;

    /* Dark surface: no darker than step 600 */
    --seq-1: #cde2fb;
    --seq-2: #9ec5f4;
    --seq-3: #6da7ec;
    --seq-4: #3987e5;
    --seq-5: #2a78d6;
    --seq-6: #256abf;
    --seq-7: #184f95;

    --c-slate: #b8b7ae;
    --c-blue: #7fb3f2;
    --c-amber: #e5b33a;
    --c-violet: #b0a6f5;
    --c-green: #6ecf8a;
    --c-orange: #f0906a;
    --c-red: #f28b86;

    --good: #6ecf8a;
    --warning: #e5b33a;
    --critical: #f28b86;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 14px rgb(0 0 0 / 0.45);
    --shadow-lg: 0 20px 54px rgb(0 0 0 / 0.6);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --bg: #111110;
  --surface: #1a1a19;
  --surface-2: #202020;
  --surface-3: #282826;
  --border: #32322e;
  --border-strong: #45443f;

  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #8e8d84;

  --brand: #3987e5;
  --brand-strong: #5598e7;
  --brand-soft: #16273d;
  --on-brand: #ffffff;

  --seq-1: #cde2fb;
  --seq-2: #9ec5f4;
  --seq-3: #6da7ec;
  --seq-4: #3987e5;
  --seq-5: #2a78d6;
  --seq-6: #256abf;
  --seq-7: #184f95;

  --c-slate: #b8b7ae;
  --c-blue: #7fb3f2;
  --c-amber: #e5b33a;
  --c-violet: #b0a6f5;
  --c-green: #6ecf8a;
  --c-orange: #f0906a;
  --c-red: #f28b86;

  --good: #6ecf8a;
  --warning: #e5b33a;
  --critical: #f28b86;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 14px rgb(0 0 0 / 0.45);
  --shadow-lg: 0 20px 54px rgb(0 0 0 / 0.6);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.is-modal-open {
  overflow: hidden;
}

/* Several top-level surfaces set their own `display`, which would otherwise
   beat the UA rule for [hidden] and leave two screens stacked on the page. */
[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4,
p,
figure,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: 5px;
}

mark {
  background: color-mix(in srgb, var(--brand) 26%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.muted {
  color: var(--text-muted);
}

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.center {
  text-align: center;
}

.ico {
  flex: none;
}

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

.noscript {
  padding: 40px;
  text-align: center;
  font-size: 17px;
}

/* --------------------------------------------------------------------------
   3. Boot screen
   -------------------------------------------------------------------------- */

.boot {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: var(--text-secondary);
}

.boot__mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--brand);
  color: #fff;
}

.boot__mark svg {
  width: 30px;
  height: 30px;
}

.boot__bar {
  width: 190px;
  height: 4px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}

.boot__bar span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 99px;
  background: var(--brand);
  animation: bootslide 1.15s ease-in-out infinite;
}

@keyframes bootslide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

.boot__text {
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   4. Buttons, inputs, chips
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, opacity 0.14s;
}

.btn:hover {
  text-decoration: none;
  background: var(--border);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--brand);
  color: var(--on-brand);
}

.btn--primary:hover {
  background: var(--brand-strong);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn--ghost:hover {
  background: var(--surface-3);
}

.btn--danger {
  background: var(--critical);
  color: #fff;
}

.btn--danger:hover {
  filter: brightness(0.92);
}

.btn--danger-ghost {
  color: var(--critical);
}

.btn--danger-ghost:hover {
  background: color-mix(in srgb, var(--critical) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--critical) 40%, var(--border));
}

.btn--block {
  width: 100%;
}

.btn--sm {
  padding: 6px 11px;
  font-size: 13px;
}

.btn.is-loading {
  position: relative;
  color: transparent;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 15px;
  height: 15px;
  border: 2px solid currentcolor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--on-brand);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-secondary);
  transition: background 0.14s, color 0.14s;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text-primary);
  text-decoration: none;
}

.icon-btn--sm {
  width: 26px;
  height: 26px;
}

.icon-btn--danger:hover {
  background: color-mix(in srgb, var(--critical) 14%, transparent);
  color: var(--critical);
}

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand);
  font-size: inherit;
}

.link:hover {
  text-decoration: underline;
}

.link--strong {
  font-weight: 600;
}

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 14.5px;
  transition: border-color 0.14s, box-shadow 0.14s;
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}

.input:disabled {
  background: var(--surface-3);
  color: var(--text-muted);
}

.input--area {
  resize: vertical;
  min-height: 76px;
  line-height: 1.55;
}

.input--sm {
  padding: 7px 30px 7px 10px;
  font-size: 13.5px;
}

.input-wrap {
  position: relative;
}

.input-affix {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  padding: 6px;
  color: var(--text-muted);
  border-radius: 6px;
}

.input-affix:hover,
.input-affix.is-on {
  color: var(--brand);
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  appearance: none;
  padding-right: 32px;
}

.select-wrap__arrow {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
}

.field {
  min-width: 0;
}

.field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field__hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 5px;
}

.field__err {
  font-size: 12.5px;
  color: var(--critical);
  margin-top: 5px;
  font-weight: 500;
}

.field__opt {
  font-weight: 400;
  color: var(--text-muted);
}

.req {
  color: var(--critical);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chips--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 3px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.chip.is-on {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.chip__n {
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
  font-size: 12px;
}

.chip--tag {
  background: var(--surface-3);
  border-color: transparent;
  font-size: 12px;
  padding: 3px 8px;
  color: var(--text-secondary);
}

/* Status badges - always paired with their own text label */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge--slate  { color: var(--c-slate);  background: color-mix(in srgb, var(--c-slate) 13%, var(--surface));  border-color: color-mix(in srgb, var(--c-slate) 26%, transparent); }
.badge--blue   { color: var(--c-blue);   background: color-mix(in srgb, var(--c-blue) 13%, var(--surface));   border-color: color-mix(in srgb, var(--c-blue) 26%, transparent); }
.badge--amber  { color: var(--c-amber);  background: color-mix(in srgb, var(--c-amber) 15%, var(--surface));  border-color: color-mix(in srgb, var(--c-amber) 28%, transparent); }
.badge--violet { color: var(--c-violet); background: color-mix(in srgb, var(--c-violet) 13%, var(--surface)); border-color: color-mix(in srgb, var(--c-violet) 26%, transparent); }
.badge--green  { color: var(--c-green);  background: color-mix(in srgb, var(--c-green) 13%, var(--surface));  border-color: color-mix(in srgb, var(--c-green) 26%, transparent); }
.badge--orange { color: var(--c-orange); background: color-mix(in srgb, var(--c-orange) 13%, var(--surface)); border-color: color-mix(in srgb, var(--c-orange) 26%, transparent); }
.badge--red    { color: var(--c-red);    background: color-mix(in srgb, var(--c-red) 13%, var(--surface));    border-color: color-mix(in srgb, var(--c-red) 26%, transparent); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-secondary);
}

.pill--red   { color: var(--c-red);   background: color-mix(in srgb, var(--c-red) 14%, var(--surface)); }
.pill--amber { color: var(--c-amber); background: color-mix(in srgb, var(--c-amber) 16%, var(--surface)); }
.pill--blue  { color: var(--c-blue);  background: color-mix(in srgb, var(--c-blue) 14%, var(--surface)); }
.pill--slate { color: var(--text-secondary); }

.tagline {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 99px;
}

.stars {
  display: inline-flex;
  gap: 1px;
  color: var(--c-amber);
  vertical-align: middle;
}

/* --------------------------------------------------------------------------
   5. Auth screens
   -------------------------------------------------------------------------- */

.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

.auth--single {
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
}

.auth__brand {
  background: linear-gradient(150deg, var(--brand-strong), var(--seq-7) 62%, #071c33);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 48px;
}

.auth__brandInner {
  max-width: 440px;
  margin-inline: auto;
}

.auth__brandTitle {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  margin: 22px 0 14px;
}

.auth__brandTitle span {
  display: block;
  font-size: 17px;
  font-weight: 500;
  opacity: 0.82;
  margin-top: 4px;
}

.auth__brandLead {
  font-size: 15.5px;
  line-height: 1.6;
  opacity: 0.86;
}

.auth__points {
  margin-top: 30px;
  display: grid;
  gap: 14px;
}

.auth__points li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-size: 14.5px;
  opacity: 0.92;
}

.auth__points svg {
  margin-top: 2px;
  opacity: 0.8;
}

.auth__panel {
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background: var(--bg);
}

.auth__card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.auth__card--wide {
  max-width: 560px;
  text-align: left;
}

/* Normal block flow here: the brandmark and status circle centre themselves
   with auto margins, while notices, lists and forms fill the card. A grid with
   justify-items:center would shrink-wrap every child instead. */
.auth--single .auth__card {
  display: block;
}

.auth__title {
  font-size: 23px;
  font-weight: 700;
  margin-bottom: 6px;
}

.auth__title--center {
  text-align: center;
}

.auth__sub {
  color: var(--text-secondary);
  font-size: 14.5px;
  margin-bottom: 22px;
}

.auth__sub--center {
  text-align: center;
}

.auth__card form {
  display: grid;
  gap: 16px;
}

.auth__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
}

.auth__foot {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}

.brandmark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  flex: none;
}

.brandmark--lg {
  width: 58px;
  height: 58px;
  border-radius: 17px;
  margin-inline: auto;
}

.brandmark--sm {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

.auth__brand .brandmark--lg {
  background: rgb(255 255 255 / 0.16);
  margin-inline: 0;
  backdrop-filter: blur(4px);
}

.status-mark {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
}

.status-mark--wait {
  background: color-mix(in srgb, var(--warning) 16%, var(--surface));
  color: var(--warning);
}

.status-mark--stop {
  background: color-mix(in srgb, var(--critical) 14%, var(--surface));
  color: var(--critical);
}

.setup-steps {
  counter-reset: step;
  display: grid;
  gap: 11px;
  margin: 20px 0;
  font-size: 14.5px;
  color: var(--text-secondary);
}

/* The counter is absolutely positioned so the step text stays ordinary
   inline flow - a grid or flex li would turn every <b> into its own cell. */
.setup-steps li {
  counter-increment: step;
  position: relative;
  padding-left: 36px;
  line-height: 1.6;
}

.setup-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   6. Shell
   -------------------------------------------------------------------------- */

.shell {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  gap: 8px;
  z-index: 40;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 16px;
}

.sidebar__brandText {
  display: grid;
  min-width: 0;
}

.sidebar__brandText b {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar__brandText small {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.3;
}

.sidebar__close {
  display: none;
  margin-left: auto;
}

.nav {
  display: grid;
  gap: 3px;
  flex: 1;
  align-content: start;
}

.sidebar__foot {
  display: grid;
  gap: 3px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.navlink {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  border: 0;
  background: none;
  color: var(--text-secondary);
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  width: 100%;
  transition: background 0.14s, color 0.14s;
}

.navlink:hover {
  background: var(--surface-3);
  color: var(--text-primary);
  text-decoration: none;
}

.navlink.is-active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.navlink--danger:hover {
  color: var(--critical);
  background: color-mix(in srgb, var(--critical) 10%, transparent);
}

.navlink b {
  text-transform: capitalize;
  font-weight: 600;
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar__menu {
  display: none;
}

.topbar__brand {
  display: none;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 15px;
}

.topbar__spacer {
  flex: 1;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 5px 4px 12px;
  border-radius: 99px;
  color: var(--text-secondary);
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.topbar__user:hover {
  text-decoration: none;
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.topbar__avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
}

.viewport {
  flex: 1;
  min-width: 0;
  outline: none;
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.45);
  z-index: 35;
}

/* --------------------------------------------------------------------------
   7. Page scaffolding
   -------------------------------------------------------------------------- */

.page {
  padding: 24px 26px 60px;
  max-width: 1420px;
  margin-inline: auto;
}

.page--narrow {
  max-width: 780px;
}

.page__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page__title {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page__sub {
  color: var(--text-secondary);
  font-size: 14.5px;
  margin-top: 3px;
}

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.backlink:hover {
  color: var(--brand);
  text-decoration: none;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 16px;
}

.panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.panel__head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15.5px;
  font-weight: 650;
}

.panel__head h2 svg {
  color: var(--text-muted);
}

.panel__count {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.panel__link {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  font-weight: 500;
}

.panel__empty {
  color: var(--text-muted);
  font-size: 14px;
  padding: 10px 0;
  line-height: 1.6;
}

.panel__note {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin: -6px 0 14px;
}

.panel__foot {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.prose {
  font-size: 14.8px;
  line-height: 1.68;
  color: var(--text-secondary);
  white-space: normal;
}

.prose--remark {
  padding: 12px 14px;
  background: var(--surface-2);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.notice {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r);
  margin-bottom: 18px;
  font-size: 14px;
  line-height: 1.55;
  border: 1px solid transparent;
}

.notice--tight {
  margin-bottom: 0;
  padding: 11px 13px;
}

.notice strong {
  display: block;
  margin-bottom: 3px;
}

.notice p {
  color: inherit;
  opacity: 0.9;
}

.notice svg {
  flex: none;
  margin-top: 1px;
}

.notice--info {
  background: color-mix(in srgb, var(--brand) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 26%, transparent);
  color: var(--text-secondary);
}

.notice--info svg,
.notice--info strong {
  color: var(--brand);
}

.notice--warn {
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--warning) 32%, transparent);
  color: var(--text-secondary);
}

.notice--warn svg,
.notice--warn strong {
  color: var(--warning);
}

.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border-radius: var(--r);
  margin-bottom: 18px;
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warning) 32%, transparent);
  color: var(--text-primary);
}

.banner:hover {
  text-decoration: none;
  background: color-mix(in srgb, var(--warning) 17%, var(--surface));
}

.banner > svg:first-child {
  color: var(--warning);
  flex: none;
}

.banner > svg:last-child {
  margin-left: auto;
  color: var(--text-muted);
  flex: none;
}

.banner strong {
  display: block;
  font-size: 14.5px;
}

.banner p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
  padding: 54px 24px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
}

.empty__icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-muted);
  margin-bottom: 6px;
}

.empty h3 {
  font-size: 17px;
  font-weight: 650;
}

.empty p {
  color: var(--text-secondary);
  font-size: 14.5px;
  max-width: 460px;
  line-height: 1.6;
}

.empty .btn {
  margin-top: 10px;
}

.empty--error .empty__icon {
  background: color-mix(in srgb, var(--critical) 12%, transparent);
  color: var(--critical);
}

/* --------------------------------------------------------------------------
   8. Toolbar / filters
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar__search {
  position: relative;
  flex: 1 1 300px;
  min-width: 220px;
}

.toolbar__searchIcon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.input--search {
  padding-left: 38px;
  padding-right: 34px;
  background: var(--surface);
}

.input-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  font-size: 19px;
  line-height: 1;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 5px;
}

.input-clear:hover {
  color: var(--text-primary);
  background: var(--surface-3);
}

.toolbar__actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
}

.segmented__btn {
  border: 0;
  background: none;
  padding: 7px 10px;
  color: var(--text-muted);
  display: grid;
  place-items: center;
}

.segmented__btn:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.segmented__btn.is-on {
  background: var(--brand-soft);
  color: var(--brand);
}

.filterbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filterbar__selects {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.select-wrap--sm select {
  min-width: 128px;
}

/* --------------------------------------------------------------------------
   9. Table + cards
   -------------------------------------------------------------------------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow-x: auto;
}

.table {
  width: 100%;
  /* Fixed layout so the declared column widths actually hold - with auto
     layout a long email address in the contact cell steals half the row.
     Below min-width the wrapper scrolls sideways instead of crushing names. */
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 14px;
}

/* Only the full nine-column layout needs more room than the pane gives it.
   Narrower breakpoints drop columns instead, so the table never scrolls
   sideways on a laptop or a phone. */
@media (min-width: 1201px) {
  .table { min-width: 1040px; }
}

.table th:nth-child(1) { width: 22%; }  /* supplier   */
.table th:nth-child(2) { width: 16%; }  /* contact    */
.table th:nth-child(3) { width: 8%; }   /* city       */
.table th:nth-child(4) { width: 13%; }  /* deals with */
.table th:nth-child(5) { width: 10%; }  /* status     */
.table th:nth-child(6) { width: 6%; }   /* files      */
.table th:nth-child(7) { width: 10%; }  /* follow-up  */
.table th:nth-child(8) { width: 8%; }   /* updated    */
.table th:nth-child(9) { width: 7%; }   /* actions    */

.table thead th {
  text-align: left;
  padding: 11px 14px;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.row {
  cursor: pointer;
  transition: background 0.12s;
}

.row:hover,
.row:focus-visible {
  background: var(--surface-2);
}

.row__identity {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.row__names {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.row__title {
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__sub {
  font-size: 12.8px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__names .chips {
  margin-top: 3px;
}

.cell-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-primary);
}

a.cell-line:hover {
  color: var(--brand);
  text-decoration: none;
}

a.cell-line:hover .cell-ico {
  color: var(--brand);
}

.cell-line--dim {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

a.cell-line--dim:hover {
  color: var(--brand);
}

.cell-ico {
  color: var(--text-muted);
}

.cell-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 13.5px;
}

.row__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
}

.quick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-3);
}

.quick:hover {
  background: var(--brand-soft);
  color: var(--brand);
  text-decoration: none;
}

.quick--sm span {
  display: none;
}

.quick--sm {
  padding: 6px;
}

.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  flex: none;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: hsl(var(--h) 62% 32%);
  background: hsl(var(--h) 70% 92%);
}

:root[data-theme='dark'] .avatar,
:root:not([data-theme='light']) .avatar {
  /* overridden below for real dark mode */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .avatar {
    color: hsl(var(--h) 72% 82%);
    background: hsl(var(--h) 42% 24%);
  }
}

:root[data-theme='dark'] .avatar {
  color: hsl(var(--h) 72% 82%);
  background: hsl(var(--h) 42% 24%);
}

.avatar--xl {
  border-radius: 18px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 14px;
}

.scard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  display: grid;
  gap: 11px;
  align-content: start;
  cursor: pointer;
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
}

.scard:hover,
.scard:focus-visible {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.scard__head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.scard__names {
  min-width: 0;
  flex: 1;
}

.scard__names h3 {
  font-size: 15.5px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scard__names p {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scard__meta {
  display: grid;
  gap: 5px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.scard__meta > div {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.scard__meta svg {
  color: var(--text-muted);
}

.scard__deals {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scard__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.scard__stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.scard__quick {
  display: flex;
  gap: 6px;
}

.scard__quick .quick--sm span {
  display: inline;
}

/* --------------------------------------------------------------------------
   10. Dashboard
   -------------------------------------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(186px, 1fr));
  gap: 13px;
  margin-bottom: 20px;
}

.tile {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: inherit;
  transition: border-color 0.14s, box-shadow 0.14s;
}

a.tile:hover {
  text-decoration: none;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.tile__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--surface-3);
  color: var(--text-secondary);
}

.tile__icon--brand { background: var(--brand-soft); color: var(--brand); }
.tile__icon--good { background: color-mix(in srgb, var(--good) 14%, var(--surface)); color: var(--good); }
.tile__icon--critical { background: color-mix(in srgb, var(--critical) 14%, var(--surface)); color: var(--critical); }

.tile__body {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.tile__value {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.tile__label {
  font-size: 13px;
  color: var(--text-secondary);
}

.tile__sub {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 3px;
}

.tile__sub--good { color: var(--good); }
.tile__sub--critical { color: var(--critical); }
.tile__sub--neutral { color: var(--text-muted); }

.dash-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  align-items: start;
}

.dash-grid__col {
  min-width: 0;
}

/* Ordinal bar chart --------------------------------------------------------
   One series, one hue, direct labels on every bar - no legend needed. */

.funnel {
  display: grid;
  gap: 9px;
}

.funnel__row {
  display: grid;
  grid-template-columns: 132px 1fr 62px;
  align-items: center;
  gap: 12px;
  color: inherit;
  padding: 3px 4px;
  border-radius: var(--r-sm);
}

a.funnel__row:hover {
  text-decoration: none;
  background: var(--surface-2);
}

.funnel__label {
  font-size: 13.2px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.funnel__track {
  height: 15px;
  background: var(--surface-3);
  border-radius: 5px;
  overflow: hidden;
  min-width: 0;
}

.funnel__bar {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
  min-width: 3px;
  transition: width 0.4s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.funnel__value {
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text-primary);
}

.funnel__value small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.funnel--compact .funnel__row {
  grid-template-columns: 120px 1fr 36px;
}

.minilist {
  display: grid;
  gap: 2px;
}

.minilist__row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 8px;
  border-radius: var(--r-sm);
  color: inherit;
}

.minilist__row:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.minilist__main {
  flex: 1;
  min-width: 0;
  display: grid;
}

.minilist__main b {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.minilist__main small {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed {
  display: grid;
  gap: 2px;
}

.feed__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px;
  border-radius: var(--r-sm);
  font-size: 13.6px;
  line-height: 1.5;
}

.feed__item:hover {
  background: var(--surface-2);
}

.feed__item--lg {
  padding: 11px 8px;
  font-size: 14px;
}

.feed__text {
  flex: 1;
  min-width: 0;
  color: var(--text-secondary);
}

.feed__text b {
  color: var(--text-primary);
  font-weight: 600;
}

.feed__line {
  display: block;
}

.feed__action--good { color: var(--good); font-weight: 500; }
.feed__action--critical { color: var(--critical); font-weight: 500; }

.feed__detail {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.feed__when {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex: none;
  padding-top: 2px;
}

/* --------------------------------------------------------------------------
   11. Supplier detail
   -------------------------------------------------------------------------- */

.page--detail {
  max-width: 1240px;
}

.dhead {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.dhead__main {
  flex: 1;
  min-width: 220px;
}

.dhead__titleRow {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-wrap: wrap;
}

.dhead__titleRow h1 {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dhead__company {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 14.5px;
  margin-top: 4px;
}

.dhead__facts {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 9px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.dhead__facts > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dhead__main .chips {
  margin-top: 9px;
}

.dhead__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dquick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.qbtn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  text-align: left;
  transition: border-color 0.14s, background 0.14s;
}

.qbtn:hover {
  text-decoration: none;
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.qbtn svg {
  flex: none;
}

.qbtn span {
  display: grid;
  min-width: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--text-muted);
}

.qbtn b {
  font-size: 13.8px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qbtn:hover b {
  color: var(--brand);
}

.dgrid {
  display: grid;
  grid-template-columns: 1fr 314px;
  gap: 16px;
  align-items: start;
}

.dgrid__main,
.dgrid__side {
  min-width: 0;
}

.dgrid__side .panel {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

.dlist {
  display: grid;
}

.drow {
  display: grid;
  grid-template-columns: 172px 1fr;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14.2px;
}

.dlist--tight .drow {
  grid-template-columns: 148px 1fr;
  padding: 7px 0;
  font-size: 13.8px;
}

.drow:last-child {
  border-bottom: 0;
}

.drow dt {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13.2px;
}

.drow__ico {
  color: var(--text-muted);
}

.drow dd {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  color: var(--text-primary);
  word-break: break-word;
}

.drow dd > span {
  min-width: 0;
}

/* Dropzone + uploads */

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r);
  padding: 24px 18px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.dropzone__icon {
  color: var(--text-muted);
  margin-bottom: 6px;
}

.dropzone.is-over .dropzone__icon,
.dropzone:hover .dropzone__icon {
  color: var(--brand);
}

.dropzone p {
  font-size: 14.5px;
}

.dropzone small {
  display: block;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.upload-queue {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.uq {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}

.uq__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 6px;
}

.uq__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uq__pct {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.uq__bar {
  height: 5px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}

.uq__bar span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
  transition: width 0.2s;
}

.uq.is-done .uq__bar span { background: var(--good); }
.uq.is-error .uq__bar span { background: var(--critical); }
.uq.is-error .uq__pct { color: var(--critical); }

.filelist {
  display: grid;
  gap: 4px;
  margin-top: 14px;
}

.filelist__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  transition: background 0.12s;
}

.filelist__item:hover {
  background: var(--surface-2);
}

.filelist__icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--surface-3);
  color: var(--text-secondary);
}

.filelist__icon--img {
  background: color-mix(in srgb, var(--seq-3) 16%, var(--surface));
  color: var(--seq-5);
}

.filelist__meta {
  flex: 1;
  min-width: 0;
  display: grid;
}

.filelist__name {
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filelist__name:hover {
  color: var(--brand);
  text-decoration: underline;
}

.filelist__sub {
  font-size: 12.3px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filelist__actions {
  display: flex;
  gap: 2px;
  flex: none;
}

/* Contact timeline */

.tl {
  display: grid;
  gap: 2px;
}

.tl__item {
  display: flex;
  gap: 12px;
  padding: 11px 4px;
  position: relative;
}

.tl__item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 42px;
  bottom: -2px;
  width: 2px;
  background: var(--border);
}

.tl__dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--surface-3);
  color: var(--text-secondary);
  z-index: 1;
}

.tl__dot--call { background: color-mix(in srgb, var(--c-blue) 15%, var(--surface)); color: var(--c-blue); }
.tl__dot--whatsapp { background: color-mix(in srgb, var(--good) 15%, var(--surface)); color: var(--good); }
.tl__dot--email { background: color-mix(in srgb, var(--c-violet) 15%, var(--surface)); color: var(--c-violet); }
.tl__dot--visit { background: color-mix(in srgb, var(--c-orange) 15%, var(--surface)); color: var(--c-orange); }
.tl__dot--meeting { background: color-mix(in srgb, var(--c-amber) 17%, var(--surface)); color: var(--c-amber); }

.tl__body {
  flex: 1;
  min-width: 0;
}

.tl__top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13.8px;
}

.tl__by {
  color: var(--text-secondary);
}

.tl__when {
  color: var(--text-muted);
  font-size: 12.5px;
  margin-left: auto;
}

.tl__notes {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 4px;
}

.tl__outcome {
  font-size: 13.4px;
  color: var(--text-secondary);
  margin-top: 5px;
  padding: 7px 10px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
}

.method-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.method input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.method span {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13.6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
}

.method span:hover {
  border-color: var(--border-strong);
}

.method input:checked + span {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.method input:focus-visible + span {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   12. Catalogue library
   -------------------------------------------------------------------------- */

.fgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
}

.fcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  transition: border-color 0.14s, box-shadow 0.14s;
}

.fcard:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.fcard__preview {
  border: 0;
  padding: 0;
  background: var(--surface-3);
  height: 132px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.fcard__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fcard__thumb--icon {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  object-fit: none;
}

.fcard__thumb--pdf { color: var(--c-red); background: color-mix(in srgb, var(--c-red) 9%, var(--surface-3)); }
.fcard__thumb--sheet { color: var(--good); background: color-mix(in srgb, var(--good) 9%, var(--surface-3)); }
.fcard__thumb--doc { color: var(--c-blue); background: color-mix(in srgb, var(--c-blue) 9%, var(--surface-3)); }

.fcard__body {
  padding: 12px 13px 10px;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.fcard__name {
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font-size: 13.8px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fcard__name:hover {
  color: var(--brand);
}

.fcard__supplier {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.6px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fcard__meta {
  font-size: 11.8px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fcard__actions {
  display: flex;
  gap: 2px;
  padding: 6px 9px 9px;
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   13. Team
   -------------------------------------------------------------------------- */

.plist {
  display: grid;
  gap: 4px;
}

.prow {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 10px;
  border-radius: var(--r-sm);
  flex-wrap: wrap;
}

.prow:hover {
  background: var(--surface-2);
}

.prow__main {
  flex: 1;
  min-width: 190px;
  display: grid;
  gap: 2px;
}

.prow__name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14.6px;
  font-weight: 600;
}

.prow__meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.prow__meta--dim {
  font-size: 12.2px;
  color: var(--text-muted);
}

.prow__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   14. Profile
   -------------------------------------------------------------------------- */

.profile-head {
  display: flex;
  align-items: center;
  gap: 17px;
  padding-bottom: 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.profile-head h2 {
  font-size: 19px;
  font-weight: 650;
}

.profile-badges {
  display: flex;
  gap: 7px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px;
}

.theme-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.theme-opt:hover {
  border-color: var(--border-strong);
}

.theme-opt.is-on {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   15. Modal, toast, skeleton
   -------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgb(8 8 8 / 0.52);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  animation: fadeIn 0.16s ease;
}

.modal-backdrop.is-leaving {
  animation: fadeOut 0.16s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
}

@keyframes fadeOut {
  to { opacity: 0; }
}

.modal {
  width: 100%;
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 40px);
  animation: modalIn 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
}

.modal--sm { max-width: 430px; }
.modal--md { max-width: 620px; }
.modal--lg { max-width: 880px; }
.modal--xl { max-width: 1060px; }

.modal__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.modal__title {
  font-size: 17px;
  font-weight: 650;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal__body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  flex: none;
  flex-wrap: wrap;
}

.confirm-text {
  color: var(--text-secondary);
  font-size: 14.6px;
  line-height: 1.6;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.field--span2 {
  grid-column: 1 / -1;
}

.form-section {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.form-grid > .form-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.form-section h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.form-section p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.rating-input {
  display: flex;
  align-items: center;
  gap: 3px;
}

.rating-star {
  border: 0;
  background: none;
  padding: 4px;
  color: var(--border-strong);
  border-radius: 5px;
  line-height: 0;
}

.rating-star:hover {
  color: var(--c-amber);
}

.rating-star.is-on {
  color: var(--c-amber);
}

.rating-clear {
  border: 0;
  background: none;
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 6px;
  padding: 4px 6px;
  border-radius: 5px;
}

.rating-clear:hover {
  color: var(--text-primary);
  background: var(--surface-3);
}

.preview {
  display: grid;
  place-items: center;
  background: var(--surface-3);
  border-radius: var(--r-sm);
  min-height: 320px;
}

.preview--img img {
  max-height: 68dvh;
  width: auto;
  object-fit: contain;
  border-radius: var(--r-sm);
}

.preview--pdf {
  min-height: 70dvh;
  background: none;
}

.preview--pdf iframe {
  width: 100%;
  height: 70dvh;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #fff;
}

.preview--generic {
  padding: 46px 24px;
  text-align: center;
  color: var(--text-secondary);
  gap: 10px;
}

.preview--generic svg {
  color: var(--text-muted);
}

/* Toasts */

.toast-host {
  position: fixed;
  z-index: 200;
  bottom: 20px;
  right: 20px;
  display: grid;
  gap: 9px;
  justify-items: end;
  pointer-events: none;
  max-width: min(94vw, 400px);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  color: var(--text-primary);
  pointer-events: auto;
  animation: toastIn 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
  width: 100%;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
}

.toast.is-leaving {
  animation: toastOut 0.2s ease forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(14px); }
}

.toast__icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.toast--success .toast__icon { color: var(--good); }
.toast--error .toast__icon { color: var(--critical); }
.toast--warn .toast__icon { color: var(--warning); }
.toast--info .toast__icon { color: var(--brand); }

.toast__msg {
  flex: 1;
  min-width: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.toast__close {
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 19px;
  line-height: 1;
  padding: 0 2px;
  flex: none;
}

.toast__close:hover { color: var(--text-primary); }

/* Skeletons */

.sk {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--border) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.sk--circle { width: 38px; height: 38px; border-radius: 50%; flex: none; }
.sk--line { height: 11px; }
.sk--pill { width: 78px; height: 22px; border-radius: 99px; flex: none; }
.sk--block { border-radius: var(--r); }

.sk-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 6px 14px;
}

.sk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.sk-row:last-child { border-bottom: 0; }

.sk-row__lines {
  flex: 1;
  display: grid;
  gap: 7px;
}

.sk-detail {
  display: grid;
  gap: 16px;
}

/* --------------------------------------------------------------------------
   16. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1200px) {
  .hide-lg { display: none; }
  .dash-grid { grid-template-columns: 1fr; }
  .dgrid { grid-template-columns: 1fr; }
  .dgrid__side .panel { position: static; }
}

@media (max-width: 1024px) {
  .auth { grid-template-columns: 1fr; }
  .auth__brand { display: none; }
}

@media (max-width: 900px) {
  .hide-md { display: none; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open { transform: none; }
  .sidebar__close { display: grid; }
  .topbar__menu { display: grid; }
  .topbar__brand { display: flex; }
  .page { padding: 18px 16px 60px; }
  .topbar { padding: 0 12px; }
  .topbar__userName { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .field--span2 { grid-column: auto; }
  .funnel__row { grid-template-columns: 108px 1fr 54px; }
  .funnel--compact .funnel__row { grid-template-columns: 100px 1fr 32px; }
}

@media (max-width: 640px) {
  .hide-sm { display: none; }
  body { font-size: 14.5px; }
  .page__title { font-size: 21px; }
  .dhead__titleRow h1 { font-size: 21px; }
  .auth__card { padding: 24px 20px; }
  .modal__body { padding: 16px; }
  .modal { max-height: calc(100dvh - 24px); }
  .modal-backdrop { padding: 12px; align-items: end; }
  .toast-host { left: 12px; right: 12px; bottom: 12px; max-width: none; justify-items: stretch; }
  .drow { grid-template-columns: 1fr; gap: 2px; }
  .dlist--tight .drow { grid-template-columns: 1fr; }
  .dhead__actions { width: 100%; }
  .dhead__actions .btn { flex: 1; }
  .cards { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* --------------------------------------------------------------------------
   17. Accessibility fallbacks
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Windows high-contrast: keep chart bars and badges distinguishable without
   relying on the palette at all. */
@media (forced-colors: active) {
  .funnel__bar,
  .uq__bar span {
    forced-color-adjust: none;
    background: Highlight !important;
    border: 1px solid ButtonText;
  }

  .badge,
  .pill,
  .chip {
    border: 1px solid ButtonText;
  }

  .tile,
  .panel,
  .scard,
  .fcard {
    border: 1px solid ButtonText;
  }
}

@media print {
  .sidebar,
  .topbar,
  .toolbar,
  .filterbar,
  .dquick,
  .dhead__actions,
  .row__actions,
  .toast-host {
    display: none !important;
  }

  .page { padding: 0; }
  .panel { break-inside: avoid; border-color: #ccc; }
  body { background: #fff; }
}
