:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a2332;
  --text-muted: #5c6b7f;
  --border: #e2e8f0;
  --primary: #0f6e56;
  --primary-hover: #0b5a46;
  --primary-soft: #e6f4ef;
  --accent: #2563eb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(15, 35, 55, 0.08);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, #dcefe8 0%, transparent 40%),
    radial-gradient(circle at bottom right, #e8eef8 0%, transparent 35%),
    var(--bg);
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

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

.logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
}

.header h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.75rem;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
}

.field input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  color: var(--text);
  background: #fafbfc;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 110, 86, 0.15);
  background: #fff;
}

.hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.dropzone {
  border: 2px dashed #c9d5e3;
  border-radius: var(--radius);
  padding: 2rem 1.25rem;
  text-align: center;
  cursor: pointer;
  background: #fafcff;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--primary);
  background: var(--primary-soft);
  outline: none;
}

.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.01);
}

.dropzone-icon {
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.dropzone-title {
  margin: 0;
  font-weight: 600;
  font-size: 1.05rem;
}

.dropzone-sub {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
}

.dropzone-meta {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: #8a97a8;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 500;
  font-size: 0.92rem;
}

.file-chip span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
  opacity: 0.7;
}

.icon-btn:hover {
  opacity: 1;
}

.link-btn {
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

.stat {
  padding: 0.85rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.stat-accent {
  background: var(--primary-soft);
  border-color: #bfe5d8;
}

.stat-muted .stat-value {
  color: var(--text-muted);
}

.stat-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 280px;
}

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

th,
td {
  padding: 0.55rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

td.num,
th.num {
  text-align: right;
}

.preview-note {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.alert {
  margin-top: 1rem;
  padding: 0.8rem 0.95rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #fecdca;
}

.alert-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.actions {
  margin-top: 1.35rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.2rem;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-secondary {
  background: #eef2f7;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.login {
  text-align: center;
  padding: 0.5rem 0 0.25rem;
}

.login-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
}

.login h2 {
  margin: 0 0 0.35rem;
}

.login-sub {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.login .field {
  text-align: left;
}

.login .btn {
  margin-top: 0.25rem;
}

.success {
  text-align: center;
  padding: 1rem 0 0.5rem;
}

.success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 700;
}

.success h2 {
  margin: 0 0 0.5rem;
}

.success p {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
}

.footer {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer code {
  background: #e8eef4;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 600px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .page {
    padding-top: 1.5rem;
  }

  .card {
    padding: 1.25rem;
  }
}
