html[data-kumai-keys-ui="on"] td[data-column-id="key"] > div {
  width: 100%;
  gap: 0.5rem;
}

html[data-kumai-keys-ui="on"] .kumai-keys-copy-button,
html[data-kumai-keys-ui="on"] .kumai-keys-group-trigger,
html[data-kumai-keys-ui="on"] .kumai-keys-cc-switch {
  box-sizing: border-box;
  border: 2px dashed #64b5f6;
  border-radius: 9999px;
  background: #f0f8ff;
  color: #2196f3;
  box-shadow: none;
  font-weight: 600;
  letter-spacing: 0;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease,
    opacity 150ms ease;
}

html[data-kumai-keys-ui="on"] .kumai-keys-copy-button:hover,
html[data-kumai-keys-ui="on"] .kumai-keys-group-trigger:hover,
html[data-kumai-keys-ui="on"] .kumai-keys-cc-switch:hover {
  border-color: #64b5f6;
  background: #64b5f6;
  color: #fff;
}

html[data-kumai-keys-ui="on"] .kumai-keys-copy-button:focus-visible,
html[data-kumai-keys-ui="on"] .kumai-keys-group-trigger:focus-visible,
html[data-kumai-keys-ui="on"] .kumai-keys-cc-switch:focus-visible {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 0 3px rgb(33 150 243 / 20%);
}

html[data-kumai-keys-ui="on"] .kumai-keys-copy-button {
  display: inline-flex;
  width: 6rem;
  height: 1.75rem;
  flex: 0 0 6rem;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1;
}

html[data-kumai-keys-ui="on"] .kumai-keys-copy-button svg {
  width: 0.875rem;
  height: 0.875rem;
}

html[data-kumai-keys-ui="on"] .kumai-keys-copy-button.is-copied {
  border-color: #4ade80;
  background: #f0fdf4;
  color: #16a34a;
}

html[data-kumai-keys-ui="on"] .kumai-keys-copy-button.is-loading,
html[data-kumai-keys-ui="on"] .kumai-keys-copy-button:disabled {
  cursor: wait;
  opacity: 0.78;
}

html[data-kumai-keys-ui="on"] .kumai-keys-copy-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-kumai-keys-ui="on"] .kumai-keys-native-group {
  display: none !important;
}

html[data-kumai-keys-ui="on"] .kumai-keys-group-trigger {
  display: inline-flex;
  width: 100%;
  min-width: 8rem;
  max-width: 13rem;
  height: 2rem;
  min-height: 2rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  line-height: 1;
  text-align: left;
}

html[data-kumai-keys-ui="on"] .kumai-keys-group-trigger[aria-expanded="true"] {
  border-color: #2196f3;
  background: var(--background, #fff);
  color: #2196f3;
  box-shadow: 0 0 0 3px rgb(33 150 243 / 20%);
}

html[data-kumai-keys-ui="on"] .kumai-keys-group-trigger:disabled {
  cursor: wait;
  opacity: 0.72;
}

html[data-kumai-keys-ui="on"] .kumai-keys-group-trigger[aria-busy="true"] {
  cursor: progress;
  opacity: 0.84;
}

html[data-kumai-keys-ui="on"] .kumai-keys-group-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-kumai-keys-ui="on"] .kumai-keys-group-trigger > svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  opacity: 0.72;
}

