:root {
  --verde:       #0abf04;
  --verde-esc:   #078a02;
  --branco:      #ffffff;
  --preto:       #000000;
  --bg:          #080808;
  --cinza:       #161616;
  --cinza2:      #1e1e1e;
  --cinza3:      #252525;
  --borda:       rgba(255,255,255,0.07);
  --txt:         rgba(255,255,255,0.85);
  --txt-fraco:   rgba(255,255,255,0.55);
}

/* Tema Claro */
body.light-theme {
  --bg:          #f5f5f5;
  --cinza:       #ffffff;
  --cinza2:      #ffffff;
  --cinza3:      #f0f0f0;
  --borda:       rgba(0,0,0,0.1);
  --txt:         rgba(0,0,0,0.85);
  --txt-fraco:   rgba(0,0,0,0.55);
}

body.light-theme .login-container {
  background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
}

body.light-theme .login-box,
body.light-theme .dg-card,
body.light-theme .dg-inner,
body.light-theme .tool-card {
  background: linear-gradient(160deg, #ffffff 0%, #f8f8f8 100%);
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

body.light-theme .dg-header,
body.light-theme .login-box {
  background: linear-gradient(135deg, #f0f0f0 0%, #ffffff 100%);
}

body.light-theme .dg-header {
  background: linear-gradient(135deg, #111 0%, #060606 100%) !important;
  border-bottom-color: rgba(10,191,4,0.2);
}

body.light-theme .dg-header-sub {
  color: rgba(255,255,255,0.55) !important;
}

body.light-theme body {
  background: #f5f5f5;
}

body.light-theme .dg-header {
  border-bottom-color: rgba(10,191,4,0.2);
}

body.light-theme .menu-dropdown {
  background: #fff;
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

body.light-theme .menu-item {
  color: #333;
  border-bottom-color: rgba(0,0,0,0.05);
}

body.light-theme .dg-footer {
  background: #e8e8e8;
  border-top-color: rgba(0,0,0,0.1);
}

body.light-theme code {
  background: rgba(10,191,4,0.15);
  color: var(--verde-esc);
}

body.light-theme .dg-table tbody tr:hover { background: rgba(0,0,0,0.03); }
body.light-theme .dg-table tbody tr:nth-child(even) { background: rgba(0,0,0,0.02); }
body.light-theme .dg-table tbody td { border-bottom-color: rgba(0,0,0,0.05); }

body.light-theme .nav-pills .nav-link {
  border-color: rgba(0,0,0,0.15);
  color: rgba(0,0,0,0.55);
}

body.light-theme .nav-pills .nav-link:hover:not(.active) {
  background: #333;
  color: #fff;
  border-color: #333;
}

body.light-theme .dg-file-btn {
  border-color: rgba(0,0,0,0.3);
  color: #333;
}

body.light-theme .dg-file-wrap:hover .dg-file-btn {
  background: #333;
  color: #fff;
}

body.light-theme .btn-dg-outline {
  border-color: rgba(0,0,0,0.35);
  color: #333;
}

body.light-theme .btn-dg-outline:hover {
  background: #333;
  color: #fff;
}

body.light-theme #btn-theme svg {
  stroke: #fff;
}

#btn-theme {
  padding: 0.4rem 0.5rem;
  min-width: 36px;
  justify-content: center;
}
#btn-theme svg {
  display: block;
}

.btn-purple {
  background: transparent;
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}

.btn-purple:hover,
.btn-purple.active {
  background: #8b5cf6 !important;
  border-color: #8b5cf6 !important;
  color: #fff !important;
}

/* Remove btn-purple do light-theme, agora é global */
body.light-theme .dg-chart-box {
  background: #fafafa;
}

body.light-theme .utm-result-box {
  background: #f5f5f5;
  border-color: rgba(10,191,4,0.4);
}

body.light-theme .news-item {
  background: rgba(0,0,0,0.03);
}

body.light-theme .news-item:hover {
  background: rgba(0,0,0,0.06);
}

body.light-theme .news-item-title {
  color: #333;
}

body.light-theme .form-control {
  background: #fff;
  border-color: rgba(0,0,0,0.15);
  color: #333;
}

body.light-theme .form-control:focus {
  background: #fff;
  color: #333;
}

body.light-theme .tool-card h3 {
  color: #333;
}

body.light-theme .widget-link {
  color: var(--verde);
  font-size: 0.75rem;
  margin-left: 0.3rem;
}

body.light-theme .weather-link {
  color: inherit;
  text-decoration: none;
  display: block;
}

body.light-theme .weather-link:hover .weather-temp {
  color: var(--verde);
}

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

body {
  font-family: "Montserrat", system-ui, sans-serif;
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.dg-header {
  flex-shrink: 0;
}

.dg-main {
  flex: 1;
  padding: 2rem 0 3rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dg-main .container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

.dg-main .row {
  flex: 1;
  width: 100%;
  margin: 0;
}

.dg-main .col-lg-11 {
  max-width: 100%;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

#home-page, #tools-page {
  display: none;
  flex-direction: column;
  width: 100%;
}

#home-page .row, #tools-page .row {
  flex: 1;
}

.dg-footer {
  flex-shrink: 0;
}

/* Login */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #111 0%, #060606 100%);
  padding: 1rem;
}

.login-box {
  background: linear-gradient(160deg, #1a1a1a 0%, #0e0e0e 100%);
  border-radius: 1rem;
  border: 1px solid var(--borda);
  box-shadow: 0 24px 60px rgba(0,0,0,0.85);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo { margin-bottom: 1.5rem; }
.login-logo .dg-logo { max-height: 64px; object-fit: contain; }

.login-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--verde);
  text-shadow: 0 0 14px rgba(10,191,4,0.5);
  margin-bottom: 0.3rem;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--txt-fraco);
  margin-bottom: 1.8rem;
}

#login-form .form-control {
  background: #1c1c1c;
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
}

