:root {
  --bg: #080711;
  --panel: rgba(16, 13, 28, 0.92);
  --panel-2: rgba(31, 24, 48, 0.92);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f7f1df;
  --muted: #c4b8d9;
  --gold: #ffcf4d;
  --pink: #ff3fa9;
  --cyan: #3ff7dc;
  --green: #70ff65;
  --red: #ff5555;
  --orange: #ff8b3d;
  --shadow: rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --radius-sm: 12px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: radial-gradient(circle at top left, #2c1144 0, #080711 45%, #030308 100%);
  color: var(--text);
  font-family: var(--font);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.75), transparent 80%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(35, 17, 62, 0.88), rgba(10, 10, 20, 0.92));
  box-shadow: 0 20px 50px var(--shadow);
}

.brand-lockup h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  color: var(--gold);
  text-shadow: 3px 3px 0 #130a20, 0 0 18px rgba(255, 63, 169, 0.45);
}

.brand-lockup p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.15rem);
}

.mini-label {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--cyan);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
}

.save-chip,
.stat-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 18px;
  margin-top: 18px;
}

.side-nav {
  position: sticky;
  top: 18px;
  align-self: start;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 20px 50px var(--shadow);
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 13px;
  margin-bottom: 8px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  text-align: left;
}

.nav-btn:hover,
.nav-btn.active {
  border-color: rgba(63, 247, 220, 0.55);
  background: linear-gradient(135deg, rgba(63, 247, 220, 0.16), rgba(255, 63, 169, 0.12));
}

.nav-btn.locked {
  opacity: 0.52;
}

.screen {
  min-height: 70vh;
}

.hero {
  min-height: 450px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-position: center;
  background-size: cover;
  overflow: hidden;
  position: relative;
  box-shadow: 0 22px 60px var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(4, 4, 10, 0.82), rgba(4,4,10,0.28), rgba(4,4,10,0.76));
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 760px;
  padding: clamp(22px, 5vw, 54px);
}

.hero-content h2,
.section-title {
  margin: 0 0 10px;
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 0.95;
  color: var(--gold);
  text-shadow: 3px 3px 0 #16091e, 0 0 18px rgba(255, 63, 169, 0.5);
}

.hero-content p,
.card p,
.notice p {
  color: var(--muted);
  line-height: 1.5;
}

.row,
.actions,
.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card,
.notice,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 45px var(--shadow);
}

.card {
  padding: 18px;
}

.card h3,
.card h4 {
  margin: 0 0 10px;
}

.card h3 {
  color: var(--cyan);
  font-size: 1.35rem;
}

.notice {
  padding: 16px;
  margin-top: 16px;
}

.actions {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-top: 16px;
}

.btn,
.small-btn {
  border: 0;
  border-radius: 14px;
  color: #120914;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  font-weight: 900;
  padding: 12px 14px;
  box-shadow: 0 10px 22px rgba(255, 139, 61, 0.18);
}

.btn.secondary,
.small-btn.secondary {
  color: var(--text);
  background: linear-gradient(135deg, rgba(63, 247, 220, 0.22), rgba(255, 63, 169, 0.18));
  border: 1px solid rgba(63, 247, 220, 0.35);
}

.btn.danger,
.small-btn.danger {
  color: white;
  background: linear-gradient(135deg, var(--red), #7a1130);
}

.btn.ghost,
.small-btn.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
}

.btn:disabled,
.small-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.small-btn {
  padding: 8px 10px;
  font-size: 0.9rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: rgba(255, 255, 255, 0.065);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 1.15rem;
  color: var(--text);
}

.meter {
  width: 100%;
  min-height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
}

.meter > i {
  display: block;
  height: 100%;
  min-height: 14px;
  background: linear-gradient(90deg, var(--green), var(--gold), var(--red));
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--cyan);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tr:last-child td {
  border-bottom: 0;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  padding: 10px 12px;
}

input[type="number"] {
  max-width: 110px;
}

textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
}

.screen-img {
  min-height: 260px;
  border-radius: var(--radius);
  background-position: center;
  background-size: cover;
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.screen-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.55));
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 2px;
}

.log-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.log-item {
  border-left: 3px solid var(--pink);
  padding: 8px 10px;
  background: rgba(255,255,255,0.055);
  border-radius: 0 10px 10px 0;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(120px);
  max-width: min(680px, calc(100vw - 28px));
  background: rgba(8, 7, 17, 0.95);
  border: 1px solid rgba(255, 207, 77, 0.5);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 999px;
  box-shadow: 0 18px 45px var(--shadow);
  transition: transform 0.25s ease;
  z-index: 40;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

hr.soft {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.footer-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1050px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    display: none;
  }

  .stats-grid,
  .grid.four,
  .grid.three,
  .grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px;
  }

  .topbar {
    flex-direction: column;
  }

  .stats-grid,
  .grid.four,
  .grid.three,
  .grid.two,
  .actions {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 520px;
  }

  th,
  td {
    padding: 10px 8px;
  }
}

