:root {
  --bg: #04110f;
  --bg-soft: #071a17;
  --surface: rgba(10, 31, 27, 0.82);
  --surface-solid: #0b211d;
  --surface-2: #102c27;
  --line: rgba(145, 255, 214, 0.14);
  --line-strong: rgba(145, 255, 214, 0.28);
  --text: #f4fffb;
  --text-soft: #9fb9b1;
  --text-muted: #78938b;
  --accent: #4ff2a8;
  --accent-2: #35cbe8;
  --danger: #ff6b6b;
  --warning: #ffc857;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 14% 18%, rgba(79, 242, 168, 0.10), transparent 30%),
    radial-gradient(circle at 82% 15%, rgba(53, 203, 232, 0.08), transparent 28%),
    linear-gradient(145deg, #03100e 0%, #061713 52%, #03100e 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.view {
  min-height: 100vh;
}

.view-login {
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-shell {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}

.brand-block {
  display: flex;
  gap: 28px;
  align-items: center;
}

.brand-block h1 {
  margin: 4px 0 2px;
  font-size: clamp(3rem, 7vw, 6.6rem);
  letter-spacing: -0.065em;
  line-height: 0.94;
}

.brand-subtitle {
  margin: 10px 0 0;
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  color: var(--text-soft);
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.brand-mark {
  position: relative;
  width: 148px;
  height: 148px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 32%, rgba(79, 242, 168, 0.95), rgba(53, 203, 232, 0.25) 35%, rgba(6, 31, 27, 0.92) 68%);
  box-shadow:
    0 0 0 1px rgba(79, 242, 168, 0.25),
    0 0 50px rgba(79, 242, 168, 0.16);
  overflow: visible;
}

.brand-core {
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 24px rgba(79, 242, 168, 0.9);
}

.brand-orbit {
  position: absolute;
  inset: -12px;
  border: 1px solid rgba(79, 242, 168, 0.5);
  border-radius: 50%;
  transform: rotate(22deg) scaleY(0.42);
}

.orbit-b {
  inset: 10px -22px;
  transform: rotate(-31deg) scaleY(0.58);
  border-color: rgba(53, 203, 232, 0.55);
}

.login-card {
  padding: 34px;
  background: linear-gradient(180deg, rgba(14, 39, 34, 0.93), rgba(7, 25, 21, 0.93));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.login-card-header h2 {
  margin: 8px 0 6px;
  font-size: 2rem;
}

.login-card-header p:last-child {
  margin: 0 0 26px;
  color: var(--text-soft);
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field > span {
  display: block;
  margin-bottom: 8px;
  color: #d7e9e3;
  font-size: 0.92rem;
  font-weight: 650;
}

.field input {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field input:focus {
  border-color: rgba(79, 242, 168, 0.6);
  box-shadow: 0 0 0 4px rgba(79, 242, 168, 0.08);
  background: rgba(255, 255, 255, 0.055);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 50px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
}

.password-toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--text-soft);
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 22px;
  color: var(--text-soft);
  font-size: 0.92rem;
  cursor: pointer;
}

.remember-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.primary-btn,
.secondary-btn {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
}

.primary-btn {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #032018;
  background: linear-gradient(135deg, var(--accent), #7df7c1);
  box-shadow: 0 14px 34px rgba(79, 242, 168, 0.16);
}

.primary-btn:hover {
  filter: brightness(1.04);
}

.primary-btn:disabled {
  cursor: wait;
  opacity: 0.7;
}

.secondary-btn {
  padding: 11px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.secondary-btn.compact {
  min-height: 42px;
}

.message {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
}

.message.error {
  color: #ffd3d3;
  background: rgba(255, 107, 107, 0.11);
  border: 1px solid rgba(255, 107, 107, 0.22);
}

.message.success {
  color: #ceffe9;
  background: rgba(79, 242, 168, 0.10);
  border: 1px solid rgba(79, 242, 168, 0.20);
}

.connection-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(255, 200, 87, 0.08);
}

.status-dot.online {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 242, 168, 0.08);
}

.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.08);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(3, 32, 24, 0.26);
  border-top-color: #032018;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.large {
  width: 34px;
  height: 34px;
  border-width: 3px;
  border-color: rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 14px clamp(20px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(3, 16, 14, 0.84);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand strong {
  display: block;
  letter-spacing: 0.04em;
}

.topbar-brand small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
}

.mini-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 35%, var(--accent), rgba(53, 203, 232, 0.28) 35%, rgba(8, 35, 30, 0.96) 70%);
  border: 1px solid rgba(79, 242, 168, 0.3);
  box-shadow: 0 0 24px rgba(79, 242, 168, 0.14);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.network-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.86rem;
}

