:root {
  --bg-1: #f4efe6;
  --bg-2: #eef6ff;
  --ink: #1f2430;
  --muted: #5e6778;
  --card: #ffffff;
  --border: #e3dfd5;
  --accent: #1b7f6b;
  --accent-2: #f06b3b;
  --shadow: 0 20px 60px rgba(20, 24, 36, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  min-height: 100vh;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -10% auto auto -10%;
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle at 30% 30%, rgba(240, 107, 59, 0.35), transparent 60%);
  z-index: -1;
  filter: blur(10px);
}

body::after {
  inset: auto -15% -10% auto;
  background: radial-gradient(circle at 70% 60%, rgba(27, 127, 107, 0.28), transparent 60%);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 24px 60px;
}

.page.wide {
  max-width: none;
  width: 100%;
  padding: 28px 36px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--muted);
}

h1, h2, h3 {
  margin: 6px 0;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  animation: rise 0.6s ease both;
}

.panel {
  display: grid;
  gap: 14px;
}

.panel details {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fffdf8;
}

.panel summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

.panel summary::-webkit-details-marker {
  display: none;
}

.panel summary::after {
  content: "+";
  float: right;
  color: var(--muted);
}

.panel details[open] summary::after {
  content: "–";
}

.panel .section-body {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.sticky {
  position: sticky;
  top: 20px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.results-table th, .results-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  align-items: center;
}

.upload-form {
  display: grid;
  gap: 14px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.stat {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #fbfaf7;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 20px rgba(27, 127, 107, 0.25);
}

.btn.danger {
  background: #c0392b;
  color: #fff;
  box-shadow: 0 8px 20px rgba(192, 57, 43, 0.25);
}

.btn.danger:hover {
  background: #a93226;
}

.btn.crm {
  background: #b91c1c;
  color: #fff;
  box-shadow: 0 10px 26px rgba(185, 28, 28, 0.35);
  animation: crm-flash 1.2s ease-in-out infinite;
  margin-right: auto;
}

.btn.crm:hover {
  background: #991b1b;
}

.btn.nav {
  background: transparent;
  color: var(--ink);
  border: 0;
  padding: 6px 8px;
  box-shadow: none;
  font-weight: 600;
  border-radius: 8px;
  white-space: nowrap;
  font-size: 13px;
}

.btn.nav:hover {
  background: rgba(27, 127, 107, 0.08);
}

.btn.nav.active {
  color: var(--accent);
  background: rgba(27, 127, 107, 0.12);
}

.nav-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.nav-group {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
}

.status-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #3fbf7f;
  box-shadow: 0 0 0 6px rgba(63, 191, 127, 0.18);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.2); opacity: 0.6; }
}

@keyframes crm-flash {
  0%, 100% { transform: translateY(0); box-shadow: 0 10px 26px rgba(185, 28, 28, 0.22); }
  50% { transform: translateY(-1px); box-shadow: 0 0 0 6px rgba(185, 28, 28, 0.16), 0 18px 36px rgba(185, 28, 28, 0.38); }
}

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

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: none;
}

input[type="file"],
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}

td form input[type="password"] {
  max-width: 220px;
}

input[type="file"]::file-selector-button {
  border: 0;
  background: var(--accent-2);
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  margin-right: 10px;
  cursor: pointer;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-queued { background: rgba(31, 36, 48, 0.08); color: #1f2430; }
.status-processing { background: rgba(240, 107, 59, 0.15); color: #b44e2c; }
.status-completed { background: rgba(27, 127, 107, 0.15); color: #1b7f6b; }
.status-failed { background: rgba(176, 0, 32, 0.15); color: #8c0c1f; }

.table-card {
  padding: 0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  background: #f7f3ea;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

tr:hover td {
  background: #fcfaf6;
}

.link {
  color: var(--ink);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-card {
  max-width: 520px;
  width: 100%;
  display: grid;
  gap: 10px;
}

.login-card .eyebrow {
  color: var(--muted);
}

.login-panel {
  display: grid;
  gap: 16px;
}

.login-fields {
  display: grid;
  gap: 14px;
}

.login-fields label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-input {
  border-radius: 14px;
  border: 1px solid #e4ded2;
  padding: 12px 14px;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.2s ease;
}

.login-input:focus {
  outline: none;
  border-color: rgba(27, 127, 107, 0.6);
  box-shadow: 0 0 0 3px rgba(27, 127, 107, 0.12);
}

.login-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.login-hint {
  font-size: 12px;
  color: var(--muted);
}

.login-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 140px);
  gap: 16px;
  align-items: center;
}

.login-hero .orb {
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, rgba(240, 107, 59, 0.5), transparent 60%),
    radial-gradient(circle at 70% 60%, rgba(27, 127, 107, 0.45), transparent 60%),
    #f7f3ea;
  box-shadow: 0 18px 40px rgba(20, 24, 36, 0.2);
  justify-self: end;
}

@media (max-width: 640px) {
  .login-hero {
    grid-template-columns: 1fr;
  }
  .login-hero .orb {
    justify-self: start;
  }
}

.err {
  color: #8c0c1f;
  font-size: 13px;
}

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

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

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  th, td {
    padding: 10px;
  }
}
