:root {
  --blue-950: #172d7d;
  --blue-900: #1c3faa;
  --blue-800: #2349b8;
  --blue-700: #315bd0;
  --blue-100: #e8efff;
  --page: #f1f5f8;
  --white: #fff;
  --text: #283252;
  --muted: #77829e;
  --line: #e4eaf2;
  --green: #2eb872;
  --red: #ea566a;
  --orange: #f6a73b;
  --shadow: 0 8px 24px rgba(28, 63, 170, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--blue-900); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--blue-900); }
button, input, select { font: inherit; }
.hidden { display: none !important; }

/* Login inspirado na composição original do Fivers, sem dependências do template legado. */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(520px, 58%) minmax(390px, 42%);
  background: var(--white);
}
.login-copy {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(52px, 6vw, 96px);
  color: white;
  isolation: isolate;
  background:
    radial-gradient(circle at 10% 15%, rgba(119, 155, 255, .55), transparent 28%),
    linear-gradient(145deg, #315bd0 0%, #1c3faa 58%, #172d7d 100%);
}
.login-copy::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  right: -130px;
  top: -190px;
  box-shadow: 0 0 0 80px rgba(255, 255, 255, .025), 0 0 0 160px rgba(255, 255, 255, .018);
  z-index: -1;
}
.login-copy-text { position: relative; z-index: 2; max-width: 600px; }
.eyebrow { font-size: 11px; letter-spacing: .19em; font-weight: 800; color: #b9caff; }
.login-copy h1 {
  margin: 20px 0 22px;
  color: white;
  font-size: clamp(45px, 5.1vw, 78px);
  line-height: .98;
  letter-spacing: -.055em;
}
.login-copy h1 em { font-style: normal; color: #9fb7ff; }
.login-copy p { margin: 0; max-width: 535px; color: #d7e0ff; font-size: 17px; line-height: 1.65; }
.login-illustration {
  position: absolute;
  z-index: 1;
  right: clamp(6px, 2.5vw, 45px);
  bottom: clamp(-20px, -2vw, -2px);
  width: min(54%, 560px);
  max-height: 58vh;
  object-fit: contain;
  filter: drop-shadow(0 22px 30px rgba(11, 28, 84, .28));
  mix-blend-mode: screen;
}
.login-card {
  align-self: center;
  justify-self: center;
  width: min(410px, calc(100% - 60px));
  padding: 24px 12px;
  background: white;
}
.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 76px; color: var(--blue-900); }
.login-brand img { width: 48px; height: 48px; padding: 9px; border-radius: 13px; background: var(--blue-900); }
.login-brand strong { font-size: 23px; letter-spacing: -.035em; }
.login-heading > span { color: var(--blue-700); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.login-heading h2 { margin: 8px 0 7px; font-size: 30px; letter-spacing: -.04em; color: #1f2948; }
.login-heading p { margin: 0 0 31px; color: var(--muted); font-size: 14px; }
.login-card label, .form-card label { display: grid; gap: 8px; margin: 18px 0; color: #4f5c78; font-size: 13px; font-weight: 650; }
.input-with-icon { position: relative; }
.input-with-icon > span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #9eabc3; font-size: 9px; }
.input-with-icon input { padding-left: 41px; }
input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #dbe2ed;
  border-radius: 7px;
  background: white;
  color: var(--text);
  padding: 11px 13px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input::placeholder { color: #aab4c6; }
input:focus, select:focus { border-color: var(--blue-700); box-shadow: 0 0 0 3px rgba(49, 91, 208, .12); }
button { border: 0; cursor: pointer; }
.primary, .login-card button {
  min-height: 42px;
  padding: 10px 18px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--blue-700), var(--blue-900));
  color: white;
  font-size: 13px;
  font-weight: 750;
  box-shadow: 0 7px 15px rgba(28, 63, 170, .18);
}
.primary:hover, .login-card button:hover { filter: brightness(1.08); }
.wide { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 25px; }
.wide span { font-size: 18px; }
.error { min-height: 20px; margin: 12px 0; color: var(--red); font-size: 13px; }
.login-footnote { display: block; color: #a2adc0; text-align: center; font-size: 10px; letter-spacing: .08em; }

/* Aplicação: lateral azul e área de trabalho clara como no painel de referência. */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 0;
  padding: 20px 20px 20px 0;
  background: linear-gradient(160deg, #294fc0 0%, var(--blue-900) 48%, var(--blue-950) 100%);
}
.side-nav {
  min-height: calc(100vh - 40px);
  padding: 6px 14px 18px 19px;
  display: flex;
  flex-direction: column;
  color: white;
}
.brand { height: 68px; display: flex; align-items: center; gap: 11px; color: white; text-decoration: none; padding: 0 12px; }
.brand img { width: 36px; height: 36px; object-fit: contain; }
.brand strong { font-size: 14px; letter-spacing: .08em; }
nav { display: flex; flex-direction: column; gap: 5px; margin-top: 15px; }
nav a {
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  border-radius: 999px;
  color: rgba(255, 255, 255, .77);
  text-decoration: none;
  font-size: 12px;
  font-weight: 650;
  transition: background .18s, color .18s, transform .18s;
}
nav a:hover { color: white; background: rgba(255, 255, 255, .10); transform: translateX(2px); }
nav a.active { color: var(--blue-900); background: white; box-shadow: 0 8px 18px rgba(11, 28, 84, .18); }
.menu-icon { width: 20px; text-align: center; font-size: 17px; font-weight: 400; }
.nav-group { display: contents; }
.nav-title { margin: 18px 13px 3px; color: rgba(255, 255, 255, .42); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.side-version { margin-top: auto; display: grid; grid-template-columns: 14px 1fr; align-items: center; padding: 17px 14px 0; color: rgba(255, 255, 255, .78); font-size: 11px; }
.side-version i { width: 7px; height: 7px; border-radius: 50%; background: #6ee7a7; box-shadow: 0 0 10px #6ee7a7; }
.side-version small { grid-column: 2; color: rgba(255, 255, 255, .39); margin-top: 3px; font-size: 9px; }
.content {
  min-width: 0;
  min-height: calc(100vh - 40px);
  padding: 0 23px 42px;
  border-radius: 30px;
  background: var(--page);
  overflow: hidden;
}
.top-bar {
  height: 68px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #dde5ee;
  gap: 24px;
}
.top-brand { min-width: 135px; display: grid; }
.top-brand span { color: var(--blue-900); font-size: 16px; font-weight: 800; }
.top-brand small { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.top-stats { margin-left: auto; display: flex; align-items: center; }
.top-stats > div { min-width: 136px; padding: 0 19px; border-right: 1px solid #e0e6ef; display: grid; gap: 3px; }
.top-stats small { color: var(--muted); font-size: 9px; }
.top-stats strong { color: #273454; font-size: 12px; }
.identity { min-width: 180px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: white; background: linear-gradient(145deg, #6d8ae2, var(--blue-900)); font-size: 12px; font-weight: 800; }
.identity > div { display: grid; gap: 2px; min-width: 92px; }
.identity strong { color: #2b3655; font-size: 11px; }
.identity small { color: var(--muted); font-size: 9px; }
.identity button { width: 31px; height: 31px; border-radius: 7px; color: #8290aa; background: transparent; font-size: 17px; }
.identity button:hover { background: #e3e9f2; color: var(--blue-900); }
.page-heading { min-height: 108px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.page-heading h2 { margin: 7px 0 0; color: #293553; font-size: 25px; letter-spacing: -.035em; }
.breadcrumb { color: #9aa5b8; font-size: 10px; }
.breadcrumb b { color: var(--blue-700); }
.status { display: flex; align-items: center; gap: 7px; color: #72809c; font-size: 10px; border: 1px solid #dfe6ef; background: white; border-radius: 999px; padding: 8px 11px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(46, 184, 114, .13); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 16px; }
.metric, .panel { background: white; border: 1px solid rgba(218, 226, 237, .78); border-radius: 9px; box-shadow: var(--shadow); }
.metric { min-height: 112px; position: relative; overflow: hidden; padding: 20px 20px 17px 68px; }
.metric::after { content: ""; position: absolute; width: 54px; height: 54px; border-radius: 50%; right: -20px; top: -20px; background: rgba(49, 91, 208, .07); }
.metric-icon { position: absolute; left: 18px; top: 22px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--blue-900); background: var(--blue-100); font-size: 17px; }
.metric:nth-child(2) .metric-icon { color: #a06906; background: #fff2d9; }
.metric:nth-child(3) .metric-icon { color: #1d9361; background: #dcf7eb; }
.metric:nth-child(4) .metric-icon { color: #b94659; background: #fee6e9; }
.metric small { display: block; color: var(--muted); font-size: 10px; }
.metric strong { display: block; margin-top: 10px; color: #263250; font-size: 23px; letter-spacing: -.04em; }
.metric em { display: block; margin-top: 5px; color: #a0aaba; font-size: 9px; font-style: normal; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(250px, .7fr); gap: 16px; margin-top: 16px; }
.panel { padding: 22px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-head h3, .form-card h3 { margin: 0 0 6px; color: #293553; font-size: 16px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.panel-actions { display: flex; align-items: center; gap: 8px; }
.panel-badge { padding: 5px 8px; border-radius: 5px; color: var(--green); background: #e3f8ed; font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.financial-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.financial-row > div { padding: 13px 15px; border-radius: 7px; background: #f7f9fc; }
.financial-row span { display: block; color: var(--muted); font-size: 9px; }
.financial-row strong { display: block; margin-top: 6px; color: #2d3958; font-size: 15px; }
.chart-bars { height: 126px; margin-top: 24px; display: flex; align-items: end; gap: clamp(6px, 1.2vw, 15px); padding: 0 7px; border-bottom: 1px solid #e4eaf2; background: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, #eff3f7 32px); }
.chart-bars i { flex: 1; min-width: 8px; max-width: 28px; border-radius: 5px 5px 0 0; background: linear-gradient(to top, var(--blue-900), #7998ef); opacity: .86; }
.security-panel { color: white; background: linear-gradient(145deg, #315bd0, #1c3faa 63%, #172d7d); border: 0; }
.security-panel h3 { margin: 15px 0 8px; font-size: 18px; }
.security-panel p { color: #d7e0ff; font-size: 11px; line-height: 1.55; }
.security-panel ul { margin: 17px 0 0; padding: 0; list-style: none; }
.security-panel li { position: relative; margin: 8px 0; padding-left: 17px; color: #e5ebff; font-size: 10px; }
.security-panel li::before { content: "✓"; position: absolute; left: 0; color: #8ff0ba; }
.security-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px; color: var(--blue-900); background: white; font-weight: 900; }

.ghost { min-height: 38px; padding: 8px 13px; border: 1px solid #dce4ee; border-radius: 7px; color: #64718d; background: white; font-size: 11px; font-weight: 700; }
.ghost:hover { color: var(--blue-900); border-color: #b9c8e4; background: #f8faff; }
.search-box { min-width: 190px; height: 38px; display: flex; align-items: center; gap: 6px; padding: 0 9px; color: #8f9bb1; border: 1px solid #dce4ee; border-radius: 7px; background: white; }
.search-box input { min-height: 32px; padding: 6px 4px; border: 0; box-shadow: none; font-size: 11px; }
.table-wrap { overflow: auto; border: 1px solid #e7ecf3; border-radius: 7px; }
table { width: 100%; border-collapse: collapse; background: white; font-size: 11px; }
th { height: 39px; padding: 9px 12px; color: #77829b; background: #f8fafc; border-bottom: 1px solid #e5ebf2; text-align: left; white-space: nowrap; font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .055em; }
td { height: 45px; padding: 10px 12px; color: #46526c; border-bottom: 1px solid #edf1f5; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f9fbff; }
td code { color: #627093; font-size: 9px; }
.agent-code { color: var(--blue-900); font-weight: 750; }
.tree-mark { display: inline-block; width: 18px; color: #9ba7bd; }
.pill { display: inline-block; padding: 4px 7px; border-radius: 4px; color: #a65463; background: #fee9ec; font-size: 8px; font-weight: 800; }
.pill.on { color: #218454; background: #dcf5e9; }
.game-form { display: grid; grid-template-columns: 74px repeat(4, minmax(90px, 1fr)) minmax(150px, auto); align-items: end; gap: 9px; padding: 12px; border-bottom: 1px solid #edf1f5; background: white; }
.game-form:last-child { border-bottom: 0; }
.game-form label { display: grid; gap: 5px; color: var(--muted); font-size: 9px; }
.game-form input, .game-form select { min-height: 37px; padding: 7px 8px; font-size: 11px; }
.game-form button { min-height: 37px; }
.provider-form { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(110px, .6fr) minmax(240px, 2fr) 110px 90px; align-items: end; gap: 11px; padding: 13px; border-bottom: 1px solid #edf1f5; background: white; }
.provider-form:last-child { border-bottom: 0; }
.provider-form > strong { align-self: center; color: #34405e; font-size: 12px; }
.provider-form > small { align-self: center; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.provider-form label { display: grid; gap: 5px; margin: 0; color: var(--muted); font-size: 9px; }
.provider-form input, .provider-form select { min-height: 37px; padding: 7px 8px; font-size: 11px; }
.provider-form button { min-height: 37px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 16px; }
.form-card label { margin: 13px 0; }
.form-card output { display: block; margin-top: 13px; color: var(--blue-700); font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.form-card output a { color: var(--blue-900); font-weight: 750; }
.flash { margin-bottom: 16px; padding: 11px 14px; color: #22734d; background: #e2f7ed; border: 1px solid #c1ead6; border-radius: 7px; font-size: 11px; }
.flash.bad { color: #a53d4e; background: #feeaed; border-color: #f6cbd2; }

@media (max-width: 1120px) {
  .top-stats > div { min-width: 108px; padding: 0 12px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .security-panel { min-height: 210px; }
  .game-form { grid-template-columns: repeat(3, 1fr); }
  .provider-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-copy { min-height: 36vh; padding: 45px; justify-content: flex-start; }
  .login-copy h1 { font-size: 47px; }
  .login-copy p { max-width: 480px; }
  .login-illustration { width: 310px; max-height: 32vh; }
  .login-card { padding: 48px 20px; }
  .login-brand { margin-bottom: 35px; }
  .app { grid-template-columns: 1fr; padding: 0; }
  .side-nav { min-height: auto; padding: 8px 12px; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { min-width: 175px; height: 52px; }
  .side-nav nav { flex-direction: row; margin: 0; }
  .nav-group { display: contents; }
  .nav-title, .side-version { display: none; }
  .side-nav nav a { min-width: max-content; min-height: 39px; }
  .content { min-height: calc(100vh - 68px); border-radius: 25px 25px 0 0; padding: 0 18px 35px; }
  .top-brand { display: none; }
  .top-stats { margin-left: 0; }
  .identity { margin-left: auto; min-width: auto; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .login-copy { min-height: 28vh; padding: 32px 26px; }
  .login-copy h1 { margin-top: 12px; font-size: 37px; }
  .login-copy p { display: none; }
  .login-illustration { width: 210px; opacity: .5; }
  .login-card { width: calc(100% - 32px); padding: 34px 8px; }
  .top-bar { height: 62px; }
  .top-stats > div { min-width: auto; padding: 0 8px; }
  .top-stats > div:nth-child(1), .top-stats > div:nth-child(3), .identity > div { display: none; }
  .page-heading { min-height: 92px; }
  .status { display: none; }
  .metrics, .financial-row, .form-grid { grid-template-columns: 1fr; }
  .metric { min-height: 96px; }
  .panel { padding: 16px; }
  .panel-head { flex-direction: column; }
  .panel-actions { width: 100%; flex-wrap: wrap; }
  .search-box { flex: 1; }
  .game-form { grid-template-columns: 1fr 1fr; }
  .provider-form { grid-template-columns: 1fr; }
}