.notification-btn {
  position: relative;
}

.notification-badge {
  position: absolute;
  min-width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  top: -6px;
  right: -6px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 0.68rem;
  font-weight: 900;
  border: 2px solid #061713;
}

.portal-main {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(26px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 84% 18%, rgba(53, 203, 232, 0.10), transparent 30%),
    linear-gradient(145deg, rgba(14, 42, 36, 0.92), rgba(7, 24, 21, 0.92));
  box-shadow: var(--shadow);
}

.hero-card h2 {
  margin: 8px 0 6px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -0.04em;
}

.hero-card p:last-child {
  margin: 0;
  color: var(--text-soft);
}

.hero-status {
  min-width: 265px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 17px 19px;
  border: 1px solid rgba(79, 242, 168, 0.18);
  border-radius: 18px;
  background: rgba(79, 242, 168, 0.055);
}

.hero-status-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(79, 242, 168, 0.12);
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 900;
}

.hero-status strong,
.hero-status small {
  display: block;
}

.hero-status small {
  margin-top: 3px;
  color: var(--text-muted);
}

.apps-section {
  margin-top: 36px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.section-heading h3 {
  margin: 7px 0 0;
  font-size: 1.55rem;
}

.count-pill {
  min-width: 40px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(79, 242, 168, 0.09);
  border: 1px solid rgba(79, 242, 168, 0.16);
  color: var(--accent);
  font-weight: 800;
}

.offline-notice {
  margin-bottom: 18px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 200, 87, 0.18);
  border-radius: 14px;
  background: rgba(255, 200, 87, 0.07);
  color: #ffe7a1;
  font-size: 0.92rem;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}

.app-card {
  min-height: 185px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(13, 37, 32, 0.86), rgba(8, 26, 22, 0.86));
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.app-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(17, 46, 40, 0.92), rgba(9, 29, 25, 0.92));
}

.app-card.offline-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.app-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: 22px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(79, 242, 168, 0.16), rgba(53, 203, 232, 0.10));
  border: 1px solid var(--line);
  color: var(--accent);
  font-weight: 900;
  font-size: 1.35rem;
}

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-card h4 {
  margin: 0;
  font-size: 1.08rem;
}

.app-card p {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.app-meta {
  margin-top: 14px;
  color: var(--text-soft);
  font-size: 0.74rem;
}

.empty-state {
  padding: 48px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 22px;
  color: var(--text-soft);
}

.empty-state h4 {
  margin: 12px 0 6px;
  color: var(--text);
}

.empty-state p {
  max-width: 560px;
  margin: 0 auto;
  color: var(--text-muted);
}

.empty-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: 50%;
  background: rgba(79, 242, 168, 0.08);
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 900;
}

.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(4px);
}

.notification-panel {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  width: min(430px, 100%);
  height: 100vh;
  transform: translateX(105%);
  transition: transform 0.22s ease;
  background: #071916;
  border-left: 1px solid var(--line);
  box-shadow: -28px 0 70px rgba(0, 0, 0, 0.28);
  overflow: auto;
}

.notification-panel.open {
  transform: translateX(0);
}

.panel-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 25, 22, 0.96);
  backdrop-filter: blur(12px);
}

.panel-header h3 {
  margin: 7px 0 0;
  font-size: 1.4rem;
}

.notifications-list {
  padding: 16px;
}

.notice-card {
  padding: 17px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
}

.notice-card.unread {
  border-color: rgba(79, 242, 168, 0.22);
  background: rgba(79, 242, 168, 0.045);
}

.notice-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notice-title {
  margin: 0;
  font-size: 1rem;
}

.notice-priority {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.notice-card p {
  margin: 10px 0 0;
  color: var(--text-soft);
  line-height: 1.55;
  font-size: 0.9rem;
}

.notice-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.mark-read-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-weight: 800;
  font-size: 0.76rem;
}

.compact-state {
  margin: 16px;
}

.global-loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(3, 16, 14, 0.72);
  backdrop-filter: blur(10px);
}

