/* Cowork UI kit — the built-in interface kit, served at /ui-ds/ when no uiDesignSystem is configured.
 * It implements the component classes the app's markup uses (ds-button-*, ds-field-*, ds-tabs-*, …,
 * the same class API as the design-system adapter) with Cowork Design's own look, so the interface
 * needs no internal design system. Colours come from the variables in /style.css (light + dark).
 * Icons: Lucide (ISC) — components/IconAction (masks) and components/IconDecorative (duotone). */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---------- text styles ---------- */
.text-web-headline-l { font: 600 28px/36px var(--font); letter-spacing: -0.02em; }
.text-web-headline-m { font: 600 20px/28px var(--font); letter-spacing: -0.01em; }
.text-web-title-l { font: 600 17px/24px var(--font); letter-spacing: -0.005em; }
.text-web-title-m { font: 600 15px/22px var(--font); }
.text-web-body-l { font: 400 16px/24px var(--font); }
.text-web-body-strong-l { font: 600 16px/24px var(--font); }
.text-web-body-m { font: 400 14px/20px var(--font); }
.text-web-body-strong-m { font: 600 14px/20px var(--font); }
.text-web-body-s { font: 400 12px/16px var(--font); }
.text-web-body-strong-s { font: 600 12px/16px var(--font); }
.text-web-caption-m { font: 500 12px/16px var(--font); letter-spacing: 0.01em; }
._text-button-web,
._text-button-secondary-web { font: 600 14px/20px var(--font); }
._text-tag { font: 500 12px/16px var(--font); }

/* ---------- icons ---------- */
.ds-ia-root {
  display: inline-block;
  flex: none;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* ---------- button ---------- */
.ds-button-root {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-action);
  background: transparent;
  color: var(--ink);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.ds-button-root::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.ds-button-root:hover::after { opacity: 0.06; }
.ds-button-root:active::after { opacity: 0.12; }
.ds-button-size-compact { height: 32px; padding: 0 12px; gap: 6px; }
.ds-button-size-compact._text-button-web,
.ds-button-size-compact._text-button-secondary-web { font-size: 13px; }
.ds-button-emph-primary-leading,
.ds-button-emph-primary-complementary {
  background: var(--accent);
  color: var(--on-accent);
}
.ds-button-emph-primary-leading:hover::after { opacity: 0.12; }
.ds-button-emph-secondary { box-shadow: inset 0 0 0 1px var(--line-strong); }
.ds-button-full-width { width: 100%; }
.ds-button-icon { display: inline-flex; }
.ds-button-icon .ds-ia-root { width: 18px; height: 18px; }
.ds-button-size-compact .ds-button-icon .ds-ia-root { width: 16px; height: 16px; }
.ds-button-root:disabled,
.ds-button-root[aria-disabled='true'] { opacity: 0.4; cursor: not-allowed; }
.ds-button-root:disabled::after { opacity: 0; }

/* ---------- icon button ---------- */
.ds-bi-root {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--r-action);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s;
}
.ds-bi-root:hover { background: var(--hover); }
.ds-bi-root:active { background: var(--pressed); }
.ds-bi-size-compact { width: 32px; height: 32px; }
.ds-bi-icon { display: inline-flex; }
.ds-bi-size-compact .ds-ia-root { width: 18px; height: 18px; }
.ds-bi-emph-secondary { box-shadow: inset 0 0 0 1px var(--line-strong); }
.ds-bi-root:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- field (input / textarea) ---------- */
.ds-field-root { display: grid; gap: 6px; }
.ds-field-label { color: var(--ink); font-weight: 500; }
.ds-field-container {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-form);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: box-shadow 0.15s;
}
.ds-field-container:hover { box-shadow: inset 0 0 0 1px var(--muted); }
.ds-field-multiline { align-items: stretch; }
.ds-field-input-area { flex: 1; min-width: 0; display: flex; }
.ds-field-input {
  width: 100%;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}
textarea.ds-field-input { resize: vertical; }
.ds-field-input::placeholder { color: var(--muted); opacity: 1; }
.ds-field-input:disabled { color: var(--muted); }

