/* SUG STUDIO — a quiet web app. Flat surfaces, hairlines, one accent. */

:root {
  --bg: #0B0B10;
  --surface: rgba(255, 255, 255, 0.028);
  --text: #ffffff;
  --muted: rgba(243, 243, 246, 0.62);
  --dim: rgba(243, 243, 246, 0.4);
  --line: rgba(255, 255, 255, 0.075);
  --line-hi: rgba(255, 255, 255, 0.16);
  --accent: #6D5CFF;
  --accent-soft: #8f82ff;
  --blue: #3AA8FF;
  --up: #6fe3a5;
  --down: #ff8f8f;
  --radius: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: 'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}

/* one soft glow, barely there */
.ambient { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.ambient i { position: absolute; border-radius: 50%; filter: blur(110px); will-change: transform; }
.ambient i:nth-child(1) { width: 56vmax; height: 56vmax; top: -30vmax; left: -18vmax; background: radial-gradient(circle, var(--accent), transparent 68%); opacity: .2; animation: drift 46s ease-in-out infinite alternate; }
.ambient i:nth-child(2) { width: 46vmax; height: 46vmax; bottom: -30vmax; right: -16vmax; background: radial-gradient(circle, var(--blue), transparent 68%); opacity: .1; animation: drift 58s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate3d(7vmax, 5vmax, 0) scale(1.06); } }

/* ---------- brand ---------- */

.brand { display: flex; align-items: center; gap: 10px; }
.brand__dot { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--blue)); flex: none; }
.brand { flex-wrap: wrap; row-gap: 6px; }
.brand__mark { font-weight: 600; font-size: 13px; letter-spacing: .04em; }
.brand__pill { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; }

/* ---------- shell ---------- */

.app { position: relative; z-index: 1; display: grid; grid-template-columns: 212px minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh; padding: 22px 16px; display: flex; flex-direction: column; gap: 26px;
  border-right: 1px solid var(--line); background: rgba(11, 11, 16, .55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; text-align: left; cursor: pointer;
  padding: 9px 12px; border-radius: 10px; transition: color .15s var(--ease), background .15s var(--ease);
}
.nav button:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav button.is-on { color: var(--text); background: rgba(109, 92, 255, .16); box-shadow: inset 2px 0 0 var(--accent); }
.signout { margin-top: auto; appearance: none; border: 0; background: none; color: var(--dim); font: inherit; font-size: 12.5px; text-align: left; padding: 8px 12px; cursor: pointer; }
.signout:hover { color: var(--text); }

.main { min-width: 0; padding: 22px 32px 56px; max-width: 1080px; width: 100%; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.bar h1 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.03em; }
.bar__right { display: flex; align-items: center; gap: 10px; }
.updated { font-size: 12px; color: var(--dim); margin-right: 4px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.25); }
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 12.5px;
  padding: 6px 13px; border-radius: 8px; transition: color .15s var(--ease), background .15s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.is-on { color: var(--text); background: rgba(255,255,255,.09); }
.icon { appearance: none; cursor: pointer; width: 34px; height: 34px; display: grid; place-items: center; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 10px; transition: color .15s var(--ease), border-color .15s var(--ease); }
.icon:hover { color: var(--text); border-color: var(--line-hi); }

