/* ==========================================================================
   Palyri skin for Twenty CRM — crm.partnerwzrostu.pl
   Injected into index.html as <link id="palyri-skin">, served by Caddy from
   /brand/. Nothing in the Twenty image is patched except that one <link>.

   Layer 1  fonts        Geist (body) + Space Grotesk (labels), self-hosted
   Layer 2  tokens       Twenty --t-* remapped onto the Palyri ramp
   Layer 3  structure    record table + record drawer layout corrections

   Palyri design system v2.1 — palyri.com/palyri-design-tokens.json
   Selectors use html.light / html.dark so they beat Twenty's own .light
   block regardless of runtime CSS-chunk injection order.
   ========================================================================== */

/* ---------- Layer 1: fonts ------------------------------------------------ */

@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/brand/geist-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/brand/geist-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/brand/space-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/brand/space-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Layer 2: tokens ---------------------------------------------- */

html.light,
html.dark {
  /* Palyri ramp, available to the structural layer below */
  --p-050: #F5F9FB;
  --p-100: #E7F0F5;
  --p-200: #CCDAE3;
  --p-300: #A7BECD;
  --p-400: #82A2B8;
  --p-500: #5E86A1;
  --p-600: #40647D;
  --p-700: #304B5D;
  --p-800: #22303A;
  --p-900: #16232B;

  --t-font-family: 'Geist', Inter, system-ui, sans-serif;
  --t-code-font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Palyri allows 400 and 500 only — 600+ is banned */
  --t-font-weight-semi-bold: 500;

  /* Closed radius table: chip 8, input 10, bar 14, card 16, pill 999 */
  --t-border-radius-xs: 4px;
  --t-border-radius-sm: 8px;
  --t-border-radius-sm-round: 8px;
  --t-border-radius-md: 10px;
  --t-border-radius-md-round: 10px;
  --t-border-radius-lg: 16px;
  --t-border-radius-xl: 16px;
  --t-border-radius-xxl: 20px;
}

