:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-soft: #f3f4f6;
  --text: #111827;
  --muted: #6b7280;
  --border: #d1d5db;
  --border-strong: #9ca3af;
  --primary: #16a34a;
  --primary-dark: #15803d;
  --danger: #dc2626;
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: var(--text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code, pre {
  display: block;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  overflow-x: auto;
  border: 1px solid var(--border);
}

.inline-code {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  margin: 0 0.2rem 0.2rem 0;
  border-radius: 8px;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand small {
  display: block;
  color: var(--muted);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: #111827;
  font-weight: 800;
}

.brand-logo-wrap {
  width: 52px;
  height: 52px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 52px;
}

.brand-logo,
.brand-logo-full {
  display: block;
  height: 52px;
  width: auto;
  max-width: min(360px, 62vw);
  object-fit: contain;
  background: #fff;
}

.brand-logo-fallback {
  display: none;
  width: 100%;
  height: 100%;
  place-items: center;
  font-weight: 800;
  color: var(--text);
  background: #f9fafb;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-user {
  color: var(--muted);
  font-size: 0.95rem;
}

.logout-form {
  margin: 0;
}

.section {
  padding: 2rem 0;
}

.section-compact {
  padding-top: 0;
}

.narrow-section .container {
  max-width: 760px;
}

.wide-form-section .container {
  max-width: 980px;
}

.dashboard-head {
  padding-bottom: 0.75rem;
}

.hero {
  padding: 2rem 0 2rem;
}

.hero-grid,
.two-columns,
.card-grid,
.section-head,
.form-grid,
.info-grid {
  display: grid;
  gap: 1rem;
}

.hero-grid {
  grid-template-columns: 1.2fr 0.8fr;
  align-items: start;
}

.info-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.section-head {
  grid-template-columns: 1fr auto;
  align-items: end;
}

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

.card-grid.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics-grid-five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metrics-grid-six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

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

.hero h1,
.panel h1,
.section-head h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
}

.panel h2,
.panel h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.lead {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.55;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.eyebrow,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #ecfdf3;
  color: #166534;
  font-size: 0.85rem;
  border: 1px solid #bbf7d0;
  margin-bottom: 1rem;
}

.hero-actions,
.section-actions,
.form-actions,
.action-links {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.panel,
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.panel-plain {
  background: #fff;
  border: 1px solid var(--border);
}

.hero-panel {
  padding: 1.5rem;
}

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

.metric-card {
  padding: 1.1rem 1.2rem;
}

.metric-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.metric-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.metric-card small {
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  text-decoration: none;
  cursor: pointer;
  background: #fff;
  color: var(--text);
}

.button:hover {
  text-decoration: none;
}

.button-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-dark);
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border-strong);
}

.messages-wrap {
  padding-top: 1rem;
}

.message {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  background: #fff;
}

.message.success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.message.error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.message.warning {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

.auth-panel {
  max-width: 520px;
  margin: 0 auto;
}

.form-stack,
.form-grid,
.stack {
  display: grid;
  gap: 1rem;
}

.tight-stack {
  gap: 0.6rem;
}

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

.full-row {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 0.5rem;
}

.field label,
.form-label {
  font-weight: 600;
}

.field-help {
  color: var(--muted);
  font-size: 0.9rem;
}

.field-error,
.form-error {
  color: var(--danger);
  font-size: 0.95rem;
}

.input,
input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  padding: 0.75rem 0.9rem;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #111827;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

thead th {
  text-align: left;
  font-size: 0.85rem;
  color: var(--text);
  background: #f3f4f6;
}

th,
td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:hover {
  background: #f9fafb;
}

.empty-state {
  margin: 0;
  padding: 1rem;
  border-radius: 12px;
  background: #f9fafb;
  color: var(--muted);
  border: 1px solid var(--border);
}

.period-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.chip-active {
  background: #ecfdf3;
  color: #166534;
  border-color: #86efac;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid transparent;
}

.status.not_connected {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

.status.pending {
  background: #fffbeb;
  color: #92400e;
  border-color: #fcd34d;
}

.status.connected,
.status.success {
  background: #f0fdf4;
  color: #166534;
  border-color: #86efac;
}

.status.error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fca5a5;
}

.status.started {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.integration-block p {
  margin: 0.2rem 0;
}

.login-panel {
  align-self: start;
}

.button-full {
  width: 100%;
}

.hint-box {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  background: #f9fafb;
  color: var(--muted);
  border: 1px solid var(--border);
}

.date-filter-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 240px)) auto;
  gap: 1rem;
  align-items: end;
}

.date-filter-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 1200px) {
  .metrics-grid-five,
  .metrics-grid-six {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .card-grid,
  .card-grid.three-columns,
  .two-columns,
  .hero-grid,
  .section-head,
  .form-grid,
  .metrics-grid-five,
  .metrics-grid-six,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .date-filter-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .brand-logo,
  .brand-logo-full {
    height: 42px;
    max-width: 240px;
  }
}

/* --- crisp header logo fix --- */
.brand-text-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-text-logo:hover {
  text-decoration: none;
}

.brand-logo-wrap {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  flex: 0 0 52px;
  overflow: hidden;
}

.brand-logo-mark {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: block;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.05;
}

.brand-copy strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: #111827;
  letter-spacing: 0;
}

