/* modals.css - 弹窗动画、历史记录弹窗、重命名弹窗、删除确认弹窗 */

/* ===== Modals ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes sketchSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) rotate(-0.5deg);
  }

  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

@keyframes drawerSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes bottomSheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

@keyframes cardExpandIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* History Modal */
.history-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(40, 35, 25, 0.35);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.history-modal-content {
  background: var(--bg-secondary);
  border: 2px solid var(--border-sketch);
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 6px 0px rgba(60, 50, 30, 0.12);
  animation: sketchSlideUp 0.3s ease;
}

.history-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 2px dashed var(--border-color);
}

.history-modal-header h3 {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 22px;
}

.history-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.history-share-manage-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-hand);
  font-size: 13px;
  transition: all var(--transition);
  white-space: nowrap;
}

.history-share-manage-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.history-share-manage-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.history-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.history-modal-close:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.history-modal-close svg {
  width: 18px;
  height: 18px;
}

/* Session Share Modal */
.session-share-modal,
.session-share-list-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(40, 35, 25, 0.35);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.session-share-content,
.session-share-list-content {
  background: var(--bg-secondary);
  border: 2px solid var(--border-sketch);
  border-radius: 16px;
  width: 90%;
  max-width: 560px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 6px 0 rgba(60, 50, 30, 0.12);
  animation: sketchSlideUp 0.3s ease;
}

.session-share-list-content {
  max-width: 680px;
}

.session-share-header,
.session-share-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 2px dashed var(--border-color);
}

.session-share-header h3,
.session-share-list-header h3 {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 22px;
}

.session-share-close,
.session-share-list-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.session-share-close:hover,
.session-share-list-close:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.session-share-close svg,
.session-share-list-close svg {
  width: 18px;
  height: 18px;
}

.session-share-body,
.session-share-list-body {
  padding: 18px 20px;
  overflow-y: auto;
}

.session-share-title {
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1.5px dashed var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  background: var(--bg-primary);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-share-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.session-share-field label,
.session-share-result label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.session-share-field input,
.session-share-field select,
.session-share-link-row input {
  width: 100%;
  padding: 9px 11px;
  border: 2px solid var(--border-color);
  border-radius: 9px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font: inherit;
  outline: none;
}

.session-share-field input:focus,
.session-share-field select:focus,
.session-share-link-row input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(107, 127, 198, 0.1);
}

.session-share-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 6px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}

.session-share-note {
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.session-share-result {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.session-share-link-row {
  display: flex;
  gap: 8px;
}

.session-share-link-row input {
  flex: 1;
  min-width: 0;
}

.session-share-copy-btn,
.session-share-icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-color);
  border-radius: 9px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.session-share-copy-btn:hover,
.session-share-icon-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-light);
}

.session-share-icon-btn.delete-action:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-light);
}

.session-share-copy-btn svg,
.session-share-icon-btn svg {
  width: 16px;
  height: 16px;
}

.session-share-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 2px dashed var(--border-color);
}

.session-share-links-btn,
.session-share-cancel-btn,
.session-share-ok-btn {
  padding: 9px 16px;
  border: 2px solid var(--border-color);
  border-radius: 9px;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 600;
}

.session-share-links-btn {
  margin-right: auto;
}

.session-share-ok-btn {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.session-share-links-btn:hover,
.session-share-cancel-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
}

.session-share-ok-btn:hover {
  filter: brightness(0.96);
}

.session-share-empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-family: var(--font-hand);
  font-size: 17px;
}

.session-share-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session-share-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-primary);
}

.session-share-list-info {
  flex: 1;
  min-width: 0;
}

.session-share-list-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-share-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 5px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.session-share-list-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.session-share-list-badges span {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
}

.session-share-list-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* History Search Bar */
.history-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  position: relative;
}

.history-search-icon {
  position: absolute;
  left: 30px;
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.history-search-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-primary);
  font-size: 13px;
  font-family: var(--font-hand);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
}

