@import './base.css';

:root {
  --color-primary: #72D1C3;
  --color-primary-strong: #4fb8a8;
  --color-primary-soft: rgba(114, 209, 195, 0.14);
  --color-primary-border: rgba(114, 209, 195, 0.38);
  --color-ink: #172033;
  --color-muted: #62708a;
}

html,
body,
#app {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(114, 209, 195, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(114, 209, 195, 0.12), transparent 26%),
    #f4f7fb;
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
  color: var(--color-ink);
}

.app-shell:has(.sidebar.collapsed) {
  grid-template-columns: 72px minmax(0, 1fr);
}

.main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  padding: 18px 24px;
  gap: 18px;
  overflow: hidden;
}

.svg-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

.svg-icon--light {
  filter: brightness(0) invert(1);
}

.has-tooltip::after,
.has-tooltip::before {
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.has-tooltip::after {
  content: attr(data-tip);
  width: max-content;
  max-width: 180px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.2);
}

.has-tooltip::before {
  content: '';
  left: calc(100% + 4px);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-right: 6px solid #111827;
  border-bottom: 6px solid transparent;
}

.sidebar.collapsed .has-tooltip:hover::after,
.sidebar.collapsed .has-tooltip:hover::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.workspace {
  min-height: 0;
  overflow: hidden;
}

.workspace-panel {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
}

.empty-panel {
  align-self: start;
  justify-self: center;
  width: min(640px, 100%);
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 22px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 44px rgba(31, 54, 101, 0.06);
}

.empty-panel--compact {
  justify-self: stretch;
  width: auto;
}

.empty-panel strong {
  color: #0f172a;
  font-size: 16px;
}

.empty-panel p {
  margin: 0;
  color: #64748b;
  line-height: 1.7;
}

.hidden-file {
  display: none;
}

.slogan,
.site-legal {
  color: #6b768a;
  font-size: 12px;
  text-align: left;
}

.site-legal {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 12px;
  flex-wrap: wrap;
  justify-self: start;
  line-height: 1.5;
}

.site-legal a {
  color: #6b768a;
  text-decoration: none;
}

.site-legal a:hover {
  color: #167766;
}

.app-footer {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) auto minmax(88px, 1fr);
  align-items: flex-end;
  min-height: 34px;
  padding: 0 4px max(2px, env(safe-area-inset-bottom));
}

.feedback-entry {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #66736d;
  font-size: 12px;
  cursor: pointer;
}

.footer-actions {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.feedback-entry:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.72);
  color: #167766;
}

.feedback-entry:disabled {
  cursor: wait;
  opacity: 0.45;
}

.feedback-entry .svg-icon {
  width: 14px;
  height: 14px;
}

@media (max-width: 640px) {
  .app-footer {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .app-footer > span[aria-hidden='true'] {
    display: none;
  }

  .slogan {
    justify-self: start;
    justify-content: flex-start;
    text-align: left;
  }

  .site-legal {
    display: none;
  }
}

.dialog-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(8px);
}

.dialog-card {
  position: relative;
  color: #0f172a;
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

.dialog-card--import {
  width: min(980px, 100%);
  max-height: min(86vh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dialog-card--collect {
  width: min(500px, 100%);
}

.dialog-card--notification {
  width: min(520px, 100%);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-right: 36px;
}

.dialog-head div {
  display: grid;
  gap: 4px;
}

.dialog-head strong {
  color: #0f172a;
  font-size: 17px;
}

.dialog-card > strong {
  padding-right: 36px;
}

.dialog-head small,
.dialog-note {
  color: #64748b;
  font-size: 12px;
  line-height: 1.6;
}

.dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.dialog-close--base {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}

.dialog-close img {
  width: 15px;
  height: 15px;
  opacity: 0.66;
}

.dialog-close:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.dialog-close:hover {
  background: var(--color-primary-soft);
}

.dialog-form {
  display: grid;
  gap: 12px;
}

.notification-detail {
  max-height: min(46vh, 360px);
  overflow-y: auto;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.notification-detail p {
  margin: 0;
  color: #263247;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
}

/* 通用拖拽上传组件 */
.drop-upload {
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 20px;
  border: 1.5px dashed rgba(114, 209, 195, 0.56);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(114, 209, 195, 0.08), rgba(248, 250, 252, 0.88));
  color: #16675d;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.drop-upload:hover,
.drop-upload--active {
  border-color: var(--color-primary-strong);
  background: rgba(114, 209, 195, 0.14);
  box-shadow: 0 12px 36px rgba(79, 184, 168, 0.1);
}

.drop-upload--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.drop-upload__icon {
  width: 42px;
  height: 42px;
}

.drop-upload strong {
  color: #0f172a;
  font-size: 17px;
}

.drop-upload span {
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}

.drop-upload--compact {
  min-height: 80px;
  padding: 14px;
  gap: 6px;
}

.drop-upload--compact strong {
  font-size: 14px;
}

.collect-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: #f1f5f9;
}

.collect-mode-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-weight: 800;
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.collect-mode-tabs button.active {
  background: #fff;
  color: #16675d;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.collect-mode-panel {
  display: grid;
  gap: 12px;
  padding: 2px 0 0;
}

.collect-scope-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: #f8fafc;
}

.collect-mode-tabs--scope {
  background: #fff;
}

.collect-item-checklist {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.collect-item-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.collect-item-tools button {
  border: 0;
  background: transparent;
  color: #22685f;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.collect-item-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.collect-item-option input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--color-primary-strong);
}

.collect-item-option span {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.collect-item-option strong {
  min-width: 0;
  overflow: hidden;
  color: #0f172a;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collect-item-option small {
  min-width: 0;
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  outline: none;
}

.field textarea {
  resize: vertical;
  line-height: 1.6;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--color-primary-border);
  box-shadow: 0 0 0 4px rgba(114, 209, 195, 0.12);
}

.dialog-error {
  margin: 0;
  color: #dc2626;
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.dialog-link {
  border: 0;
  background: transparent;
  color: #22685f;
  cursor: pointer;
  font-weight: 700;
}

.danger-link {
  border: 0;
  background: transparent;
  color: #22685f;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.danger-link {
  color: #dc2626;
}

/* Shared controls form the application design-system layer rather than a page dependency. */
.assistant-action {
  justify-self: stretch;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: var(--color-primary-strong);
  box-shadow: 0 14px 30px rgba(79, 184, 168, 0.2);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.assistant-action--compact { justify-self: start; min-height: 38px; padding: 0 16px; border-radius: 12px; font-size: 13px; }
.assistant-action:hover { background: var(--color-primary-strong); }
.assistant-action:disabled { cursor: not-allowed; opacity: 0.72; }

.subject-ghost-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  background: #fff;
  color: #22685f;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.subject-ghost-btn:hover { border-color: var(--color-primary-border); background: var(--color-primary-soft); transform: translateY(-1px); }
.subject-ghost-btn.danger { color: #dc2626; }
.subject-ghost-btn:disabled { cursor: not-allowed; opacity: 0.56; }