/* ---------- select (native select under a styled control) ---------- */
.ds-select-root { display: grid; gap: 6px; }
.ds-select-label-standard { color: var(--muted); }
.ds-select-control {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-form);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.ds-select-control:hover { box-shadow: inset 0 0 0 1px var(--muted); }
.ds-select-valuearea { flex: 1; min-width: 0; }
.ds-select-value { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.ds-select-addons { display: inline-flex; color: var(--muted); }
.ds-select-caret .ds-ia-root { width: 18px; height: 18px; }

/* ---------- search ---------- */
.ds-search-root {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-form);
  background: var(--hover);
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.ds-search-root:hover { box-shadow: inset 0 0 0 1px var(--line); }
.ds-search-root:focus-within { background: var(--surface); box-shadow: inset 0 0 0 2px var(--line-strong); }
.ds-search-leading { display: inline-flex; color: var(--muted); }
.ds-search-leading .ds-ia-root { width: 18px; height: 18px; }
.ds-search-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.ds-search-input::placeholder { color: var(--muted); opacity: 1; }
.ds-search-input::-webkit-search-cancel-button { display: none; }

/* ---------- checkbox ---------- */
.ds-checkbox-root { position: relative; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.ds-checkbox-input { position: absolute; left: 0; top: 0; width: 20px; height: 20px; margin: 0; opacity: 0; cursor: pointer; }
.ds-checkbox-box {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  color: var(--on-accent);
  transition: background-color 0.15s, box-shadow 0.15s;
}
.ds-checkbox-selected { background: var(--accent); box-shadow: none; }
.ds-checkbox-check-icon { width: 12px; height: 10px; }
.ds-checkbox-input:focus-visible + .ds-checkbox-box { outline: 2px solid var(--ink); outline-offset: 2px; }
.ds-checkbox-input:disabled,
.ds-checkbox-input:disabled + .ds-checkbox-box { opacity: 0.5; cursor: not-allowed; }
.ds-checkbox-text { display: grid; gap: 2px; min-width: 0; }
.ds-checkbox-label { color: var(--ink); }

/* ---------- tabs ---------- */
.ds-tabs-root { display: flex; gap: 4px; }
.ds-tabs-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 48px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s;
}
.ds-tabs-item:hover,
.ds-tabs-item-selected { color: var(--ink); }
.ds-tabs-label.text-web-body-l,
.ds-tabs-label.text-web-body-strong-l { font-size: 14px; line-height: 20px; }
.ds-tabs-indicator { position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px; background: var(--ink); }
.ds-tabs-badge { display: inline-flex; }

/* ---------- notification badge ---------- */
.ds-nb-root {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--notify);
  color: #fff;
}
.ds-nb-value-text { font-size: 11px; line-height: 1; font-weight: 600; }

/* ---------- segmented control ---------- */
.ds-segmented-root {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: calc(var(--r-action) + 2px);
  background: var(--hover);
}
.ds-segmented-segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-action);
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.ds-segmented-segment:hover { color: var(--ink); }
.ds-segmented-selected {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.08);
}
.ds-segmented-segment:disabled { opacity: 0.5; cursor: not-allowed; }
/* reserve the bold width so segments do not jump when selected */
.ds-segmented-label { display: inline-grid; }
.ds-segmented-label::after { content: attr(data-label); height: 0; overflow: hidden; visibility: hidden; font-weight: 600; }

/* ---------- message banner ---------- */
.ds-messagebanner-root {
  --status: var(--notify);
  display: block;
  padding: 12px 16px;
  border-radius: var(--r-container);
  background: color-mix(in srgb, var(--status) 7%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--status) 40%, transparent);
}
.ds-messagebanner-warning { --status: var(--warning); }
.ds-messagebanner-success { --status: var(--success); }
.ds-messagebanner-danger { --status: var(--error); }
.ds-messagebanner-status { display: flex; align-items: flex-start; gap: 10px; }
.ds-messagebanner-icon { display: inline-flex; margin-top: 1px; color: var(--status); }
.ds-messagebanner-icon .ds-ia-root { width: 18px; height: 18px; }
.ds-messagebanner-description { display: grid; gap: 2px; min-width: 0; color: var(--ink); }
.ds-messagebanner-text a { color: var(--notify); }

/* ---------- card ---------- */
.ds-card-root { border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.ds-card-padded { padding: 24px; }

/* ---------- tag ---------- */
.ds-ti-root {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--hover);
  color: var(--ink);
  white-space: nowrap;
}
.ds-ti-overlay { display: none; }
.ds-ti-content { display: inline-flex; align-items: center; }

/* ---------- tile ---------- */
.ds-tile-root {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s;
}
.ds-tile-root::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 0 transparent;
  transition: box-shadow 0.15s;
}
.ds-tile-root:hover { border-color: var(--line-strong); }
.ds-tile-root:hover::after { box-shadow: inset 0 0 0 1px var(--line-strong); }
.ds-tile-slot { display: flex; flex: 1 0 auto; flex-direction: column; width: 100%; min-height: 1px; overflow: clip; }

/* ---------- dropdown menu ---------- */
.ds-dropdown-root {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 220px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}
.ds-dropdown-header { padding: 6px 10px 4px; }
.ds-dropdown-header-text-web { color: var(--muted); }
.ds-dropdown-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.ds-dropdown-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--on-surface);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
}
.ds-dropdown-item:hover::before { opacity: 0.05; }
.ds-dropdown-item:active::before { opacity: 0.1; }
.ds-dropdown-icon-slot { display: inline-flex; flex: none; color: var(--muted); }
.ds-dropdown-icon-slot-selected { color: var(--ink); }
.ds-dropdown-label-web { position: relative; white-space: nowrap; }
