/* geocode-web — Aegis Design System (Atlas) */

:root {
  --background: 85 15% 8%;
  --foreground: 85 10% 90%;
  --card: 85 15% 11%;
  --card-foreground: 85 10% 90%;
  --card-border: 85 15% 18%;
  --primary: 85 35% 45%;
  --primary-foreground: 0 0% 100%;
  --primary-border: 85 35% 55%;
  --secondary: 85 15% 18%;
  --secondary-foreground: 85 10% 80%;
  --muted: 85 15% 15%;
  --muted-foreground: 85 10% 60%;
  --accent: 85 25% 18%;
  --accent-foreground: 85 35% 55%;
  --destructive: 0 60% 45%;
  --destructive-foreground: 0 0% 100%;
  --border: 85 15% 18%;
  --input: 85 15% 22%;
  --ring: 85 35% 45%;
  --radius: 0.375rem;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: "Plus Jakarta Sans", sans-serif;
  --elevate-1: rgba(255, 255, 255, 0.05);
  --elevate-2: rgba(255, 255, 255, 0.1);
  --brand-primary: hsl(var(--primary));
  --brand-hover: hsl(85 35% 52%);
  --bg-primary: hsl(var(--background));
  --bg-secondary: hsl(var(--card));
  --bg-tertiary: hsl(var(--muted));
  --bg-input: hsl(var(--input));
  --bg-hover: hsl(var(--accent));
  --border-color: hsl(var(--border));
  --border-subtle: hsl(85 15% 15%);
  --border-strong: hsl(85 12% 24%);
  --text-primary: hsl(var(--foreground));
  --text-secondary: hsl(var(--muted-foreground));
  --text-muted: hsl(85 10% 50%);
  --success: hsl(142 45% 22%);
  --success-text: hsl(142 50% 70%);
  --warning: hsl(38 55% 25%);
  --warning-text: hsl(38 90% 55%);
  --danger: hsl(var(--destructive));
  --danger-text: hsl(var(--destructive-foreground));
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  --btn-border: hsl(85 12% 24%);
  --focus-ring: 0 0 0 3px hsl(var(--ring) / 0.2);
}

