:root {
  --bg: #f3f6fb;
  --bg-accent: #e9eef8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --sidebar: #0f172a;
  --sidebar-soft: #18233a;
  --line: #dbe4f0;
  --line-strong: #c7d3e3;
  --text: #132238;
  --muted: #62748a;
  --primary: #2563eb;
  --primary-2: #3b82f6;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}
* { box-sizing: border-box; }
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.08), transparent 28%),
    radial-gradient(circle at right top, rgba(59,130,246,.08), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
}
.shell { max-width: 1440px; margin: 0 auto; padding: 28px 24px 48px; }
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  background: url('/static/palace.jpg') center/cover no-repeat;
}
.auth-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 252, 0.84);
  z-index: 0;
}
.auth-card {
  position: relative;
  z-index: 10;
  width: min(520px, 100%);
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 24px 48px rgba(15,23,42,.18);
  border-radius: 28px;
  padding: 32px;
  backdrop-filter: blur(12px);
}
.mobile-shell {
  display: block;
  min-height: 100vh;
  padding: 16px;
  position: relative;
  background: url('/static/palace.jpg') center/cover no-repeat;
}
.mobile-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 252, 0.84);
  z-index: 0;
}
.mobile-card {
  position: relative;
  z-index: 10;
  width: calc(100vw - 32px);
  max-width: 640px;
  margin: 16px auto 32px;
  box-sizing: border-box;
}
.mobile-card .subpanel {
  padding: 18px;
  max-width: 100%;
}
.mobile-card .stack,
.mobile-card .actions,
.mobile-card .field,
.mobile-card .table-wrap,
.mobile-card .result-grid {
  max-width: 100%;
}
.mobile-card .result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mobile-card .table-wrap {
  overflow-x: auto;
}

.mobile-card .compact-task-panel {
  width: fit-content;
  max-width: 100%;
  min-width: min(100%, 360px);
}
.mobile-card .compact-task-head {
  margin-bottom: 14px;
}
.mobile-card .compact-task-panel .result-grid {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}
.mobile-card .compact-task-panel .actions {
  justify-content: flex-start;
}

.standalone-task-panel {
  display: block;
  width: min(560px, 100%);
}
.compact-task-grid {
  grid-template-columns: repeat(2, minmax(140px, 1fr));
}
.mobile-card table {
  min-width: 0;
  width: 100%;
}
.mobile-card .alert {
  position: static;
  margin-top: 14px;
  max-width: 100%;
  animation: none;
}
.auth-title { margin: 0; font-size: 36px; }
.auth-btn { width: 100%; justify-content: center; }
.eyebrow { margin: 0 0 8px; text-transform: uppercase; letter-spacing: .16em; color: #7290b3; font-size: 12px; }
h1 { margin: 0; font-size: 38px; line-height: 1.05; }
.subtitle { margin: 12px 0 0; color: var(--muted); }
.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 28px 30px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #ffffff, #f7fbff);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: var(--shadow);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.text-input, textarea, input[type="file"] {
  width: 100%;
  font: inherit;
}
textarea, .text-input {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea:focus, .text-input:focus {
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 4px rgba(37,99,235,.08);
}
textarea { resize: vertical; min-height: 104px; }
.secret-field-wrap {
  position: relative;
}
.secret-field-wrap.left-icon::after {
  content: "";
  position: absolute;
  left: 52px;
  top: 50%;
  width: 1px;
  height: 26px;
  background: var(--line);
  transform: translateY(-50%);
  pointer-events: none;
}
.secret-input-inline {
  padding-right: 16px;
}
.secret-input-inline.left-icon {
  padding-left: 66px;
}
.secret-toggle {
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
}
.secret-icon-svg {
  width: 18px;
  height: 18px;
  display: block;
}
.secret-toggle.inline-inside {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border-color: transparent;
  background: transparent;
}
.secret-toggle.inline-inside.left-side {
  left: 8px;
}
.secret-toggle.inline-inside:hover {
  background: #f8fafc;
}
.select-input.compact { min-width: 210px; padding: 10px 12px; }
input[type="file"] {
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  background: #fff;
  color: var(--muted);
  padding: 14px;
}
.workspace-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
}
.sidebar-card {
  position: sticky;
  top: 24px;
  align-self: start;
  padding: 22px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-soft) 100%);
  color: #f8fafc;
  box-shadow: 0 18px 40px rgba(15,23,42,.22);
}
.step-nav-title {
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(191,219,254,.72);
  margin-bottom: 16px;
}
.step-nav-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  text-decoration: none;
  color: #e2e8f0;
  padding: 16px 14px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: rgba(255,255,255,.04);
  margin-bottom: 10px;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.step-nav-item:hover { transform: translateY(-1px); }
