:root {
  --bg: #f2f5f7;
  --ink: #0e141f;
  --muted: #5d6776;
  --card: #ffffff;
  --line: #d6dde6;
  --accent: #0865ff;
  --accent-2: #20aa79;
  --shadow: 0 18px 50px rgba(28, 40, 70, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 5%, rgba(188, 219, 255, 0.45), transparent 35%),
    radial-gradient(circle at 85% 12%, rgba(201, 244, 226, 0.42), transparent 35%),
    linear-gradient(180deg, #f9fbfe 0%, #eef3ef 100%);
}

.hidden { display: none !important; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 26px;
}

.auth-layout {
  width: min(900px, 100%);
  display: grid;
}

.auth-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.auth-card {
  padding: clamp(28px, 4vw, 44px);
  min-height: clamp(430px, 58vh, 620px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
}

.auth-title {
  margin: 0;
  font-family: "Helvetica Neue", "Arial", sans-serif;
  font-size: clamp(2rem, 4.8vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.auth-brand p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.auth-brand {
  width: min(620px, 100%);
  margin-inline: auto;
}

.auth-form,
.auth-message {
  width: min(360px, 100%);
  margin-inline: auto;
}

.auth-brand {
  text-align: center;
}

.auth-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.auth-form input,
.series-row input,
select {
  width: 100%;
  max-width: 360px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  background: #f9fafb;
}

.auth-form input:focus {
  outline: none;
  border-color: #aab5c4;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(169, 179, 194, 0.2);
}

.auth-message {
  min-height: 1.3em;
  margin: 0;
  color: #b13d00;
  font-size: 0.95rem;
}

button {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-form button {
  width: 220px;
  justify-self: center;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid #cdd3dc;
  background: linear-gradient(180deg, #ffffff 0%, #f2f4f7 100%);
  color: #131722;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 20px rgba(18, 26, 38, 0.08);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.auth-form button:hover {
  border-color: #aeb8c6;
  box-shadow: 0 12px 24px rgba(18, 26, 38, 0.12);
  transform: translateY(-1px);
}

.auth-form button:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(18, 26, 38, 0.1);
}

button.ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
}

.brand-line h1 {
  margin: 0;
  font-size: 1.28rem;
}

.session-meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.actions,
.pnl-actions,
.layer-tabs,
.table-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.app-main {
  padding: 14px;
}

.app-screen {
  display: grid;
  gap: 12px;
}

.hub-headline {
  text-align: center;
  padding-top: 8px;
}

.hub-headline h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.hub-headline p {
  margin: 6px 0 0;
  color: var(--muted);
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(20, 30, 60, 0.08);
  padding: 12px;
}

.video-panel {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 12px;
  align-items: center;
}

.video-panel h3 { margin: 0; }
.video-panel p { margin: 5px 0 0; color: var(--muted); }

.video-frame {
  height: 240px;
  border-radius: 16px;
  border: 1px solid #d2dcef;
  background:
    radial-gradient(circle at 22% 26%, rgba(50, 125, 255, 0.38), transparent 34%),
    radial-gradient(circle at 85% 82%, rgba(45, 190, 130, 0.38), transparent 35%),
    linear-gradient(140deg, #0f1c34 10%, #203156 55%, #1b2f4a 100%);
  display: grid;
  place-items: center;
}

.video-frame span {
  color: #eaf1ff;
  font-size: 1rem;
  font-weight: 600;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hub-card {
  background: linear-gradient(160deg, #f8fbff, #f6f7f9);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(20, 30, 60, 0.09);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.hub-card.accent {
  background: linear-gradient(160deg, #eaf2ff, #eafaf1);
}

.hub-card img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #d0dbeb;
}

.hub-card h3 { margin: 0; font-size: 1.1rem; }
.hub-card p { margin: 0; color: var(--muted); min-height: 44px; }

.detail-screen h2 { margin: 0; font-size: 2rem; }

.page-back {
  width: fit-content;
}

.detail-hero-image {
  width: 100%;
  max-width: 980px;
  border-radius: 16px;
  border: 1px solid #d0dbeb;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-grid h3 { margin: 0 0 8px; }
.detail-grid p { margin: 0; color: var(--muted); }

.layer-tabs button,
.table-tabs button {
  background: #f7f8fc;
  border: 1px solid var(--line);
  color: var(--ink);
}

.layer-tabs button.active,
.table-tabs button.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.layer,
.table-layer { display: none; }
.layer.active,
.table-layer.active { display: block; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.metric-card {
  background: linear-gradient(140deg, #f4f8ff, #eef8f2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.metric-card h3 { margin: 0; color: var(--muted); font-size: 0.88rem; }
.metric-card p {
  margin: 6px 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  font-weight: 600;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.chart-card canvas {
  width: 100% !important;
  height: 270px !important;
}

.control-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  gap: 10px;
}

.control-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.inline-note {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: #fff7e8;
  border: 1px solid #f2d4a2;
  color: #b13d00;
  font-size: 0.82rem;
}

.editor-panel { margin-top: 10px; }

.series-row {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfd;
}

.series-row > label {
  display: block;
  font-size: 0.84rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.year-inputs {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.table-wrap { overflow: auto; max-width: 100%; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  min-width: 920px;
}

th, td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: right;
  white-space: nowrap;
}

th:first-child, td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: #f4f6fa;
}

thead th {
  background: #eef2f8;
  position: sticky;
  top: 0;
  z-index: 2;
}

@media (max-width: 1200px) {
  .auth-layout,
  .detail-grid,
  .chart-grid,
  .metric-grid,
  .control-row,
  .hub-grid,
  .video-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .actions { justify-content: flex-start; }
  .hero { flex-direction: column; align-items: flex-start; }
}
