:root {
  --page: #f7f8fb;
  --ink: #172033;
  --muted: #667085;
  --panel: #ffffff;
  --line: #d8dee9;
  --primary: #E8651A;
  --primary-dark: #C85415;
  --primary-soft: #FEE8D6;
  --neutral-soft: #eef2f7;
  --green: #10b981;
  --green-soft: #d1fae5;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(232, 101, 26, 0.06), rgba(232, 101, 26, 0.02) 42%, transparent 70%),
    var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, input, select { font: inherit; }
button { border: 0; }

[v-cloak] { display: none !important; }

/* ── Shell ── */
.storyboard-list-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

/* ── Search / Filter bar ── */
.toolbar-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(23, 32, 51, 0.04);
}

.search-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  color: var(--muted);
}

.search-wrapper input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  min-width: 0;
}

.search-wrapper input::placeholder { color: #98a2b3; }

.toolbar-divider {
  width: 1px;
  height: 28px;
  background: var(--line);
  flex-shrink: 0;
}

.filter-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.filter-select-wrap select {
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding-right: 4px;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.view-toggle button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.view-toggle button:first-child { border-right: 1px solid var(--line); }
.view-toggle button.active { background: var(--primary); color: #fff; }
.view-toggle button:not(.active):hover { background: var(--neutral-soft); }

/* ── Results count ── */
.results-count {
  margin: 18px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Card grid ── */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.folder-grid.list-view {
  grid-template-columns: 1fr;
}

/* ── Card ── */
.folder-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.folder-card:hover {
  border-color: #c0c8d4;
  box-shadow: 0 20px 50px rgba(23, 32, 51, 0.12);
}

.folder-tab {
  height: 4px;
  background: var(--primary-soft);
}

.folder-card.not_created .folder-tab { background: var(--neutral-soft); }
.folder-card.created .folder-tab    { background: var(--green); }
.folder-card.orphan .folder-tab     { background: var(--amber); }

.folder-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

/* ── Title row ── */
.folder-title-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.folder-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--primary);
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 0;
}

.status-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.created     { color: #047857; background: var(--green-soft); }
.status-pill.not_created { color: #6b7280; background: var(--neutral-soft); }
.status-pill.orphan      { color: #92400e; background: var(--amber-soft); }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.menu-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.menu-trigger:hover { background: var(--neutral-soft); }

/* ── Card dropdown menu ── */
.card-menu-wrap { position: relative; }

.card-menu {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 20;
  min-width: 140px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.14);
  padding: 4px;
  animation: scaleIn 0.12s ease;
}

.card-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--red);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}

.card-menu button:hover { background: #fef2f2; }

/* ── Description ── */
.folder-desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Metadata ── */
.folder-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 10px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-icon {
  color: var(--primary);
  flex-shrink: 0;
  opacity: 0.7;
}

.meta-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  opacity: 0.75;
  margin-bottom: 1px;
}

.meta-value {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* ── Action buttons ── */
.folder-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: transform 0.12s ease, filter 0.18s ease, background 0.15s;
}

.btn:focus-visible {
  outline: 3px solid rgba(232, 101, 26, 0.24);
  outline-offset: 2px;
}

.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  flex: 1;
}

.btn-secondary {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: var(--neutral-soft);
}

/* ── Empty / loading / error states ── */
.loading,
.empty-state,
.error-state {
  grid-column: 1 / -1;
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 28px;
}

.loading { grid-auto-flow: column; gap: 12px; }

.loading-ring {
  width: 28px;
  height: 28px;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* ── Toast ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 90px);
  padding: 11px 18px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
  z-index: 10;
}

.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--red); }

/* ── Delete confirmation modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  background: rgba(23, 32, 51, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease;
}

.modal-overlay:not([hidden]) { display: flex; }

.modal-dialog {
  width: min(420px, calc(100vw - 32px));
  background: var(--panel);
  border-radius: 14px;
  padding: 28px 24px 22px;
  box-shadow: 0 24px 60px rgba(23, 32, 51, 0.18);
  text-align: center;
  animation: scaleIn 0.2s ease;
}

.modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fee2e2;
  color: var(--red);
  margin-bottom: 14px;
}

.modal-title { margin: 0 0 8px; font-size: 18px; font-weight: 700; color: var(--ink); }
.modal-desc { margin: 0 0 22px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.modal-desc strong { color: var(--ink); font-weight: 600; }
.modal-actions { display: flex; gap: 10px; }

.modal-btn {
  flex: 1;
  min-height: 42px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}

.modal-btn:active { transform: translateY(1px); }
.btn-delete { background: var(--red); color: #fff; }
.btn-delete:hover { background: #b91c1c; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.92) } to { opacity: 1; transform: scale(1) } }
@keyframes spin { to { transform: rotate(360deg) } }

@media (max-width: 760px) {
  .toolbar-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .search-wrapper { flex-basis: 100%; }
  .toolbar-divider { display: none; }

  .folder-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .storyboard-list-shell {
    width: calc(100% - 16px);
    padding: 16px 0 32px;
  }

  .folder-body { padding: 14px; gap: 10px; }
  .folder-title { font-size: 16px; }
  .folder-meta { grid-template-columns: 1fr; gap: 8px; }
  .folder-actions .btn { flex: 1; min-height: 44px; }
  .toast { max-width: calc(100vw - 32px); }
}
