/* ============================================================
   AiMaker · Banco de Datos — recreated view
   ============================================================ */

:root {
  --bg: #f4f5f8;
  --bg-card: #ffffff;
  --bg-soft: #fafbfd;
  --border: #ececf1;
  --border-strong: #e1e2e8;
  --text: #1a1a23;
  --text-soft: #6b6c79;
  --text-mute: #9c9da8;
  --brand: #6366f1;
  --brand-soft: #eef0ff;
  --brand-grad-1: #6366f1;
  --brand-grad-2: #7c3aed;
  --folder: #fff4d6;
  --folder-stroke: #f1c97a;
  --master: #fff7c2;
  --master-stroke: #f0d56b;
  --rag: #efe5ff;
  --rag-stroke: #c9b3ff;
  --lego: #d8f5e1;
  --lego-stroke: #8ed5a4;
  --humano: #e1efff;
  --humano-stroke: #a8c8f0;
  --memory: #ffe6f1;
  --memory-stroke: #f0a8c8;
  --deploy: #ffe1cf;
  --deploy-stroke: #f0a878;
  --danger: #ef5544;
  --shadow-sm: 0 1px 2px rgba(15,18,40,.05);
  --shadow-md: 0 4px 14px rgba(15,18,40,.06);
  --shadow-lg: 0 14px 40px rgba(15,18,40,.10);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  font-size: 14px;
}

/* ----- Layout ----- */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ----- Topbar ----- */
.topbar {
  height: 64px;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 260px 1fr auto;
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title {
  padding: 0 28px;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
}
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 999px;
  background: transparent;
  border: none;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--text-soft);
  transition: background .15s;
}
.icon-btn:hover { background: #ebecf1; }

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #e6f0ff;
  color: #2b3a67;
  padding: 8px 16px 8px 12px;
  border-radius: 999px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-size: 14px;
}
.profile-pill .avatar {
  width: 22px; height: 22px;
  border-radius: 999px;
  background: #fff;
  display: grid; place-items: center;
  color: #2b3a67;
}

/* ----- Sidebar ----- */
.sidebar {
  grid-row: 2;
  padding: 0 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-right: 1px solid transparent;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px 18px;
  position: relative;
}
.brand-logo {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-grad-1), var(--brand-grad-2));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 20px;
  box-shadow: 0 6px 20px rgba(99,102,241,.35);
}
.brand-name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand .collapse {
  margin-left: auto;
  color: var(--text-soft);
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  cursor: pointer;
}
.brand .collapse:hover { background: #ebecf1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text-soft);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  font-size: 15px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: #ebecf1; color: var(--text); }
.nav-item.active {
  background: var(--bg-card);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}
.nav-item.active .nav-icon { color: var(--brand); }
.nav-icon {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  color: var(--text-mute);
}
.nav-item.active .nav-icon { color: var(--brand); }

.sidebar .spacer { flex: 1; }
.mod-check {
  width: 18px; height: 18px;
  border-radius: 999px;
  background: #2ee07a;
  color: #fff;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.logout {
  color: var(--danger);
  font-weight: 600;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

/* ----- Main ----- */
.main {
  padding: 4px 28px 60px 12px;
}
.panel {
  background: var(--bg-card);
  border-radius: 22px;
  padding: 32px 34px 40px;
  min-height: calc(100vh - 100px);
  box-shadow: var(--shadow-sm);
}
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 26px;
}
.panel-header h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.panel-header p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
}
.btn-new {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .15s;
}
.btn-new:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-new .plus { color: var(--brand); font-size: 18px; font-weight: 700; }

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  margin: 22px 0 14px;
  letter-spacing: 0.02em;
}

.filters {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px 4px 16px;
}
.filter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  text-transform: uppercase;
}
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  border: none;
  background: transparent;
}
.chip.active {
  background: #16181f;
  color: #fff;
}
.select {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
}
.search {
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-mute);
  font-size: 14px;
}
.search input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 14px;
  color: var(--text);
}