.loading-card {
  min-width: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #0a211d;
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .login-shell {
    grid-template-columns: 1fr;
    gap: 34px;
    max-width: 620px;
  }

  .brand-block {
    justify-content: center;
    text-align: left;
  }

  .brand-mark {
    width: 108px;
    height: 108px;
  }

  .brand-block h1 {
    font-size: 4rem;
  }

  .hero-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-status {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .view-login {
    padding: 18px;
  }

  .brand-block {
    gap: 18px;
  }

  .brand-mark {
    width: 78px;
    height: 78px;
  }

  .brand-block h1 {
    font-size: 3rem;
  }

  .login-card {
    padding: 24px 20px;
  }

  .topbar {
    padding: 12px 14px;
  }

  .topbar-brand small,
  .network-badge span:last-child {
    display: none;
  }

  .network-badge {
    width: 42px;
    padding: 0;
    justify-content: center;
  }

  .portal-main {
    width: min(100% - 24px, 1280px);
    padding-top: 24px;
  }

  .apps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .app-card {
    min-height: 160px;
    padding: 17px;
  }

  .app-icon {
    width: 54px;
    height: 54px;
    margin-bottom: 18px;
  }
}

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


/* ===== CONECT v1.2 — responsividade refinada ===== */

.portal-footer {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.portal-footer strong {
  color: var(--text-soft);
  font-weight: 700;
}

/* Tablet / telas médias */
@media (max-width: 900px) {
  .portal-main {
    width: min(100% - 28px, 1280px);
  }

  .apps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-card {
    min-height: 172px;
  }
}

/* Celular em retrato */
@media (max-width: 620px) and (orientation: portrait) {
  .view-login {
    align-items: start;
    padding-top: 22px;
  }

  .login-shell {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .brand-block {
    justify-content: flex-start;
    text-align: left;
  }

  .brand-mark {
    width: 68px;
    height: 68px;
  }

  .brand-block h1 {
    font-size: clamp(2.5rem, 15vw, 3.5rem);
  }

  .brand-subtitle {
    font-size: 0.98rem;
  }

  .login-card {
    width: 100%;
    border-radius: 22px;
  }

  .topbar {
    min-height: 68px;
    padding: 10px 12px;
  }

  .topbar-actions {
    gap: 7px;
  }

  .secondary-btn.compact {
    padding: 10px 12px;
  }

  .portal-main {
    width: min(100% - 20px, 1280px);
    padding: 18px 0 38px;
  }

  .hero-card {
    padding: 22px 18px;
    border-radius: 22px;
  }

  .hero-card h2 {
    font-size: clamp(1.9rem, 10vw, 2.7rem);
  }

  .apps-section {
    margin-top: 26px;
  }

  .section-heading {
    margin-bottom: 14px;
  }

  .section-heading h3 {
    font-size: 1.28rem;
  }

  .apps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .app-card {
    min-height: 148px;
    padding: 15px 12px;
    border-radius: 18px;
    text-align: center;
  }

  .app-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 15px;
  }

  .app-card h4 {
    font-size: 0.98rem;
    line-height: 1.2;
  }

  .app-card p {
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .app-meta {
    font-size: 0.68rem;
  }

  .portal-footer {
    width: calc(100% - 20px);
    padding-bottom: 18px;
    font-size: 0.7rem;
  }

  .notification-panel {
    width: 100%;
  }
}

/* Celulares muito estreitos */
@media (max-width: 350px) and (orientation: portrait) {
  .apps-grid {
    grid-template-columns: 1fr;
  }

  .app-card {
    min-height: 132px;
  }
}

/* Tablet em retrato: 3 colunas quando houver espaço */
@media (min-width: 700px) and (max-width: 1100px) and (orientation: portrait) {
  .apps-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}


/* ===== CONECT v1.3 — aplicativos em formato launcher ===== */

.apps-grid {
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.app-card {
  min-height: 148px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px 14px;
  text-align: center;
}

.app-icon {
  width: 72px;
  height: 72px;
  margin: 0;
  border-radius: 20px;
}

.app-card h4 {
  width: 100%;
  margin: 0;
  text-align: center;
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* Elementos antigos deixam de ocupar espaço caso alguma versão em cache ainda os injete */
.app-card p,
.app-meta {
  display: none !important;
}

@media (max-width: 900px) {
  .apps-grid {
    grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
    gap: 14px;
  }

  .app-card {
    min-height: 138px;
  }

  .app-icon {
    width: 66px;
    height: 66px;
  }
}

@media (max-width: 620px) and (orientation: portrait) {
  .apps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .app-card {
    min-height: 132px;
    padding: 16px 10px;
    gap: 12px;
  }

  .app-icon {
    width: 58px;
    height: 58px;
    margin: 0;
    border-radius: 17px;
  }

  .app-card h4 {
    font-size: 0.94rem;
  }
}

@media (min-width: 700px) and (max-width: 1100px) and (orientation: portrait) {
  .apps-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
