/* ========================================================
   COOKER · App shell
   ======================================================== */

.app-body { min-height: 100vh; }

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ---------- Sidebar ---------- */
.side {
  background: rgba(8, 13, 24, 0.6);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side .brand { margin-bottom: 28px; padding: 4px 6px; }

.side__nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side__link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  transition: all 0.15s;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
}
.side__link svg { width: 18px; height: 18px; flex-shrink: 0; }
.side__link:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.side__link.active {
  background: linear-gradient(180deg, rgba(249,115,22,0.12), rgba(249,115,22,0.04));
  color: var(--orange-2);
  border-color: rgba(249,115,22,0.2);
}

.side__foot { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

.mode-card {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
}
.mode-card__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 10px;
}
.mode-switch {
  display: flex;
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 10px;
}
.mode-switch__btn {
  flex: 1;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.mode-switch__btn.active {
  background: var(--orange);
  color: #1a0f04;
  box-shadow: 0 2px 10px -2px rgba(249,115,22,0.5);
}
.mode-card__hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.side__back {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  transition: color 0.15s;
}
.side__back svg { width: 14px; height: 14px; }
.side__back:hover { color: var(--orange-2); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(8,13,24,0.6);
  backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 50;
}
.topbar__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  flex: 1;
}
.topbar__actions { display: flex; align-items: center; gap: 10px; }

.mode-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(249,115,22,0.08);
  border: 1px solid rgba(249,115,22,0.25);
  font-size: 12px;
  font-weight: 600;
  color: var(--orange-2);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mode-pill.live {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.25);
  color: var(--pos);
}
.mode-pill__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse 2s infinite;
}

.burger { display: none; width: 40px; height: 40px; flex-direction: column; justify-content: center; align-items: center; gap: 4px; background: none; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.burger span { display: block; width: 18px; height: 2px; background: var(--text); }

.view { padding: 32px; flex: 1; }

/* ---------- Cards ---------- */
.card {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
}
.card--accent {
  background: linear-gradient(180deg, rgba(249,115,22,0.06), rgba(249,115,22,0.01));
  border-color: rgba(249,115,22,0.25);
}
.card__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card__title { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.card__sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------- Dashboard ---------- */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  padding: 20px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
}
.stat-card__label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.stat-card__val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat-card__delta { margin-top: 6px; font-size: 13px; font-weight: 500; }
.stat-card__delta.pos { color: var(--pos); }
.stat-card__delta.neg { color: var(--neg); }

.grid-2col {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}

/* ---------- Vault grid ---------- */
.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.v-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.v-card:hover { border-color: var(--border-2); transform: translateY(-2px); background: rgba(249,115,22,0.04); }
.v-card__head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.v-card__hex {
  width: 40px; height: 40px;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  box-shadow: 0 0 16px rgba(249,115,22,0.3);
  flex-shrink: 0;
}
.v-card__name { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.v-card__sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.v-card__body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin-bottom: 18px; }
.v-card__kv .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px; }
.v-card__kv .v { font-family: var(--font-mono); font-weight: 600; font-size: 14px; }
.v-card__enc {
  padding: 12px 14px;
  background: rgba(249,115,22,0.06);
  border: 1px solid rgba(249,115,22,0.2);
  border-radius: 10px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted);
}
.v-card__enc-dots { font-family: var(--font-mono); color: var(--orange); letter-spacing: 2px; }

.v-card__badge {
  padding: 3px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  font-family: var(--font-mono);
}
.v-card__badge.risk-Low { background: rgba(34,197,94,0.12); color: var(--pos); }
.v-card__badge.risk-Medium { background: rgba(251,191,36,0.12); color: #fbbf24; }
.v-card__badge.risk-High { background: rgba(239,68,68,0.12); color: var(--neg); }

/* ---------- Filter row ---------- */
.filter-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-btn {
  padding: 8px 16px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--border-2); color: var(--text); }
.filter-btn.active {
  background: rgba(249,115,22,0.12);
  border-color: rgba(249,115,22,0.35);
  color: var(--orange-2);
}

/* ---------- Portfolio ---------- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}
.empty-state__icon {
  width: 80px; height: 80px;
  margin: 0 auto 20px;
  background: rgba(249,115,22,0.08);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--orange);
}
.empty-state h3 { font-family: var(--font-display); font-size: 20px; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

.pos-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.pos-row:last-child { border-bottom: none; }
.pos-row__hex {
  width: 32px; height: 32px;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}
.pos-row__name { font-weight: 700; font-size: 14px; }
.pos-row__sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pos-row__val { text-align: right; }
.pos-row__val .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.pos-row__val .v { font-family: var(--font-mono); font-weight: 600; font-size: 14px; margin-top: 2px; }

/* ---------- Activity log ---------- */
.activity-list { display: flex; flex-direction: column; gap: 8px; }
.act-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.15s;
}
.act-item:hover { border-color: var(--border-2); }
.act-item__ico {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: rgba(249,115,22,0.12);
  color: var(--orange);
}
.act-item__ico svg { width: 14px; height: 14px; }
.act-item__ico.withdraw { background: rgba(239,68,68,0.12); color: var(--neg); }
.act-item__ico.created { background: rgba(34,197,94,0.12); color: var(--pos); }
.act-item__main { min-width: 0; }
.act-item__title { font-size: 13px; font-weight: 600; }
.act-item__meta { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: var(--font-mono); }
.act-item__time { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }

