:root {
  --gp-green: #92c84e;
  --gp-green-dark: #7ab33a;
  --gp-slate: #2a3a43;
  --gp-slate-mid: #3e5866;
  --gp-slate-soft: #5b7382;
  --gp-bg: #f4f7f8;
  --gp-white: #ffffff;
  --gp-border: #d7e0e5;
  --gp-danger: #c0392b;
  --shadow: 0 14px 40px rgba(42, 58, 67, 0.18);
  --radius: 14px;
  --font: "Montserrat", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--gp-slate);
  background: var(--gp-slate);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(42, 58, 67, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--gp-green);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand__logo {
  height: 42px;
  width: auto;
  display: block;
}

.brand__product {
  color: var(--gp-white);
  font-weight: 700;
  letter-spacing: 0.02em;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  padding-left: 0.85rem;
}

.topbar__nav a {
  color: #fff;
  font-size: 0.92rem;
  font-weight: 500;
  opacity: 0.9;
}

.topbar__nav a:hover {
  color: var(--gp-green);
}

.hero {
  position: relative;
  overflow: hidden;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  padding: clamp(1.25rem, 3vw, 2.5rem) 0;
  background:
    radial-gradient(circle at 78% 42%, rgba(146, 200, 78, 0.22), transparent 34%),
    radial-gradient(circle at 18% 70%, rgba(146, 200, 78, 0.12), transparent 40%),
    linear-gradient(145deg, #24343c 0%, #2a3a43 48%, #3e5866 100%);
  background-color: var(--gp-slate);
}

.hero:has(#loginPanel:not([hidden])) {
  justify-content: center;
}

.hero:has(#appPanel:not([hidden])) .hero__db {
  opacity: 0.12;
  transform: translate(8%, -10%) scale(0.72);
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(36, 52, 60, 0.2), rgba(36, 52, 60, 0.45));
  pointer-events: none;
}

.hero__db {
  position: absolute;
  right: clamp(-2rem, 4vw, 4rem);
  top: 50%;
  width: min(340px, 42vw);
  transform: translateY(-50%);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}

.hero__db svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.35));
}

.hero__content {
  position: relative;
  z-index: 1;
  width: 100%;
}

.login-icon {
  width: 52px;
  height: 58px;
  margin-bottom: 0.85rem;
}

.login-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.login-panel,
.app-panel {
  background: var(--gp-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.15rem, 2.5vw, 1.75rem);
}

.login-panel {
  width: min(520px, 100%);
  margin: 0 auto;
}

.app-panel {
  width: 100%;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--gp-slate-soft);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--gp-slate);
  line-height: 1.25;
}

.login-panel h1,
.app-panel h1 {
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  font-weight: 800;
}

.lead {
  margin: 0.75rem 0 1.4rem;
  color: var(--gp-slate-mid);
  line-height: 1.55;
}

.app-panel .lead {
  margin: 0;
  max-width: 42rem;
  font-size: 0.95rem;
}

.login-panel h1 {
  margin-bottom: 1.15rem;
}

.login-form {
  display: grid;
  gap: 0.45rem;
}

.login-form label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.45rem;
}

.field-hint {
  margin: 0 0 0.35rem;
  color: var(--gp-slate-soft);
  font-size: 0.78rem;
  line-height: 1.4;
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  border: 1px solid var(--gp-border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  color: var(--gp-slate);
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
  border-color: var(--gp-green);
  box-shadow: 0 0 0 3px rgba(146, 200, 78, 0.25);
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.25rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}

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

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--gp-green);
  color: var(--gp-slate);
}

.btn--primary:hover:not(:disabled) {
  background: var(--gp-green-dark);
}

.btn--secondary {
  background: var(--gp-slate-mid);
  color: #fff;
}

.btn--ghost {
  background: #e8eef1;
  color: var(--gp-slate);
}

.login-form .btn {
  margin-top: 1rem;
  width: 100%;
}

.form-error {
  margin: 0.75rem 0 0;
  color: var(--gp-danger);
  font-size: 0.9rem;
  font-weight: 600;
}

.app-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.app-panel__actions {
  display: flex;
  gap: 0.6rem;
}

.toolbar {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 1rem;
}