.banner { margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; font-size: 13px; color: #ffd88a; background: rgba(255,178,36,.08); border: 1px solid rgba(255,178,36,.28); }
.banner.is-error { color: #ffb0b0; background: rgba(255,90,90,.08); border-color: rgba(255,90,90,.28); }

/* ---------- panels ---------- */

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 20px 22px; margin-bottom: 16px; }
.panel__head { margin-bottom: 8px; }
h2 { margin: 0; font-size: 14px; font-weight: 500; letter-spacing: -0.01em; color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.split .panel { margin-bottom: 0; }

/* metric tiles: the one you pick drives the chart */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  appearance: none; text-align: left; cursor: pointer; font: inherit; color: inherit;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px 18px 15px;
  transition: border-color .15s var(--ease), background .15s var(--ease); position: relative;
}
.tile:hover { border-color: var(--line-hi); }
.tile.is-on { border-color: rgba(109,92,255,.6); background: rgba(109,92,255,.07); }
.tile__label { font-size: 12px; color: var(--muted); }
.tile__value { font-size: 26px; font-weight: 500; letter-spacing: -0.035em; line-height: 1.2; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.delta { font-size: 11.5px; color: var(--dim); }
.delta.is-up { color: var(--up); }
.delta.is-down { color: var(--down); }

/* chart */
.chartcard { padding: 18px 18px 12px; }
.chartcard__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 4px 6px; font-size: 13px; color: var(--muted); }
.legend { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); }
.lg { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--accent-soft); margin-left: 6px; }
.lg--prev { border-top: 2px dashed rgba(255,255,255,.4); }
.chart { position: relative; width: 100%; height: 280px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .axis { fill: var(--dim); font-size: 11px; font-family: var(--font); }
.chart .grid { stroke: rgba(255,255,255,.06); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.tip {
  position: absolute; pointer-events: none; min-width: 132px; padding: 9px 12px; border-radius: 10px; font-size: 12px;
  background: rgba(20, 20, 28, .96); border: 1px solid var(--line-hi); box-shadow: 0 12px 30px rgba(0,0,0,.45); transform: translate(-50%, -100%);
  opacity: 0; transition: opacity .12s var(--ease);
}
.tip.is-on { opacity: 1; }
.tip b { display: block; font-weight: 500; margin-bottom: 4px; color: var(--muted); }
.tip div { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tip .k { color: var(--dim); }

/* rows & bars */
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 14px; align-items: baseline; padding: 10px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__val { font-variant-numeric: tabular-nums; color: var(--muted); }
.row__sub { color: var(--dim); font-size: 11.5px; margin-left: 8px; }
.bar-track { grid-column: 1 / -1; height: 3px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; }
.bar-track > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--blue)); width: 0; transition: width .6s var(--ease); }
.note { margin: 12px 0 0; font-size: 12px; color: var(--dim); }
.kicker { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: right; font-weight: 400; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); padding: 4px 0 8px 12px; }
.table th:first-child, .table td:first-child { text-align: left; padding-left: 0; }
.table td { padding: 10px 0 10px 12px; text-align: right; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; color: var(--muted); }
.table td:first-child { color: var(--text); }

.mini { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 6px; }
.mini span { display: block; font-size: 12px; color: var(--muted); }
.mini b { font-weight: 500; font-size: 22px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.stat b { display: block; font-weight: 500; font-size: 20px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }

/* states */
.state { color: var(--muted); font-size: 13.5px; margin: 0; }
.state b { color: var(--text); font-weight: 500; }
.pill { display: inline-block; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); margin-bottom: 8px; }
.skel { height: 12px; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.09), rgba(255,255,255,.04)); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; margin: 10px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }
.foot { margin-top: 28px; font-size: 12px; color: var(--dim); }

/* ---------- sign in ---------- */

.signin { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin__box { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 22px; }
.signin__box form { display: flex; flex-direction: column; gap: 10px; }
.signin__box input {
  font: inherit; color: var(--text); background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; outline: none; transition: border-color .15s var(--ease);
}
.signin__box input:focus { border-color: rgba(109,92,255,.7); }
.primary {
  appearance: none; cursor: pointer; font: inherit; font-weight: 500; color: var(--text); background: var(--accent);
  border: 0; border-radius: 10px; padding: 12px 16px; transition: filter .15s var(--ease); margin-top: 4px;
}
.primary:hover { filter: brightness(1.1); }
.primary:disabled { opacity: .55; cursor: default; }
.linkbtn { appearance: none; background: none; border: 0; cursor: pointer; font: inherit; font-size: 12.5px; color: var(--dim); padding: 0; text-align: left; transition: color .15s var(--ease); }
.linkbtn:hover { color: var(--text); }
.signin__msg { margin: -8px 0 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- small screens: sidebar becomes a top strip ---------- */

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
  .nav { flex-direction: row; order: 3; width: 100%; overflow-x: auto; gap: 4px; }
  .nav button { white-space: nowrap; }
  .nav button.is-on { box-shadow: none; }
  .signout { margin: 0; }
  .main { padding: 18px 16px 48px; }
  .tiles, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; gap: 0; }
  .split .panel { margin-bottom: 16px; }
  .updated { display: none; }
  .chart { height: 230px; }
}

@media (prefers-reduced-motion: reduce) {
  .ambient i, .skel { animation: none; }
  .bar-track > i, .tip { transition: none; }
}
