@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  color-scheme: light;
  font-family: 'DM Sans', sans-serif;
  color: #19243a;
  background: #f3f6fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --blue: #315de8;
  --blue-dark: #2149c7;
  --navy: #111d37;
  --muted: #74819a;
  --line: #e5eaf2;
  --surface: #fff;
  --shadow: 0 12px 32px rgb(31 48 83 / 6%);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; overflow-x: clip; background: #f3f6fb; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 10% 0%, #dce8ff 0, transparent 35%),
    radial-gradient(ellipse at 100% 100%, #e2e9ff 0, transparent 32%), #f4f6fb;
}
.login-card {
  width: min(100%, 430px);
  padding: 38px;
  display: grid;
  gap: 17px;
  border: 1px solid rgb(255 255 255 / 85%);
  border-radius: 26px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 28px 90px rgb(25 47 94 / 14%);
}
.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(145deg, #5480ff, #2549bf);
  box-shadow: 0 9px 20px rgb(49 93 232 / 26%);
  font: 800 17px Manrope, sans-serif;
}
.brand-mark.small { width: 42px; height: 42px; border-radius: 14px; }
.eyebrow { margin: 0; color: #7583a0; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.login-card h1, .topbar h1 { margin: 0; font: 800 27px Manrope, sans-serif; letter-spacing: -.035em; }
.muted { margin: 5px 0 0; color: var(--muted); line-height: 1.55; }
.login-card label, .stack-form label, .inline-form label { display: grid; gap: 8px; color: #40506d; font-size: 13px; font-weight: 700; }
.login-card input, .stack-form input, .stack-form textarea, .inline-form input, .inline-form select, .panel-heading select {
  width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid #dce3ef;
  border-radius: 12px;
  outline: none;
  color: #19243a;
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
}
.login-card input:focus, .stack-form input:focus, .stack-form textarea:focus, .inline-form input:focus, .inline-form select:focus, .request-controls input:focus, .price-field input:focus {
  border-color: #7897ff;
  box-shadow: 0 0 0 4px rgb(49 93 232 / 11%);
}
.button { min-height: 44px; padding: 11px 16px; border: 0; border-radius: 12px; font-weight: 800; transition: .18s ease; }
.ui-icon { width: 19px; height: 19px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item span { display: grid; place-items: center; }
.stat-icon .ui-icon { width: 20px; height: 20px; }
#refresh-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgb(34 62 120 / 13%); }
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.primary { color: #fff; background: linear-gradient(135deg, #426bf0, #2e53d0); }
.primary:hover { background: linear-gradient(135deg, #355de0, #2447bd); }
.secondary { border: 1px solid #dfe5f0; color: #405170; background: #fff; }
.ghost { color: #e2e9ff; background: rgb(255 255 255 / 9%); }
.link { padding: 7px 0; color: var(--blue); background: transparent; }
.form-error { min-height: 18px; margin: 0; color: #be3846; font-size: 13px; }

.app-shell { min-width: 0; min-height: 100vh; display: grid; grid-template-columns: 256px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 620px;
  display: flex;
  flex-direction: column;
  padding: 24px 15px 18px;
  color: #fff;
  background: linear-gradient(165deg, #152648 0%, #101b33 70%, #182c53 100%);
}
.brand-row { display: flex; align-items: center; gap: 12px; padding: 2px 8px 34px; }
.brand-row b, .brand-row small { display: block; }
.brand-row b { font: 800 14px Manrope, sans-serif; }
.brand-row small { margin-top: 4px; color: #9badd1; font-size: 12px; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item {
  position: relative;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 0;
  border-radius: 12px;
  color: #bac7df;
  background: transparent;
  text-align: left;
  font-weight: 700;
  transition: .18s ease;
}
.nav-item span { width: 20px; color: #9fb6f7; text-align: center; font-size: 18px; }
.nav-item:hover { color: #fff; background: rgb(255 255 255 / 7%); }
.nav-item.active { color: #fff; background: linear-gradient(100deg, rgb(87 124 238 / 34%), rgb(87 124 238 / 13%)); box-shadow: inset 3px 0 #89a4ff; }
.nav-item.active span { color: #d5dfff; }
.sidebar-bottom { display: grid; gap: 12px; margin-top: auto; padding: 15px 7px 0; color: #aab9d4; font-size: 12px; overflow-wrap: anywhere; }

.main-area { width: min(100%, 1560px); min-width: 0; margin: 0 auto; padding: 36px clamp(20px, 4vw, 62px) 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 27px; }
.topbar h1 { margin-top: 6px; font-size: clamp(25px, 3vw, 32px); }
.topbar .button { min-width: 126px; }
.view-section { display: grid; gap: 20px; animation: appear .22s ease-out; }
@keyframes appear { from { opacity: .5; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.stat-card, .panel-card { border: 1px solid rgb(225 231 241 / 90%); border-radius: 19px; background: var(--surface); box-shadow: var(--shadow); }
.stat-card { position: relative; min-height: 156px; padding: 20px; overflow: hidden; }
.stat-card::after { position: absolute; right: -25px; bottom: -43px; width: 112px; height: 112px; border-radius: 50%; background: currentColor; content: ''; opacity: .035; }
.stat-card p { margin: 14px 0 8px; color: #74819a; font-size: 12px; font-weight: 600; }
.stat-card strong { color: #17233b; font: 800 30px Manrope, sans-serif; letter-spacing: -.04em; }
.stat-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; font-size: 17px; }
.blue { color: #315de8; background: #eaf0ff; }
.amber { color: #c17a05; background: #fff3da; }
.green { color: #16824e; background: #e4f7ed; }
.violet { color: #7545c8; background: #f0eaff; }
.panel-card { padding: 23px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.panel-heading h2 { margin: 0; color: #19243a; font: 800 17px Manrope, sans-serif; letter-spacing: -.02em; }
.panel-heading .muted { max-width: 620px; font-size: 12px; }
.table-wrap { overflow: auto; border: 1px solid #edf0f5; border-radius: 13px; }
table { width: 100%; min-width: 730px; border-collapse: separate; border-spacing: 0; }
th, td { padding: 14px 12px; border-bottom: 1px solid #edf0f5; text-align: left; vertical-align: top; font-size: 12px; }
th { position: sticky; top: 0; color: #78869f; background: #f8faff; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
td { color: #506079; }
td strong { color: #1c2942; }
.pill { display: inline-flex; align-items: center; border-radius: 30px; padding: 6px 10px; color: #526178; background: #eef2f7; font-size: 10px; font-weight: 800; white-space: nowrap; }
.pill.pending, .pill.emailed { color: #966100; background: #fff2d8; }
.pill.approved, .pill.active, .pill.published { color: #167244; background: #e4f7ed; }
.pill.rejected, .pill.revoked, .pill.archived { color: #ac3038; background: #fde9e9; }
.row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.small-button { padding: 8px 10px; border: 1px solid #dce4ef; border-radius: 9px; color: #315de8; background: #fff; font-size: 11px; font-weight: 800; }
.small-button:hover { background: #f5f7ff; }
.small-button.danger { color: #bd3942; }
.inline-form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.inline-form .grow { flex: 1; min-width: 230px; }
.stack-form { display: grid; gap: 15px; }
.stack-form textarea { min-height: 124px; resize: vertical; line-height: 1.55; }
.stack-form small { float: right; color: #8591a5; font-size: 11px; }
.campaign-layout { display: grid; grid-template-columns: minmax(290px, .9fr) minmax(320px, 1.1fr); gap: 18px; }
.campaign-item { padding: 16px 2px; border-bottom: 1px solid #edf0f5; }
.campaign-item:last-child { border-bottom: 0; }
.campaign-item h3 { margin: 0 0 7px; font-size: 14px; }
.campaign-item p { margin: 0 0 9px; color: #63728a; font-size: 12px; line-height: 1.6; }
.campaign-meta { color: #8a96a8; font-size: 11px; }
.bar-chart { height: 250px; display: flex; align-items: end; gap: 10px; padding: 12px 2px 0; border-bottom: 1px solid #e8edf4; }
.bar-item { min-width: 20px; height: 100%; flex: 1; display: grid; justify-items: center; align-items: end; gap: 7px; }
.bar { width: min(100%, 38px); min-height: 3px; border-radius: 8px 8px 2px 2px; background: linear-gradient(180deg, #83a1ff, #315de8); }
.bar-item b { color: #61718a; font-size: 10px; }
.bar-item span { color: #8995a8; font-size: 10px; white-space: nowrap; }
.compact-chart { height: 150px; }
.metrics-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metric-box { padding: 16px; border: 1px solid #edf0f5; border-radius: 14px; background: #f8faff; }
.metric-box span { display: block; color: #74829a; font-size: 11px; }
.metric-box strong { display: block; margin-top: 7px; color: #1a2944; font: 800 21px Manrope, sans-serif; }
.empty { padding: 28px 18px; color: #8591a5; text-align: center; font-size: 13px; }
.request-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.request-controls input { width: min(280px, 100%); min-height: 44px; padding: 11px 13px; border: 1px solid #dbe2ed; border-radius: 11px; outline: none; background: #fff; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 255px), 1fr)); gap: 15px; }
.plan-card { display: grid; align-content: start; gap: 14px; padding: 19px; border: 1px solid #e4eaf3; border-radius: 17px; background: linear-gradient(150deg, #fff, #f8faff); box-shadow: 0 8px 22px rgb(23 52 91 / 5%); }
.plan-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.plan-period { color: #6e7d99; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.plan-card h3 { margin: 6px 0 0; color: #172944; font: 800 17px Manrope, sans-serif; }
.plan-code { padding: 5px 8px; border-radius: 8px; color: #6c7d99; background: #eef3fb; font-size: 10px; }
.price-field { display: grid; gap: 7px; color: #3e4e68; font-size: 12px; font-weight: 800; }
.price-field input { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid #dbe2ed; border-radius: 12px; outline: none; color: #172944; background: #fff; font-size: 20px; font-weight: 800; }
.plan-check { display: flex; align-items: center; gap: 9px; color: #53627a; font-size: 12px; }
.plan-check input { width: 17px; height: 17px; accent-color: var(--blue); }
.plan-card .button { margin-top: 2px; }
.toast { position: fixed; right: 24px; bottom: 22px; z-index: 20; max-width: min(440px, calc(100vw - 32px)); padding: 14px 18px; border: 1px solid rgb(255 255 255 / 15%); border-radius: 13px; color: #fff; background: #1b2b4d; box-shadow: 0 16px 38px rgb(16 35 78 / 25%); font-size: 13px; }
.toast.error { background: #ad3442; }
.dialog-overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgb(12 22 41 / 48%); backdrop-filter: blur(5px); }
.dialog-card { width: min(100%, 440px); padding: 25px; border: 1px solid #e8edf5; border-radius: 20px; background: #fff; box-shadow: 0 25px 80px rgb(10 24 52 / 25%); }
.dialog-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: var(--blue); background: #ebf0ff; font-weight: 900; }
.dialog-card h2 { margin: 15px 0 8px; font: 800 19px Manrope, sans-serif; }
.dialog-card p { color: #66748d; font-size: 13px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .campaign-layout { grid-template-columns: 1fr; }
  .main-area { padding-right: 26px; padding-left: 26px; }
}
@media (max-width: 760px) {
  .app-shell { display: flex; flex-direction: column; }
  .sidebar { position: sticky; top: 0; z-index: 10; height: auto; min-height: 0; padding: 11px 12px 9px; box-shadow: 0 8px 24px rgb(12 27 55 / 18%); }
  .brand-row { padding: 0 4px 10px; }
  .brand-mark.small { width: 36px; height: 36px; border-radius: 12px; }
  .brand-row b { font-size: 13px; }
  .sidebar nav { display: flex; gap: 6px; margin: 0 -2px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .nav-item { min-height: 39px; flex: 0 0 auto; gap: 7px; padding: 8px 10px; border-radius: 10px; font-size: 11px; white-space: nowrap; }
  .nav-item span { width: 15px; font-size: 15px; }
  .nav-item.active { box-shadow: inset 0 -2px #a9bbff; }
  .sidebar-bottom { display: none; }
  .main-area { padding: 21px 13px 34px; }
  .topbar { align-items: center; margin-bottom: 18px; }
  .topbar h1 { font-size: 23px; }
  .topbar .eyebrow { font-size: 9px; }
  .topbar .button { min-width: 0; min-height: 40px; padding: 9px 11px; font-size: 12px; }
  .view-section { gap: 13px; }
  .stat-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .stat-card { min-height: 116px; padding: 14px; border-radius: 15px; }
  .stat-card p { min-height: 31px; margin: 10px 0 5px; font-size: 10px; line-height: 1.45; }
  .stat-card strong { font-size: 23px; }
  .stat-icon { width: 31px; height: 31px; border-radius: 10px; font-size: 14px; }
  .panel-card { padding: 16px 14px; border-radius: 16px; }
  .panel-heading { align-items: flex-start; flex-direction: column; gap: 9px; margin-bottom: 14px; }
  .panel-heading h2 { font-size: 15px; }
  .panel-heading .muted { font-size: 11px; }
  .panel-heading > .button.link { align-self: flex-end; }
  .request-controls { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .request-controls input { width: 100%; min-width: 0; }
  .request-controls select { grid-column: 1 / -1; width: 100%; }
  .table-wrap { margin: 0 -5px; border-radius: 10px; }
  table { min-width: 680px; }
  th, td { padding: 11px 9px; font-size: 11px; }
  .row-actions { min-width: 90px; flex-direction: column; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form .grow { min-width: 0; }
  .inline-form .button { width: 100%; }
  .stack-form .button { width: 100%; }
  .plans-grid { grid-template-columns: 1fr; gap: 11px; }
  .plan-card { padding: 16px; border-radius: 15px; }
  .metrics-summary { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .metric-box { padding: 12px; }
  .metric-box span { font-size: 10px; line-height: 1.4; }
  .metric-box strong { font-size: 18px; }
  .bar-chart { gap: 5px; overflow: hidden; }
  .bar-item span { font-size: 8px; }
  .bar-item b { font-size: 9px; }
  .login-card { padding: 27px 22px; border-radius: 21px; }
  .toast { right: 12px; bottom: 12px; left: 12px; max-width: none; text-align: center; }
  .dialog-overlay { padding: 14px; }
  .dialog-card { padding: 21px; border-radius: 17px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}
/* Alguns browsers móveis pedem a versão desktop e reportam uma largura grande.
   O ponteiro tátil força o mesmo layout compacto mesmo nesse modo. */
@media (pointer: coarse) {
  .app-shell { width: 100%; display: flex; flex-direction: column; overflow-x: clip; }
  .sidebar { position: sticky; top: 0; z-index: 10; width: 100%; height: auto; min-height: 0; padding: 11px 12px 9px; box-shadow: 0 8px 24px rgb(12 27 55 / 18%); }
  .brand-row { padding: 0 4px 10px; }
  .brand-mark.small { width: 36px; height: 36px; border-radius: 12px; }
  .sidebar nav { display: flex; width: 100%; gap: 6px; margin: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .nav-item { min-height: 39px; flex: 0 0 auto; gap: 7px; padding: 8px 10px; font-size: 11px; white-space: nowrap; }
  .nav-item.active { box-shadow: inset 0 -2px #a9bbff; }
  .sidebar-bottom { display: none; }
  .main-area { width: 100%; max-width: none; margin: 0; padding: 21px 13px 34px; }
  .topbar { flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
  .topbar h1 { font-size: 23px; }
  .view-section, .panel-card, .panel-heading { min-width: 0; }
  .view-section { gap: 13px; }
  .stat-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .stat-card { min-height: 116px; padding: 14px; }
  .panel-card { padding: 16px 14px; }
  .panel-heading { align-items: flex-start; flex-direction: column; gap: 9px; margin-bottom: 14px; }
  .plans-grid, .campaign-layout { grid-template-columns: minmax(0, 1fr); }
  .metrics-summary { grid-template-columns: minmax(0, 1fr); }
  .bar-chart { width: 100%; min-width: 0; gap: 5px; overflow: hidden; }
  .table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
