:root {
  --ink: #07140f;
  --ink-2: #0b1f18;
  --panel: #122820;
  --panel-2: #18352a;
  --line: rgba(180, 255, 170, 0.12);
  --text: #e8f6ea;
  --muted: #8eae97;
  --lime: #b8f255;
  --lime-dim: #7cbc2a;
  --amber: #ffb020;
  --coral: #ff6b4a;
  --sky: #5ec8ff;
  --radius: 18px;
  --font-brand: "Syne", sans-serif;
  --font-body: "Figtree", sans-serif;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

#app {
  min-height: 100dvh;
}

.view {
  display: none;
  min-height: 100dvh;
}

.view.is-active {
  display: block;
}

.view[hidden] {
  display: none !important;
}

/* —— Splash —— */
.view-splash {
  position: relative;
  display: none;
  overflow: hidden;
}

.view-splash.is-active {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.splash-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 70% 20%, rgba(184, 242, 85, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 50% at 15% 80%, rgba(94, 200, 255, 0.12), transparent 50%),
    linear-gradient(165deg, #05110c 0%, #0d2a1e 45%, #132a18 100%);
}

.splash-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23b8f255' stroke-opacity='0.08'%3E%3Cpath d='M0 30h60M30 0v60'/%3E%3C/g%3E%3C/svg%3E");
  animation: gridDrift 28s linear infinite;
}

@keyframes gridDrift {
  from { background-position: 0 0; }
  to { background-position: 60px 60px; }
}

.splash-inner {
  position: relative;
  text-align: center;
  max-width: 26rem;
  animation: riseIn 0.7s ease both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.splash-mark {
  display: block;
  margin: 0 auto 1.25rem;
  filter: drop-shadow(0 8px 24px rgba(184, 242, 85, 0.35));
  animation: bob 3.2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.brand {
  margin: 0;
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  background: linear-gradient(120deg, #f4ffe0 10%, var(--lime) 55%, #7ed957 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.splash-tag {
  margin: 1rem 0 1.75rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.splash-hint {
  margin: 1.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.download-panel {
  margin: 1.5rem auto 0;
  padding: 1rem 1.05rem 1.1rem;
  max-width: 22rem;
  text-align: left;
  border-radius: 16px;
  background: rgba(8, 28, 20, 0.65);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.download-title {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.download-sub {
  margin: 0.35rem 0 0.85rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Shell desktop/Electron: sembunyikan ajakan install (sudah di dalam app). */
html.cicak-desktop .download-panel,
body.cicak-desktop .download-panel,
html.cicak-desktop #btn-go-install-webs,
body.cicak-desktop #btn-go-install-webs {
  display: none !important;
}

.btn-download {
  flex: 1 1 8rem;
  background: rgba(184, 242, 85, 0.12);
  color: var(--lime);
  border: 1px solid rgba(184, 242, 85, 0.35);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  text-align: center;
}

.btn-download:hover {
  background: rgba(184, 242, 85, 0.22);
}

.download-note {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  color: var(--amber);
}

/* —— Buttons / forms —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--lime);
  color: #0a1a10;
  box-shadow: 0 10px 30px rgba(184, 242, 85, 0.25);
}

.btn-primary:hover {
  background: #c9ff6a;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 0.45rem 0.75rem;
}

.btn-block {
  width: 100%;
}

.link-back {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: inline-block;
}

.link-back:hover {
  color: var(--lime);
}

.panel-narrow {
  max-width: 24rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  animation: riseIn 0.45s ease both;
}

.panel-title {
  font-family: var(--font-brand);
  font-size: 1.85rem;
  margin: 0 0 0.35rem;
  letter-spacing: -0.03em;
}

.panel-sub {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.form label {
  display: block;
  margin-bottom: 1rem;
}

.form label span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.form input,
.search {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  outline: none;
}

.form input:focus,
.search:focus {
  border-color: rgba(184, 242, 85, 0.45);
  box-shadow: 0 0 0 3px rgba(184, 242, 85, 0.12);
}

.form-error {
  color: var(--coral);
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}

/* —— Topbar —— */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(11, 31, 24, 0.95), rgba(11, 31, 24, 0.7));
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.topbar-dash {
  align-items: center;
  flex-wrap: wrap;
  padding-top: 0.65rem;
  padding-bottom: 0.55rem;
  min-height: 0;
}

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 0 1 auto;
  min-width: 7rem;
}

.topbar-left .link-back {
  margin: 0 0 0.15rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lime-dim);
  font-weight: 600;
}

.topbar-title {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.topbar-dash .topbar-title {
  font-size: 1.15rem;
}

.meta {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 9rem;
  text-align: right;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  margin-left: auto;
}

.topbar-dash .token-rail {
  flex: 1 1 200px;
  margin: 0;
  max-width: min(520px, 100%);
  padding: 0.28rem 0.4rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(18, 40, 32, 0.85);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 0;
}

.topbar-dash .token-rail-head {
  margin: 0;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  max-width: 7.5rem;
}

.topbar-dash .token-rail-head h3 {
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lime-dim);
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.1;
}

.topbar-dash .token-rail-meta {
  font-size: 0.58rem;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 7.5rem;
}

.topbar-dash .token-rail-cards {
  flex: 1 1 auto;
  justify-content: flex-start;
  align-items: center;
  gap: 0.3rem;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding: 0;
  min-width: 0;
}

.topbar-dash .vt-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  max-width: none;
  padding: 0.2rem 0.4rem;
  border-radius: 8px;
  line-height: 1.15;
}

.topbar-dash .vt-ord {
  margin: 0;
  min-width: 0.85rem;
  height: 0.85rem;
  font-size: 0.55rem;
}

.topbar-dash .vt-name {
  font-size: 0.72rem;
  white-space: nowrap;
}

.topbar-dash .vt-flags {
  margin: 0;
  gap: 0.15rem;
}

.topbar-dash .vt-chip {
  font-size: 0.52rem;
  padding: 0.05rem 0.22rem;
}

@media (max-width: 720px) {
  .topbar-dash .token-rail {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }
  .topbar-dash .topbar-actions {
    margin-left: 0;
  }
  .topbar-dash .token-rail-meta {
    display: none;
  }
}

/* —— Webs —— */
.webs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  padding: 1.25rem;
}

.web-card {
  text-align: left;
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(184, 242, 85, 0.08), transparent 55%),
    var(--panel);
  border: 1px solid var(--line);
  transition: border-color 0.15s, transform 0.15s;
}

.web-card:hover {
  border-color: rgba(184, 242, 85, 0.35);
  transform: translateY(-2px);
}

.web-card strong {
  display: block;
  font-family: var(--font-brand);
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.web-card span {
  color: var(--muted);
  font-size: 0.85rem;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}

.empty.small {
  padding: 0.75rem 0;
  font-size: 0.85rem;
}

/* —— Dashboard layout —— */
.dash-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: calc(100dvh - 4.5rem);
}

.alerts-rail {
  order: -1;
  padding: 0.9rem 1.1rem 1rem;
  background: linear-gradient(180deg, rgba(255, 107, 74, 0.12), transparent 90%);
  border-bottom: 1px solid rgba(255, 107, 74, 0.2);
}

.alerts-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alerts-head h3 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1rem;
}