[data-theme="light"] {
  --background: 85 20% 98%;
  --foreground: 85 15% 15%;
  --card: 0 0% 100%;
  --card-border: 85 20% 92%;
  --primary: 85 45% 40%;
  --primary-border: 85 45% 35%;
  --secondary: 85 20% 90%;
  --secondary-foreground: 85 20% 30%;
  --muted: 85 20% 92%;
  --muted-foreground: 85 15% 45%;
  --accent: 85 30% 90%;
  --border: 85 20% 90%;
  --input: 85 20% 85%;
  --ring: 85 45% 40%;
  --elevate-1: rgba(0, 0, 0, 0.04);
  --elevate-2: rgba(0, 0, 0, 0.08);
  --brand-primary: hsl(var(--primary));
  --brand-hover: hsl(85 45% 48%);
  --bg-input: hsl(0 0% 100%);
  --border-subtle: hsl(85 20% 88%);
  --border-strong: hsl(85 15% 85%);
  --text-muted: hsl(85 15% 40%);
  --success: hsl(142 45% 90%);
  --success-text: hsl(142 55% 28%);
  --warning: hsl(38 90% 94%);
  --warning-text: hsl(38 80% 30%);
  --danger: hsl(0 70% 96%);
  --danger-text: hsl(0 70% 35%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --btn-border: hsl(85 15% 85%);
  --focus-ring: 0 0 0 3px hsl(var(--ring) / 0.15);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  transition: background-color 0.15s, color 0.15s;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

#layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

a {
  color: hsl(var(--accent-foreground));
  text-decoration: none;
  transition: color 0.12s ease;
}

a:hover {
  color: var(--brand-hover);
  text-decoration: underline;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* —— header —— */

.site-header {
  background: hsl(var(--background) / 0.95);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background-color 0.15s, border-color 0.15s;
}

/* ——————————————————————————————
   Modo embed (data-embed="1") — padrão geo / Cakitu
   Ver docs/template/modelopadraodesign.md
—————————————————————————————— */

html[data-embed="1"] .site-header,
html[data-embed="1"] .scraper-site-header,
html[data-embed="1"] .scraper-site-footer,
html[data-embed="1"] .scraper-standalone-nav {
  display: none !important;
}

html[data-embed="1"] body {
  padding: 16px 20px 24px;
  min-height: auto;
  overflow-x: hidden;
  overflow-y: visible;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  background: var(--bg-primary);
}

html[data-embed="1"] #layout,
html[data-embed="1"] .app-shell {
  min-height: auto;
  background: var(--bg-primary);
}

html[data-embed="1"] .site-main {
  padding: 0;
  background: var(--bg-primary);
}

html[data-embed="1"] .wrap,
html[data-embed="1"] .main-container {
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
}

html[data-embed="1"] .page-head {
  display: none;
}

html[data-embed="1"] .layout-grid {
  grid-template-columns: 1fr;
}

html[data-embed="1"] .scroll-x {
  max-height: none !important;
  overflow: visible !important;
}

html[data-embed="1"] .history-panel,
html[data-embed="1"] .history-section,
html[data-embed="1"] [class*="history"] {
  width: 100%;
  max-width: none;
  height: auto !important;
  max-height: none !important;
  min-height: 0;
  overflow: visible !important;
}

html[data-embed="1"] .history-table-wrap,
html[data-embed="1"] .history-list,
html[data-embed="1"] .history-scroll {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

html[data-embed="1"] .history-panel {
  flex: none;
  display: block;
}

html[data-embed="1"] label,
html[data-embed="1"] .row-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0;
  text-transform: none;
}

html[data-embed="1"] .btn {
  border-radius: var(--radius);
}

html[data-embed="1"] .panel,
html[data-embed="1"] fieldset.panel {
  box-shadow: none;
}

/* login embed */
html[data-embed="1"].page-login body,
html[data-embed="1"] body.page-login {
  background: var(--bg-primary);
}

html[data-embed="1"] body.page-login .site-main,
html[data-embed="1"].page-login .site-main {
  padding: 0;
  justify-content: flex-start;
}

html[data-embed="1"] body.page-login .page-head,
html[data-embed="1"].page-login .page-head {
  display: none;
}

html[data-embed="1"] body.page-login .login-foot,
html[data-embed="1"].page-login .login-foot {
  display: none;
}

html[data-embed="1"] body.page-login .wrap,
html[data-embed="1"].page-login .wrap {
  max-width: 420px;
  margin: 0 auto;
}

.site-header__inner {
  max-width: 96rem;
  margin: 0 auto;
  padding: 0 1rem 0 1.25rem;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-header__left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
  padding-left: 0.5rem;
  border-left: 2px solid hsl(var(--primary));
}

.site-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.site-title:hover {
  opacity: 0.92;
  color: var(--text-primary);
  text-decoration: none;
}

.site-breadcrumb {
  font-size: 12px;
  color: var(--text-secondary);
}

.site-breadcrumb::before {
  content: "/";
  margin-right: 0.5rem;
  color: var(--text-muted);
}

.site-header__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 12px;
}

.site-usage {
  color: var(--text-secondary);
}

.site-usage__value {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.site-link {
  font-size: 12px;
  font-weight: 500;
}

.warn {
  color: hsl(0 65% 55%);
  font-weight: 600;
}

[data-theme="light"] .warn {
  color: hsl(0 65% 42%);
}

/* —— main —— */

.site-main {
  flex: 1;
  padding: 1.25rem 0 2.5rem;
  background: hsl(var(--muted) / 0.1);
}

.wrap {
  width: 100%;
  max-width: 96rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-head {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.page-head--center {
  text-align: center;
  border-bottom: none;
  padding-bottom: 0;
}

.page-head__title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.page-head .intro,
.intro {
  margin: 0;
  max-width: 42rem;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.page-head--center .intro {
  margin-left: auto;
  margin-right: auto;
}

.intro strong {
  color: var(--text-primary);
  font-weight: 600;
}

.small {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
}

/* —— layout grid —— */

.layout-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: start;
}

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

/* —— panels —— */

.panel,
fieldset.panel {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 0 0 1rem;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s, border-color 0.15s;
}

.panel__legend {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  padding: 0 0.35rem;
}

.panel__hint {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.panel-narrow {
  max-width: 100%;
}

.panel--run .run-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.run-row__after {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.run-row__after .small {
  color: var(--text-secondary);
  margin: 0;
  font-size: 11.5px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.stack:last-child {
  margin-bottom: 0;
}

label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.row-label {
  margin: 0.5rem 0 0.35rem;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* —— buttons —— */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--btn-border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  gap: 4px;
  white-space: nowrap;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn:hover {
  background: hsl(var(--muted) / 0.5);
  text-decoration: none;
}

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

.btn--primary {
  background: hsl(85 40% 40%);
  border-color: hsl(85 40% 32%);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: hsl(85 40% 46%);
  border-color: hsl(85 40% 38%);
  color: #fff;
}

[data-theme="light"] .btn--primary {
  background: hsl(85 48% 38%);
  border-color: hsl(85 48% 30%);
}

[data-theme="light"] .btn--primary:hover:not(:disabled) {
  background: hsl(85 48% 44%);
}

.btn--secondary {
  background: var(--bg-tertiary);
  border-color: var(--btn-border);
}

.btn--secondary:hover:not(:disabled) {
  background: hsl(var(--muted) / 0.5);
}

.btn--ghost {
  background: transparent;
  border-color: var(--btn-border);
  color: var(--text-secondary);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn--sm {
  font-size: 11px;
  height: 24px;
  padding: 0 8px;
}

/* tabs */

.tabs {
  display: inline-flex;
  gap: 0;
  margin-bottom: 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  overflow: hidden;
  background: var(--bg-tertiary);
}

.tabs__btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  margin: 0;
  border: none;
  border-right: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.tabs__btn:last-child {
  border-right: none;
}

.tabs__btn:hover {
  background: var(--elevate-1);
  color: var(--text-primary);
}

.tabs__btn.is-active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 hsl(var(--primary));
}

/* drop zone */

.file-zone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1.35rem 1rem;
  text-align: center;
  cursor: pointer;
  background: hsl(var(--muted) / 0.25);
  margin-bottom: 0.5rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-zone:hover {
  border-color: hsl(var(--primary));
  background: var(--elevate-1);
}

.file-zone p {
  margin: 0.25rem 0;
}

.file-zone__hint {
  margin-top: 0.35rem;
}

/* formulários */

.w100 {
  width: 100%;
  max-width: 100%;
}

input,
select,
textarea,
button {
  font-family: inherit;
  font-size: 13px;
}

input,
select,
textarea {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0 10px;
  height: 32px;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: hsl(var(--ring) / 0.5);
}

textarea {
  height: auto;
  min-height: 7rem;
  padding: 8px 10px;
  resize: vertical;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.meta {
  margin-top: 0.35rem;
}

/* progresso */

.prog {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
}

.prog-bar {
  display: inline-block;
  width: min(200px, 35vw);
  height: 5px;
  border-radius: 99px;
  background: var(--bg-tertiary);
  overflow: hidden;
  vertical-align: middle;
}

.prog-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: hsl(var(--primary));
  transition: width 0.15s ease;
}

.prog-text {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
}

.toolbar {
  margin: 0 0 0.5rem;
}

/* tabela */

.scroll-x {
  overflow: auto;
  max-height: min(420px, 55vh);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.grid {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
  background: var(--bg-secondary);
}

.grid th,
.grid td {
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 14px;
}

.grid th {
  background: var(--bg-tertiary);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  color: hsl(var(--muted-foreground));
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
}

.grid tbody tr {
  transition: background-color 0.1s;
}

.grid tbody tr:hover {
  background: var(--elevate-1);
}

.tr-ok td {
  background: hsl(142 45% 22% / 0.35);
}

[data-theme="light"] .tr-ok td {
  background: hsl(142 55% 88% / 0.55);
}

.tr-warn td {
  background: hsl(38 55% 25% / 0.45);
}

[data-theme="light"] .tr-warn td {
  background: hsl(38 92% 94% / 0.7);
}

.tr-err td {
  background: hsl(0 50% 22% / 0.4);
}

[data-theme="light"] .tr-err td {
  background: hsl(0 70% 95% / 0.75);
}

/* histórico */

.history-wrap {
  margin-top: 0.5rem;
}

.history-empty {
  color: var(--text-muted);
  padding: 0.5rem 0;
}

.history-table td:last-child {
  white-space: nowrap;
}

.hist-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hist-badge--ok {
  background: var(--success);
  color: var(--success-text);
}

.hist-badge--err {
  background: hsl(0 50% 22% / 0.5);
  color: hsl(0 75% 70%);
}

[data-theme="light"] .hist-badge--err {
  background: hsl(0 70% 95%);
  color: hsl(0 65% 35%);
}

.text-muted {
  color: var(--text-muted);
}

.history-download {
  font-weight: 600;
  font-size: 12px;
}

/* banner */

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  background: var(--warning);
  color: var(--warning-text);
  box-shadow: var(--shadow-sm);
}

.banner__text {
  flex: 1;
  min-width: 12rem;
}

/* toasts */

.toasts {
  position: fixed;
  bottom: 18px;
  right: 24px;
  z-index: 9000;
  max-width: min(320px, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.notification {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
  background: var(--bg-secondary);
  pointer-events: auto;
  animation: toastUp 0.18s ease-out;
}

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

.notification > span {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.notification-success {
  border-left: 3px solid var(--success-text);
}

.notification-error {
  border-left: 3px solid hsl(0 65% 55%);
}

.notification-warning {
  border-left: 3px solid var(--warning-text);
}

.notification-info {
  border-left: 3px solid hsl(var(--primary));
}

.notification-close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius);
  transition: color 0.12s, background 0.12s;
}

.notification-close:hover {
  color: var(--text-primary);
  background: hsl(var(--muted) / 0.5);
}

/* tema */

.theme-switcher {
  display: inline-block;
  position: relative;
}

.theme-dd {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  z-index: 1200;
  min-width: 9rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.theme-dd__opt {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background-color 0.1s, color 0.1s, border-color 0.1s;
}

.theme-dd__opt:hover {
  background: var(--elevate-1);
  color: var(--text-primary);
  border-left-color: hsl(var(--primary));
}

/* login */

.page-login--standalone #layout {
  min-height: 100vh;
}

.page-login .site-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 2rem;
  background: var(--bg-primary);
}

.page-login .wrap {
  max-width: 420px;
}

.login-card {
  width: 100%;
}

.page-login .panel-narrow {
  max-width: 100%;
}

.login-hint {
  margin-bottom: 0.75rem;
}

.login-actions {
  margin: 1rem 0 0;
}

.login-actions .btn {
  width: 100%;
  height: 32px;
}

.login-foot {
  margin-top: 1rem;
  text-align: center;
}

.err {
  color: hsl(0 65% 55%);
  margin: 0 0 0.65rem;
  font-size: 12px;
}

[data-theme="light"] .err {
  color: hsl(0 65% 42%);
}

code {
  font-size: 11px;
  background: var(--bg-tertiary);
  padding: 0.12rem 0.35rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border-color);
}

@media (max-width: 480px) {
  .site-header__inner {
    padding: 0 1rem;
  }

  .wrap {
    padding: 0 1rem;
  }

  .toasts {
    right: 0.65rem;
    left: 0.65rem;
    max-width: none;
  }
}
