/* Shoppable Support theme: palette, typography, and the shared behaviour of
   the Tiptap editor and react-select tag picker. Loaded before every other
   Support stylesheet so screen rules can still override it. */

@font-face {
  font-display: swap;
  font-family: 'Inter Variable';
  font-style: normal;
  font-weight: 100 900;
  src: url('/fonts/inter/inter-latin-wght-normal.woff2') format('woff2-variations');
  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-display: swap;
  font-family: 'Inter Variable';
  font-style: normal;
  font-weight: 100 900;
  src: url('/fonts/inter/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  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-display: swap;
  font-family: 'Inter Variable';
  font-style: italic;
  font-weight: 100 900;
  src: url('/fonts/inter/inter-latin-wght-italic.woff2') format('woff2-variations');
  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;
}

:root {
  --s-font: 'Inter Variable', Inter, ui-sans-serif, system-ui, -apple-system,
    'Segoe UI', sans-serif;

  /* ---- Neutrals ---------------------------------------------------------
     Two jobs: separate the canvas the app sits on from the surfaces that
     carry content, and keep enough steps between them that hierarchy comes
     from tone rather than from another border. The cool cast is the product's
     own; the chroma is low so long sessions read as paper, not as blue. */
  --s-white: #fff;
  /* Read rows and other resting surfaces: a half-step under white, which is
     what lets an unread row be white and still register as brighter. */
  --s-tint: #fafbfc;
  --s-bg: #f4f6f8;
  --s-wash: #eef1f4;
  --s-hover: #eaeef1;
  --s-selected: #e6eef1;
  /* Row separators inside a dense list. Deliberately weaker than --s-line:
     twelve of these stack up on one screen. */
  --s-line-subtle: #e9edf0;
  --s-line: #dbe2e8;
  --s-line-strong: #c6d0d8;

  /* Icons and dividers only: this tone does not meet AA for text. */
  --s-muted-soft: #8b98a3;
  --s-muted: #64737f;
  /* Reads on the tinted chat bubbles, where the muted tone falls short. */
  --s-muted-strong: #4a5a67;
  --s-text-secondary: #4a5a67;
  --s-navy: #253746;
  --s-navy-strong: #1a2836;
  --s-text: #1c2b36;

  --s-aqua: #90c9d5;
  --s-aqua-strong: #3f8fa3;
  --s-teal: #286779;
  --s-ring: #438393;
  --s-agent-bubble: #e3f1f5;

  /* ---- Semantic status ---------------------------------------------------
     A Ticket's status is the one fact an Agent scans for, so it carries
     colour where almost nothing else does. Desaturated on purpose: these sit
     twelve to a screen and must not compete with the subject line. All meet
     AA on white and on the read-row tint. */
  --s-status-new: #2f6f86;
  --s-status-open: #2f7d5e;
  --s-status-pending: #96660f;
  --s-status-resolved: #64737f;
  --s-status-closed: #8b98a3;
  --s-danger: #b03d3d;
  --s-danger-soft: #fdf3f3;
  --s-warning: #96660f;
  --s-success: #2f7d5e;

  /* ---- Spacing -----------------------------------------------------------
     One 4px-based scale. Density is a feature here: the large steps exist for
     pane padding, not for breathing room between rows. */
  --s-1: 2px;
  --s-2: 4px;
  --s-3: 6px;
  --s-4: 8px;
  --s-5: 12px;
  --s-6: 16px;
  --s-7: 20px;
  --s-8: 24px;
  --s-9: 32px;

  /* ---- Type --------------------------------------------------------------
     13px is the interface size; everything else is a deliberate step away
     from it. Three weights only, so weight still means something. */
  --s-text-micro: 11px;
  --s-text-meta: 12px;
  --s-text-ui: 13px;
  --s-text-pane: 14px;
  --s-text-subject: 15px;
  --s-text-title: 20px;
  --s-weight-normal: 400;
  --s-weight-medium: 500;
  --s-weight-strong: 600;

  /* ---- Shape -------------------------------------------------------------
     Precise, not soft. 999px is reserved for genuine dots and chips. */
  --s-radius-sm: 4px;
  --s-radius: 6px;
  --s-radius-lg: 8px;

  /* ---- Elevation ---------------------------------------------------------
     Shadows mean "this floats above the page". Resting surfaces get none. */
  --s-shadow-popover: 0 4px 16px -2px rgb(28 43 54 / .12), 0 1px 3px rgb(28 43 54 / .08);
  --s-shadow-dialog: 0 16px 48px -8px rgb(28 43 54 / .22), 0 2px 8px rgb(28 43 54 / .08);

  /* ---- Controls ----------------------------------------------------------
     One height per role, so a row of mixed controls still lines up. */
  --s-control-height: 32px;
  --s-control-height-sm: 28px;
  --s-focus-ring: 0 0 0 3px rgb(67 131 147 / .28);

  --s-motion: 150ms;
  --s-motion-pane: 190ms;
  --s-ease: cubic-bezier(.2, .7, .3, 1);

  /* Chat channels are branded surfaces: an Agent should recognise which
     product the customer is writing from without reading the header. */
  /* Messenger's own #0084ff carries white text at only 3.7:1. This is the
     same hue darkened to 4.73:1, so the bubble still reads as Messenger. */
  --s-messenger: #0071e0;
  --s-messenger-in: #f0f0f0;
  --s-messenger-in-text: #050505;
  --s-whatsapp-bg: #efeae2;
  --s-whatsapp-out: #d9fdd3;
  --s-whatsapp-text: #111b21;
  /* 5.0:1 on the outgoing green and 5.5:1 on white. */
  --s-whatsapp-meta: #5b6b73;
  --s-whatsapp-read: #53bdeb;
  --s-note-bubble: #fef3c7;
  --s-note-accent: #d9b83a;
  --s-note-text: #4a3a05;
}

/* Interface type. Numerals stay tabular so counts and timestamps do not shift
   as conversations arrive. */
.support-workspace-shell,
.support-entry-page,
.support-management-page,
.support-terminal-page,
.support-auth-page,
.support-form-page,
.support-profile-page,
.support-followup-page,
.support-customer-profile-page,
.support-ui {
  font-family: var(--s-font);
  font-synthesis-weight: none;
}

.support-workspace-shell time,
.support-workspace-shell b,
.support-count-pill { font-variant-numeric: tabular-nums; }

::selection { background: #c3e7ed; color: var(--s-navy); }

/* Restrained motion. Hover and selection settle in 150ms; panes take slightly
   longer because they move more. */
.support-ticket-row,
.support-status-button,
.support-management-nav nav > a,
.support-settings-nav-group a,
.support-button,
.support-primary-button,
.support-secondary-button {
  transition: background-color var(--s-motion) ease,
    color var(--s-motion) ease, border-color var(--s-motion) ease,
    box-shadow var(--s-motion) ease;
}

/* The conversation fades in when an Agent opens another Ticket, so the swap
   reads as one surface changing rather than a page reload. */
@keyframes support-conversation-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.support-conversation > .support-timeline {
  animation: support-conversation-in var(--s-motion-pane) var(--s-ease);
}

@media (prefers-reduced-motion: reduce) {
  .support-ticket-row,
  .support-status-button,
  .support-management-nav nav > a,
  .support-settings-nav-group a,
  .support-button,
  .support-primary-button,
  .support-secondary-button { transition: none; }
  .support-conversation > .support-timeline { animation: none; }
  /* The label still says "Sending…", so the state survives without the spin. */
  .support-spinner { animation: none; }
}

/* ---- Tiptap ------------------------------------------------------------ */

.support-rich-editor .tiptap,
.support-form-editor .tiptap {
  min-height: inherit;
  outline: 0;
}

/* Gmail rhythm: Enter is a compact next line, and vertical space comes only
   from blank lines the agent types. Outbound mail pins the same margin:0
   inline, so the composer shows exactly what the customer receives. */
.tiptap p { margin: 0; }
.tiptap ul, .tiptap ol { margin: 0; padding-left: 20px; }
.tiptap blockquote {
  border-left: 3px solid var(--s-line);
  color: var(--s-muted);
  margin: 0 0 8px;
  padding-left: 10px;
}
.tiptap a { color: var(--s-teal); text-decoration: underline; }

/* Placeholder copy is supplied by the Tiptap extension. */
.tiptap p.is-editor-empty:first-child::before {
  color: var(--s-muted);
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
}

.support-rich-toolbar,
.support-form-toolbar { flex-wrap: wrap; }

/* In the composer bar the strip shares a row with Macro, Attach and Send, so
   it scrolls sideways rather than wrapping the bar onto extra lines. */
.support-rich-toolbar.support-rich-toolbar-inline { flex-wrap: nowrap; }

.support-rich-toolbar button[aria-pressed='true'],
.support-form-toolbar button[aria-pressed='true'] {
  background: var(--s-selected);
  color: var(--s-teal);
}

/* ---- react-select tag picker ------------------------------------------- */

.support-tag__control {
  background: var(--s-white);
  border: 1px solid var(--s-line-strong);
  border-radius: var(--s-radius);
  font-size: 12px;
  min-height: 36px;
  padding: 3px 5px;
  transition: border-color var(--s-motion) ease, box-shadow var(--s-motion) ease;
}

.support-tag__control--is-focused {
  border-color: var(--s-ring);
  box-shadow: 0 0 0 3px rgb(67 131 147 / .25);
}

.support-tag__value-container { display: flex; flex-wrap: wrap; gap: 3px; }
.support-tag__placeholder { color: var(--s-muted); }

.support-tag__multi-value {
  align-items: center;
  background: var(--s-selected);
  border-radius: 4px;
  color: var(--s-teal);
  display: flex;
  gap: 4px;
  overflow-wrap: anywhere;
  padding: 3px 6px;
}

.support-tag__multi-value__remove {
  cursor: pointer;
  display: flex;
  border-radius: 3px;
}
.support-tag__multi-value__remove:hover { color: #a42d2d; }

.support-tag__indicators { align-items: center; display: flex; gap: 2px; }
.support-tag__indicator { color: var(--s-muted-soft); cursor: pointer; }
.support-tag__indicator:hover { color: var(--s-navy); }

.support-tag__menu {
  background: var(--s-white);
  border: 1px solid var(--s-line);
  border-radius: var(--s-radius);
  box-shadow: 0 8px 24px rgb(38 63 80 / .13);
  font-size: 12px;
  margin-top: 5px;
  padding: 4px;
  z-index: 20;
}

.support-tag__option {
  border-radius: 4px;
  cursor: pointer;
  overflow-wrap: anywhere;
  padding: 7px 9px;
}
.support-tag__option--is-focused { background: var(--s-selected); }
.support-tag__menu-notice { color: var(--s-muted); padding: 8px 9px; }

/* ---- Icons -------------------------------------------------------------- */

/* Lucide renders 24px icons by default; Support runs a denser scale. */
.lucide { flex: none; height: 16px; stroke-width: 1.8; width: 16px; }
.support-channel-logo { flex: none; height: 16px; width: 16px; }
.support-channel-marker .support-channel-logo,
.support-row-meta .support-channel-logo { height: 13px; width: 13px; }
.support-inbox-channel .support-channel-logo { height: 15px; width: 15px; }
.support-primary-button .lucide,
.support-secondary-button .lucide { height: 15px; width: 15px; }

/* The one animated primitive in Support. It exists because a send needs to
   read as in flight, and it is gated below so reduced motion falls back to
   the "Sending…" label alone. */
.support-spinner { animation: support-spin 640ms linear infinite; flex: none; height: 15px; width: 15px; }
@keyframes support-spin { to { transform: rotate(360deg); } }
.support-composer-attachments button { align-items: center; display: inline-flex; gap: 5px; }
.support-composer-attachments button .lucide { height: 13px; width: 13px; }

/* Macro attributes reuse Support's editor, popup, and focus colors. */
.support-attribute-chip { display:inline-block; padding:1px 6px; margin:0 2px; border:1px solid var(--s-line); border-radius:4px; background:var(--s-tint); color:var(--s-text); cursor:pointer; font-weight:500; }
.support-attribute-chip::before { content:'{\2026} '; color:var(--s-muted); }
.support-attribute-chip.ProseMirror-selectednode { outline:2px solid var(--s-teal); }
.support-macro-editor .tiptap { padding-right:46px; }
.support-attribute-trigger { display:inline-flex; align-items:center; gap:5px; padding:5px 8px; border:0; border-radius:4px; background:transparent; color:var(--s-text); cursor:pointer; font-size:12px; }
.support-attribute-trigger svg,.support-attribute-floater svg { width:18px; height:18px; }
.support-attribute-floater { position:fixed; z-index:30; display:grid; place-items:center; width:32px; height:32px; border:1px solid var(--s-line); border-radius:6px; background:var(--s-white); color:var(--s-text); box-shadow:0 2px 8px #0001; cursor:pointer; }
.support-attribute-popup { position:fixed; z-index:100; width:min(328px,calc(100vw - 24px)); max-height:min(400px,calc(100vh - 24px)); display:flex; flex-direction:column; gap:10px; padding:12px; border:1px solid var(--s-line); border-radius:8px; background:var(--s-white); color:var(--s-text); box-shadow:0 6px 24px #0002; font:13px Inter,sans-serif; overflow:auto; }
.support-attribute-popup { box-sizing:border-box; }
.support-attribute-popup header { display:flex; align-items:center; justify-content:space-between; }
.support-attribute-popup button { cursor:pointer; color:inherit; background:var(--s-white); border:1px solid var(--s-line); border-radius:4px; padding:6px 9px; }
.support-attribute-popup button:disabled { opacity:.5; cursor:default; }
.support-attribute-popup input { width:100%; box-sizing:border-box; border:1px solid var(--s-line); border-radius:4px; padding:8px; background:var(--s-white); color:inherit; }
.support-attribute-popup :focus-visible,.support-attribute-trigger:focus-visible,.support-attribute-floater:focus-visible { outline:2px solid var(--s-teal); outline-offset:2px; }
.support-attribute-options { overflow:auto; min-height:70px; max-height:190px; flex:1 1 auto; }
.support-attribute-options h4 { margin:10px 4px 4px; font-size:11px; color:var(--s-muted); }
.support-attribute-options button { display:block; width:100%; text-align:left; border:0; }
.support-attribute-options button:hover,.support-attribute-options button[aria-selected=true] { background:var(--s-tint); }
.support-attribute-fallback { display:grid; gap:7px; border-top:1px solid var(--s-line); padding-top:10px; }
.support-attribute-fallback label { display:grid; gap:4px; }
.support-attribute-help,.support-attribute-fallback small { color:var(--s-muted); font-size:12px; }
.support-inbox-ticket-number { display:none; }
.support-workspace-shell.layout-inbox .support-row-top > .support-row-sender { display:flex; align-items:center; gap:8px; min-width:0; }
/* Named rather than positional: the unread dot now opens this cell, and a
   :first-child rule would truncate the dot and let the name run off. */
.support-workspace-shell.layout-inbox .support-row-sender-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.support-workspace-shell.layout-inbox .support-inbox-ticket-number { display:inline; flex:none; color:var(--s-muted); font-size:11px; font-weight:400; font-variant-numeric:tabular-nums; }
@media(max-width:760px) { .support-attribute-floater { display:none; } .support-macro-editor .tiptap { padding-right:12px; } }

/* ---- Shared control primitive ------------------------------------------
   `.support-button` is used across Settings, the view editor and every
   dialog, but its only definition lived in the component gallery's
   stylesheet and had drifted off the scale. Its geometry now comes from the
   tokens at source; these are the states that definition never carried. */
.support-button.quiet { border-color: transparent; }
.support-button:hover { background: var(--s-wash); border-color: var(--s-line-strong); }
.support-button.quiet:hover { background: var(--s-hover); border-color: transparent; }
.support-button.primary { background: var(--s-navy); border-color: var(--s-navy); }
.support-button.primary:hover { background: var(--s-navy-strong); border-color: var(--s-navy-strong); }
.support-button:focus-visible { outline: 2px solid var(--s-ring); outline-offset: 2px; }

.support-badge.dark { background: var(--s-navy); border-color: var(--s-navy); }