#login-form .form-control:focus {
  background: #1c1c1c;
  border-color: var(--verde);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(10,191,4,0.2);
}

#login-form .form-control::placeholder { color: var(--txt-fraco); }

.login-error {
  color: #ff6b6b;
  font-size: 0.8rem;
  margin-bottom: 1rem;
  min-height: 1.2rem;
}

.login-footer {
  margin-top: 1.5rem;
  font-size: 0.72rem;
  color: var(--txt-fraco);
}

.btn-sm { padding: 0.35rem 0.9rem; font-size: 0.78rem; }

/* MENU DROPDOWN */
.header-buttons {
  position: relative;
}

#btn-menu {
  position: relative;
}

.menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #1a1a1a;
  border: 1px solid var(--borda);
  border-radius: 0.5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  min-width: 220px;
  z-index: 1000;
  margin-top: 0.5rem;
  overflow: hidden;
}

.menu-dropdown.show {
  display: block;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--txt);
  cursor: pointer;
  transition: background .15s, color .15s;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item:hover {
  background: rgba(10,191,4,0.15);
  color: var(--verde);
}

.menu-item svg {
  flex-shrink: 0;
}

/* RESET bootstrap */
a, a:visited, a:hover, a:focus { color: var(--verde); text-decoration: none; }
code, kbd, samp, pre {
  color: var(--verde);
  background: rgba(10,191,4,0.1);
  padding: 0.05em 0.3em;
  border-radius: 4px;
  font-size: 0.82em;
}
:focus-visible { outline: 2px solid var(--verde); outline-offset: 2px; }
::selection { background: rgba(10,191,4,0.3); color: #fff; }

/* HEADER */
.dg-header {
  background: linear-gradient(135deg, #111 0%, #060606 100%);
  border-bottom: 1px solid rgba(10,191,4,0.15);
  padding: 0.85rem 0;
}
.dg-logo { max-height: 60px; object-fit: contain; }

.dg-header .container {
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}
.dg-header-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--verde);
  text-shadow: 0 0 14px rgba(10,191,4,0.5);
}
.dg-header-sub { font-size: 0.78rem; color: var(--txt-fraco); margin-top: 0.1rem; }

/* MAIN */
.dg-main { flex: 1; padding: 2rem 0 3rem; }

/* CARD */
.dg-card {
  background: linear-gradient(160deg, #1a1a1a 0%, #0e0e0e 100%);
  border-radius: 1rem;
  border: 1px solid var(--borda);
  box-shadow: 0 24px 60px rgba(0,0,0,0.85);
  padding: 1.75rem 1.5rem;
}
.dg-inner {
  background: #1c1c1c;
  border-radius: 0.75rem;
  border: 1px solid rgba(255,255,255,0.07);
  padding: 1rem 1.15rem;
}

/* TABS */
.nav-pills { gap: 0.4rem; flex-wrap: wrap; }
.nav-pills .nav-link {
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--txt-fraco);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.4rem 1.1rem;
  background: transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-pills .nav-link.active {
  background: var(--verde);
  color: #000;
  border-color: var(--verde);
  box-shadow: 0 0 18px rgba(10,191,4,0.5);
}
.nav-pills .nav-link:hover:not(.active) {
  background: #ffffff;
  color: var(--verde);
  border-color: var(--verde);
}

/* TÍTULOS */
.dg-section-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.2rem; }
.dg-section-desc { font-size: 0.84rem; color: var(--txt-fraco); margin-bottom: 1rem; }