.step-nav-item.active {
  background: rgba(59,130,246,.18);
  border-color: rgba(147,197,253,.28);
}
.step-nav-item strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}
.step-nav-item small {
  display: block;
  font-size: 12px;
  color: rgba(226,232,240,.74);
}
.step-index {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  background: rgba(255,255,255,.08);
  color: #bfdbfe;
}
.sidebar-tips { margin-top: 22px; display: grid; gap: 12px; }
.tip-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}
.tip-card strong { display: block; margin-bottom: 6px; }
.tip-card p { margin: 0; font-size: 13px; line-height: 1.55; color: rgba(226,232,240,.78); }
.tip-card.muted { opacity: .92; }
.content-stack { display: grid; gap: 20px; }
.panel {
  padding: 28px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.72);
  box-shadow: var(--shadow);
}
.step-panel.is-hidden { display: none; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
}
.panel-head h2 { margin: 0 0 8px; font-size: 28px; }
.panel-head p { margin: 0; color: var(--muted); }
.section-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 12px;
  color: #7c8ea7;
}
.mini-badge {
  flex-shrink: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-span-2 { grid-column: 1 / -1; }
.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 8px; }
.field span { font-size: 14px; color: var(--muted); }
.checkbox { display:flex; align-items:center; gap:10px; color: var(--muted); }
.actions, .actions-wrap { display:flex; gap:12px; flex-wrap: wrap; }
.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  min-height: 46px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s ease, opacity .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); opacity: .97; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; }
.btn.secondary { background: #0f766e; color: white; }
.btn.ghost { background: #f8fafc; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: linear-gradient(135deg, #dc2626, #ef4444); color: white; }
.btn.danger.subtle { background: #fff5f5; color: #b91c1c; border: 1px solid #fecaca; }
.btn.compact { padding: 10px 14px; }
.loading-btn {
  position: relative;
  gap: 8px;
}
.loading-btn .btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  display: none;
}
.loading-btn.is-loading .btn-spinner {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}
.loading-btn:disabled {
  opacity: 0.9;
  cursor: wait;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.alert {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  max-width: 420px;
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid transparent;
  box-shadow: 0 10px 28px rgba(15,23,42,.18);
  animation: slideIn 0.25s ease;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.alert.success { background: #ecfdf3; border-color: #86efac; color: #166534; }
.alert.error { background: #fff1f2; border-color: #fda4af; color: #9f1239; }

.alert.inline-alert {
  position: static;
  right: auto;
  bottom: auto;
  width: 100%;
  max-width: 100%;
  margin-top: 14px;
  box-shadow: none;
  animation: none;
  padding: 12px 14px;
}
.alert.inline-alert.info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.status-grid, .result-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.status-card, .metric {
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  min-height: 72px;
}
.status-card.ok { border-color: rgba(22,163,74,.32); }
.status-card.bad { border-color: rgba(220,38,38,.25); }
.status-label, .metric span { display:block; font-size:11px; color: var(--muted); margin-bottom: 6px; }
.metric strong, .status-card strong { font-size: 18px; line-height: 1.2; font-weight: 700; }
.details pre {
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  background: #0f172a;
  border: 1px solid #1e293b;
  color: #cbd5e1;
}
.entry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.login-assistant-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.login-captcha-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
}
.captcha-title {
  font-size: 16px;
  font-weight: 800;
}
.captcha-hint {
  font-size: 13px;
  color: var(--muted);
}
.captcha-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px dashed var(--line-strong);
}
.captcha-preview img {
  max-width: 100%;
  max-height: 80px;
  display: block;
}
.captcha-placeholder {
  color: var(--muted);
  font-size: 13px;
}
.captcha-input {
  letter-spacing: 0.08em;
  font-weight: 700;
}
.subpanel {
  padding: 22px;
  border-radius: 22px;
  background: #f8fbff;
  border: 1px solid #e3ebf5;
}
.subpanel-head { margin-bottom: 16px; }
.subpanel-head h3 { margin: 0 0 8px; font-size: 20px; }
.subpanel-head p { margin: 0; color: var(--muted); }
.placeholder-box {
  padding: 18px 20px;
  border-radius: 18px;
  background: #fffaf0;
  border: 1px solid #fde68a;
}
.placeholder-box strong { display: block; margin-bottom: 6px; }
.placeholder-box p { margin: 0; color: #92400e; }
.table-wrap { overflow:auto; border-radius: 18px; border: 1px solid var(--line); background: white; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 14px 16px; border-bottom: 1px solid #eef2f7; text-align: left; }
th input[type="checkbox"], td input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
th:first-child, td:first-child {
  width: 56px;
  text-align: center;
}
th:first-child input[type="checkbox"], td:first-child input[type="checkbox"] {
  transform: scale(1.15);
}
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f8fafc; }
tr:hover td { background: #f8fbff; }
.empty {
  padding: 22px;
  border-radius: 18px;
  background: #f8fbff;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}
.pill {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.pill.add, .pill.success { background: #dcfce7; color: #166534; }
.pill.failed { background: #fee2e2; color: #991b1b; }
.pill.skipped { background: #fef3c7; color: #92400e; }
.top-gap { margin-top: 18px; }
@media (max-width: 1100px) {
  .workspace-layout { grid-template-columns: 1fr; }
  .sidebar-card { position: static; }
  .entry-grid, .grid-2, .login-assistant-grid { grid-template-columns: 1fr; }
  .grid-span-2 { grid-column: auto; }
}
@media (max-width: 760px) {
  .shell { padding: 18px 14px 32px; }
  .app-topbar, .panel, .sidebar-card { padding: 20px; border-radius: 22px; }
  .app-topbar, .panel-head { flex-direction: column; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .select-input.compact { min-width: 0; }
  h1, .auth-title { font-size: 30px; }
  .mobile-card {
    width: 100%;
    margin: 8px auto 24px;
    padding: 20px;
    border-radius: 22px;
  }
  .mobile-card .result-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .mobile-card .metric strong {
    font-size: 22px;
  }
  .mobile-card th,
  .mobile-card td {
    padding: 10px 12px;
    font-size: 13px;
  }
}
