/* ===== WIDGETS: shared buttons, pills, chips, inputs, dialog, menu, toast ===== */

/* Table cells hold chips at their own width (not stretched) */
.table-row > .chip { justify-self: start; }

/* Icon button */
.icon-button {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--control-radius); color: var(--muted);
}
.icon-button:hover { background: var(--card); color: var(--text); }
/* Icon buttons in list button rows (Tick all, Delete, Add software ...): 32px square */
.icon-button.is-tool { width: 32px; height: 32px; background: var(--card); color: var(--text); }
.icon-button.is-tool:hover { background: var(--surface); }
.icon-button.is-tool.is-sage { background: var(--sage-soft); color: var(--sage); }
.icon-button.is-tool.is-rose { background: var(--rose-soft); color: var(--rose); }
.icon-button.is-tool.is-soft { background: var(--accent-soft); color: var(--accent); }
.icon-button.is-tool.is-quiet { background: var(--surface); color: var(--muted); }
.icon-button.is-large { width: 40px; height: 40px; background: var(--card); border: 1px solid var(--line); }

/* Buttons */
.button {
  min-height: 36px; padding: 0 14px; border-radius: var(--control-radius);
  font-size: var(--font-size-control); font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--card); color: var(--text); border: 1px solid var(--line);
}
.button:hover { border-color: var(--accent); }
/* Soft buttons from the Figma design: no border, soft fill + strong text */
.button.is-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.button.is-rose { background: var(--rose-soft); border-color: transparent; color: var(--rose); }
.button.is-sage { background: var(--sage-soft); border-color: transparent; color: var(--sage); }
.button.is-amber { background: var(--card); border-color: transparent; color: var(--amber); }
.button.is-large { min-height: 40px; padding: 0 14px; font-size: var(--font-size-body); }
.button.is-soft:hover, .button.is-sage:hover, .button.is-amber:hover, .button.is-dark:hover { border-color: transparent; opacity: .88; }
.button.is-dark { background: var(--button-dark); border-color: var(--button-dark); color: var(--button-dark-text); }
.button.is-quiet { background: var(--surface); color: var(--muted); border-color: transparent; }
.button.is-danger { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button:disabled { opacity: .4; cursor: default; }

/* Pills (tabs, choices) */
.pill {
  padding: 8px 10px; min-height: 30px; border-radius: var(--control-radius);
  font-size: var(--font-size-control); font-weight: 500;
  background: var(--surface); color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.pill:hover { color: var(--text); }
.pill.is-selected { background: var(--card); color: var(--text); }
.pill-count { font-size: var(--font-size-small); color: var(--muted); }

/* Status chips: one class per color name */
.chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 10px;
  border-radius: 10px; font-size: var(--font-size-small); font-weight: 500; white-space: nowrap;
}
.chip.small { height: 16px; padding: 0 8px; border-radius: 8px; }
.chip.gray   { background: var(--gray-soft);  color: var(--gray); }
.chip.sage   { background: var(--sage-soft);  color: var(--sage); }
.chip.amber  { background: var(--amber-soft); color: var(--amber); }
.chip.blue   { background: var(--blue-soft);  color: var(--blue); }
.chip.rose   { background: var(--rose-soft);  color: var(--rose); }
.chip.orange { background: var(--accent-soft); color: var(--accent); }
.chip.purple { background: var(--purple-soft); color: var(--purple); }
.chip.teal   { background: var(--teal-soft);   color: var(--teal); }
.chip.pink   { background: var(--pink-soft);   color: var(--pink); }
.chip.olive  { background: var(--olive-soft);  color: var(--olive); }
.chip.brown  { background: var(--brown-soft);  color: var(--brown); }
.chip.slate  { background: var(--slate-soft);  color: var(--slate); }

/* Color circle (opens the picker) and the 6 x 2 picker */
.color-circle { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.color-picker { position: fixed; z-index: 80; width: 230px; padding: 12px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; justify-items: center; }
.color-picker .color-circle { width: 22px; height: 22px; }
.color-picker .color-circle.is-selected { outline: 2px solid var(--text); outline-offset: 2px; }
.swatch-orange { background: var(--accent); } .swatch-rose { background: var(--rose); } .swatch-sage { background: var(--sage); }
.swatch-amber { background: var(--amber); } .swatch-blue { background: var(--blue); } .swatch-gray { background: var(--gray); }
.swatch-purple { background: var(--purple); } .swatch-teal { background: var(--teal); } .swatch-pink { background: var(--pink); }
.swatch-olive { background: var(--olive); } .swatch-brown { background: var(--brown); } .swatch-slate { background: var(--slate); }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: var(--font-size-small); font-weight: 500; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; padding: 11px 14px; font-size: var(--font-size-body); color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--control-radius);
}
/* Drop down: our own 14 px arrow, 14 px from the right edge, centered (same in every select) */
.select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: var(--select-arrow); background-repeat: no-repeat; background-position: right 14px center; background-size: 14px 14px;
}
.beta-badge { padding: 2px 7px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: var(--font-size-tiny); font-weight: 700; line-height: 1.4; }
.label-with-badge { display: flex; align-items: center; gap: 8px; }   /* label text and Beta badge on one centered line; You can change the 8px */
.icon-button:disabled { opacity: .4; cursor: default; }
.dropdown { display: block; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: inherit; }
.dropdown:disabled { cursor: default; opacity: .6; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); outline: none; }
.textarea { min-height: 88px; resize: vertical; }
.error-text { color: var(--rose); font-size: var(--font-size-small); }

