/* ---- AI Reply Keyboard - Polished Minimalist Redesign ---- */

.ark-mode .tool-hero {
  display: none;
}

.ark-mode .tool-detail-head {
  display: none;
}

.ark-mode {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  backdrop-filter: none;
}

.ark-root {
  width: 100%;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow-x: hidden;
}

.ark-root,
.ark-root * {
  box-sizing: border-box;
}

.ark-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ark-back-link:hover {
  background: #f1f5f9;
  color: #334155;
}

.ark-back-link:active {
  background: #e2e8f0;
}

.ark-back-link svg {
  width: 18px;
  height: 18px;
  color: #6366f1;
}

.ark-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.ark-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}

.ark-header,
.ark-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ark-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #ede9fe;
  color: #6366f1;
  flex-shrink: 0;
}

.ark-header-icon svg {
  width: 16px;
  height: 16px;
}

.ark-header-copy {
  flex: 1;
  min-width: 0;
}

.ark-header-eyebrow,
.ark-section-tag {
  margin: 0 0 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.ark-header-title,
.ark-save-copy h3,
.ark-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.ark-header-desc,
.ark-save-copy p:last-child,
.ark-item-desc,
.ark-list-q,
.ark-list-a,
.ark-list-script,
.ark-empty {
  margin: 4px 0 0;
  font-size: 0.78rem;
  line-height: 1.65;
  color: #64748b;
}

.ark-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.ark-tabs::-webkit-scrollbar {
  display: none;
}

.ark-tab,
.ark-subtab,
.ark-chip,
.ark-btn {
  font: inherit;
}

.ark-tab {
  flex: 0 0 auto;
  min-width: 88px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ark-tab.is-active {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.ark-panel,
.ark-tab-content,
.ark-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ark-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ark-label,
.ark-modal-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
}

.ark-input,
.ark-textarea,
.ark-modal-input,
.ark-modal-textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font: inherit;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.ark-input,
.ark-modal-input {
  min-height: 44px;
  padding: 0 12px;
}

.ark-textarea,
.ark-modal-textarea {
  min-height: 112px;
  padding: 12px;
  line-height: 1.6;
  resize: vertical;
}

.ark-input:focus,
.ark-textarea:focus,
.ark-modal-input:focus,
.ark-modal-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: #fff;
}

.ark-category-tags,
.ark-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ark-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 0.74rem;
  font-weight: 700;
}

.ark-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6366f1;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}

.ark-category-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 8px;
}

.ark-input-inline {
  min-width: 0;
}

.ark-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ark-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.ark-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.ark-btn-primary,
.ark-btn-save {
  border-color: #6366f1;
  background: #6366f1;
  color: #fff;
}

.ark-btn-primary:hover,
.ark-btn-save:hover {
  opacity: 0.92;
}

.ark-btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.76rem;
}

.ark-btn-xs {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.72rem;
}

.ark-btn-danger {
  border-color: #fecaca;
  background: #fff;
  color: #dc2626;
}

.ark-btn-danger:hover {
  background: #fef2f2;
}

.ark-card-list,
.ark-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ark-item-card,
.ark-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.ark-item-body,
.ark-list-item-body {
  flex: 1;
  min-width: 0;
}

.ark-item-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
}

.ark-item-desc,
.ark-list-q,
.ark-list-a,
.ark-list-script {
  word-break: break-word;
}

.ark-list-q strong,
.ark-list-a strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.7rem;
}

.ark-list-item-actions,
.ark-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.ark-stage-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.ark-chips {
  gap: 10px;
}

.ark-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ark-chip.is-active {
  border-color: #6366f1;
  background: #6366f1;
  color: #fff;
}

.ark-subtabs,
.ark-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ark-subtab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.ark-subtab.is-active {
  border-color: #6366f1;
  background: #eef2ff;
  color: #4f46e5;
}

.ark-empty {
  padding: 18px 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  text-align: center;
}

.ark-message-wrap .message {
  margin: 0;
}

.ark-save-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ark-helper,
.ark-history-time {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.6;
  color: #94a3b8;
}