/* ----- Folder grid ----- */
.folders {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 18px;
  margin-bottom: 36px;
}
.folder-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: transform .12s, box-shadow .15s, border-color .15s;
  min-height: 64px;
}
.folder-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--border-strong);
}
.folder-icon {
  width: 38px; height: 30px;
  background: var(--folder);
  border: 1px solid var(--folder-stroke);
  border-radius: 4px 8px 8px 8px;
  position: relative;
  flex-shrink: 0;
}
.folder-icon::before {
  content: '';
  position: absolute;
  top: -6px; left: 0;
  width: 18px; height: 8px;
  background: var(--folder);
  border: 1px solid var(--folder-stroke);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}
.folder-name {
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
  line-height: 1.25;
}
.folder-badges {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge.master  { background: var(--master); color: #6a5300; }
.badge.rag     { background: var(--rag);    color: #5524a8; }
.badge.lego    { background: var(--lego);   color: #1c6b3a; }
.badge.humano  { background: var(--humano); color: #1e4a8a; }
.badge.memory  { background: var(--memory); color: #8a1e54; }
.badge.deploy  { background: var(--deploy); color: #8a3e10; }

.info-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 18px; height: 18px;
  border-radius: 999px;
  display: grid; place-items: center;
  color: var(--text-mute);
  background: transparent;
  font-size: 12px;
  border: 1px solid var(--border);
}

/* ----- Files table ----- */
.files-section {
  margin-top: 18px;
}
.files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.files-table th {
  text-align: left;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  font-weight: 600;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
}
.files-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
}

/* ============================================================
   AIMY · AI assistant
   ============================================================ */
.aimy-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px; height: 56px;
  border-radius: 999px;
  background: linear-gradient(135deg, #4f8df6, #7c5cff);
  color: #fff;
  border: none;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(79,141,246,.45);
  z-index: 90;
  transition: transform .15s;
}
.aimy-fab:hover { transform: scale(1.06); }
.aimy-fab .pulse {
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  background: rgba(124,92,255,.4);
  animation: pulse 2.4s ease-out infinite;
  z-index: -1;
}
@keyframes pulse {
  0% { transform: scale(.9); opacity: .7; }
  100% { transform: scale(1.6); opacity: 0; }
}
.aimy-fab .nudge {
  position: absolute;
  top: -8px; right: -8px;
  background: #ff5a5f;
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 999px;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid #fff;
}

.aimy-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: min(640px, calc(100vh - 48px));
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(15,18,40,.22), 0 4px 14px rgba(15,18,40,.08);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  animation: rise .25s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes rise {
  from { transform: translateY(20px) scale(.96); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.aimy-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 14px;
  background: linear-gradient(135deg, #5e7cff 0%, #8a5cff 100%);
  color: #fff;
  position: relative;
}
.aimy-avatar {
  width: 40px; height: 40px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  display: grid; place-items: center;
  font-size: 18px;
  position: relative;
  border: 2px solid rgba(255,255,255,.3);
}
.aimy-avatar::after {
  content: '';
  position: absolute;
  bottom: -2px; right: -2px;
  width: 12px; height: 12px;
  background: #2ee07a;
  border: 2px solid #fff;
  border-radius: 999px;
}
.aimy-meta { line-height: 1.2; }
.aimy-meta .name { font-weight: 700; font-size: 15px; }
.aimy-meta .role { font-size: 12px; opacity: .85; }
.aimy-header .close, .aimy-header .min {
  margin-left: auto;
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: grid; place-items: center;
}
.aimy-header .close:hover, .aimy-header .min:hover { background: rgba(255,255,255,.24); }

.aimy-progress {
  height: 4px;
  background: rgba(255,255,255,.2);
  position: relative;
}
.aimy-progress > div {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #ffe16b, #ff8e6b);
  border-radius: 999px;
  transition: width .35s;
}
.aimy-progress-label {
  position: absolute;
  top: 8px; right: 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,.95);
  background: rgba(0,0,0,.18);
  padding: 2px 8px;
  border-radius: 999px;
}

.aimy-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  background: linear-gradient(180deg, #f7f8fc 0%, #fff 80px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.aimy-body::-webkit-scrollbar { width: 8px; }
.aimy-body::-webkit-scrollbar-thumb { background: #d6d7de; border-radius: 999px; }

.msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  animation: msgIn .35s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.msg.user { flex-direction: row-reverse; }
.msg .av {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #5e7cff, #8a5cff);
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px;
  flex-shrink: 0;
}
.msg.user .av { background: #2b3a67; }
.bubble {
  max-width: 80%;
  background: #fff;
  border: 1px solid var(--border);
  padding: 11px 14px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  box-shadow: 0 2px 6px rgba(15,18,40,.04);
}
.msg.user .bubble {
  background: #2b3a67;
  color: #fff;
  border-color: #2b3a67;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 16px;
}
.bubble strong { color: var(--brand); }
.msg.user .bubble strong { color: #ffd76b; }
.bubble .quote {
  border-left: 3px solid var(--brand);
  padding-left: 10px;
  margin: 8px 0;
  color: var(--text-soft);
  font-style: italic;
  font-size: 13px;
}

.aimy-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.stat-card .v { font-size: 18px; font-weight: 700; color: var(--brand); }
.stat-card .l { font-size: 10px; color: var(--text-soft); line-height: 1.2; }

.type-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.type-chip {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  transition: all .15s;
  position: relative;
}
.type-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.type-chip.explored { background: #f4ffea; border-color: #b9e08c; }
.type-chip .ico { font-size: 18px; }
.type-chip .tname { font-size: 10px; font-weight: 700; margin-top: 2px; }
.type-chip .check {
  position: absolute;
  top: -4px; right: -4px;
  width: 14px; height: 14px;
  background: #2ee07a;
  color: #fff;
  border-radius: 999px;
  display: grid; place-items: center;
  font-size: 9px;
  border: 2px solid #fff;
}

.aimy-actions {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
}
.aimy-btn {
  flex: 1;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.aimy-btn:hover { background: var(--bg-soft); }
.aimy-btn.primary {
  background: linear-gradient(135deg, #5e7cff, #8a5cff);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(124,92,255,.35);
}
.aimy-btn.primary:hover { filter: brightness(1.05); }
.aimy-btn.ghost { background: transparent; border: none; flex: 0 0 auto; color: var(--text-soft); }
.aimy-btn:disabled { opacity: .45; cursor: not-allowed; }

.aimy-quick {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.quick-chip {
  padding: 6px 12px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
}
.quick-chip:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }

/* ----- Spotlight overlay ----- */
.spotlight {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  transition: opacity .3s;
}
.spot-ring {
  position: absolute;
  border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(20, 24, 50, 0.55), 0 0 0 4px rgba(124,92,255,.9), 0 0 28px rgba(124,92,255,.65);
  transition: all .35s cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}
.spot-label {
  position: absolute;
  background: #16181f;
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transform: translateY(-130%);
}

/* ----- Quiz ----- */
.quiz-q { font-weight: 600; font-size: 15px; margin: 0 0 4px; }
.quiz-opts { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.quiz-opt {
  text-align: left;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: all .15s;
}
.quiz-opt:hover { border-color: var(--brand); background: var(--brand-soft); }
.quiz-opt.right { border-color: #2ee07a; background: #e8fff0; color: #0e6b34; }
.quiz-opt.wrong { border-color: #ff6b6b; background: #ffe9e9; color: #7e1a1a; }

/* ----- Badge ----- */
.badge-trophy {
  text-align: center;
  padding: 20px 12px;
}
.badge-trophy .seal {
  width: 120px; height: 120px;
  border-radius: 999px;
  margin: 0 auto 12px;
  background:
    radial-gradient(circle at 30% 30%, #ffe89a, #f1b933 60%, #b67a14);
  display: grid; place-items: center;
  font-size: 50px;
  box-shadow: inset 0 -8px 16px rgba(0,0,0,.15), 0 12px 30px rgba(241,185,51,.4);
  position: relative;
  animation: pop .6s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pop { from { transform: scale(.5); opacity: 0; } }
.badge-trophy h3 { margin: 8px 0 4px; font-size: 18px; }
.badge-trophy .pts {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 13px;
}

/* ----- Modal: create folder ----- */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(20,24,50,.5);
  z-index: 95;
  display: grid;
  place-items: center;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: 480px;
  max-width: 92vw;
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: rise .25s cubic-bezier(.2,.9,.3,1.2);
}
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal p { margin: 0 0 16px; color: var(--text-soft); font-size: 13px; }
.type-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.type-pick {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: center;
  background: #fff;
  text-align: left;
  transition: all .15s;
}
.type-pick:hover { border-color: var(--brand); background: var(--brand-soft); }
.type-pick.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.type-pick .ti {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
}
.type-pick .tt { font-weight: 700; font-size: 14px; }
.type-pick .td { font-size: 11px; color: var(--text-soft); }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}
.btn-cancel {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-weight: 600;
}
.btn-create {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #5e7cff, #8a5cff);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.btn-create:disabled { opacity: .4; cursor: not-allowed; }

/* ----- New folder name input ----- */
.input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  margin: 8px 0 4px;
  font-family: inherit;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }

/* ----- new folder appear flash ----- */
.folder-card.is-new {
  animation: flash 1.6s ease-out;
}
@keyframes flash {
  0%   { box-shadow: 0 0 0 0 rgba(46,224,122,.0); border-color: var(--border); }
  20%  { box-shadow: 0 0 0 6px rgba(46,224,122,.35); border-color: #2ee07a; }
  100% { box-shadow: 0 0 0 0 rgba(46,224,122,0); border-color: var(--border); }
}

/* ----- responsive ----- */
@media (max-width: 1100px) {
  .folders { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-title { padding-left: 16px; }
  .sidebar { display: none; }
  .main { padding: 4px 12px 60px; }
  .panel { padding: 22px 18px; border-radius: 18px; }
  .folders { grid-template-columns: 1fr; }
  .aimy-panel { right: 8px; left: 8px; width: auto; bottom: 8px; height: 80vh; }
}

/* ── New dropdown menu ── */
.new-btn-wrapper { position: relative; display: inline-block; }
.new-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.14);
  padding: 8px 6px;
  min-width: 230px;
  z-index: 300;
  animation: rise .15s ease;
}
.nd-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-mute);
  letter-spacing: .06em;
  padding: 6px 12px 4px;
}
.nd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background .12s;
}
.nd-item:hover { background: var(--brand-soft); color: var(--brand); }
.nd-item svg { flex-shrink: 0; opacity: .6; }
.nd-item:hover svg { opacity: 1; }
.nd-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* ── Folder group (master + auto sub-folders) ── */
.folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.folder-group {
  grid-column: 1 / -1;
  background: var(--brand-soft, #f5f3ff);
  border: 1px solid rgba(99,102,241,.18);
  border-radius: 14px;
  padding: 14px 14px 10px;
}
.folder-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: .03em;
}
.folder-group-header span { opacity: .6; font-weight: 400; }
.folder-group-toggle {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--brand);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13px;
  transition: background .1s;
}
.folder-group-toggle:hover { background: rgba(99,102,241,.12); }
.folder-group-children {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

/* ── Simple name modal ── */
.modal-simple { max-width: 400px; }
.modal-simple h3 { font-size: 17px; margin: 0 0 6px; }
.modal-simple p  { font-size: 13px; color: var(--text-soft); margin: 0 0 16px; }
.modal-simple .sub-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
}
.sub-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-soft);
}