.badge {
  display: inline-flex;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.4rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--coral);
  color: #1a0a06;
  font-size: 0.75rem;
  font-weight: 700;
}

.alerts-sub {
  margin: 0.25rem 0 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.alerts-list {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.alert-card {
  flex: 0 0 auto;
  width: min(78vw, 260px);
  scroll-snap-align: start;
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  background: rgba(20, 10, 8, 0.55);
  border: 1px solid rgba(255, 107, 74, 0.35);
}

.alert-card strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-card .alert-meta {
  font-size: 0.75rem;
  color: #ffc4b5;
}

.alert-card .alert-reason {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--amber);
}

.dash-main {
  flex: 1;
  padding: 1rem 1.1rem 2.5rem;
}

.dash-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.search {
  flex: 1 1 180px;
  max-width: 320px;
}

.totals {
  font-size: 0.85rem;
  color: var(--muted);
}

.person-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.person-block.zero-spend-card {
  order: 9999;
  border-color: rgba(255, 176, 32, 0.35);
}

.person-block.zero-spend-card .person-block-head {
  background: linear-gradient(120deg, #ffb020, #e09a12) !important;
  color: #1a1408 !important;
  cursor: pointer;
  user-select: none;
}

.person-block.zero-spend-card .person-block-head .zs-toggle-hint {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-left: 0.35rem;
}

.person-block.zero-spend-card .account-list {
  max-height: 320px;
  overflow: auto;
}

.person-block.zero-spend-card .acc-spend {
  color: var(--amber);
}

.person-block.zero-spend-card.is-collapsed .account-list,
.person-block.zero-spend-card.is-collapsed .zero-spend-empty {
  display: none;
}

.zero-spend-empty {
  margin: 0;
  padding: 0.85rem 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.token-rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.token-rail-meta {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
}

.token-rail-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.vt-card {
  flex: 1 1 120px;
  max-width: 180px;
  min-width: 110px;
  padding: 0.65rem 0.7rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  text-align: left;
}

.vt-card.is-current {
  border-color: rgba(94, 200, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(94, 200, 255, 0.25);
}

.vt-card.is-dead {
  border-color: rgba(255, 107, 74, 0.55);
  background: rgba(255, 107, 74, 0.12);
}

.vt-card.is-dead.is-current {
  box-shadow: 0 0 0 1px rgba(255, 107, 74, 0.35), 0 0 0 3px rgba(94, 200, 255, 0.2);
}

.vt-ord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: rgba(184, 242, 85, 0.2);
  color: var(--lime);
  font-size: 0.68rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.vt-card.is-dead .vt-ord {
  background: rgba(255, 107, 74, 0.25);
  color: #ffb4ae;
}

.vt-name {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  word-break: break-word;
}

.vt-card.is-dead .vt-name {
  color: var(--coral);
}

.vt-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.vt-chip {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.15rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.vt-chip.now {
  color: #9fdfff;
  border-color: rgba(94, 200, 255, 0.45);
}

.vt-chip.dead {
  color: #ffb4ae;
  border-color: rgba(255, 107, 74, 0.45);
}

.person-block {
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: riseIn 0.4s ease both;
}

.person-block-head {
  padding: 0.95rem 1rem 0.85rem;
  color: #0b120c;
}

.person-block-head h3 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.person-block-head .person-stats {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  opacity: 0.85;
  font-weight: 600;
}

.account-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
}

.account-item {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  transition: background 0.12s;
}

.account-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.account-item .acc-name {
  font-weight: 600;
  font-size: 0.9rem;
  word-break: break-word;
}

.account-item.is-disabled .acc-name {
  color: var(--coral);
}

.account-item.is-payment-error:not(.is-disabled) .acc-name {
  color: var(--amber);
}

.account-item .acc-spend {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--lime);
  white-space: nowrap;
}

.account-item.is-disabled .acc-spend {
  color: var(--coral);
  opacity: 0.9;
}

.account-item.is-payment-error:not(.is-disabled) .acc-spend {
  color: var(--amber);
}

.account-item .acc-flag {
  display: block;
  font-size: 0.7rem;
  color: var(--coral);
  font-weight: 600;
  margin-top: 0.15rem;
}

.account-item .acc-flag-disabled {
  letter-spacing: 0.04em;
}

.account-item .acc-flag-payment-error {
  color: var(--amber);
  letter-spacing: 0.04em;
}

/* —— Sheet —— */
.sheet[hidden] {
  display: none !important;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  align-items: end;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet-panel {
  position: relative;
  max-height: min(88dvh, 720px);
  overflow: auto;
  background: var(--ink-2);
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 1rem 1rem 1.5rem;
  animation: sheetUp 0.28s ease;
}

@keyframes sheetUp {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  position: sticky;
  top: 0;
  background: var(--ink-2);
  padding-bottom: 0.5rem;
  z-index: 1;
}

.sheet-head h3 {
  margin: 0.1rem 0;
  font-family: var(--font-brand);
  font-size: 1.2rem;
}

.sheet-spend {
  margin: 0;
  color: var(--lime);
  font-weight: 700;
}

.camp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.camp-table th,
.camp-table td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.camp-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.camp-name {
  font-weight: 600;
  max-width: 14rem;
  word-break: break-word;
}

.tier-red { color: var(--coral); font-weight: 700; }
.tier-yellow { color: var(--amber); font-weight: 600; }
.tier-green { color: var(--lime); }
.status-active { color: var(--lime); font-weight: 700; }
.status-learning { color: var(--sky); font-weight: 600; }
.status-error { color: var(--amber); font-weight: 700; }
.status-off { color: var(--muted); }

/* Desktop: alerts on left */
@media (min-width: 960px) {
  .dash-layout {
    flex-direction: row;
    align-items: stretch;
  }

  .alerts-rail {
    order: 0;
    width: 300px;
    flex-shrink: 0;
    border-bottom: 0;
    border-right: 1px solid rgba(255, 107, 74, 0.2);
    background: linear-gradient(90deg, rgba(255, 107, 74, 0.1), transparent 85%);
    position: sticky;
    top: 4.5rem;
    align-self: flex-start;
    max-height: calc(100dvh - 4.5rem);
    overflow: auto;
  }

  .alerts-list {
    flex-direction: column;
    overflow-x: visible;
  }

  .alert-card {
    width: 100%;
  }

  .sheet {
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
  }

  .sheet-panel {
    width: min(920px, 100%);
    max-height: 85dvh;
    border-radius: 20px;
    border: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