.toolbar input {
  max-width: 360px;
}

.muted {
  color: var(--gp-slate-soft);
  font-size: 0.88rem;
}

.layout-split {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  min-height: 520px;
}

.folder-list,
.detail-panel,
.files-box,
.analysis-box,
.status-box {
  border: 1px solid var(--gp-border);
  border-radius: 12px;
  background: #fbfcfd;
}

.folder-list {
  overflow: auto;
  max-height: 70vh;
  padding: 0.4rem;
}

.folder-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  font: inherit;
  font-weight: 600;
  color: var(--gp-slate);
  cursor: pointer;
}

.folder-item:hover,
.folder-item.is-active {
  background: rgba(146, 200, 78, 0.18);
}

.folder-item.is-active {
  box-shadow: inset 3px 0 0 var(--gp-green);
}

.detail-panel {
  padding: 1rem;
  background: #fff;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.files-box {
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.files-box h3,
.analysis-box h3 {
  margin-bottom: 0.65rem;
  font-size: 1rem;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.file-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--gp-border);
  font-size: 0.9rem;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.file-size {
  white-space: nowrap;
  min-width: 4.5rem;
  text-align: right;
}

.btn--small {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

@media (max-width: 700px) {
  .file-list li {
    grid-template-columns: 1fr auto;
  }

  .file-date {
    grid-column: 1 / 2;
    order: 3;
  }

  .file-size {
    order: 4;
  }

  .file-download {
    order: 2;
  }
}

.status-box {
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border-color: rgba(146, 200, 78, 0.45);
  background: rgba(146, 200, 78, 0.12);
  font-weight: 600;
}

.status-box.is-error {
  border-color: rgba(192, 57, 43, 0.35);
  background: rgba(192, 57, 43, 0.08);
  color: var(--gp-danger);
}

.loading-panel {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.1rem 1.15rem;
  border: 1px solid rgba(146, 200, 78, 0.45);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(146, 200, 78, 0.14), rgba(62, 88, 102, 0.08));
}

.loading-panel[hidden] {
  display: none !important;
}

.loading-panel__text {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.loading-panel__text strong {
  font-size: 1.05rem;
  color: var(--gp-slate);
}

.loading-elapsed {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
}

.loading-dots::after {
  content: "";
  display: inline-block;
  width: 1.4em;
  text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75%,
  100% {
    content: "...";
  }
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(42, 58, 67, 0.15);
  border-top-color: var(--gp-green);
  border-right-color: var(--gp-slate-mid);
  animation: spin 0.85s linear infinite;
  flex-shrink: 0;
}

.btn.is-loading {
  position: relative;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: 0.55rem;
  border-radius: 50%;
  border: 2px solid rgba(42, 58, 67, 0.2);
  border-top-color: var(--gp-slate);
  display: inline-block;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.analysis-box {
  padding: 1rem;
  background: #fff;
}

.analysis-box__head,
.ask-box__head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.analysis-box__head .btn,
.ask-box__head .btn {
  flex-shrink: 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.kpi-card {
  border: 1px solid var(--gp-border);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: linear-gradient(180deg, #ffffff, #f7faf8);
}

.kpi-card__label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gp-slate-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi-card__value {
  margin: 0.35rem 0 0.2rem;
  font-size: 1.55rem;
  font-weight: 800;
  color: #c45c26;
  line-height: 1.1;
}

.kpi-card__hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--gp-slate-soft);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0 0 1.1rem;
}

.chart-card {
  border: 1px solid var(--gp-border);
  border-radius: 12px;
  padding: 0.9rem;
  background: #fff;
}

.chart-card h4 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.bar-list {
  display: grid;
  gap: 0.55rem;
}

.bar-row {
  display: grid;
  gap: 0.25rem;
}

.bar-row__meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e7eef2;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #92c84e, #c45c26);
}

.bars-vertical {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  min-height: 140px;
  padding-top: 0.4rem;
}

.bars-vertical__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

.bars-vertical__value {
  font-size: 0.72rem;
  font-weight: 700;
  color: #c45c26;
}

.bars-vertical__col {
  width: 100%;
  max-width: 28px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #3e5866, #92c84e);
  min-height: 4px;
}

.bars-vertical__label {
  font-size: 0.68rem;
  color: var(--gp-slate-soft);
  text-align: center;
  word-break: break-all;
}

.analysis-content {
  line-height: 1.6;
  color: var(--gp-slate);
}

.analysis-content h1,
.analysis-content h2,
.analysis-content h3,
.analysis-content h4 {
  margin: 1.1rem 0 0.45rem;
}

.analysis-content p,
.analysis-content ul,
.analysis-content ol {
  margin: 0.45rem 0;
}

.analysis-content code,
.analysis-content pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: #eef3f6;
  border-radius: 6px;
}

.analysis-content pre {
  padding: 0.75rem;
  overflow: auto;
}

.analysis-content code {
  padding: 0.1rem 0.3rem;
}

.analysis-content ol {
  padding-left: 1.2rem;
}

.md-table-wrap {
  overflow: auto;
  margin: 0.75rem 0 1rem;
  border: 1px solid var(--gp-border);
  border-radius: 10px;
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.md-table th,
.md-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--gp-border);
  text-align: left;
  vertical-align: top;
}