/* BOTÕES */
.btn-dg {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  border-radius: 999px;
  font-size: 0.85rem;
  padding: 0.48rem 1.4rem;
  border-width: 2px;
  border-style: solid;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-dg-verde {
  background: var(--verde);
  border-color: var(--verde);
  color: #000;
}
.btn-dg-verde:hover {
  background: #fff;
  border-color: var(--verde);
  color: var(--verde);
}
.btn-dg-outline {
  background: transparent;
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}
.btn-dg-outline:hover {
  background: #fff;
  border-color: #fff;
  color: #000;
}

/* FILE INPUT */
.dg-file-wrap { position: relative; display: inline-block; }
.dg-file-wrap input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  width: 100%;
  height: 100%;
}
.dg-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.3);
  padding: 0.45rem 1.2rem;
  font-size: 0.84rem;
  font-weight: 600;
  background: transparent;
  color: #fff;
  pointer-events: none;
  transition: background .15s, color .15s, border-color .15s;
}
.dg-file-wrap:hover .dg-file-btn {
  background: #fff;
  border-color: #fff;
  color: var(--verde);
}
.dg-file-name { font-size: 0.79rem; color: var(--txt-fraco); }

/* TABELA */
.dg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.dg-table thead th {
  color: var(--verde);
  font-weight: 700;
  font-size: 0.77rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(10,191,4,0.25);
  background: transparent;
}
.dg-table tbody tr { transition: background .1s; }
.dg-table tbody tr:hover { background: rgba(255,255,255,0.04); }
.dg-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.025); }
.dg-table tbody td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--txt);
}

/* TOTAL BAR */
.dg-total {
  margin-top: 0.6rem;
  padding: 0.5rem 0.85rem;
  border-radius: 0.5rem;
  background: linear-gradient(90deg, rgba(10,191,4,0.14) 0%, transparent 100%);
  border-left: 3px solid var(--verde);
  font-size: 0.82rem;
  color: var(--txt);
}
.dg-total strong { color: var(--verde); }

/* GRÁFICO */
.dg-chart-box {
  margin-top: 1rem;
  background: #181818;
  border-radius: 0.7rem;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 0.85rem 1rem;
}
.dg-chart-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--txt-fraco);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
canvas { width: 100% !important; height: 200px !important; display: block; }

/* ALERTS */
.dg-alert {
  border-radius: 0.6rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.8rem;
  border: 1px solid;
  margin-bottom: 0.75rem;
}
.dg-alert-ok {
  background: rgba(10,191,4,0.08);
  border-color: rgba(10,191,4,0.45);
  color: rgba(200,255,200,0.92);
}
.dg-alert-err {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.28);
  color: rgba(255,255,255,0.88);
}
.dg-alert-info {
  background: rgba(10,191,4,0.06);
  border-color: rgba(10,191,4,0.25);
  color: rgba(200,255,200,0.8);
}

/* FOOTER */
.dg-footer {
  background: var(--bg);
  border-top: 1px solid var(--borda);
  padding: 0.75rem 0;
  font-size: 0.77rem;
  color: var(--txt-fraco);
  width: 100%;
}

.dg-footer .container {
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}
.dg-footer .brand { color: var(--verde); font-weight: 700; }

/* TOOL CARDS (HOMEPAGE) */
.tool-card {
  background: linear-gradient(160deg, #1a1a1a 0%, #0e0e0e 100%);
  border: 1px solid var(--borda);
  border-radius: 0.75rem;
  padding: 1.25rem;
  cursor: pointer;
  transition: all .2s ease;
  height: 100%;
}
.tool-card:hover {
  border-color: var(--verde);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(10,191,4,0.2);
}
.tool-card .tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(10,191,4,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  color: var(--verde);
}
.tool-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: #fff;
}
.tool-card p {
  font-size: 0.78rem;
  color: var(--txt-fraco);
  margin: 0;
}

/* WIDGETS */
.widget-box { min-height: 180px; }
.widget-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--verde);
  margin-bottom: 0.75rem;
}

/* WEATHER WIDGET */
.weather-loading, .news-loading {
  color: var(--txt-fraco);
  font-size: 0.8rem;
  text-align: center;
  padding: 2rem 0;
}
.weather-content { text-align: center; }
.weather-temp {
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
}
.weather-desc {
  font-size: 0.9rem;
  color: var(--txt-fraco);
  margin-bottom: 0.5rem;
}
.weather-details {
  font-size: 0.8rem;
  color: var(--txt-fraco);
}
.weather-details strong { color: var(--verde); }