.history-search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(107, 127, 198, 0.1);
}

.history-search-input::placeholder {
  color: var(--text-tertiary);
  font-family: var(--font-hand);
}

.history-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-loading,
.history-error,
.history-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-family: var(--font-hand);
  font-size: 18px;
}

.history-error {
  color: var(--error);
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  transition: all var(--transition);
}

.history-item:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sketch);
  transform: translateX(3px);
}

.history-item-info {
  flex: 1;
  min-width: 0;
}

.history-item-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.history-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
}

.history-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.history-action-btn:hover {
  background: var(--bg-hover);
}

.history-action-btn.load-btn:hover {
  color: var(--info);
  background: var(--info-light);
}

.history-action-btn.rename-btn:hover {
  color: var(--warning);
  background: var(--warning-light);
}

.history-action-btn.delete-btn:hover {
  color: var(--error);
  background: var(--error-light);
}

.history-action-btn.export-btn:hover {
  color: var(--success);
  background: var(--success-light);
}

.history-action-btn svg {
  width: 16px;
  height: 16px;
}

/* Rename Modal */
.rename-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(40, 35, 25, 0.35);
  backdrop-filter: blur(4px);
  z-index: 1001;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.rename-modal-content {
  background: var(--bg-secondary);
  border: 2px solid var(--border-sketch);
  border-radius: 16px;
  width: 90%;
  max-width: 480px;
  box-shadow: 4px 6px 0px rgba(60, 50, 30, 0.12);
  animation: sketchSlideUp 0.3s ease;
}

.rename-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 2px dashed var(--border-color);
}

.rename-modal-header h3 {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 22px;
}

.rename-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.rename-modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.rename-modal-close svg {
  width: 18px;
  height: 18px;
}

.rename-modal-body {
  padding: 20px;
}

.rename-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.rename-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition);
  font-family: var(--font-body);
  box-sizing: border-box;
}

.rename-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(107, 127, 198, 0.15);
}

.rename-modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 2px dashed var(--border-color);
  justify-content: flex-end;
}

.rename-cancel-btn,
.rename-confirm-btn {
  padding: 8px 18px;
  border: 2px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.rename-cancel-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.rename-cancel-btn:hover {
  background: var(--bg-hover);
  box-shadow: var(--shadow-sketch);
}

.rename-confirm-btn {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.rename-confirm-btn:hover {
  background: var(--accent-secondary);
  box-shadow: var(--shadow-sketch);
}

/* Delete Modal */
.delete-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(40, 35, 25, 0.35);
  backdrop-filter: blur(4px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

.delete-modal-content {
  background: var(--bg-secondary);
  border: 2px solid var(--border-sketch);
  border-radius: 16px;
  box-shadow: 4px 6px 0px rgba(60, 50, 30, 0.12);
  width: 90%;
  max-width: 420px;
  animation: sketchSlideUp 0.3s ease;
}

.delete-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 2px dashed var(--border-color);
}

.delete-modal-header h3 {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 22px;
  font-weight: 600;
  color: var(--error);
}

.delete-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
  border-radius: 8px;
}

.delete-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.delete-modal-close svg {
  width: 20px;
  height: 20px;
}

.delete-modal-body {
  padding: 24px 20px;
  text-align: center;
}

.delete-warning-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--warning);
}

.delete-message {
  font-size: 15px;
  margin: 0 0 8px 0;
  line-height: 1.5;
  word-break: break-all;
}

.delete-message span {
  font-weight: 600;
  color: var(--accent-primary);
}

.delete-warning {
  font-size: 13px;
  color: var(--error);
  margin: 0;
  font-weight: 500;
}

.delete-modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 2px dashed var(--border-color);
  justify-content: flex-end;
}