.md-table th {
  background: #eef3f6;
  font-weight: 700;
}

.md-table tr:last-child td {
  border-bottom: none;
}

.ask-box {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--gp-border);
}

.analysis-box__head h3,
.ask-box__head h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.analysis-box__head .muted,
.ask-box__head .muted {
  margin: 0;
}

.ask-messages {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  max-height: 360px;
  overflow: auto;
}

.ask-messages:empty {
  display: none;
}

.ask-bubble {
  border: 1px solid var(--gp-border);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: #fff;
}

.ask-bubble--user {
  background: rgba(146, 200, 78, 0.12);
  border-color: rgba(146, 200, 78, 0.35);
}

.ask-charts {
  margin: 0.35rem 0 0.85rem;
}

.ask-bubble__label {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gp-slate-soft);
}

.ask-loading {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.9rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(146, 200, 78, 0.45);
  border-radius: 12px;
  background: rgba(146, 200, 78, 0.12);
}

.ask-loading[hidden] {
  display: none !important;
}

.ask-loading strong {
  display: block;
  font-size: 0.95rem;
}

.ask-loading .muted {
  margin: 0.2rem 0 0;
  font-variant-numeric: tabular-nums;
}

.ask-form {
  display: grid;
  gap: 0.65rem;
}

.ask-form textarea {
  width: 100%;
  border: 1px solid var(--gp-border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  color: var(--gp-slate);
  resize: vertical;
  min-height: 84px;
  outline: none;
}

.ask-form textarea:focus {
  border-color: var(--gp-green);
  box-shadow: 0 0 0 3px rgba(146, 200, 78, 0.25);
}

.ask-form .btn {
  justify-self: end;
}

.empty-state {
  padding: 1.5rem 1rem;
  color: var(--gp-slate-soft);
  text-align: center;
}

.footer {
  flex-shrink: 0;
  background: var(--gp-slate);
  color: rgba(255, 255, 255, 0.85);
  padding: 1rem 0;
  border-top: 3px solid var(--gp-green);
}

.footer__inner {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 900px) {
  .brand__logo {
    height: 34px;
  }

  .brand__product {
    font-size: 0.92rem;
    padding-left: 0.65rem;
  }

  .topbar__inner {
    min-height: 60px;
  }

  .layout-split {
    grid-template-columns: 1fr;
  }

  .folder-list {
    max-height: 240px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar input {
    max-width: none;
  }

  .app-panel__header {
    flex-direction: column;
  }

  .app-panel__actions {
    width: 100%;
  }

  .app-panel__actions .btn {
    flex: 1;
  }

  .detail-head {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-head .btn {
    width: 100%;
  }

  .hero__db {
    width: min(220px, 48vw);
    opacity: 0.18;
    right: -1.5rem;
  }

  .kpi-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .container {
    width: calc(100% - 1.25rem);
  }

  .hero__db {
    display: none;
  }

  .login-panel,
  .app-panel {
    border-radius: 12px;
  }

  .login-panel h1,
  .app-panel h1 {
    font-size: 1.25rem;
  }

  .lead {
    font-size: 0.92rem;
  }
}