/* NEWS WIDGET */
.news-content {
  max-height: 160px;
  overflow: hidden;
  position: relative;
}
.news-list {
  display: flex;
  flex-direction: column;
  animation: newsScroll 20s linear infinite;
}
.news-list:hover {
  animation-play-state: paused;
}
@keyframes newsScroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}
.news-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem;
  border-radius: 0.4rem;
  background: rgba(255,255,255,0.03);
  transition: background .15s;
  cursor: pointer;
}
.news-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem;
  border-radius: 0.4rem;
  background: rgba(255,255,255,0.03);
  transition: background .15s;
  cursor: pointer;
}
.news-item:hover { background: rgba(255,255,255,0.06); }
.news-item a {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
}
.news-item-icon {
  color: var(--verde);
  flex-shrink: 0;
  margin-top: 2px;
}
.news-item-title {
  font-size: 0.78rem;
  color: #fff;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-item-source {
  font-size: 0.7rem;
  color: var(--txt-fraco);
  margin-top: 0.2rem;
}

.widget-link {
  color: var(--verde);
  font-size: 0.75rem;
  margin-left: 0.3rem;
  text-decoration: none;
}
.widget-link:hover {
  text-decoration: underline;
}

.weather-link {
  color: inherit;
  text-decoration: none;
  display: block;
}
.weather-link:hover .weather-temp {
  color: var(--verde);
}

.news-empty {
  color: var(--txt-fraco);
  font-size: 0.8rem;
  text-align: center;
  padding: 1rem;
}

/* UTM BUILDER */
.form-label {
  font-size: 0.82rem;
  color: var(--txt-fraco);
  margin-bottom: 0.35rem;
}
#utm-form input, #utm-form select {
  background: #1c1c1c;
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 0.85rem;
}
#utm-form input:focus {
  border-color: var(--verde);
  box-shadow: 0 0 0 2px rgba(10,191,4,0.2);
}
.utm-result-box {
  background: #0a0a0a;
  border: 1px solid rgba(10,191,4,0.3);
  border-radius: 0.5rem;
  padding: 0.85rem;
  min-height: 60px;
  font-size: 0.8rem;
  word-break: break-all;
  color: #fff;
}
.utm-placeholder { color: var(--txt-fraco); font-style: italic; }
.utm-result-link { color: var(--verde); }
.utm-saved-list {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 0.5rem;
}
.utm-saved-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  gap: 0.5rem;
}
.utm-saved-item:last-child { border-bottom: none; }
.utm-saved-name {
  font-size: 0.78rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.utm-saved-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}
.utm-saved-actions button {
  background: transparent;
  border: none;
  color: var(--txt-fraco);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 0.3rem;
  transition: all .15s;
}
.utm-saved-actions button:hover {
  color: var(--verde);
  background: rgba(10,191,4,0.1);
}
.utm-empty {
  color: var(--txt-fraco);
  font-size: 0.78rem;
  text-align: center;
  padding: 0.5rem;
}

/* CONTADOR DE CARACTERES */
.char-stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.char-stat-item {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  background: rgba(255,255,255,0.03);
  border-radius: 0.4rem;
  font-size: 0.85rem;
}
.char-stat-label { color: var(--txt-fraco); }
.char-stat-value { font-weight: 700; color: var(--verde); }
.char-limits {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.char-limit-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.limit-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.limit-badge.over {
  background: rgba(255,100,100,0.2);
  color: #ff6b6b;
}
.limit-badge.ok {
  background: rgba(10,191,4,0.15);
  color: var(--verde);
}

/* VALIDADOR DE URLs */
.url-summary {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.url-ok-badge, .url-error-badge, .url-total-badge {
  padding: 0.3rem 0.8rem;
  border-radius: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.url-ok-badge { background: rgba(10,191,4,0.2); color: var(--verde); }
.url-error-badge { background: rgba(255,100,100,0.2); color: #ff6b6b; }
.url-total-badge { background: rgba(255,255,255,0.1); color: var(--txt); }
.url-status-icon { margin-right: 0.3rem; }

/* QR CODE */
.qr-result-box {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 0.5rem;
  padding: 1rem;
}
.qr-result-box canvas, .qr-result-box img {
  max-width: 100%;
  height: auto !important;
}
.qr-result-box .utm-placeholder {
  color: #333;
}

@media (max-width: 768px) {
  .dg-card { padding: 1.2rem 1rem; }
}