/* v0.1.4 mobile layout polish */
.quick-actions {
  display: grid;
  grid-template-columns: 1.35fr repeat(4, minmax(120px, 1fr));
  gap: 10px;
  align-items: stretch;
  margin: 0 0 16px;
  padding: 10px;
  border: 1px solid rgba(255, 207, 77, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 207, 77, 0.12), rgba(255, 63, 169, 0.08), rgba(63, 247, 220, 0.08));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.quick-actions .btn,
.quick-actions .small-btn {
  min-height: 48px;
}

.day-btn {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 2px rgba(255, 207, 77, 0.16), 0 14px 28px rgba(255, 139, 61, 0.22);
}

.key-stat {
  border-color: rgba(255, 207, 77, 0.34);
  background: rgba(255, 207, 77, 0.08);
}

@media (max-width: 1050px) {
  .layout {
    gap: 10px;
  }

  .side-nav {
    position: sticky;
    top: 8px;
    z-index: 25;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px;
    scrollbar-width: thin;
  }

  .nav-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 132px;
    margin-bottom: 0;
    justify-content: center;
    text-align: center;
    min-height: 48px;
  }

  .nav-btn span:last-child {
    display: none;
  }

  .quick-actions {
    position: sticky;
    top: 72px;
    z-index: 20;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow-x: auto;
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 18px;
  }

  .topbar {
    gap: 10px;
    padding: 12px;
  }

  .brand-lockup h1 {
    font-size: clamp(2.1rem, 12vw, 3.25rem);
  }

  .brand-lockup p {
    font-size: 0.92rem;
  }

  .save-chip,
  .stat-chip {
    white-space: normal;
    width: 100%;
    text-align: center;
  }

  .side-nav {
    margin: 0 -2px;
    border-radius: 14px;
  }

  .nav-btn {
    min-width: 116px;
    padding: 11px 12px;
    font-size: 0.95rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
    margin: 10px 0;
  }

  .stat {
    padding: 10px;
    min-height: 74px;
  }

  .stat span {
    font-size: 0.7rem;
  }

  .stat strong {
    font-size: 0.98rem;
    overflow-wrap: anywhere;
  }

  .quick-actions {
    position: sticky;
    top: 6px;
    z-index: 35;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px;
  }

  .quick-actions .day-btn {
    grid-column: 1 / -1;
    min-height: 54px;
    font-size: 1.12rem;
  }

  .card,
  .notice,
  .table-wrap {
    border-radius: 14px;
  }

  .card {
    padding: 14px;
  }

  .screen-img {
    min-height: 160px;
    margin-bottom: 10px;
  }

  .hero {
    min-height: 380px;
  }

  .hero-content {
    padding: 22px;
  }

  .actions {
    gap: 10px;
  }

  .btn,
  .small-btn {
    width: 100%;
    min-height: 48px;
  }

  .inline-form {
    align-items: stretch;
    width: 100%;
  }

  .inline-form input,
  .inline-form select,
  .inline-form button {
    width: 100%;
  }

  input[type="number"] {
    max-width: none;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  th,
  td {
    padding: 9px 8px;
    font-size: 0.92rem;
  }

  .log-list {
    max-height: 210px;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding: 8px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .quick-actions {
    grid-template-columns: 1fr 1fr;
  }

  .screen-img {
    min-height: 130px;
  }

  .hero {
    min-height: 340px;
  }

  .section-title,
  .hero-content h2 {
    font-size: 2.1rem;
  }
}

.tutorial-card {
  margin-bottom: 14px;
}

.tutorial-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.tutorial-step {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.055);
  padding: 12px;
}

.tutorial-step strong {
  display: block;
  color: var(--gold);
  margin-bottom: 6px;
}

.tutorial-step span {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.how-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.how-list li {
  margin: 0 0 8px;
}

.how-list strong {
  color: var(--text);
}

@media (max-width: 760px) {
  .tutorial-steps {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .tutorial-step {
    padding: 11px;
  }

  .how-list {
    padding-left: 18px;
  }
}

.crypto-report {
  border-color: rgba(89, 255, 199, 0.35);
  box-shadow: 0 0 0 1px rgba(89, 255, 199, 0.08) inset;
}

.report-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.report-line {
  display: grid;
  grid-template-columns: 1.15fr 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  padding: 10px;
}

.report-line small {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.4;
}

.report-line .good {
  color: var(--green);
  font-weight: 900;
}

.report-line .bad {
  color: var(--red);
  font-weight: 900;
}

.muted {
  color: var(--muted);
}

@media (max-width: 760px) {
  .report-line {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}


.dealer-art {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  margin-bottom: 12px;
  display: block;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.dealer-card.selected {
  border-color: rgba(63, 247, 220, 0.7);
  box-shadow: 0 0 0 1px rgba(63, 247, 220, 0.18) inset, 0 18px 45px var(--shadow);
}

.good {
  color: var(--green);
  font-weight: 900;
}

.bad {
  color: var(--red);
  font-weight: 900;
}

@media (max-width: 760px) {
  .dealer-card p {
    margin-bottom: 10px;
  }
}
