/* ========================================================================
   Octopus Farm — Design System
   Tema dark premium. Um acento em gradiente (violeta -> cyan, "tinta de polvo").
   ===================================================================== */

:root {
  /* superficies */
  --bg: #07080c;
  --surface: #0d0f16;
  --surface-2: #12151f;
  --surface-3: #171b27;
  --border: #212636;
  --border-strong: #2c3346;

  /* texto */
  --text: #eef1f8;
  --text-muted: #98a2b8;
  --text-faint: #626b82;

  /* acento */
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(124, 92, 255, .14);
  --grad: linear-gradient(135deg, #9b7bff 0%, #6d5efc 45%, #22d3ee 130%);
  --grad-text: linear-gradient(120deg, #b9a5ff 0%, #7cf3ff 100%);

  /* status */
  --ok: #34d399;      --ok-bg: rgba(52, 211, 153, .13);
  --warn: #fbbf24;    --warn-bg: rgba(251, 191, 36, .13);
  --danger: #fb7185;  --danger-bg: rgba(251, 113, 133, .13);

  /* forma */
  --r-lg: 18px;
  --r: 13px;
  --r-sm: 10px;
  --pill: 999px;

  /* sombra */
  --sh-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --sh: 0 10px 34px rgba(0, 0, 0, .38);
  --sh-lg: 0 28px 70px rgba(0, 0, 0, .55);
  --ring: 0 0 0 3px rgba(124, 92, 255, .32);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* brilho de fundo sutil (profundidade) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(680px 460px at 12% -6%, rgba(124, 92, 255, .16), transparent 60%),
    radial-gradient(720px 520px at 100% 0%, rgba(34, 211, 238, .10), transparent 55%),
    radial-gradient(600px 600px at 50% 120%, rgba(124, 92, 255, .06), transparent 60%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .86em;
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 6px;
  color: #cdd4e6;
}

/* ---- Logo do polvo ---- */
.logo-tile {
  display: inline-grid;
  place-items: center;
  background: var(--grad);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(109, 94, 252, .38), inset 0 1px 0 rgba(255, 255, 255, .25);
  flex: none;
}
.logo-tile.sm { width: 34px; height: 34px; }
.logo-tile.md { width: 44px; height: 44px; border-radius: 14px; }
.logo-tile.lg { width: 62px; height: 62px; border-radius: 18px; }
.octo { width: 66%; height: 66%; display: block; }
.octo-body { fill: #fff; }
.octo-eye { fill: #2a1a5c; }

.wordmark { font-weight: 800; letter-spacing: -.02em; font-size: 16px; }
.wordmark .of-tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--accent-2);
  vertical-align: middle;
  padding: 2px 7px;
  border: 1px solid rgba(34, 211, 238, .3);
  border-radius: var(--pill);
  background: rgba(34, 211, 238, .07);
}

/* ==========================  BOTÕES  ========================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 10px 18px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .18s ease, background .18s, border-color .18s, opacity .18s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }

.btn-primary {
  color: #fff;
  background: var(--grad);
  box-shadow: 0 8px 22px rgba(109, 94, 252, .35), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 30px rgba(109, 94, 252, .48), inset 0 1px 0 rgba(255, 255, 255, .25); }

.btn-ghost {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--border-strong); background: #1b2130; }

.btn-block { width: 100%; }
.btn-lg { padding: 12px 20px; font-size: 15px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); border-color: var(--border); }
.icon-btn svg { width: 18px; height: 18px; }

/* ==========================  CAMPOS  ========================== */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > .lbl { font-size: 12.5px; font-weight: 600; color: var(--text-muted); letter-spacing: .01em; }
input[type=text], input[type=password], input:not([type]) {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input::placeholder { color: var(--text-faint); }
input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }

/* ==========================  BADGES / PILLS  ========================== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px 5px 9px;
  border-radius: var(--pill);
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text-muted);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(255,255,255,.06); }
.pill.is-ok { color: var(--ok); border-color: rgba(52,211,153,.3); background: var(--ok-bg); }
.pill.is-off { color: var(--danger); border-color: rgba(251,113,133,.3); background: var(--danger-bg); }
.pill.is-ok .dot { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(52,211,153,.5); } 70% { box-shadow: 0 0 0 6px rgba(52,211,153,0); } }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: var(--pill); letter-spacing: .01em; }
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.err { color: var(--danger); background: var(--danger-bg); }

/* ==========================  LOGIN  ========================== */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}
.auth-brand {
  position: relative;
  overflow: hidden;
  padding: 54px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(600px 420px at 20% 15%, rgba(124,92,255,.32), transparent 60%),
    radial-gradient(560px 460px at 90% 90%, rgba(34,211,238,.22), transparent 60%),
    linear-gradient(160deg, #0b0d18, #0a0b12 60%);
  border-right: 1px solid var(--border);
}
.auth-brand .blob {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; z-index: 0;
  animation: float 14s ease-in-out infinite;
}
.auth-brand .blob.b1 { width: 320px; height: 320px; background: #6d5efc; top: -60px; left: 40px; }
.auth-brand .blob.b2 { width: 280px; height: 280px; background: #22d3ee; bottom: -40px; right: 20px; animation-delay: -5s; }
@keyframes float { 0%,100% { transform: translate(0,0); } 50% { transform: translate(18px, -24px); } }

.auth-brand-inner { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 16px; }
.auth-brand-inner .brand-row { display: flex; align-items: center; gap: 14px; }
.auth-brand h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.03em; margin: 26px 0 0; font-weight: 800; max-width: 15ch; }
.auth-brand h1 .grad { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.auth-brand p.lead { color: var(--text-muted); font-size: 15.5px; max-width: 40ch; margin: 4px 0 0; }
.auth-features { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 13px; margin-top: 8px; }
.auth-features .feat { display: flex; align-items: center; gap: 12px; color: var(--text); font-size: 14px; }
.auth-features .feat .ck { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: #b9a5ff; flex: none; }
.auth-features .feat .ck svg { width: 15px; height: 15px; }
.auth-foot { position: relative; z-index: 1; color: var(--text-faint); font-size: 12.5px; }

.auth-form-wrap { display: grid; place-items: center; padding: 40px; }
.auth-card { width: min(400px, 100%); }
.auth-card .head { text-align: center; margin-bottom: 26px; }
.auth-card .head .logo-tile { margin-bottom: 16px; }
.auth-card h2 { font-size: 23px; letter-spacing: -.02em; margin: 0 0 6px; font-weight: 700; }
.auth-card .head p { color: var(--text-muted); margin: 0; font-size: 14px; }

.banner { display: flex; align-items: center; gap: 9px; padding: 11px 13px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 16px; }
.banner svg { width: 17px; height: 17px; flex: none; }
.banner.err { background: var(--danger-bg); color: #ffc2ca; border: 1px solid rgba(251,113,133,.25); }
.banner.warn { background: var(--warn-bg); color: #ffe4a3; border: 1px solid rgba(251,191,36,.22); }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}

/* ==========================  APP / TOPBAR  ========================== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(10, 12, 18, .78);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .right { display: flex; align-items: center; gap: 12px; }
.sep { width: 1px; height: 26px; background: var(--border); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 4px 4px 5px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: var(--grad);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.user-chip .uname { font-size: 13.5px; font-weight: 600; color: var(--text); }

/* ==========================  LAYOUT  ========================== */
.container { max-width: 940px; margin: 0 auto; padding: 30px 22px 70px; }

.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 25px; letter-spacing: -.025em; margin: 0 0 5px; font-weight: 800; }
.page-head p { color: var(--text-muted); margin: 0; font-size: 14.5px; }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.015), transparent), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
}
.card + .card { margin-top: 20px; }
.card-pad { padding: 22px; }

/* ---- Segmented tabs ---- */
.tabs {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--pill);
  margin: 22px 22px 0;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; background: transparent; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-muted);
  padding: 8px 16px; border-radius: var(--pill);
  transition: color .16s, background .16s;
}
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--text); }
.tab.active { color: #fff; background: var(--grad); box-shadow: 0 4px 14px rgba(109,94,252,.36); }

.panel { display: none; padding: 20px 22px 24px; }
.panel.active { display: block; animation: rise .28s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel .hint { color: var(--text-muted); margin: 0 0 18px; font-size: 13.5px; }

/* ---- Dropzone ---- */
.dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 26px;
  text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .16s, background .16s;
}
.dropzone:hover { border-color: var(--accent); background: #12141f; }
.dropzone.drag { border-color: var(--accent-2); background: rgba(34,211,238,.06); }
.dropzone.filled { border-style: solid; border-color: rgba(52,211,153,.4); background: var(--ok-bg); }
.dropzone input[type=file] { display: none; }
.dropzone .dz-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: #b9a5ff; }
.dropzone .dz-ico svg { width: 21px; height: 21px; }
.dropzone.filled .dz-ico { background: var(--ok-bg); color: var(--ok); }
.dropzone .dz-main { font-size: 14px; font-weight: 600; color: var(--text); }
.dropzone .dz-sub { font-size: 12.5px; color: var(--text-faint); }
.dropzone .dz-main .pick { color: #b9a5ff; }

.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

/* ---- Colar contas x proxies ---- */
.paste-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.paste-col { display: flex; flex-direction: column; gap: 8px; }
.lbl-hint { font-style: normal; font-weight: 500; color: var(--text-faint); font-size: 11.5px; }
textarea {
  width: 100%; min-height: 190px; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.7;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  transition: border-color .16s, box-shadow .16s;
}
textarea::placeholder { color: var(--text-faint); }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }

.paste-opts { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 4px; }
.paste-opts label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.paste-opts label.grow { flex: 1; min-width: 160px; }
select {
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 12px; cursor: pointer;
  min-width: 118px;
}
select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

#preview-wrap { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 18px; }
.preview-summary { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; color: var(--text-muted); }

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

/* ==========================  RESULTADOS  ========================== */
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.results-head .rh-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.results-head h3 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.summary-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.results-actions { display: flex; align-items: center; gap: 12px; }
.progress-txt { font-size: 12.5px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 8px; }

.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.18); border-top-color: var(--accent-2); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress-bar { height: 3px; background: var(--surface-3); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--grad); width: 0; transition: width .4s ease; box-shadow: 0 0 12px rgba(34,211,238,.6); }