html[data-kumai-keys-ui="on"] .kumai-keys-ratio {
  display: inline-flex;
  height: 1.25rem;
  flex: 0 0 auto;
  align-items: center;
  border: 1px solid #bbf7d0;
  border-radius: 9999px;
  background: #f0fdf4;
  color: #15803d;
  padding: 0 0.375rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

html[data-kumai-keys-ui="on"] .kumai-keys-ratio.is-blue {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

html[data-kumai-keys-ui="on"] .kumai-keys-ratio.is-orange {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

html[data-kumai-keys-ui="on"] .kumai-keys-ratio.is-red {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

html[data-kumai-keys-ui="on"] td.kumai-keys-actions-cell {
  min-width: 11.875rem;
  padding-top: 0.125rem;
  padding-bottom: 0.125rem;
}

html[data-kumai-keys-ui="on"] .kumai-keys-native-actions {
  justify-content: flex-start;
}

html[data-kumai-keys-ui="on"] .kumai-keys-cc-switch {
  display: flex;
  width: calc(100% - 0.375rem);
  height: 1.5rem;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin: 0 0.1875rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1;
  white-space: nowrap;
}

html[data-kumai-keys-ui="on"] .kumai-keys-cc-switch svg {
  width: 0.75rem;
  height: 0.75rem;
  flex: 0 0 0.75rem;
}

html[data-kumai-keys-ui="on"] .kumai-keys-cc-switch.is-loading {
  cursor: wait;
  opacity: 0.76;
}

.kumai-keys-menu {
  position: fixed;
  z-index: 2147483000;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 0.75rem;
  background: var(--popover, #fff);
  color: var(--popover-foreground, #111827);
  box-shadow:
    0 18px 48px rgb(15 23 42 / 18%),
    0 4px 14px rgb(15 23 42 / 10%);
  animation: kumai-keys-menu-in 100ms ease-out;
}

.kumai-keys-menu-search-wrap {
  position: relative;
  border-bottom: 1px solid var(--border, #e5e7eb);
  padding: 0.5rem;
}

.kumai-keys-menu-search-icon {
  position: absolute;
  top: 50%;
  left: 0.875rem;
  width: 0.875rem;
  height: 0.875rem;
  color: var(--muted-foreground, #64748b);
  transform: translateY(-50%);
  pointer-events: none;
}

.kumai-keys-menu-search {
  box-sizing: border-box;
  width: 100%;
  height: 2.25rem;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 0.5rem;
  background: var(--background, #fff);
  color: var(--foreground, #111827);
  padding: 0 0.75rem 0 2rem;
  font-size: 0.8125rem;
  letter-spacing: 0;
  outline: none;
}

.kumai-keys-menu-search:focus {
  border-color: #2196f3;
  box-shadow: 0 0 0 3px rgb(33 150 243 / 16%);
}

.kumai-keys-menu-list {
  max-height: min(22.5rem, 55vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.375rem;
}

.kumai-keys-menu-option {
  display: flex;
  width: 100%;
  min-height: 3rem;
  align-items: flex-start;
  gap: 0.625rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: inherit;
  padding: 0.625rem 0.75rem;
  font: inherit;
  letter-spacing: 0;
  text-align: left;
  cursor: pointer;
}

.kumai-keys-menu-option:hover,
.kumai-keys-menu-option:focus-visible {
  background: var(--muted, #f1f5f9);
  outline: none;
}

.kumai-keys-menu-option.is-selected {
  background: color-mix(in srgb, #2196f3 10%, transparent);
}

.kumai-keys-menu-check {
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  margin-top: 0.125rem;
  color: #2196f3;
  opacity: 0;
}

.kumai-keys-menu-option.is-selected .kumai-keys-menu-check {
  opacity: 1;
}

.kumai-keys-menu-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.kumai-keys-menu-title {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25rem;
}

.kumai-keys-menu-description {
  display: block;
  margin-top: 0.125rem;
  overflow-wrap: anywhere;
  color: var(--muted-foreground, #64748b);
  font-size: 0.75rem;
  line-height: 1.1rem;
}

.kumai-keys-menu-empty {
  padding: 1.5rem 0.75rem;
  color: var(--muted-foreground, #64748b);
  font-size: 0.8125rem;
  text-align: center;
}

html.kumai-keys-cc-modal-open,
html.kumai-keys-cc-modal-open body {
  overflow: hidden;
}

.kumai-keys-cc-layer {
  position: fixed;
  inset: 0;
  z-index: 2147483050;
  display: grid;
  box-sizing: border-box;
  place-items: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgb(15 23 42 / 34%);
  padding: 1.5rem;
  backdrop-filter: blur(3px);
  animation: kumai-keys-cc-layer-in 150ms ease-out;
}

.kumai-keys-cc-dialog {
  box-sizing: border-box;
  width: min(28rem, 100%);
  max-height: calc(100vh - 3rem);
  overflow: hidden;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 0.75rem;
  background: var(--background, #fff);
  color: var(--foreground, #111827);
  box-shadow:
    0 24px 64px rgb(15 23 42 / 24%),
    0 6px 20px rgb(15 23 42 / 12%);
  animation: kumai-keys-cc-dialog-in 160ms ease-out;
}

.kumai-keys-cc-form {
  display: flex;
  max-height: calc(100vh - 3rem);
  flex-direction: column;
}

.kumai-keys-cc-header {
  display: flex;
  min-height: 3.5rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
}

.kumai-keys-cc-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5rem;
  letter-spacing: 0;
}

.kumai-keys-cc-close {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--muted-foreground, #64748b);
  padding: 0;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.kumai-keys-cc-close:hover {
  background: var(--muted, #f1f5f9);
  color: var(--foreground, #111827);
}

.kumai-keys-cc-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(33 150 243 / 20%);
}

.kumai-keys-cc-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 1rem 1rem;
}

.kumai-keys-cc-apps {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  margin: 0 0 1rem;
  border: 0;
  padding: 0;
}

.kumai-keys-cc-apps legend {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: 0;
}

.kumai-keys-cc-apps label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
  font-size: 0.8125rem;
  line-height: 1.25rem;
  cursor: pointer;
}

.kumai-keys-cc-apps input {
  width: 0.875rem;
  height: 0.875rem;
  flex: 0 0 0.875rem;
  margin: 0;
  accent-color: #2196f3;
  cursor: pointer;
}

.kumai-keys-cc-field {
  display: block;
  margin-top: 0.875rem;
}

.kumai-keys-cc-field:first-of-type {
  margin-top: 0;
}

.kumai-keys-cc-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: 0;
}

.kumai-keys-cc-label strong {
  color: #ef4444;
  font-weight: 600;
}

.kumai-keys-cc-input {
  box-sizing: border-box;
  width: 100%;
  height: 2.25rem;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 0.5rem;
  background: var(--background, #fff);
  color: var(--foreground, #111827);
  padding: 0 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.25rem;
  letter-spacing: 0;
  outline: none;
}

.kumai-keys-cc-input::placeholder {
  color: var(--muted-foreground, #64748b);
  opacity: 0.82;
}

.kumai-keys-cc-input:hover {
  border-color: #94a3b8;
}

.kumai-keys-cc-input:focus {
  border-color: #2196f3;
  box-shadow: 0 0 0 3px rgb(33 150 243 / 16%);
}

.kumai-keys-cc-input[aria-invalid="true"] {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgb(239 68 68 / 14%);
}

.kumai-keys-cc-claude-fields[hidden] {
  display: none !important;
}

.kumai-keys-cc-footer {
  display: flex;
  min-height: 4rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  border-top: 1px solid var(--border, #e5e7eb);
  background: var(--background, #fff);
  padding: 0.75rem 1rem;
}

.kumai-keys-cc-cancel,
.kumai-keys-cc-open {
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  padding: 0 0.875rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
}

.kumai-keys-cc-cancel {
  border: 1px solid var(--border, #d1d5db);
  background: var(--background, #fff);
  color: var(--foreground, #111827);
}

.kumai-keys-cc-cancel:hover {
  background: var(--muted, #f1f5f9);
}

.kumai-keys-cc-open {
  border: 1px solid #2196f3;
  background: #2196f3;
  color: #fff;
}

.kumai-keys-cc-open:hover {
  border-color: #1976d2;
  background: #1976d2;
}

.kumai-keys-cc-open:disabled {
  border-color: #90caf9;
  background: #90caf9;
  cursor: wait;
}

.kumai-keys-cc-cancel:focus-visible,
.kumai-keys-cc-open:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(33 150 243 / 20%);
}

.kumai-keys-toast-region {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2147483100;
  display: flex;
  width: min(22rem, calc(100vw - 2rem));
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.kumai-keys-toast {
  box-sizing: border-box;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 0.5rem;
  background: var(--popover, #fff);
  color: var(--popover-foreground, #111827);
  box-shadow: 0 12px 34px rgb(15 23 42 / 18%);
  padding: 0.75rem 0.875rem;
  font-size: 0.8125rem;
  line-height: 1.25rem;
  animation: kumai-keys-toast-in 160ms ease-out;
}

.kumai-keys-toast.is-success {
  border-color: #86efac;
}

.kumai-keys-toast.is-error {
  border-color: #fda4af;
}

.kumai-keys-spin {
  animation: kumai-keys-spin 800ms linear infinite;
}

html.dark[data-kumai-keys-ui="on"] .kumai-keys-copy-button,
html.dark[data-kumai-keys-ui="on"] .kumai-keys-group-trigger,
html.dark[data-kumai-keys-ui="on"] .kumai-keys-cc-switch {
  border-color: #42a5f5;
  background: #1a2436;
  color: #42a5f5;
}

html.dark[data-kumai-keys-ui="on"] .kumai-keys-copy-button:hover,
html.dark[data-kumai-keys-ui="on"] .kumai-keys-group-trigger:hover,
html.dark[data-kumai-keys-ui="on"] .kumai-keys-cc-switch:hover {
  background: #42a5f5;
  color: #07111f;
}

html.dark[data-kumai-keys-ui="on"] .kumai-keys-copy-button.is-copied {
  border-color: #4ade80;
  background: #123326;
  color: #86efac;
}

html.dark .kumai-keys-cc-layer {
  background: rgb(2 6 23 / 58%);
}

html.dark .kumai-keys-cc-dialog,
html.dark .kumai-keys-cc-footer {
  background: var(--background, #0f172a);
}

html.dark .kumai-keys-cc-input,
html.dark .kumai-keys-cc-cancel {
  background: var(--background, #0f172a);
}

@media (max-width: 640px) {
  html[data-kumai-keys-ui="on"] .kumai-keys-copy-button {
    width: 5.25rem;
    flex-basis: 5.25rem;
  }

  html[data-kumai-keys-ui="on"] .kumai-keys-group-trigger {
    min-width: 7.5rem;
    max-width: 10.5rem;
  }

  html[data-kumai-keys-ui="on"] td.kumai-keys-actions-cell {
    min-width: 10.75rem;
  }

  html[data-kumai-keys-ui="on"] .kumai-keys-native-actions {
    justify-content: flex-end;
  }

  .kumai-keys-toast-region {
    top: 0.75rem;
    right: 0.75rem;
    width: calc(100vw - 1.5rem);
  }

  .kumai-keys-cc-layer {
    align-items: end;
    padding: 0.75rem;
  }

  .kumai-keys-cc-dialog,
  .kumai-keys-cc-form {
    max-height: calc(100vh - 1.5rem);
  }
}

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

@keyframes kumai-keys-menu-in {
  from {
    opacity: 0;
    transform: translateY(-3px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes kumai-keys-toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes kumai-keys-cc-layer-in {
  from {
    background: rgb(15 23 42 / 0%);
    backdrop-filter: blur(0);
  }
  to {
    background: rgb(15 23 42 / 34%);
    backdrop-filter: blur(3px);
  }
}

@keyframes kumai-keys-cc-dialog-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kumai-keys-menu,
  .kumai-keys-cc-layer,
  .kumai-keys-cc-dialog,
  .kumai-keys-toast,
  .kumai-keys-spin {
    animation: none;
  }
}