/* ---------- Forms ---------- */
.form-grid { display: flex; flex-direction: column; gap: 16px; max-width: 560px; }
.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.15s;
}
.form-field textarea { resize: vertical; min-height: 100px; font-family: var(--font-mono); font-size: 13px; }
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: rgba(249,115,22,0.5);
  background: rgba(249,115,22,0.04);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
}
.color-swatch.active { border-color: var(--text); transform: scale(1.1); }

/* ---------- Modals ---------- */
.modal {
  position: fixed; inset: 0;
  z-index: 500;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal.show { display: flex; }
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 7, 15, 0.7);
  backdrop-filter: blur(6px);
}
.modal__panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7), var(--shadow-glow);
  max-height: 90vh;
  overflow-y: auto;
}

.modal__head { margin-bottom: 20px; }
.modal__title { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.01em; }
.modal__sub { font-size: 13px; color: var(--muted); margin-top: 6px; }

.modal__close {
  position: absolute; top: 18px; right: 18px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  transition: all 0.15s;
  cursor: pointer;
  border: none;
}
.modal__close:hover { background: rgba(255,255,255,0.1); color: var(--text); }

/* ---------- MPC modal ---------- */
.mpc-header { text-align: center; margin-bottom: 20px; }
.mpc-header h3 { font-family: var(--font-display); font-weight: 700; font-size: 20px; margin-bottom: 6px; }
.mpc-header p { font-size: 13px; color: var(--muted); }

.mpc-hexes {
  display: flex; justify-content: center; gap: 8px;
  margin-bottom: 20px;
}
.mpc-hexes span {
  width: 18px; height: 18px;
  background: var(--orange);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  animation: mpcPulse 1.4s ease-in-out infinite;
}
.mpc-hexes span:nth-child(2) { animation-delay: 0.2s; }
.mpc-hexes span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mpcPulse {
  0%, 100% { transform: scale(0.8); opacity: 0.4; }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 16px var(--orange); }
}

.mpc-log {
  max-height: 240px;
  overflow-y: auto;
  padding: 14px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 16px;
}
.mpc-log__line {
  padding: 6px 0;
  color: var(--text-2);
  opacity: 0;
  animation: fadeIn 0.4s forwards;
  border-bottom: 1px dashed rgba(148,163,184,0.06);
}
.mpc-log__line:last-child { border-bottom: none; }
.mpc-log__line.success { color: var(--pos); }
.mpc-log__line.label { color: var(--orange-2); }
.mpc-log__line.hash { color: var(--gold); word-break: break-all; }
@keyframes fadeIn { to { opacity: 1; } }

.mpc-foot { display: flex; justify-content: center; }

/* ---------- Utility ---------- */
.row-between { display: flex; justify-content: space-between; align-items: center; }
.flex-grow { flex: 1; }
.amount-input-row { display: flex; gap: 8px; align-items: center; }
.amount-quick { display: flex; gap: 6px; }
.amount-quick button {
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.amount-quick button:hover { background: rgba(249,115,22,0.1); color: var(--orange-2); }

.tab-switch { display: flex; padding: 3px; background: rgba(0,0,0,0.3); border-radius: 10px; margin-bottom: 20px; }
.tab-switch button {
  flex: 1; padding: 10px; border-radius: 8px;
  background: transparent; border: none; color: var(--muted);
  font-weight: 600; font-size: 14px; cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.tab-switch button.active { background: var(--orange); color: #1a0f04; }

.v-detail-strategy {
  padding: 16px;
  background: rgba(249,115,22,0.06);
  border: 1px solid rgba(249,115,22,0.2);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 20px;
}
.v-detail-strategy strong { color: var(--orange-2); }

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}
.section-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .side {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .side.open { transform: translateX(0); }
  .burger { display: flex; }
  .grid-2col { grid-template-columns: 1fr; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .topbar { padding: 14px 20px; }
  .topbar__title { font-size: 18px; }
  .view { padding: 20px 16px; }
  .vault-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .grid-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 16px; }
  .stat-card__val { font-size: 22px; }
  .topbar__actions .btn span { display: none; }
  .topbar__actions #connect-btn { padding: 10px; }
  .mode-pill { padding: 5px 10px; font-size: 11px; }
  .modal__panel { padding: 22px 18px; }
  .pos-row { grid-template-columns: auto 1fr auto; gap: 10px; padding: 14px 16px; }
  .pos-row__val.desk-only { display: none; }
  .v-card { padding: 18px; }
}

/* ---------- Scroll-in-sidebar on overflow ---------- */
.side { overflow-y: auto; }
.side::-webkit-scrollbar { width: 6px; }
.side::-webkit-scrollbar-track { background: transparent; }
.side::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.1); border-radius: 3px; }
