:root {
  --primary-blue: #0d2d62;
  --primary-blue-strong: #09244f;
  --blue-light: #ecf3ff;
  --accent-cyan: #3bb6ff;
  --white: #ffffff;
  --text: #1a2740;
  --muted: #6a7890;
  --border: rgba(16, 35, 69, 0.12);
  --success: #1e9d72;
  --shadow: 0 25px 60px rgba(13, 45, 98, 0.18);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #edf3ff;
  color: var(--text);
}

body {
  min-height: 100vh;
}

button, input, select {
  font: inherit;
}

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, #eef4ff 0%, #dde8ff 100%);
}

.auth-shell {
  width: min(1200px, 100%);
  height: min(calc(100vh - 48px), 760px);
  min-height: 0;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.auth-panel {
  position: relative;
  background: linear-gradient(180deg, var(--primary-blue) 0%, var(--primary-blue-strong) 100%);
  padding: 64px 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--white);
  isolation: isolate;
}

.auth-panel::before,
.auth-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.auth-panel::before {
  width: 420px;
  height: 420px;
  right: -120px;
  top: -80px;
}

.auth-panel::after {
  width: 240px;
  height: 240px;
  left: -50px;
  bottom: -60px;
}

.brand-badge {
  position: relative;
  z-index: 1;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.07);
  padding: 5px 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.brand-logo {
  display: block;
  width: 90px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.18));
}

.auth-panel h1 {
  position: relative;
  z-index: 1;
  margin: 28px 0 16px;
  font-size: clamp(2.3rem, 3vw, 4rem);
  line-height: 1.1;
  max-width: 420px;
}

.auth-panel p {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 430px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.08rem;
  line-height: 1.7;
}

.panel-footer {
  position: relative;
  z-index: 1;
  margin-top: 42px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.8);
  flex-wrap: wrap;
}

.panel-footer::before {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3ddc97;
  box-shadow: 0 0 18px rgba(61, 220, 151, 0.9);
}

.auth-card {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  padding: 38px 38px 24px;
}

.form-wrapper {
  width: min(460px, 100%);
}

.step {
  display: none;
  animation: fadeInUp 0.45s ease;
}

.step.active {
  display: block;
}

.eyebrow {
  color: var(--accent-cyan);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  margin: 0 0 14px;
}

.step h2 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: clamp(2rem, 2vw, 2.6rem);
}

.step-subtitle {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.7;
}

.form-field {
  margin-bottom: 20px;
}

.label {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 600;
}

.input, .select {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(237, 243, 255, 0.45);
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 1rem;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.input:focus, .select:focus {
  outline: none;
  border-color: rgba(59, 182, 255, 0.9);
  box-shadow: 0 0 0 5px rgba(59, 182, 255, 0.12);
}

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

.code-box {
  width: 100%;
  height: 56px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(237, 243, 255, 0.45);
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.code-box:focus {
  outline: none;
  border-color: rgba(59, 182, 255, 0.9);
  box-shadow: 0 0 0 5px rgba(59, 182, 255, 0.12);
}

button.primary-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-blue) 0%, #1a5cce 100%);
  color: var(--white);
  font-weight: 700;
  padding: 16px 18px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 16px 28px rgba(42, 92, 191, 0.28);
}

button.primary-btn:hover {
  transform: translateY(-1px);
}

button.primary-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.status-message {
  min-height: 28px;
  margin-top: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 0.93rem;
}

.status-message.error {
  color: #b13b3b;
}

.status-message.success {
  color: var(--success);
}

.loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(13, 45, 98, 0.12);
  border-top-color: var(--primary-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #edf6ff 0%, #edf3ff 100%);
  padding: 18px;
  overflow-y: auto;
}

.dashboard {
  width: min(980px, 100%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(13, 45, 98, 0.08);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin: 0 auto;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(59, 182, 255, 0.12);
  color: var(--primary-blue);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-header h1 {
  margin: 14px 0 0;
  font-size: clamp(1.7rem, 2.5vw, 2.5rem);
  color: var(--text);
  line-height: 1.18;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.info-card {
  background: linear-gradient(180deg, #f7fbff 0%, #edf4ff 100%);
  border: 1px solid rgba(13, 45, 98, 0.08);
  border-radius: 18px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.info-card strong {
  font-size: 1.15rem;
  color: var(--text);
  word-break: break-word;
}

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

.details-panel {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.detail-block,
.detail-meta,
.documents-panel {
  background: #ffffff;
  border: 1px solid rgba(13, 45, 98, 0.08);
  border-radius: 18px;
  padding: 20px;
}

.detail-block h2,
.documents-header h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 1.2rem;
}

.detail-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.detail-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.detail-meta > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(13, 45, 98, 0.08);
}

.detail-meta > div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.detail-meta span {
  color: var(--muted);
}

.detail-meta strong {
  color: var(--text);
}

.documents-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.ghost-btn {
  border: none;
  border-radius: 12px;
  background: rgba(59, 182, 255, 0.1);
  color: var(--primary-blue);
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  border: 1px solid rgba(13, 45, 98, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.document-row > div {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 600;
}

.document-row a {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 700;
}

.folder-group {
  border: 1px solid rgba(13, 45, 98, 0.08);
  border-radius: 14px;
  background: #f8fbff;
  overflow: hidden;
  margin-bottom: 12px;
}

.folder-toggle {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  text-transform: uppercase;
}

.caret {
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.folder-group.open .caret {
  transform: rotate(180deg);
}

.folder-content {
  padding: 0 12px 12px;
}

.document-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.document-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  border: 1px solid rgba(13, 45, 98, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
}

.document-list li > div {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 600;
}

.doc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(13, 45, 98, 0.08);
  color: var(--primary-blue);
  font-size: 0.7rem;
  font-weight: 800;
}

.document-list a {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 700;
}

.back-btn {
  display: inline-block;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-blue) 0%, #1a5cce 100%);
  color: var(--white);
  padding: 14px 22px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease;
}

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

@media (max-width: 840px) {
  html, body {
    overflow: auto;
  }

  .welcome-page {
    padding: 16px;
  }

  .dashboard {
    padding: 18px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .overview-grid,
  .details-panel {
    grid-template-columns: 1fr;
  }

  .documents-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .document-list li {
    flex-direction: column;
    align-items: flex-start;
  }

  .document-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .dashboard-header h1 {
    font-size: 1.9rem;
  }

  .documents-header h3,
  .detail-block h2 {
    font-size: 1.05rem;
  }

  .tag {
    font-size: 0.72rem;
  }
}

@media (max-width: 840px) {
  html, body {
    overflow: auto;
  }

  .auth-page {
    min-height: 100vh;
    height: auto;
    padding: 16px;
  }

  .auth-shell {
    width: 100%;
    min-height: auto;
    height: auto;
    grid-template-columns: 1fr;
  }

  .auth-panel {
    padding: 32px 24px 28px;
    min-height: 260px;
  }

  .auth-panel h1 {
    font-size: clamp(2rem, 7vw, 3rem);
  }

  .auth-card {
    padding: 24px 20px 20px;
  }

  .form-wrapper {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .brand-badge {
    padding: 6px 10px;
  }

  .brand-logo {
    width: 74px;
  }

  .panel-footer {
    gap: 8px;
    font-size: 0.82rem;
  }

  .step h2 {
    font-size: 1.65rem;
  }

  .step-subtitle {
    font-size: 0.95rem;
  }

  button.primary-btn {
    padding: 14px 16px;
  }
}