/* Checkbox (20x20) */
.checkbox {
  width: 20px; height: 20px; border-radius: 7px; border: 1.4px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; color: transparent;
}
.checkbox:hover:not(.is-disabled) { border-color: var(--accent); }   /* no hover effect when it cannot be ticked */
.checkbox.is-checked { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.checkbox .icon { width: 16px; height: 16px; }

/* Dialog */
.overlay {
  position: fixed; inset: 0; background: var(--overlay); z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.dialog {
  width: min(460px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto;
  background: var(--card); border-radius: var(--dialog-radius); box-shadow: var(--shadow);
  padding: 24px; display: flex; flex-direction: column; gap: 18px;
}
.dialog-header { display: flex; align-items: center; }
.dialog-title { font-size: var(--font-size-dialog-title); font-weight: 700; flex: 1; }
.dialog-footer { display: flex; gap: 12px; }
.dialog-footer .button { flex: 1; height: 40px; }

/* Context menu */
.context-menu {
  position: fixed; z-index: 60; min-width: 190px; padding: 6px; display: flex; flex-direction: column; gap: 2px;   /* Figma: 190 wide, items 36 high, gap 2 */
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.menu-item {
  width: 100%; height: 36px; padding: 0 10px; border-radius: 8px;
  display: flex; align-items: center; gap: 8px; font-size: var(--font-size-control); font-weight: 500; text-align: left;
}
.context-menu.is-submenu { min-width: 174px; max-height: 320px; overflow-y: auto; }   /* long lists (Move into) scroll; You can change the 320px */
.context-menu.is-submenu .menu-item { flex: none; }
.menu-item.has-dot, .menu-item.has-submenu { gap: 10px; }
.menu-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }   /* Figma: dot at x 10, text at x 30 */
.menu-item .icon { width: 16px; height: 16px; color: var(--muted); }
.menu-item:hover { background: var(--surface); }
.menu-item.is-danger { color: var(--rose); }
.menu-item.is-danger .icon { color: var(--rose); }
.menu-divider { height: 1px; background: var(--line); margin: 6px 0; }

/* Toast */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%); z-index: 70;
  padding: 8px 14px; border-radius: var(--control-radius);
  background: var(--accent-soft); color: var(--accent); font-size: var(--font-size-control); font-weight: 500;
}

/* Add software dialog (Figma): choice pills, version row, test row */
.pill.is-choice { height: 34px; padding: 0 14px; }
.pill.is-choice.is-selected { background: var(--accent-soft); color: var(--accent); }
.version-row { display: flex; align-items: center; gap: 8px; }
.version-row .select { flex: none; width: 150px; }   /* the Version mode dropdown; You can change this */
.online-box { display: flex; flex-direction: column; gap: 14px; }
.version-row .input { flex: 1; min-width: 0; }
.test-row {
  display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border-radius: var(--control-radius);
  background: var(--surface); color: var(--muted); font-size: var(--font-size-control); font-weight: 500;
}
.test-row.is-ok { background: var(--sage-soft); color: var(--sage); }
.test-row.is-bad { background: var(--rose-soft); color: var(--rose); }
.test-action { color: inherit; font-size: var(--font-size-control); font-weight: 500; }
.test-action:hover { text-decoration: underline; }

/* Settings dialog (Figma): title row on top, then nav | divider | content */
.settings-body { display: flex; gap: 20px; overflow: hidden; }   /* fixed height; long content scrolls inside .settings-content */
.settings-nav { display: flex; flex-direction: column; gap: 4px; flex: none; }
.settings-nav-item {
  height: 36px; padding: 0 12px; border-radius: var(--control-radius); text-align: left;
  font-size: 13px; font-weight: 500; color: var(--muted);
}
.settings-nav-item:hover { color: var(--text); }
.settings-nav-item.is-selected { background: var(--accent-soft); color: var(--accent); }
.settings-divider { width: 1px; background: var(--line); flex: none; }
.settings-content { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; padding-right: 4px; }
.customize-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.customize-page { display: flex; flex-direction: column; min-height: 100%; }   /* lets a tab push its button to the bottom */
.color-tab { display: flex; flex-direction: column; flex: 1; }
.restore-colors-button {
  align-self: flex-start; margin-top: auto; height: 32px; padding: 0 12px; border-radius: var(--control-radius);
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500;
}
.restore-colors-button:hover { color: var(--text); }
.settings-section-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.settings-stacked-row { display: flex; flex-direction: column; gap: 8px; }
.choice-pills { display: flex; gap: 8px; }
.choice-pill {
  width: 90px; height: 36px; border-radius: var(--control-radius); box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  font-size: var(--font-size-control); font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.choice-pill:hover { color: var(--text); }
.choice-pill.is-selected { background: var(--card); border-color: var(--accent); color: var(--text); }

/* Settings tabs (Figma) */
.settings-description { font-size: var(--font-size-control); color: var(--muted); margin: -6px 0 14px; }
.settings-note { font-size: var(--font-size-small); color: var(--muted); margin-top: 12px; }
.settings-divider-line { height: 1px; background: var(--line); margin: 14px 0; }
.color-row { display: flex; align-items: center; height: 36px; }
.color-row-chip { width: 320px; }
.color-row .chip { height: 22px; }
.lab-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.lab-row, .team-row {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 14px;
  background: var(--surface); border-radius: 12px; font-size: 13px; font-weight: 500;
}
.lab-row .input { padding: 4px 10px; font-size: 13px; }
.lab-row .icon-button, .team-actions .icon-button { width: 24px; height: 24px; }
.lab-add-button {
  width: 100%; height: 40px; border-radius: 12px; border: 1.2px dashed var(--accent); color: var(--accent);
  font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.team-block { display: flex; flex-direction: column; gap: 10px; }
.team-header { display: flex; align-items: center; min-height: 30px; }
.team-name { min-width: 130px; }
.team-actions { display: flex; gap: 4px; }
.icon-button.is-soft-icon { width: 30px; height: 30px; background: var(--accent-soft); color: var(--accent); }
.text-action { color: var(--accent); font-size: var(--font-size-control); font-weight: 500; }
.sign-out-button { margin-top: 12px; background: var(--surface); color: var(--muted); min-height: 34px; }
.about-block { display: flex; flex-direction: column; gap: 6px; }
.about-value { font-size: 13px; }

/* Dialog helpers (Figma) */
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { font-size: 10px; color: var(--muted); margin-top: -8px; }
.textarea { min-height: 72px; }

/* Signature preview card (Figma): 64 high, handwriting 32 + date text */
.signature-preview { display: flex; align-items: center; min-height: 64px; padding: 0 16px; border-radius: var(--control-radius); background: var(--surface); }
.signature-handwriting { font-size: 32px; font-weight: 700; color: var(--text); }
.signature-handwriting.is-empty { color: var(--muted); }
.signature-date { font-size: var(--font-size-small); color: var(--muted); }

.info-box { padding: 10px 12px; border-radius: var(--control-radius); background: var(--accent-soft); color: var(--accent); font-size: var(--font-size-small); font-weight: 500; }
.icon-circle { width: 40px; height: 40px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.input:disabled { color: var(--muted); }
.choice-row { display: flex; gap: 8px; }

/* Settings dialog size (Figma): 22 high title row, gap 16, padding 22 top / 24 sides and bottom -> 464 high with the 380 body */
.dialog.is-settings { gap: 16px; padding: 22px 24px 24px; }
.dialog.is-settings .dialog-header { height: 22px; }
.dialog.is-settings .dialog-header .icon-button { width: 22px; height: 22px; margin-right: -3px; }

/* Software dialog: collapsed "Advanced (regular expression)" row */
.advanced-row { display: flex; flex-direction: column; gap: 10px; }
.advanced-toggle { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; font-size: var(--font-size-small); font-weight: 500; color: var(--muted); }
.advanced-toggle:hover { color: var(--text); }
.advanced-toggle .icon { transition: transform var(--duration-fast); }
.advanced-toggle.is-open .icon { transform: rotate(90deg); }

/* Toggle switch (design system) and the settings row that uses it */
.toggle { position: relative; flex: none; width: 36px; height: 20px; border-radius: 10px; background: var(--line); transition: background var(--duration-fast); }
.toggle.is-on { background: var(--accent); }
.toggle-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); transition: transform var(--duration-fast); }
.toggle.is-on .toggle-knob { transform: translateX(16px); }
.toggle-row { display: flex; align-items: center; gap: 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.toggle-text { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.menu-item.is-disabled { opacity: .4; cursor: default; }

/* Tick-box rows inside a dialog (Reset) */
.option-list { display: flex; flex-direction: column; gap: 8px; }
.option-row {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: var(--control-radius);
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--text); font-family: inherit; cursor: pointer; text-align: left;
}
.option-row:hover .checkbox { border-color: var(--accent); }
.option-row.is-disabled { opacity: .4; cursor: default; }
.option-row.is-disabled:hover .checkbox { border-color: var(--line); }

/* The browser's own "show password" eye icon is black; make it white in the Dark theme. */
:root[data-theme="dark"] input::-ms-reveal { filter: invert(1); }
