:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #111827;
  --success: #059669;
  --error: #dc2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

.page {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
}

.header {
  flex-shrink: 0;
  margin-bottom: 12px;
  padding: 0 4px;
}

.header h1,
.login-panel h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
}

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

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 12px;
  min-height: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 20px;
  min-height: 0;
}

.form-panel {
  overflow-y: auto;
}

.results-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

form label,
fieldset legend {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

input[type="text"],
input[type="number"],
input[type="password"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  margin-bottom: 12px;
}

textarea {
  resize: vertical;
}

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 12px;
}

.radio,
.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.9rem;
}

.btn.primary {
  width: 100%;
  background: var(--primary);
  color: white;
}

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

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

.btn.secondary {
  background: var(--secondary);
  color: white;
}

.status-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: #dbeafe;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width 0.3s ease;
}

.progress-bar.indeterminate {
  width: 40% !important;
  animation: indeterminate 1.2s ease-in-out infinite;
}

@keyframes indeterminate {
  0% { margin-left: 0; }
  50% { margin-left: 60%; }
  100% { margin-left: 0; }
}

.note {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.85rem;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.export-actions {
  display: flex;
  gap: 8px;
}

.results-meta {
  color: var(--muted);
  margin: 4px 0 12px;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.table-wrap {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 0;
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 0.88rem;
}

th {
  background: #f9fafb;
  position: sticky;
  top: 0;
  z-index: 1;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
  padding: 40px 16px;
}

.hint {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: -8px;
  margin-bottom: 12px;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.social-links a {
  display: inline-block;
  padding: 2px 8px;
  background: #eef2ff;
  color: var(--primary);
  border-radius: 4px;
  font-size: 0.75rem;
  text-decoration: none;
  white-space: nowrap;
}

.social-links a:hover {
  background: #dbeafe;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  flex-shrink: 0;
}

.pagination .btn {
  min-width: 90px;
}

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

#page-info {
  color: var(--muted);
  font-size: 0.9rem;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.login-panel {
  width: 100%;
  max-width: 420px;
}

.error {
  color: var(--error);
  font-weight: 600;
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .page {
    height: auto;
    min-height: 100vh;
  }

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

  .results-panel {
    min-height: 60vh;
  }
}
