/* ═══════════════════════════════════════
   DANOENGINE · Design System
   Tokens: cream / navy / coral / card
════════════════════════════════════════ */

:root {
  --cream:  #faf9f5;
  --navy:   #181715;
  --coral:  #cc785c;
  --card:   #efe9de;
  --border: #e5ddd0;
  --muted:  #a89880;
  --body:   #3a3028;
  --sub:    #6b5a48;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--cream); font-family: 'Inter', sans-serif; color: var(--body); }

/* ── Login Gate ───────────────────────── */
body.auth-locked {
  min-height: 100vh;
  overflow: hidden;
}

body.auth-locked #app-shell {
  display: none !important;
}

body.auth-ready #login-gate {
  display: none;
}

.login-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(204,120,92,0.10), transparent 34%),
    linear-gradient(180deg, #fffdf9 0%, var(--cream) 100%);
}

.login-card {
  width: min(100%, 520px);
  min-height: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 54px 48px 38px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(229,221,208,0.92);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(24,23,21,0.10);
  text-align: center;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.dano-logo{
  width: 220px;
  max-width: 70%;
  height: auto;
  display: block;
  margin: 0 auto 24px auto;
}

@media(max-width:768px){
  .dano-logo{
    width: 180px;
  }
}

.login-product {
  color: var(--navy);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.7px;
}

.login-copy {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 400px;
}

.login-copy h1 {
  color: var(--navy);
  font-size: 30px;
  line-height: 1.22;
  font-weight: 800;
  letter-spacing: 0;
}

.login-copy p {
  color: var(--sub);
  font-size: 15.5px;
  line-height: 1.7;
  font-weight: 500;
}

.google-login-btn {
  width: 100%;
  min-height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  border: 1.5px solid var(--navy);
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
  box-shadow: 0 16px 34px rgba(24,23,21,0.18);
}

.google-login-btn:hover {
  background: #26231f;
  transform: translateY(-1px);
  box-shadow: 0 20px 38px rgba(24,23,21,0.22);
}

.google-login-btn:active {
  transform: translateY(0);
}

.google-login-btn svg {
  width: 23px;
  height: 23px;
  padding: 3px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
}

.login-terms {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.login-terms a {
  color: var(--sub);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-error {
  display: none;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.login-footer {
  width: 100%;
  margin-top: 10px;
  padding-top: 24px;
  border-top: 1px solid #f1e9dd;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.social-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.social-links a {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--cream);
  color: var(--sub);
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.social-links a:hover {
  background: #fff;
  border-color: var(--coral);
  color: var(--coral);
}

.social-links svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.login-copyright {
  color: #b0a090;
  font-size: 11.5px;
  line-height: 1.4;
}

/* ── Scrollbar ─────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d5c9b8; border-radius: 2px; }

/* ── Panel ─────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; animation: panelIn 0.18s ease; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Sidebar Nav ───────────────────────── */
.nav-section-label {
  font-size: 9px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: rgba(255,255,255,0.18); padding: 14px 10px 6px; user-select: none;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px 7px 8px; border-radius: 6px; margin-bottom: 1px;
  cursor: pointer; font-size: 12.5px; font-weight: 500;
  color: rgba(255,255,255,0.38);
  transition: all 0.12s ease;
  text-decoration: none;
  user-select: none;
  border-left: 2px solid transparent;
}
.nav-item:hover  { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.7); }
.nav-item.active { background: rgba(204,120,92,0.1); color: white; border-left-color: #cc785c; }
.nav-item.disabled { opacity: 0.3; cursor: default; pointer-events: none; }

.nav-badge {
  margin-left: auto; font-size: 9px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
}
.nav-badge-coral  { background: rgba(204,120,92,0.25); color: #cc785c; }
.nav-badge-muted  { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.3); }
.nav-badge-green  { background: rgba(74,222,128,0.2); color: #4ade80; }

/* ── Topbar ────────────────────────────── */
#topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(250,249,245,0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}

.tools-menu {
  position: relative;
}

.tools-menu-trigger {
  height: 29px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--card);
  color: #5f5548;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.tools-menu-trigger::after {
  content: "v";
  margin-left: 7px;
  color: #a89880;
  font-size: 10px;
}

.tools-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 168px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 35px rgba(24, 23, 21, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}

.tools-menu:hover .tools-menu-list,
.tools-menu:focus-within .tools-menu-list {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tools-menu-list a {
  display: block;
  padding: 9px 10px;
  border-radius: 6px;
  color: #181715;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.tools-menu-list a:hover,
.tools-menu-list a:focus {
  background: var(--cream);
  outline: none;
}

/* ── Cards ─────────────────────────────── */
.card     { background: white; border: 1px solid var(--border); border-radius: 12px; }
.card-sm  { background: white; border: 1px solid var(--border); border-radius: 10px; }
.kpi-card { background: white; border: 1px solid var(--border); border-radius: 11px; padding: 16px 18px; }

/* ── Command Input ─────────────────────── */
#cmd-input {
  width: 100%; resize: none;
  background: var(--cream); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 13px 52px 13px 15px;
  font-size: 13.5px; color: var(--body); font-family: inherit; line-height: 1.65;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#cmd-input:focus {
  outline: none; border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(204,120,92,0.1);
}
#cmd-input::placeholder { color: #b8a898; }

/* ── Execution Status Strip ────────────── */
#exec-strip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px; margin-top: 10px;
  font-size: 11.5px; font-weight: 500;
  background: var(--cream); border: 1px solid var(--border);
  transition: all 0.2s ease;
  min-height: 34px;
}
#exec-strip.state-idle     { color: #a89880; }
#exec-strip.state-thinking { color: #6b5a48; background: #fef9f5; border-color: #e8ddd0; }
#exec-strip.state-executing{ color: var(--coral); background: rgba(204,120,92,0.05); border-color: rgba(204,120,92,0.2); }
#exec-strip.state-complete { color: #059669; background: rgba(5,150,105,0.05); border-color: rgba(5,150,105,0.2); }
#exec-strip.state-error    { color: #dc2626; background: rgba(220,38,38,0.04); border-color: rgba(220,38,38,0.15); }

/* ── Status Dot ────────────────────────── */
.status-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: #d5c9b8;
}
.status-dot.idle     { background: #c8b9a8; }
.status-dot.thinking { background: #f59e0b; animation: pulseDot 1s ease-in-out infinite; }
.status-dot.running  { background: var(--coral); animation: pulseDot 0.8s ease-in-out infinite; }
.status-dot.complete { background: #4ade80; }
.status-dot.error    { background: #f87171; }

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

/* ── Output Panel ──────────────────────── */
#cmd-output {
  margin-top: 12px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); display: none;
}
.output-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: #faf7f2; border-bottom: 1px solid var(--border);
  font-size: 11px; color: var(--muted);
}
.output-body { padding: 14px; font-size: 13px; line-height: 1.75; color: var(--body); }
.output-actions { display: flex; gap: 7px; }
.output-btn {
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  border-radius: 6px; border: 1px solid var(--border);
  background: white; color: var(--sub); cursor: pointer; font-family: inherit;
  transition: all 0.12s;
}
.output-btn:hover { background: var(--coral); color: white; border-color: var(--coral); }
.output-btn.primary { background: var(--coral); color: white; border-color: var(--coral); }
.output-btn.primary:hover { background: #b86a4e; }

/* ── Execution Steps ───────────────────── */
.exec-steps { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; }
.exec-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--muted); padding: 3px 0;
  opacity: 0; transform: translateX(-4px);
  animation: stepIn 0.2s ease forwards;
}
.exec-step.done  { color: #059669; }
.exec-step.active{ color: var(--coral); }
.exec-step.error { color: #dc2626; }
@keyframes stepIn {
  to { opacity: 1; transform: translateX(0); }
}

/* ── Status Badges ─────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 4px; padding: 2px 8px;
  font-size: 11px; font-weight: 600;
}
.badge-ok   { background: #d1fae5; color: #065f46; }
.badge-run  { background: #dbeafe; color: #1e40af; }
.badge-err  { background: #fee2e2; color: #991b1b; }
.badge-wait { background: #fef9c3; color: #713f12; }
.badge-muted{ background: #f0ebe2; color: #8c7060; }

/* ── Pill Buttons ──────────────────────── */
.pill {
  border: 1px solid var(--border); border-radius: 20px; padding: 5px 13px;
  font-size: 11.5px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: all 0.12s;
  background: white; color: var(--sub);
}
.pill:hover { background: var(--coral); color: white; border-color: var(--coral); }

/* ── Run Rows ──────────────────────────── */
.run-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid #f5f0e8;
  transition: background 0.1s; cursor: default;
}
.run-row:last-child { border-bottom: none; }
.run-row:hover { background: #faf7f2; }

/* ── Runtime Log ───────────────────────── */
.runtime-log {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 11.5px; line-height: 1.8; color: #5c4f40;
  background: #faf7f2; padding: 14px 16px; border-radius: 8px;
  border: 1px solid #ede4d8;
}
.log-line { display: flex; gap: 12px; }
.log-time { color: #b8a898; flex-shrink: 0; }
.log-icon { flex-shrink: 0; }
.log-text { color: #5c4f40; }
.log-text.success { color: #059669; }
.log-text.error   { color: #dc2626; }
.log-text.accent  { color: var(--coral); }

/* ── Skill Cards ───────────────────────── */
.skill-card {
  background: white; border: 1px solid var(--border); border-radius: 11px;
  padding: 18px; cursor: pointer; transition: all 0.18s;
}
.skill-card:hover {
  transform: translateY(-2px); border-color: var(--coral);
  box-shadow: 0 6px 20px rgba(204,120,92,0.1);
}

/* ── Shortcut Cards ────────────────────── */
.sc-card {
  background: white; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 15px; cursor: pointer; transition: all 0.14s;
}
.sc-card:hover { border-color: var(--coral); transform: translateY(-1px); }

/* ── Memory Items ──────────────────────── */
.memory-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid #f5f0e8; cursor: pointer;
  transition: background 0.1s;
}
.memory-item:last-child { border-bottom: none; }
.memory-item:hover { background: #faf7f2; }
.memory-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px; background: var(--card); color: var(--sub);
}

/* ── Slash Menu ────────────────────────── */
#slash-menu {
  position: fixed; z-index: 999;
  background: white; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12); min-width: 260px; overflow: hidden;
  display: none;
}
#slash-menu.visible { display: block; animation: panelIn 0.12s ease; }
.slash-section { padding: 6px 12px 4px; font-size: 9px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid #f5f0e8; }
.slash-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  cursor: pointer; font-size: 13px; transition: background 0.1s;
}
.slash-item:hover, .slash-item.focused { background: var(--cream); }
.slash-cmd { font-size: 11px; color: var(--coral); font-weight: 700; font-family: monospace; min-width: 80px; }

/* ── Spin ──────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.7s linear infinite; display: inline-block; }

/* ── Action Button (generic) ───────────── */
.action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border); border-radius: 7px; padding: 6px 12px;
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
  background: white; color: var(--sub); transition: all 0.12s;
}
.action-btn:hover { background: var(--card); border-color: #d0c4b4; }
.action-btn.danger:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }

/* ── Mobile Sidebar Drawer ─────────────────────────────── */
.mobile-menu-trigger,
.mobile-sidebar-overlay,
.mobile-sidebar-close {
  display: none;
}

.mobile-menu-trigger {
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(120,90,60,0.18);
  border-radius: 14px;
  background: rgba(255,250,242,0.92);
  color: #2f2924;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(47, 41, 36, 0.08);
}

.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(24, 23, 21, 0.54);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

/* ── Mobile UX Patch · 2026-05-08 ─────────────────────── */
@media (max-width: 768px) {
  * {
    word-break: keep-all;
    overflow-wrap: anywhere;
  }

  html,
  body {
    overflow-x: hidden;
    width: 100%;
  }

  body > div[style*="height:100vh"] {
    width: 100vw;
  }

  body > div > aside {
    position: fixed !important;
    top: 10px;
    left: 0;
    z-index: 90;
    width: min(292px, calc(100vw - 24px)) !important;
    min-width: 280px !important;
    max-width: calc(100vw - 24px) !important;
    height: calc(100dvh - 20px) !important;
    flex-basis: auto !important;
    background: #fff9f3 !important;
    border: 1px solid #f1e7db !important;
    border-radius: 0 22px 22px 0 !important;
    color: #2f2924 !important;
    transform: translateX(-100%);
    box-shadow:
      18px 0 44px rgba(47, 41, 36, 0.18),
      inset -1px 0 0 rgba(255, 255, 255, 0.82);
    opacity: 0.98;
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
    will-change: transform, opacity;
    overflow: hidden;
  }

  body.mobile-sidebar-open > div > aside {
    transform: translateX(0) !important;
    opacity: 1 !important;
  }

  body.mobile-sidebar-open {
    overflow: hidden;
  }

  body.mobile-sidebar-open .mobile-sidebar-overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-trigger {
    display: inline-flex;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    left: 16px;
    z-index: 1200;
    width: 44px;
    height: 44px;
    background: rgba(255,250,242,0.92);
    border-color: rgba(120,90,60,0.18);
    border-radius: 14px;
    color: #2f2924;
    box-shadow: 0 4px 14px rgba(47, 41, 36, 0.08);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  }

  .mobile-menu-trigger svg {
    width: 20px;
    height: 20px;
  }

  .mobile-menu-trigger:hover,
  .mobile-menu-trigger:active {
    background: rgba(255,244,232,0.96);
    border-color: rgba(204,120,92,0.26);
    filter: none;
  }

  body.mobile-sidebar-open .mobile-menu-trigger {
    transform: translateX(-8px);
    opacity: 0;
    pointer-events: none;
    background: #ffffff;
    border-color: #f1d4c0;
    color: #e58a5b;
    box-shadow: 0 7px 18px rgba(229, 138, 91, 0.18);
  }

  .mobile-sidebar-overlay {
    background: rgba(47, 41, 36, 0.25);
    backdrop-filter: blur(2px);
  }

  body > div > aside > div:first-child {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 16px 16px 14px !important;
    cursor: pointer;
    border-bottom: 1px solid #f1e7db !important;
    background: rgba(255, 255, 255, 0.58);
  }

  body > div > aside > div:first-child > div {
    justify-content: flex-start;
    min-width: 0;
  }

  body > div > aside > div:first-child > div > div:first-child {
    background: #e58a5b !important;
    box-shadow: 0 8px 18px rgba(229, 138, 91, 0.22);
  }

  body > div > aside > div:first-child > div > div:last-child > div:first-child {
    color: #2f2924 !important;
  }

  body > div > aside > div:first-child > div > div:last-child > div:last-child {
    color: #7a6e61 !important;
  }

  .mobile-sidebar-close {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #f1e7db;
    border-radius: 12px;
    background: #ffffff;
    color: #7a6e61;
    cursor: pointer;
    flex: 0 0 auto;
    box-shadow: 0 6px 16px rgba(47, 41, 36, 0.06);
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-sidebar-close:hover,
  .mobile-sidebar-close:active {
    color: #e58a5b;
    border-color: #f1d4c0;
    background: #fff4ec;
  }

  body > div > aside > div:first-child > div > div:last-child,
  body > div > aside > div:last-child,
  .nav-section-label,
  .nav-badge {
    display: revert !important;
  }

  .nav-item {
    justify-content: flex-start;
    gap: 10px;
    min-height: 50px;
    padding: 12px 13px !important;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 650;
    color: #2f2924;
    background: #ffffff !important;
    border: 1px solid #f1e7db !important;
    border-left: 4px solid transparent !important;
    border-radius: 14px !important;
    box-shadow: 0 7px 18px rgba(47, 41, 36, 0.045) !important;
  }

  .nav-item:hover {
    color: #2f2924;
    background: #fff4ec !important;
    border-color: #f1d4c0 !important;
    filter: none;
    transform: translateY(-1px);
  }

  .nav-item.active {
    color: #2f2924 !important;
    background: linear-gradient(90deg, rgba(229, 138, 91, 0.18), rgba(255, 255, 255, 0.96)) !important;
    border-color: #f1d4c0 !important;
    border-left-color: #e58a5b !important;
    box-shadow:
      0 0 0 1px rgba(229, 138, 91, 0.08),
      0 10px 24px rgba(229, 138, 91, 0.12) !important;
  }

  .nav-item.disabled {
    color: #b7aa9b !important;
    opacity: 0.72;
    background: rgba(255, 255, 255, 0.62) !important;
  }

  .nav-item svg {
    width: 16px;
    height: 16px;
    color: #e58a5b;
    flex: 0 0 auto;
  }

  .nav-section-label {
    color: #e58a5b;
    padding: 18px 12px 8px;
    font-size: 9px;
    letter-spacing: 1.5px;
  }

  .nav-badge,
  .nav-badge-coral,
  .nav-badge-muted,
  .nav-badge-green {
    min-width: 24px;
    text-align: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fff1e8;
    color: #e58a5b;
    border: 1px solid #f1d4c0;
  }

  body > div > aside > div:last-child {
    margin: 0 12px 12px !important;
    padding: 12px !important;
    border: 1px solid #f1e7db !important;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 26px rgba(47, 41, 36, 0.06);
    backdrop-filter: blur(14px);
  }

  body > div > aside > div:last-child > div:first-child span {
    color: #7a6e61 !important;
  }

  body > div > aside > div:last-child > div:last-child {
    background: rgba(255, 255, 255, 0.86) !important;
    border-color: #f1e7db !important;
    border-radius: 14px !important;
    box-shadow:
      0 8px 20px rgba(47, 41, 36, 0.055),
      inset 0 1px 0 rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(10px);
  }

  body > div > aside > div:last-child > div:last-child > div:first-child {
    color: #2f2924 !important;
  }

  body > div > aside > div:last-child > div:last-child > div:last-child {
    color: #7a6e61 !important;
  }

  body > div > main {
    width: 100vw !important;
    margin-left: 0 !important;
    min-width: 0;
    flex: 1 1 auto !important;
  }

  #topbar {
    padding: 10px 14px 10px 72px;
    gap: 8px;
    min-height: 60px;
  }

  #topbar > div:first-child {
    min-width: 0;
  }

  #topbar > div:last-child {
    gap: 7px !important;
  }

  .tools-menu-trigger {
    padding: 0 10px;
  }

  .tools-menu-list {
    right: -42px;
  }

  #clock,
  #topbar kbd {
    display: none;
  }

  .panel {
    padding: 16px 14px !important;
  }

  #panel-dashboard > div[style*="grid-template-columns"],
  #panel-memory > div[style*="grid-template-columns"],
  #panel-dashboard > div[style*="1.6fr"],
  #skill-grid,
  #sc-grid {
    grid-template-columns: 1fr !important;
  }

  .card,
  .card-sm,
  .kpi-card,
  .skill-card,
  .sc-card {
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(24, 23, 21, 0.08);
  }

  .action-btn:hover,
  .action-btn:active,
  .card:hover,
  .card-sm:hover,
  .kpi-card:hover,
  .skill-card:hover,
  .sc-card:hover {
    filter: brightness(1.02);
  }

  #cmd-input,
  #cmd-workspace,
  textarea {
    min-height: 120px !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
  }

  #exec-strip,
  .output-body,
  .runtime-log {
    line-height: 1.65;
  }

  .pill,
  .output-actions,
  .output-header,
  #quick-sc,
  #panel-dashboard div[style*="flex-wrap:wrap"],
  #panel-command div[style*="flex-wrap:wrap"] {
    flex-wrap: wrap !important;
  }

  .pill {
    white-space: normal;
    line-height: 1.35;
  }

  .output-header {
    align-items: flex-start;
    gap: 8px;
  }

  .output-actions {
    justify-content: flex-start;
  }

  .run-row {
    align-items: flex-start;
    gap: 9px;
    padding: 11px 12px;
  }

  #panel-runs .card-sm > div[style*="overflow-x:auto"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #panel-runs table {
    min-width: 720px !important;
  }

  #panel-runs > div:first-child,
  #panel-memory > div:first-child {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }

  .memory-item {
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .login-gate {
    padding: 22px 14px;
    align-items: center;
  }

  .login-card {
    min-height: auto;
    gap: 22px;
    padding: 34px 24px 28px;
    border-radius: 16px;
  }
  .login-copy {
    gap: 12px;
  }

  .login-copy h1 {
    font-size: 25px;
    line-height: 1.28;
  }

  .login-copy p {
    font-size: 14.5px;
  }

  .google-login-btn {
    min-height: 58px;
    font-size: 15.5px;
  }

  body > div > aside {
    width: min(292px, calc(100vw - 16px)) !important;
    min-width: 280px !important;
    max-width: calc(100vw - 16px) !important;
    flex-basis: auto !important;
  }

  body > div > main {
    width: 100vw !important;
  }

  .panel {
    padding: 14px 10px !important;
  }

  .kpi-card {
    padding: 14px;
  }
}

