:root {
  --ink: #1a2330;
  --muted: #5c6b7a;
  --line: rgba(26, 35, 48, 0.12);
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #f7f4ef;
  --accent: #0d7377;
  --accent-deep: #095456;
  --accent-soft: rgba(13, 115, 119, 0.12);
  --danger: #b42318;
  --ok: #1b7f4a;
  --warn: #9a6700;
  --radius: 14px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --shadow: 0 18px 50px rgba(26, 35, 48, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface-solid);
}

.app-bg,
.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 10% -10%, rgba(13, 115, 119, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(196, 140, 72, 0.16), transparent 50%),
    linear-gradient(165deg, #f3efe7 0%, #e8eef0 45%, #dde8e6 100%);
}

.brand {
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1.35rem;
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--accent-soft);
  padding: 0.15em 0.4em;
  border-radius: 6px;
}

/* Auth */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.auth-shell {
  width: min(420px, 100%);
  animation: rise 0.55s ease both;
}

.auth-shell h1 {
  margin: 0.35rem 0 0.5rem;
  font-size: clamp(1.8rem, 4vw, 2.35rem);
  letter-spacing: -0.04em;
  font-weight: 600;
}

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

.auth-form {
  margin-top: 1.75rem;
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
}

label span { color: var(--muted); }

input, select, button {
  font: inherit;
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s, background 0.15s, opacity 0.15s;
}

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

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

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

.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-danger {
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
}

.form-error {
  color: var(--danger);
  margin: 0;
  font-size: 0.9rem;
}

/* App chrome */
.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  background: rgba(247, 244, 239, 0.72);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-brand {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 8rem;
}

.topbar-sub {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  flex: 1;
}

.tab {
  background: transparent;
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.auth-footer {
  margin-top: 1.75rem;
  font-size: 0.9rem;
}

.auth-footer a {
  color: var(--accent-deep);
  font-weight: 600;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.topbar-user a.btn-ghost {
  color: var(--muted);
  text-decoration: none;
}

.topbar-user a.btn-ghost:hover {
  color: var(--accent-deep);
}

.workspace {
  width: min(1100px, calc(100% - 2rem));
  margin: 1.5rem auto 3rem;
  animation: rise 0.45s ease both;
}

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

.panel-head h1 {
  margin: 0;
  font-size: 1.75rem;
  letter-spacing: -0.03em;
}

.panel-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 42rem;
}

.dropzone {
  border: 1.5px dashed rgba(13, 115, 119, 0.45);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.35));
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  outline: none;
}

.dropzone.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}

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

.dropzone-hint {
  margin: 0.4rem 0 1.1rem;
  color: var(--muted);
}

.progress {
  margin-top: 0.85rem;
  height: 6px;
  border-radius: 999px;
  background: rgba(26, 35, 48, 0.08);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #3aa6a0);
  transition: width 0.2s ease;
}

.table-wrap {
  margin-top: 1.5rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

th, td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.55);
}

tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pending { background: rgba(154, 103, 0, 0.12); color: var(--warn); }
.badge-processing { background: var(--accent-soft); color: var(--accent-deep); }
.badge-completed { background: rgba(27, 127, 74, 0.12); color: var(--ok); }
.badge-failed { background: rgba(180, 35, 24, 0.12); color: var(--danger); }
.badge-active { background: rgba(27, 127, 74, 0.12); color: var(--ok); }
.badge-inactive { background: rgba(26, 35, 48, 0.08); color: var(--muted); }

.row-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.row-actions .btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  background: #fff8e8;
  border: 1px solid rgba(154, 103, 0, 0.25);
  margin-bottom: 1rem;
}

.banner code {
  font-size: 0.8rem;
  word-break: break-all;
}

dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: min(420px, calc(100vw - 2rem));
  box-shadow: var(--shadow);
  background: #fffdf9;
}

dialog::backdrop {
  background: rgba(26, 35, 48, 0.35);
  backdrop-filter: blur(2px);
}

.dialog-form {
  padding: 1.35rem 1.4rem 1.2rem;
  display: grid;
  gap: 0.85rem;
}

.dialog-form h2 {
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.check input { width: auto; }

.auth-footer {
  margin-top: 1.75rem;
  font-size: 0.9rem;
}

.auth-footer a,
.topbar-user a {
  color: var(--accent-deep);
  font-weight: 600;
  text-decoration: none;
}

.auth-footer a:hover,
.topbar-user a:hover {
  text-decoration: underline;
}

.topbar-user a.btn-ghost {
  color: var(--muted);
  text-decoration: none;
}

.topbar-user a.btn-ghost:hover {
  color: var(--accent-deep);
  text-decoration: none;
}

@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
  }

  .panel-head {
    flex-direction: column;
  }

  .user-label { display: none; }
}