.table-wrap { overflow-x: auto; max-height: 460px; overflow-y: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 10px 14px; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.data thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--text-muted); font-weight: 600; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: rgba(255,255,255,.02); }
table.data td.mono { font-family: ui-monospace, Menlo, monospace; color: #c9d1e6; }

.empty { padding: 46px 22px; text-align: center; color: var(--text-faint); }
.empty .e-ico { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; background: var(--surface-3); margin-bottom: 12px; color: var(--text-muted); }
.empty .e-ico svg { width: 24px; height: 24px; }
.empty p { margin: 0; font-size: 13.5px; }

/* ==========================  TOASTS  ========================== */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 15px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  box-shadow: var(--sh-lg);
  animation: toastIn .28s cubic-bezier(.2,.9,.3,1.2);
}
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }
.toast .t-ico { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; flex: none; margin-top: 1px; }
.toast .t-ico svg { width: 15px; height: 15px; }
.toast.ok .t-ico { background: var(--ok-bg); color: var(--ok); }
.toast.err .t-ico { background: var(--danger-bg); color: var(--danger); }
.toast.info .t-ico { background: var(--accent-soft); color: #b9a5ff; }
.toast .t-body { font-size: 13px; }
.toast .t-title { font-weight: 600; color: var(--text); }
.toast .t-sub { color: var(--text-muted); margin-top: 2px; }

@media (max-width: 560px) {
  .tabs { margin: 16px 14px 0; overflow-x: auto; }
  .panel { padding: 18px 14px; }
  .container { padding: 22px 14px 60px; }
  .topbar { padding: 10px 14px; }
  .user-chip .uname { display: none; }
}