/* ── Idea Vault ─────────────────────────── */
.iv-tab {
  padding: 5px 12px; font-size: 12px; font-weight: 500;
  border-radius: 7px; border: 1px solid var(--border);
  background: white; color: var(--sub); cursor: pointer; font-family: inherit;
  transition: all 0.12s; white-space: nowrap;
}
.iv-tab:hover { background: #faf7f2; border-color: var(--coral); color: var(--coral); }
.iv-tab.iv-tab-active {
  background: rgba(204,120,92,0.1); border-color: rgba(204,120,92,0.3);
  color: var(--coral); font-weight: 600;
}
.iv-tab-count {
  font-size: 10px; background: rgba(0,0,0,0.06);
  border-radius: 8px; padding: 1px 5px; margin-left: 3px;
}
.iv-tab.iv-tab-active .iv-tab-count { background: rgba(204,120,92,0.15); color: #cc785c; }

.iv-select {
  padding: 5px 10px; font-size: 11.5px; color: var(--sub);
  border: 1px solid var(--border); border-radius: 7px;
  background: white; font-family: inherit; cursor: pointer;
  outline: none; transition: border-color 0.12s;
}
.iv-select:focus { border-color: var(--coral); }

.iv-row:hover td { background: #faf7f2; }
.iv-row-sel td { background: rgba(204,120,92,0.06) !important; }
.iv-row-sel td:first-child { border-left: 2px solid var(--coral); }

@media (max-width: 1024px) {
  .iv-stats-grid { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 768px) {
  .iv-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .iv-main-grid  { grid-template-columns: 1fr !important; }
  #iv-detail { position: static !important; max-height: none !important; }
}