.delete-cancel-btn,
.delete-confirm-btn {
  padding: 8px 18px;
  border: 2px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.delete-cancel-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.delete-cancel-btn:hover {
  background: var(--bg-hover);
  box-shadow: var(--shadow-sketch);
}

.delete-confirm-btn {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

.delete-confirm-btn:hover {
  background: #b55858;
  box-shadow: var(--shadow-sketch);
}

/* ===== Schedule Drawer ===== */

.schedule-drawer {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(40, 35, 25, 0.35);
  backdrop-filter: blur(4px);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
  justify-content: flex-end;
}

.schedule-drawer-panel {
  width: 480px;
  max-width: 90vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-secondary);
  border-left: 2px solid var(--border-sketch);
  box-shadow: -4px 0 16px rgba(60, 50, 30, 0.12);
  display: flex;
  flex-direction: column;
  animation: drawerSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.schedule-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 2px dashed var(--border-color);
  flex-shrink: 0;
}

.schedule-drawer-header h3 {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.schedule-drawer-header h3 svg {
  width: 22px; height: 22px;
  color: var(--accent-primary);
}

.schedule-drawer-header-actions {
  display: flex; align-items: center; gap: 8px;
}

.schedule-filter {
  padding: 6px 10px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  font-size: 13px;
  font-family: var(--font-hand);
  color: var(--text-primary);
  outline: none; cursor: pointer;
}
.schedule-filter:focus { border-color: var(--accent-primary); }

.schedule-drawer-icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.schedule-drawer-icon-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-primary);
}
.schedule-drawer-icon-btn svg { width: 18px; height: 18px; }

.schedule-drawer-body {
  flex: 1; overflow-y: auto; padding: 16px;
}

.schedule-list {
  display: flex; flex-direction: column; gap: 10px;
}

.schedule-loading, .schedule-empty {
  padding: 40px 20px; text-align: center;
  color: var(--text-tertiary); font-family: var(--font-hand); font-size: 18px;
}

/* ---- Task Card ---- */

.schedule-item {
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-left: 4px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative; overflow: hidden;
}
.schedule-item:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sketch);
  transform: translateX(3px);
}

.schedule-item.status-running  { border-left-color: var(--info); }
.schedule-item.status-pending  { border-left-color: var(--warning); }
.schedule-item.status-completed { border-left-color: var(--success); }
.schedule-item.status-failed   { border-left-color: var(--error); }
.schedule-item.status-cancelled { border-left-color: var(--text-tertiary); }

.schedule-item.status-running::before {
  content: ''; position: absolute;
  left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--info);
  animation: statusPulse 1.8s ease-in-out infinite;
  border-radius: 2px 0 0 2px;
}

.schedule-item-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}

.schedule-status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 12px;
  font-family: var(--font-hand);
}

.schedule-status-badge .status-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.schedule-status-badge.status-pending .status-dot  { background: var(--warning); }
.schedule-status-badge.status-running .status-dot   { background: var(--info); animation: statusPulse 1.2s ease-in-out infinite; }
.schedule-status-badge.status-completed .status-dot { background: var(--success); }
.schedule-status-badge.status-failed .status-dot    { background: var(--error); }
.schedule-status-badge.status-cancelled .status-dot { background: var(--text-tertiary); }

