@import './tokens.css';

* {
  box-sizing: border-box;
}

html {
  font-family: var(--font-main);
  color: var(--ink);
  background: radial-gradient(circle at 100% 0, rgba(243, 0, 101, 0.045), transparent 32%), var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

/* Telas de Autenticação (/entrar) */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  background: var(--surface);
}

.login-decoration {
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 64px;
  background: linear-gradient(135deg, rgba(16, 42, 59, 0.97), rgba(70, 34, 56, 0.92));
}

.login-decoration::before, .login-decoration::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.login-decoration::before {
  width: 440px;
  height: 440px;
  right: -90px;
  top: -100px;
}

.login-decoration::after {
  width: 240px;
  height: 240px;
  left: -70px;
  bottom: 70px;
  border-color: rgba(243, 0, 101, 0.38);
  box-shadow: 0 0 0 32px rgba(243, 0, 101, 0.035);
}

.decoration-copy {
  position: relative;
  z-index: 1;
  color: #fff;
  max-width: 620px;
}

.decoration-copy h1 {
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1.05;
  margin: 14px 0 22px;
  letter-spacing: -0.045em;
}

.decoration-copy p {
  font-size: 18px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
  max-width: 560px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  font-weight: 800;
  color: var(--pink);
}

.decoration-copy .eyebrow {
  color: #ff9bc4;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.feature-pills span {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(243, 0, 101, 0.11);
  backdrop-filter: blur(12px);
  font-size: 12px;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 42px;
  background: linear-gradient(180deg, #fff, #fffafb);
}

.login-card {
  width: min(440px, 100%);
}

.brand-login {
  display: block;
  margin-bottom: 48px;
}

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

.brand-logo-img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 4px;
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
  letter-spacing: -0.03em;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 0;
}

.login-heading h2 {
  font-size: 32px;
  letter-spacing: -0.03em;
  margin: 8px 0;
  color: var(--navy);
}

.login-heading p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 28px;
}

/* Campos de Formulário */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field > label, .field > span {
  font-size: 12px;
  font-weight: 700;
  color: #43516a;
}

.field input, .field select, .field textarea {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  outline: 0;
  transition: 0.2s;
  height: 46px;
  padding: 0 13px;
}

.field textarea {
  height: auto;
  padding: 13px;
  resize: vertical;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(243, 0, 101, 0.12);
}

/* Botões */
.btn {
  height: 44px;
  border: 0;
  border-radius: 11px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
  text-decoration: none;
  transition: 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--pink-dark));
  color: #fff;
  box-shadow: 0 9px 22px rgba(243, 0, 101, 0.22);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 27px rgba(243, 0, 101, 0.29);
}

.btn-light {
  background: #f4f0f2;
  color: var(--navy);
}

.btn-success {
  background: var(--green);
  color: #fff;
}

.btn-block {
  width: 100%;
  margin-top: 8px;
}

.alert-box {
  padding: 12px 16px;
  border-radius: 11px;
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.5;
}

.alert-danger {
  background: #fdf2f4;
  border: 1px solid #f8c8d2;
  color: var(--red);
}

.alert-success {
  background: #edfbf4;
  border: 1px solid #bcecd3;
  color: #156d47;
}

/* App Shell (Estrutura Autenticada) */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--blue-950), #172f40);
  padding: 24px 18px;
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.sidebar::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--pink), rgba(243, 0, 101, 0.08));
}

.brand-plate {
  width: 100%;
  min-height: 64px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 20px;
}

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  color: rgba(255, 255, 255, 0.72);
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 13px;
  text-decoration: none;
  font-weight: 650;
  transition: 0.2s;
}

.nav-item:hover, .nav-item.is-active {
  background: rgba(243, 0, 101, 0.15);
  color: #fff;
}

.nav-item.is-active {
  box-shadow: inset 3px 0 0 var(--pink);
}

.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.34);
  font-weight: 800;
  padding: 18px 13px 7px;
}

.sidebar-footer {
  margin-top: auto;
}

.storage-card {
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(243, 0, 101, 0.18);
  border-radius: 13px;
  padding: 14px;
}

.storage-card span, .storage-card strong, .storage-card small {
  display: block;
}

.storage-card span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.storage-card strong {
  font-size: 12px;
  margin: 4px 0 10px;
}

.storage-card div {
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  overflow: hidden;
}

.storage-card i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--pink);
}

.storage-card small {
  font-size: 10px;
  margin-top: 7px;
  color: rgba(255, 255, 255, 0.45);
}

.logout-button {
  width: 100%;
  height: 42px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  margin-top: 8px;
}

/* Topbar */
.content-shell {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 78px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  box-shadow: 0 4px 22px rgba(32, 56, 75, 0.04);
}

.topbar-search {
  height: 43px;
  flex: 1;
  max-width: 580px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  height: 100%;
  padding: 0 14px 0 42px;
  background: #faf8f9;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.topbar-search input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(243, 0, 101, 0.12);
  outline: 0;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: #e8f8f1;
  color: #168255;
}

.sync-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #24a873;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pink), #ff70aa);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
}

.user-menu strong, .user-menu span {
  display: block;
}

.user-menu strong {
  font-size: 13px;
}

.user-menu span {
  font-size: 11px;
  color: var(--muted);
}

/* Conteúdo Principal */
.main-content {
  padding: 32px;
  max-width: 1600px;
  margin: auto;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-heading h1 {
  font-size: 32px;
  letter-spacing: -0.035em;
  margin: 6px 0;
  color: var(--navy);
}

.page-heading p {
  color: var(--muted);
  margin: 0;
}

/* Grids e Cartões */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e9e4e7;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: var(--shadow-sm);
}

.metric-card::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--pink), transparent);
  opacity: 0.55;
}

.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: var(--pink-soft);
  color: var(--pink);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
}

.metric-card span, .metric-card strong, .metric-card small {
  display: block;
}

.metric-card span {
  font-size: 12px;
  color: var(--muted);
}

.metric-card strong {
  font-size: 27px;
  letter-spacing: -0.03em;
  margin: 3px 0;
  color: var(--navy);
}

.metric-card small {
  font-size: 11px;
  color: #6b7a90;
}

/* Tabelas */
.panel {
  background: #fff;
  border: 1px solid #e9e4e7;
  border-radius: var(--radius);
  box-shadow: 0 7px 28px rgba(36, 63, 96, 0.045);
  padding: 22px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8591a3;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 14px 14px;
  border-bottom: 1px solid #edf1f6;
  font-size: 13px;
}

td strong, td span {
  display: block;
}

td span {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

/* Responsividade */
@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}

@media (max-width: 780px) {
  .login-screen {
    grid-template-columns: 1fr;
  }
  .login-decoration {
    display: none;
  }
  .metric-grid {
    grid-template-columns: 1fr;
  }
  .main-content {
    padding: 18px;
  }
}