.ark-textarea-sm {
  min-height: 120px;
}

.ark-result-stack,
.ark-result-block,
.ark-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ark-result-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.ark-result-head,
.ark-reply-card-head,
.ark-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ark-result-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
}

.ark-result-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.ark-result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ark-result-tags .ark-tag {
  background: #eff6ff;
  color: #2563eb;
}

.ark-result-text,
.ark-history-message {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.7;
  color: #475569;
  word-break: break-word;
}

.ark-history-message {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.ark-history-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ark-reply-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ark-reply-card {
  background: #fff;
}

.ark-qa-launcher {
  align-items: flex-start;
}

.ark-qa-modal {
  width: min(100%, 760px);
}

.ark-qa-modal-body {
  gap: 14px;
}

.ark-qa-modal-actions {
  align-items: center;
}

.ark-qa-modal .ark-reply-grid {
  grid-template-columns: 1fr;
}

.ark-btn-save {
  width: 100%;
}

.ark-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(env(safe-area-inset-top, 0px), 20px) 16px max(env(safe-area-inset-bottom, 0px), 20px);
  background: rgba(15, 23, 42, 0.44);
  backdrop-filter: blur(6px);
}

.ark-modal {
  width: min(100%, 420px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
}

.ark-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ark-modal-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: #1e293b;
}

.ark-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 1rem;
  cursor: pointer;
}

.ark-modal-body,
.ark-modal-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ark-modal-footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ark-entry-strip,
.ark-config-summary,
.ark-guide {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ark-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ark-summary-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #ecfeff;
  color: #0f766e;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.ark-summary-status.is-dirty {
  background: #fff7ed;
  color: #c2410c;
}

.ark-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ark-summary-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.ark-summary-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
}

.ark-summary-value {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #1e293b;
  word-break: break-word;
}

.ark-guide-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.ark-guide-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
}

.ark-guide-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: #475569;
  font-size: 0.76rem;
  line-height: 1.6;
}

.ark-guide-list li {
  display: grid;
  grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
  gap: 8px;
}

.ark-modal--wide {
  width: min(860px, calc(100vw - 24px));
}

.ark-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ark-modal-field--full {
  grid-column: 1 / -1;
}

.ark-preset-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ark-preset-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.ark-preset-card.is-active {
  border-color: #6366f1;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.12);
  background: #f5f3ff;
}

.ark-preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ark-preset-name {
  padding: 0;
  border: 0;
  background: transparent;
  color: #1e293b;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.ark-preset-name:hover {
  color: #4f46e5;
}

.ark-history-body.is-collapsed .ark-result-tags {
  display: none;
}

.ark-text-clamp {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ark-preset-picker {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.ark-preset-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.ark-preset-trigger::-webkit-details-marker {
  display: none;
}

.ark-preset-trigger-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #94a3b8;
}

.ark-preset-trigger-value {
  color: #1e293b;
  font-size: 0.9rem;
}

.ark-preset-dropdown-list {
  padding: 0 12px 12px;
}

.ark-preset-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ark-preset-option:hover {
  border-color: #c7d2fe;
  background: #eef2ff;
}

.ark-preset-option.is-active {
  border-color: #6366f1;
  background: #eef2ff;
  color: #4338ca;
}

@media (max-width: 640px) {
  .ark-card {
    padding: 14px;
  }

  .ark-header,
  .ark-section-head,
  .ark-result-head,
  .ark-reply-card-head,
  .ark-history-head,
  .ark-item-card,
  .ark-list-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .ark-item-actions,
  .ark-list-item-actions {
    width: 100%;
  }

  .ark-category-add,
  .ark-modal-footer,
  .ark-reply-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ark-summary-head,
  .ark-guide-list li {
    grid-template-columns: minmax(0, 1fr);
    flex-direction: column;
  }

  .ark-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ark-modal-grid {
    grid-template-columns: 1fr;
  }

  .ark-modal-overlay {
    padding: max(env(safe-area-inset-top, 0px), 16px) 16px max(env(safe-area-inset-bottom, 0px), 16px);
  }
}
