﻿:root {
  --bg: #0a0f15;
  --bg-2: #101722;
  --panel: #121a25;
  --panel-2: #0f1620;
  --panel-3: #0c121b;
  --text: #e7edf5;
  --muted: #8c9aad;
  --accent: #4ee1b8;
  --accent-2: #5aa8ff;
  --danger: #ff6b6b;
  --success: #3ed69b;
  --border: rgba(255, 255, 255, 0.08);
  --border-soft: rgba(255, 255, 255, 0.05);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% 10%, rgba(90, 168, 255, 0.12), transparent 50%),
    radial-gradient(circle at 70% 0%, rgba(78, 225, 184, 0.12), transparent 45%),
    var(--bg);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), transparent 60%);
  pointer-events: none;
}

.hidden {
  display: none;
}

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.app-shell {
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
  gap: 24px;
  padding: 0;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 40px;
  width: min(360px, 100%);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  gap: 18px;
  animation: floatIn 0.6s ease;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.save-indicator {
  font-family: "Sora", sans-serif;
  border-radius: 999px;
  padding: 10px 18px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.danger-btn {
  font-family: "Sora", sans-serif;
  border-radius: 999px;
  padding: 10px 18px;
  border: 1px solid rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.12);
  color: #ffb3b3;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.danger-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #041015;
  box-shadow: 0 12px 30px rgba(78, 225, 184, 0.2);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(78, 225, 184, 0.28);
}

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

.ghost-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

#save-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 999;
}

#save-progress .bar {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  transform: translateX(-100%);
  animation: progress 1.2s ease-in-out infinite;
}

body.saving #save-progress {
  opacity: 1;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  padding: 20px 32px;
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  gap: 24px;
  align-items: center;
  background: rgba(8, 12, 18, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.brand-pill {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.18em;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
}

.date-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.date-copy {
  display: grid;
  gap: 4px;
  min-width: 170px;
}

#today-date {
  font-size: 16px;
  font-weight: 600;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.date-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

#add-date {
  background: var(--panel-3);
  border: 1px solid var(--border-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: "IBM Plex Mono", monospace;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border: 1px solid var(--border-soft);
  font-size: 11px;
  padding: 8px 10px;
}

.field-value {
  background: var(--panel-3);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 12px 14px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  font-size: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
}

.user-meta {
  display: grid;
  gap: 2px;
  text-align: right;
}

#user-name {
  font-size: 12px;
  font-weight: 600;
}

#user-email {
  font-size: 11px;
  color: var(--muted);
}

.app-grid {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
  padding: 24px 32px 60px;
}

.left-col,
.right-col {
  display: grid;
  gap: 24px;
}

.card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h2,
h3 {
  margin: 0;
  font-weight: 600;
}

.chip {
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid var(--border-soft);
}

.chip.profit {
  color: #9af0c4;
  background: rgba(62, 214, 155, 0.18);
}

.chip.loss {
  color: #ffb2b9;
  background: rgba(255, 95, 109, 0.16);
}

.today-card {
  display: grid;
  gap: 16px;
}

.today-value {
  font-size: 40px;
  font-weight: 600;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.table {
  display: grid;
  gap: 12px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  transition: border 0.2s ease, background 0.2s ease;
}

.table-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.table-head {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
  background: transparent;
  border: none;
}

.table-body .table-row {
  cursor: pointer;
}

.table-body .table-row.empty-row {
  cursor: default;
}

.table-body {
  display: grid;
  gap: 10px;
}

.date-stack {
  display: grid;
  gap: 4px;
}

.date-stack span:first-child {
  font-size: 14px;
  font-weight: 600;
}

.date-stack span:last-child {
  font-size: 11px;
  color: var(--muted);
}

.value-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
}

.value-input span {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
}

.value-input input {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  width: 100%;
  outline: none;
  font-family: "IBM Plex Mono", monospace;
}

.value-display {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  color: var(--text);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.tag.profit {
  background: rgba(62, 214, 155, 0.2);
  color: #9af0c4;
}

.tag.loss {
  background: rgba(255, 95, 109, 0.18);
  color: #ffb2b9;
}

.ranking-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.rank-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.rank-number {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  background: rgba(78, 225, 184, 0.2);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 600;
}

.rank-details {
  display: grid;
  gap: 4px;
}

.rank-details span:first-child {
  font-weight: 600;
}

.rank-details span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.save-indicator {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
}

.save-indicator.hidden {
  display: none;
}

.save-indicator .icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(62, 214, 155, 0.2);
  display: grid;
  place-items: center;
}

.save-indicator svg {
  width: 14px;
  height: 14px;
}

.save-indicator .tick {
  fill: none;
  stroke: var(--success);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 28;
  stroke-dashoffset: 28;
}

body.saved .save-indicator .tick {
  animation: draw 0.6s ease forwards;
}

.popup {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 6, 10, 0.6);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.popup.show {
  opacity: 1;
  pointer-events: auto;
}

.popup-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 28px;
  min-width: 260px;
  text-align: center;
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
}

.popup-card.success {
  border-color: rgba(62, 214, 155, 0.4);
}

.popup-card.error {
  border-color: rgba(255, 95, 109, 0.4);
}

.popup-title {
  font-weight: 600;
}

.popup-message {
  color: var(--muted);
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 7, 11, 0.72);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1200;
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(420px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
}

.modal-card.modal-wide {
  width: min(760px, 92vw);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.modal-title {
  font-weight: 600;
  font-size: 18px;
}

.modal-body {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.field input {
  background: var(--panel-3);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 0 6px;
}

.calendar-year {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  max-height: 60vh;
  overflow: auto;
  padding-right: 4px;
}

.month-card {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.month-title {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.month-labels,
.month-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.month-labels span {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.day {
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 11px;
  border-radius: 8px;
  padding: 6px 0;
  cursor: pointer;
}

.day.blank {
  background: transparent;
  cursor: default;
}

.day.today {
  border: 1px solid rgba(78, 225, 184, 0.4);
}

.day.selected {
  background: rgba(90, 168, 255, 0.24);
  color: #d8e7ff;
}

.small {
  font-size: 12px;
}

@keyframes progress {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(250%);
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .app-header {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

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

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