html.light {
  /* neutral ramp — slate-blue, never pure gray */
  --t-gray-scale-gray1: #FFFFFF;
  --t-gray-scale-gray2: #FAFCFD;
  --t-gray-scale-gray3: #F5F9FB;
  --t-gray-scale-gray4: #EFF4F7;
  --t-gray-scale-gray5: #E7F0F5;
  --t-gray-scale-gray6: #CCDAE3;
  --t-gray-scale-gray7: #C4D3DC;
  --t-gray-scale-gray8: #A7BECD;
  --t-gray-scale-gray9: #6E8792;
  --t-gray-scale-gray10: #52646E;
  --t-gray-scale-gray11: #38464E;
  --t-gray-scale-gray12: #101A1F;

  /* surfaces — figure/ground: tinted canvas, white cards */
  --t-background-primary: #FFFFFF;
  --t-background-secondary: #F3F6F8;
  --t-background-tertiary: #EFF4F7;
  --t-background-quaternary: #E7F0F5;
  --t-background-inverted-primary: #16232B;
  --t-background-inverted-secondary: #304B5D;
  --t-background-primary-inverted: #16232B;
  --t-background-primary-inverted-hover: #304B5D;
  --t-background-danger: #FBEAE8;

  --t-background-transparent-primary: rgba(255, 255, 255, 0.72);
  --t-background-transparent-secondary: rgba(255, 255, 255, 0.5);
  --t-background-transparent-strong: rgba(29, 54, 66, 0.16);
  --t-background-transparent-medium: rgba(29, 54, 66, 0.08);
  --t-background-transparent-light: rgba(29, 54, 66, 0.05);
  --t-background-transparent-lighter: rgba(29, 54, 66, 0.025);
  --t-background-transparent-danger: rgba(187, 58, 49, 0.09);
  --t-background-transparent-blue: rgba(64, 100, 125, 0.09);
  --t-background-transparent-orange: rgba(138, 90, 18, 0.12);
  --t-background-transparent-success: rgba(62, 107, 82, 0.12);

  --t-background-overlay-primary: rgba(13, 32, 42, 0.6);
  --t-background-overlay-secondary: rgba(13, 32, 42, 0.32);
  --t-background-overlay-tertiary: rgba(13, 32, 42, 0.07);

  --t-background-radial-gradient: linear-gradient(118deg, #40647D 0%, #5E86A1 100%);
  --t-background-radial-gradient-hover: linear-gradient(118deg, #304B5D 0%, #40647D 100%);

  /* borders — hairlines only clarify, value separates surfaces */
  --t-border-color-strong: #C4D3DC;
  --t-border-color-medium: #DFE8EC;
  --t-border-color-light: #E7F0F5;
  --t-border-color-inverted: #16232B;
  --t-border-color-secondary-inverted: #304B5D;
  --t-border-color-danger: #E9C3BF;
  --t-border-color-blue: #82A2B8;
  --t-border-color-transparent-strong: rgba(23, 49, 62, 0.1);

  /* type colours — contrast floors are law, never lighter than these */
  --t-font-color-primary: #101A1F;
  --t-font-color-secondary: #38464E;
  --t-font-color-tertiary: #52646E;
  --t-font-color-light: #6E8792;
  --t-font-color-extra-light: #A7BECD;
  --t-font-color-inverted: #FFFFFF;
  --t-font-color-danger: #9C2F26;

  /* accent — Twenty's indigo becomes Palyri interactive blue */
  --t-accent-primary: #CCDAE3;
  --t-accent-secondary: #CCDAE3;
  --t-accent-tertiary: #E7F0F5;
  --t-accent-quaternary: #F5F9FB;
  --t-accent-accent3570: #82A2B8;
  --t-accent-accent4060: #82A2B8;
  --t-accent-accent1: #FDFEFE;
  --t-accent-accent2: #F5F9FB;
  --t-accent-accent3: #E7F0F5;
  --t-accent-accent4: #DCE8EF;
  --t-accent-accent5: #CCDAE3;
  --t-accent-accent6: #BACEDA;
  --t-accent-accent7: #A7BECD;
  --t-accent-accent8: #82A2B8;
  --t-accent-accent9: #40647D;
  --t-accent-accent10: #395A70;
  --t-accent-accent11: #304B5D;
  --t-accent-accent12: #16232B;
  --t-buttons-secondary-text-color: #40647D;

  --t-box-shadow-color: rgba(13, 32, 42, 0.05);
  --t-box-shadow-light: 0 1px 2px rgba(13, 32, 42, 0.05), 0 4px 12px -6px rgba(13, 32, 42, 0.06);
  --t-box-shadow-strong: 0 8px 24px -8px rgba(13, 32, 42, 0.16), 0 2px 6px rgba(13, 32, 42, 0.05);
  --t-box-shadow-super-heavy: 0 24px 64px -16px rgba(13, 32, 42, 0.24), 0 8px 24px rgba(13, 32, 42, 0.08);
  --t-box-shadow-underline: 0 1px 0 0 rgba(13, 32, 42, 0.32);

  --t-snack-bar-success-color: #3E6B52;
  --t-snack-bar-success-background-color: rgba(62, 107, 82, 0.12);
  --t-snack-bar-error-color: #9C2F26;
  --t-snack-bar-error-background-color: rgba(156, 47, 38, 0.1);
  --t-snack-bar-warning-color: #8A5A12;
  --t-snack-bar-warning-background-color: rgba(138, 90, 18, 0.12);
  --t-snack-bar-info-color: #3D6472;
  --t-snack-bar-info-background-color: rgba(64, 100, 125, 0.1);
  --t-snack-bar-default-color: #101A1F;
  --t-snack-bar-default-background-color: rgba(29, 54, 66, 0.05);

  --t--illustration-icon-color-blue: #82A2B8;
  --t--illustration-icon-color-gray: #6E8792;
  --t--illustration-icon-fill-blue: #E7F0F5;
  --t--illustration-icon-fill-gray: #EFF4F7;

  /* solid palette — used for dots, avatars and colour pickers.
     Twenty's 30 hues collapse onto the Palyri status pairs + viz series,
     so badges stay distinguishable without leaving the palette. */
  --t-color-gray: #4E6570;
  --t-color-mauve: #4E6570;
  --t-color-slate: #4E6570;
  --t-color-sage: #4E6570;
  --t-color-olive: #4E6570;
  --t-color-sand: #4E6570;
  --t-color-blue: #40647D;
  --t-color-sky: #3D6472;
  --t-color-cyan: #3D6472;
  --t-color-green: #3E6B52;
  --t-color-jade: #3E6B52;
  --t-color-grass: #3E6B52;
  --t-color-mint: #2F6A62;
  --t-color-turquoise: #2F6A62;
  --t-color-red: #9C2F26;
  --t-color-tomato: #9C2F26;
  --t-color-ruby: #9C2F26;
  --t-color-crimson: #9C2F26;
  --t-color-orange: #8A4C3E;
  --t-color-bronze: #8A4C3E;
  --t-color-brown: #8A4C3E;
  --t-color-amber: #8A5A12;
  --t-color-gold: #8A5A12;
  --t-color-yellow: #8A5A12;
  --t-color-lime: #4E6B3C;
  --t-color-purple: #6A5478;
  --t-color-violet: #6A5478;
  --t-color-iris: #6A5478;
  --t-color-plum: #6A5478;
  --t-color-pink: #6A5478;

  /* badge pairs — same nine groups, tint + readable ink */
  --t-tag-text-gray: #4E6570;      --t-tag-background-gray: #F1F4F4;
  --t-tag-text-mauve: #4E6570;     --t-tag-background-mauve: #F1F4F4;
  --t-tag-text-slate: #4E6570;     --t-tag-background-slate: #F1F4F4;
  --t-tag-text-sage: #4E6570;      --t-tag-background-sage: #F1F4F4;
  --t-tag-text-olive: #4E6570;     --t-tag-background-olive: #F1F4F4;
  --t-tag-text-sand: #4E6570;      --t-tag-background-sand: #F1F4F4;
  --t-tag-text-blue: #3D6472;      --t-tag-background-blue: #E9F0F3;
  --t-tag-text-sky: #3D6472;       --t-tag-background-sky: #E9F0F3;
  --t-tag-text-cyan: #3D6472;      --t-tag-background-cyan: #E9F0F3;
  --t-tag-text-green: #3E6B52;     --t-tag-background-green: #E8F0EA;
  --t-tag-text-jade: #3E6B52;      --t-tag-background-jade: #E8F0EA;
  --t-tag-text-grass: #3E6B52;     --t-tag-background-grass: #E8F0EA;
  --t-tag-text-mint: #2F6A62;      --t-tag-background-mint: #E4F0EE;
  --t-tag-text-turquoise: #2F6A62; --t-tag-background-turquoise: #E4F0EE;
  --t-tag-text-red: #9C2F26;       --t-tag-background-red: #FBEAE8;
  --t-tag-text-tomato: #9C2F26;    --t-tag-background-tomato: #FBEAE8;
  --t-tag-text-ruby: #9C2F26;      --t-tag-background-ruby: #FBEAE8;
  --t-tag-text-crimson: #9C2F26;   --t-tag-background-crimson: #FBEAE8;
  --t-tag-text-orange: #8A4C3E;    --t-tag-background-orange: #F7EAE7;
  --t-tag-text-bronze: #8A4C3E;    --t-tag-background-bronze: #F7EAE7;
  --t-tag-text-brown: #8A4C3E;     --t-tag-background-brown: #F7EAE7;
  --t-tag-text-amber: #8A5A12;     --t-tag-background-amber: #FDF3DC;
  --t-tag-text-gold: #8A5A12;      --t-tag-background-gold: #FDF3DC;
  --t-tag-text-yellow: #8A5A12;    --t-tag-background-yellow: #FDF3DC;
  --t-tag-text-lime: #4E6B3C;      --t-tag-background-lime: #EDF2E8;
  --t-tag-text-purple: #6A5478;    --t-tag-background-purple: #F0ECF2;
  --t-tag-text-violet: #6A5478;    --t-tag-background-violet: #F0ECF2;
  --t-tag-text-iris: #6A5478;      --t-tag-background-iris: #F0ECF2;
  --t-tag-text-plum: #6A5478;      --t-tag-background-plum: #F0ECF2;
  --t-tag-text-pink: #6A5478;      --t-tag-background-pink: #F0ECF2;
}

html.dark {
  --t-gray-scale-gray1: #0C1216;
  --t-gray-scale-gray2: #101820;
  --t-gray-scale-gray3: #131A1F;
  --t-gray-scale-gray4: #172127;
  --t-gray-scale-gray5: #1C282F;
  --t-gray-scale-gray6: #223039;
  --t-gray-scale-gray7: #2C3D48;
  --t-gray-scale-gray8: #3A4D59;
  --t-gray-scale-gray9: #7E939B;
  --t-gray-scale-gray10: #8A9AA3;
  --t-gray-scale-gray11: #C3CACC;
  --t-gray-scale-gray12: #F2F4F4;

  --t-background-primary: #131A1F;
  --t-background-secondary: #0C1216;
  --t-background-tertiary: #172127;
  --t-background-quaternary: #1C282F;
  --t-background-inverted-primary: #F2F4F4;
  --t-background-inverted-secondary: #C3CACC;
  --t-background-primary-inverted: #F2F4F4;
  --t-background-primary-inverted-hover: #C3CACC;

  --t-background-transparent-strong: rgba(143, 182, 206, 0.18);
  --t-background-transparent-medium: rgba(143, 182, 206, 0.1);
  --t-background-transparent-light: rgba(143, 182, 206, 0.07);
  --t-background-transparent-lighter: rgba(143, 182, 206, 0.035);
  --t-background-transparent-blue: rgba(127, 166, 188, 0.14);

  --t-border-color-strong: #2C3D48;
  --t-border-color-medium: #223039;
  --t-border-color-light: #1C282F;
  --t-border-color-blue: #7FA6BC;

  --t-font-color-primary: #F2F4F4;
  --t-font-color-secondary: #C3CACC;
  --t-font-color-tertiary: #8A9AA3;
  --t-font-color-light: #7E939B;
  --t-font-color-extra-light: #5C7079;

  --t-accent-primary: #18262F;
  --t-accent-secondary: #18262F;
  --t-accent-tertiary: #16242A;
  --t-accent-quaternary: #131C22;
  --t-accent-accent3570: #7FA6BC;
  --t-accent-accent4060: #7FA6BC;
  --t-accent-accent9: #7FA6BC;
  --t-accent-accent10: #8FB6CE;
  --t-accent-accent11: #A9C6D6;
  --t-accent-accent12: #E7F0F5;
  --t-buttons-secondary-text-color: #8FB6CE;
  --t-color-blue: #7FA6BC;
}

/* ---------- Layer 3: structure ------------------------------------------- */
/*
   Two kinds of hook are used below, both deliberate:
     .table-cell / .header-cell / .record-table-column-*   authored by Twenty
     [class*='_section_'] / [class*='_overflowingText_']   CSS-module names;
       only the trailing hash moves between builds, the readable part does not
   Everything else is stamped by palyri-skin.js as data-pl="..." — never rely
   on the vanilla-extract hashes (s1e51d2w and friends), those do move.
*/

html body {
  font-family: var(--t-font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Numbers align in columns; ratings, review counts and dates stop jittering. */
html .table-cell,
html [data-pl='field-value'],
html input[type='number'] {
  font-variant-numeric: tabular-nums;
}

/* Palyri allows 400 and 500 only — catch anything hard-coded in the app. */
html b,
html strong {
  font-weight: 500;
}

/* --- record table ---------------------------------------------------------
   41 columns of imported lead data. The grid was drawn at one weight in both
   axes, which reads as a spreadsheet. Rows keep their hairline; the column
   rules drop a step so the eye travels along the row, not into the grid. */

html .table-cell {
  border-right-color: var(--t-border-color-light);
}

/* The header is a quiet band, not a dark bar: value separates it from the
   rows, the hairline only confirms the edge. */
html .header-cell {
  background-color: var(--p-050);
  border-bottom: 1px solid var(--t-border-color-strong);
  border-right-color: var(--t-border-color-light);
}
html .header-cell [class*='_overflowingText_'],
html .header-cell [class*='_label_'] {
  color: var(--t-font-color-tertiary);
  font-weight: 500;
}

/* Name column carries the record identity — it stays anchored and slightly
   stronger than the columns that scroll past it. */
html .record-table-column-field-0 {
  border-right-color: var(--t-border-color-strong);
}

/* Aggregate footer reads as a recessed summary strip. */
html .footer-cell {
  background-color: var(--p-050);
  border-top: 1px solid var(--t-border-color-medium);
  border-right-color: transparent;
  color: var(--t-font-color-tertiary);
}

/* --- record drawer --------------------------------------------------------
   Field rows are stamped by palyri-skin.js. Twenty ships a fixed 90px label
   column, which truncated "Campaign Status" and "SMS Lead Status" to
   "Campaign …" / "SMS Lead …". The label column now flexes and wraps. */

html aside [data-pl='field'] {
  display: grid;
  grid-template-columns: minmax(104px, 150px) minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
  min-height: 26px;
}

/* Twenty pins the label to 90px on an inner wrapper and clamps it to one
   line, so the wrapper — not just the text node — has to be released, or
   "When to contact" still ellipsises to "When to…" and then wraps. */
html aside [data-pl='field-label'],
html aside [data-pl='field-label'] > *,
html aside [data-pl='field-label'] > * > * {
  width: auto !important;
  max-width: none !important;
  min-width: 0;
}
html aside [data-pl='field-label'] {
  padding-top: 3px;
}
html aside [data-pl='field-label'] [class*='_overflowingMultilineText_'] {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  -webkit-line-clamp: 2;
  font-size: 12px;
  line-height: 15px;
  color: var(--t-font-color-light);
}

html aside [data-pl='field-value'] {
  min-width: 0;
}

/* Empty fields: Twenty's placeholder is the field name, so half the drawer
   was the label column printed twice. Idle, an empty field is a dash; on
   hover or while editing the real placeholder comes back so it still reads
   as something you can click. opacity (not visibility) keeps the hit area. */
html aside [data-pl='field'][data-pl-empty] [data-pl='field-value'] {
  position: relative;
}
html aside [data-pl='field'][data-pl-empty]:not(:hover):not(:focus-within) [data-pl='field-value'] > * {
  opacity: 0;
}
html aside [data-pl='field'][data-pl-empty]:not(:hover):not(:focus-within) [data-pl='field-value']::after {
  content: '—';
  position: absolute;
  left: 8px;
  top: 3px;
  color: var(--t-font-color-extra-light);
  pointer-events: none;
}

/* Long free text (Conversation, SMS Conversation, AI Personalization) gets
   three lines instead of one clipped line. The value cell is a stack of
   fixed 24px, overflow:hidden boxes, so the whole chain has to be released
   or the extra lines render on top of the row above. */
html aside [data-pl='field'][data-pl-long] {
  align-items: start;
}
html aside [data-pl='field'][data-pl-long] [data-pl='field-value'],
html aside [data-pl='field'][data-pl-long] [data-pl='field-value'] * {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  white-space: normal !important;
}
html aside [data-pl='field'][data-pl-long] [data-pl='field-value'] [class*='_overflowingText_'] {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden !important;
  line-height: 16px;
}

/* --- view picker ----------------------------------------------------------
   38 views in a menu that ships 192px wide with 168px of scroll. Widen it,
   let it use the viewport, and draw a section heading above the first view
   of each category. The heading is a ::before on the item itself, absolutely
   positioned into the margin above, so no node is inserted into the list. */

html [data-pl='view-shell'] {
  min-width: 380px !important;
  max-width: none !important;
}
html [data-pl='view-scroll'] {
  min-width: 380px !important;
  max-height: 60vh !important;
}
html [data-pl='view-item'] {
  min-width: 0 !important;
  width: 100% !important;
}
html [data-pl='view-item'] [class*='_menuItemLabel_'],
html [data-pl='view-item'] [class*='_mainText_'],
html [data-pl='view-item'] [class*='_overflowingText_'] {
  width: auto !important;
  max-width: none !important;
}

html [data-pl-view-head] {
  position: relative;
  margin-top: 26px !important;
}
html [data-pl-view-head]::before {
  content: attr(data-pl-view-head);
  position: absolute;
  top: -19px;
  left: 8px;
  right: 8px;
  padding-top: 5px;
  border-top: 1px solid var(--t-border-color-light);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t-font-color-light);
  pointer-events: none;
}

/* Section headings — General / Lead / Contact / Outreach / SMS / Campaign /
   Notes / System — become Palyri eyebrows with a hairline above.
   The heading is a <header>; the rest of the section is the field list, so
   the eyebrow rule must not reach past that element. */
html aside [class*='_section_'] {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--t-border-color-light);
}
html aside [class*='_section_']:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
html aside [class*='_section_'] > header > :first-child {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t-font-color-light);
}