.schedule-status-badge.status-pending  { background: rgba(212,165,74,0.15); color: #b08a2e; }
.schedule-status-badge.status-running  { background: rgba(107,165,198,0.15); color: #4f8db0; }
.schedule-status-badge.status-completed { background: rgba(125,184,127,0.15); color: #5a9e5c; }
.schedule-status-badge.status-failed   { background: rgba(198,107,107,0.15); color: #ac5252; }
.schedule-status-badge.status-cancelled { background: rgba(156,163,175,0.15); color: #6b7280; }

.schedule-item-id {
  font-size: 11px; color: var(--text-tertiary); font-family: monospace;
}

.schedule-item-task {
  font-size: 14px; line-height: 1.5; margin-bottom: 10px;
  color: var(--text-primary); word-break: break-word;
}

.schedule-item-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 12px;
}

.schedule-meta-tag {
  padding: 2px 8px; border-radius: 6px;
  font-family: monospace; font-size: 11px;
}
.schedule-meta-cron { background: rgba(107,127,198,0.12); color: var(--accent-primary); }
.schedule-meta-once { background: rgba(168,162,138,0.15); color: var(--text-secondary); }
.schedule-meta-time { color: var(--text-tertiary); font-size: 12px; }

.schedule-item-actions {
  display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px;
}

.schedule-cancel-btn {
  padding: 4px 12px; font-size: 12px;
  font-family: var(--font-hand);
  background: transparent;
  border: 1.5px solid var(--error);
  border-radius: 8px; color: var(--error);
  cursor: pointer; transition: all var(--transition);
}
.schedule-cancel-btn:hover {
  background: var(--error); color: white;
  box-shadow: var(--shadow-sketch);
}

/* ---- Detail View (master-detail) ---- */

.schedule-detail-view {
  animation: cardExpandIn 0.25s ease;
}

.schedule-detail-back {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px; margin-bottom: 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px; cursor: pointer;
  font-family: var(--font-hand); font-size: 14px;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.schedule-detail-back:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.schedule-detail-back svg { width: 16px; height: 16px; }

.schedule-detail-task {
  font-size: 15px; font-weight: 500;
  color: var(--text-primary); margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-radius: 8px; line-height: 1.5;
}

.schedule-detail-body { }

.schedule-detail-empty {
  padding: 40px 20px; text-align: center;
  color: var(--text-tertiary); font-family: var(--font-hand); font-size: 16px;
}

.schedule-detail-loading, .schedule-detail-error {
  padding: 16px; text-align: center;
  color: var(--text-tertiary); font-size: 13px; font-family: var(--font-hand);
}
.schedule-detail-error { color: var(--error); }

/* ---- Result ---- */

.schedule-result { margin-bottom: 16px; }

.schedule-result-header {
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 8px;
  font-family: var(--font-hand); text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 6px;
}
.schedule-result-header::before {
  content: ''; width: 3px; height: 14px;
  background: var(--accent-primary); border-radius: 2px;
}

.schedule-result-content {
  background: var(--bg-secondary);
  border: 2px solid var(--border-sketch);
  border-radius: 8px; padding: 14px 16px;
  font-size: 13px; line-height: 1.6;
  max-height: 400px; overflow-y: auto;
}
.schedule-result-content h2 { font-size: 17px; }
.schedule-result-content h3 { font-size: 15px; }
.schedule-result-content h4 { font-size: 13px; }
.schedule-result-content h2, .schedule-result-content h3, .schedule-result-content h4 {
  font-family: var(--font-hand); margin: 12px 0 6px;
}
.schedule-result-content p { margin: 4px 0; }
.schedule-result-content ul, .schedule-result-content ol { margin: 4px 0; padding-left: 18px; }
.schedule-result-content li { margin: 2px 0; }
.schedule-result-content code {
  background: var(--bg-tertiary); padding: 1px 5px;
  border-radius: 4px; font-size: 12px; font-family: monospace;
}
.schedule-result-content a { color: var(--accent-primary); }
.schedule-result-content hr { border: none; border-top: 1px dashed var(--border-color); margin: 10px 0; }
.schedule-result-content table {
  width: 100%; border-collapse: collapse; margin: 12px 0;
  border: 2px solid var(--border-color); border-radius: 8px; overflow: hidden;
}
.schedule-result-content th, .schedule-result-content td {
  padding: 8px 12px; text-align: left; border: 1px solid var(--border-color);
}
.schedule-result-content th { background: var(--bg-tertiary); font-weight: 600; }
.schedule-result-content blockquote {
  border-left: 3px solid var(--accent-primary); margin: 8px 0; padding: 4px 12px;
  color: var(--text-secondary); background: var(--bg-tertiary); border-radius: 0 6px 6px 0;
}

/* ---- History Timeline ---- */

.schedule-history { margin-top: 8px; }

.schedule-history-header {
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 12px;
  font-family: var(--font-hand); text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 6px;
}
.schedule-history-header::before {
  content: ''; width: 3px; height: 14px;
  background: var(--warning); border-radius: 2px;
}

.schedule-history-timeline {
  display: flex; flex-direction: column; gap: 0;
  position: relative; padding-left: 20px;
}
.schedule-history-timeline::before {
  content: ''; position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border-color); border-radius: 1px;
}

.schedule-history-entry {
  position: relative; padding: 6px 0 6px 16px;
  cursor: pointer; transition: all var(--transition);
  border-radius: 6px;
}
.schedule-history-entry:hover { background: var(--bg-tertiary); }
.schedule-history-entry::before {
  content: ''; position: absolute;
  left: -17px; top: 11px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  transition: all var(--transition);
}
.schedule-history-entry:hover::before {
  background: var(--accent-primary); border-color: var(--accent-primary);
}
.schedule-history-entry.active::before {
  background: var(--accent-primary); border-color: var(--accent-primary);
}

.schedule-history-entry-time {
  font-family: monospace; font-size: 11px; color: var(--text-tertiary);
}
.schedule-history-entry-label {
  font-size: 12px; color: var(--accent-primary); font-family: var(--font-hand);
}

/* History content viewer */
.schedule-history-viewer {
  margin-top: 12px; border-top: 1px dashed var(--border-color);
  padding-top: 12px; animation: fadeIn 0.2s ease;
}
.schedule-history-viewer-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-family: monospace;
  color: var(--text-secondary); margin-bottom: 8px;
}
.schedule-history-viewer-close {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border-color);
  border-radius: 4px; cursor: pointer;
  color: var(--text-secondary); transition: all var(--transition);
}
.schedule-history-viewer-close:hover {
  background: var(--bg-tertiary); color: var(--text-primary);
}

/* ===== Mobile: bottom sheet ===== */
@media (max-width: 768px) {
  .schedule-drawer {
    align-items: flex-end;
  }

  .schedule-drawer-panel {
    width: 100%; max-width: 100%;
    height: 92vh; height: 92dvh;
    border-left: none; border-top: 2px solid var(--border-sketch);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 16px rgba(60, 50, 30, 0.15);
    animation: bottomSheetUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .schedule-drawer-header { padding: 16px; flex-direction: column; align-items: stretch; gap: 10px; }
  .schedule-drawer-header::before {
    content: ''; align-self: center; width: 36px; height: 4px;
    background: var(--border-color); border-radius: 2px; margin-bottom: 4px;
  }
  .schedule-drawer-header h3 { font-size: 20px; }
  .schedule-drawer-header-actions { justify-content: flex-end; }
  .schedule-drawer-body { padding: 12px; }
  .schedule-item { padding: 12px; }
  .schedule-item-task { font-size: 13px; }
  .schedule-item-meta { gap: 6px; }
  .schedule-result-content { max-height: 280px; }
  .schedule-history-timeline { padding-left: 16px; }
}

/* Approval Modal */
.approval-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(40, 35, 25, 0.45);
  backdrop-filter: blur(4px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

.approval-modal-content {
  background: var(--bg-secondary);
  border: 2px solid var(--warning);
  border-radius: 16px;
  box-shadow: 4px 6px 0px rgba(60, 50, 30, 0.12);
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: sketchSlideUp 0.3s ease;
}

.approval-modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 2px dashed var(--border-color);
}

.approval-modal-header h3 {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 22px;
  font-weight: 600;
  color: var(--warning);
}

.approval-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.approval-message {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  background: var(--bg-tertiary);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.approval-modal-footer {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 2px dashed var(--border-color);
  justify-content: center;
  flex-wrap: wrap;
}

.approval-btn {
  padding: 8px 16px;
  border: 2px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.approval-btn-reject {
  background: var(--bg-tertiary);
  color: var(--error);
  border-color: var(--error);
}

.approval-btn-reject:hover {
  background: var(--error);
  color: white;
  box-shadow: var(--shadow-sketch);
}

.approval-btn-once {
  background: var(--accent-light);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.approval-btn-once:hover {
  background: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-sketch);
}

.approval-btn-item {
  background: var(--success-light);
  color: var(--success);
  border-color: var(--success);
}

.approval-btn-item:hover {
  background: var(--success);
  color: white;
  box-shadow: var(--shadow-sketch);
}

.approval-btn-all {
  background: var(--warning-light);
  color: var(--warning);
  border-color: var(--warning);
}

.approval-btn-all:hover {
  background: var(--warning);
  color: white;
  box-shadow: var(--shadow-sketch);
}

/* Ask Questions Modal */
.ask-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(40, 35, 25, 0.45);
  backdrop-filter: blur(4px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

.ask-modal-content {
  background: var(--bg-secondary);
  border: 2px solid var(--accent-primary);
  border-radius: 16px;
  box-shadow: 4px 6px 0px rgba(60, 50, 30, 0.12);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: sketchSlideUp 0.3s ease;
}

.ask-modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 2px dashed var(--border-color);
}

.ask-modal-header h3 {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 22px;
  font-weight: 600;
  color: var(--accent-primary);
}

.ask-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.ask-question {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.ask-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.ask-option-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition);
}

.ask-option-label:hover {
  border-color: var(--accent-primary);
  background: var(--accent-light);
}

.ask-option-label:has(input:checked) {
  border-color: var(--accent-primary);
  background: var(--accent-light);
  font-weight: 500;
}

.ask-option-input {
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.ask-option-custom {
  border-style: dashed;
}

.ask-free-text {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-body);
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
  transition: border-color var(--transition);
}

.ask-free-text:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.ask-free-text::placeholder {
  color: var(--text-muted);
}

.ask-modal-footer {
  display: flex;
  justify-content: center;
  padding: 16px 20px;
  border-top: 2px dashed var(--border-color);
}

.ask-submit-btn {
  padding: 10px 32px;
  background: var(--accent-primary);
  color: white;
  border: 2px solid var(--accent-primary);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.ask-submit-btn:hover {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
  box-shadow: var(--shadow-sketch);
}

/* Auth Expired Overlay */
.auth-expired-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border-sketch);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 4px 6px 0px rgba(60, 50, 30, 0.12);
  animation: sketchSlideUp 0.3s ease;
}

.auth-expired-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  color: var(--warning);
}

.auth-expired-icon svg { width: 100%; height: 100%; }

.auth-expired-card h2 {
  font-family: var(--font-hand);
  font-size: 20px; font-weight: 600;
  color: var(--text-primary); margin: 0 0 8px 0;
}

.auth-expired-card p {
  font-size: 14px; color: var(--text-secondary);
  margin: 0 0 24px 0; line-height: 1.5;
}

.auth-expired-btn {
  padding: 10px 32px;
  background: var(--accent-primary);
  color: white;
  border: 2px solid var(--accent-primary);
  border-radius: 10px;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.auth-expired-btn:hover {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
  box-shadow: var(--shadow-sketch);
}

@media (max-width: 640px) {
  .history-modal-header {
    padding: 16px;
  }

  .history-modal-header h3 {
    font-size: 20px;
  }

  .history-share-manage-btn {
    padding: 6px 8px;
    font-size: 12px;
  }

  .session-share-content,
  .session-share-list-content {
    width: calc(100vw - 20px);
    max-height: 88vh;
  }

  .session-share-header,
  .session-share-list-header {
    padding: 16px;
  }

  .session-share-body,
  .session-share-list-body {
    padding: 14px;
  }

  .session-share-footer {
    flex-wrap: wrap;
    padding: 14px;
  }

  .session-share-links-btn {
    width: 100%;
    margin-right: 0;
  }

  .session-share-cancel-btn,
  .session-share-ok-btn {
    flex: 1;
  }

  .session-share-list-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .session-share-list-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