.brand-copy small {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

@media (max-width: 640px) {
  .brand-logo-wrap {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .brand-logo-mark {
    width: 30px;
    height: 30px;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .brand-copy small {
    font-size: 12px;
  }
}

/* --- official-style header logo fix --- */
.brand-text-logo {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-text-logo:hover {
  text-decoration: none;
}

.brand-logo-wrap {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  flex: 0 0 58px;
  overflow: visible;
  padding: 0;
}

.brand-logo-mark {
  width: 52px;
  height: 52px;
  object-fit: contain;
  display: block;
}

.brand-copy-official {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  line-height: 0.92;
}

.brand-copy-official .brand-line {
  display: block;
  font-family: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #111827;
  text-transform: uppercase;
  margin: 0;
  padding: 0;
}

.brand-copy small,
.brand-copy-official small {
  display: none !important;
}

@media (max-width: 640px) {
  .brand-text-logo {
    gap: 10px;
  }

  .brand-logo-wrap {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .brand-logo-mark {
    width: 40px;
    height: 40px;
  }

  .brand-copy-official .brand-line {
    font-size: 13px;
  }
}

/* HOME_REFERENCE_DESIGN_START */
.home-page {
  background: #f4f7fb;
}

.home-page .site-header {
  display: none;
}

.home-stage {
  min-height: 100vh;
  padding: 48px 52px;
  display: grid;
  place-items: center;
}

.home-shell {
  width: min(1432px, 100%);
}

.home-visual {
  position: relative;
  min-height: 860px;
  border: 1px solid rgba(209, 213, 219, 0.72);
  border-radius: 26px;
  overflow: hidden;
  background:
    linear-gradient(90deg,
      rgba(255,255,255,0.98) 0%,
      rgba(255,255,255,0.94) 38%,
      rgba(255,255,255,0.54) 55%,
      rgba(255,255,255,0.92) 74%,
      rgba(255,255,255,0.98) 100%),
    url('/static/hero-climber.webp') center center / cover no-repeat;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.12);
}

.home-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 22% 18%, rgba(255,255,255,0.9), transparent 28%),
    linear-gradient(0deg, rgba(229,239,247,0.52), transparent 42%);
}

.home-brand {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin: 30px 0 0 50px;
}

.home-brand-mark {
  width: 50px;
  height: 50px;
  object-fit: contain;
  display: block;
}

.home-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 0.9;
}

.home-brand-text span {
  display: block;
  font-family: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #111827;
}

.home-content {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 452px;
  gap: 76px;
  align-items: center;
  padding: 82px 50px 70px;
}

.home-left {
  max-width: 690px;
}

.home-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 16px;
  border-radius: 999px;
  color: #057a42;
  background: rgba(209, 250, 229, 0.88);
  border: 1px solid rgba(167, 243, 208, 0.95);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 28px;
}

.home-left h1 {
  margin: 0;
  font-size: clamp(48px, 5.15vw, 72px);
  line-height: 1.05;
  letter-spacing: -0.045em;
  color: #111827;
  font-weight: 850;
}

.home-lead {
  margin: 28px 0 34px;
  max-width: 610px;
  color: #334155;
  font-size: 20px;
  line-height: 1.65;
}

.home-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  max-width: 640px;
}

.home-info-card {
  min-height: 208px;
  padding: 28px 28px 26px;
  border: 1px solid rgba(209, 213, 219, 0.88);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 52px rgba(15, 23, 42, 0.08);
}

.home-info-card h3 {
  margin: 0 0 14px;
  color: #111827;
  font-size: 20px;
  font-weight: 850;
}

.home-info-card p {
  margin: 0;
  color: #1f2937;
  font-size: 16px;
  line-height: 1.58;
}

.home-login-card {
  width: 100%;
  padding: 42px 44px 44px;
  border: 1px solid rgba(209, 213, 219, 0.72);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 72px rgba(15, 23, 42, 0.12);
}

.home-login-card h2 {
  margin: 0 0 18px;
  color: #111827;
  font-size: 34px;
  line-height: 1.16;
  letter-spacing: -0.03em;
  font-weight: 850;
}

.home-login-card > p {
  margin: 0 0 34px;
  color: #64748b;
  font-size: 18px;
  line-height: 1.45;
}

.home-login-form {
  display: grid;
  gap: 24px;
}

.home-field {
  display: grid;
  gap: 10px;
}

.home-field label {
  color: #111827;
  font-size: 15px;
  font-weight: 800;
}

.home-field input {
  height: 56px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  padding: 0 18px;
  font-size: 16px;
  box-shadow: none;
}

.home-field input::placeholder {
  color: #94a3b8;
}

.home-field input:focus {
  border-color: #15803d;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.home-submit {
  margin-top: 20px;
  height: 58px;
  border: 1px solid #15803d;
  border-radius: 10px;
  background: #16a34a;
  color: #fff;
  font-size: 17px;
  font-weight: 850;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  transition: background .15s ease, transform .15s ease;
}

.home-submit:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.home-submit span {
  font-size: 24px;
  line-height: 1;
}

@media (max-width: 1180px) {
  .home-stage {
    padding: 24px;
  }

  .home-visual {
    min-height: auto;
  }

  .home-content {
    grid-template-columns: 1fr;
    gap: 30px;
    padding-top: 56px;
  }

  .home-login-card {
    max-width: 560px;
  }
}

@media (max-width: 720px) {
  .home-stage {
    padding: 0;
  }

  .home-visual {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .home-brand {
    margin: 24px 20px 0;
  }

  .home-content {
    padding: 48px 20px 34px;
  }

  .home-left h1 {
    font-size: 42px;
  }

  .home-lead {
    font-size: 17px;
  }

  .home-info-grid {
    grid-template-columns: 1fr;
  }

  .home-login-card {
    padding: 30px 22px;
  }
}
/* HOME_REFERENCE_DESIGN_END */
