/* NUBE — tema */
:root {
  --bg: #0a0b11;
  --bg2: #0f1118;
  --card: #14161f;
  --card2: #1b1e2b;
  --border: #232634;
  --border2: #2e3242;
  --text: #eceef5;
  --text-dim: #b6bacb;
  --muted: #767b91;
  --accent: #8b5cf6;
  --accent-2: #6d28d9;
  --accent-3: #5b21b6;
  --accent-soft: rgba(139, 92, 246, .12);
  --accent-line: rgba(139, 92, 246, .35);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, .12);
  --yellow: #f5c451;
  --yellow-soft: rgba(245, 196, 81, .12);
  --red: #f1707b;
  --red-soft: rgba(241, 112, 123, .12);
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.18);
}

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

body {
  background:
    radial-gradient(1100px 500px at 78% -8%, rgba(109, 40, 217, .14), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: 100%;
  max-width: 430px;
  padding: 0;
}

.login-card {
  width: 100%;
  background: linear-gradient(180deg, var(--card), #11131c);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow);
}

.login-logo {
  width: 146px;
  display: block;
  margin-bottom: 28px;
}

.login-copy h1 {
  font-size: 22px;
  margin-bottom: 6px;
}

.login-copy p {
  color: var(--muted);
  margin-bottom: 24px;
}

.login-form button {
  width: 100%;
  margin-top: 4px;
}

.login-error {
  min-height: 20px;
  color: var(--red);
  margin-top: 12px;
  font-size: 13px;
  text-align: center;
}

/* números com largura uniforme — colunas de R$ alinham certinho */
.value, td.num, th.num, .summary-line span, .info-stat b, .card .value, table { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  background: linear-gradient(180deg, var(--bg2), #0c0e15);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 30px;
  flex-shrink: 0;
}
.sidebar .logo { padding: 4px 8px 0; }
.sidebar .logo img { width: 132px; height: auto; display: block; }
.sidebar .logo small { display:block; color: var(--muted); font-size: 10.5px; letter-spacing: 2.5px; text-transform: uppercase; margin-top: 9px; padding-left: 2px; }

.sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar nav a {
  color: var(--text-dim); text-decoration: none; padding: 10px 12px;
  border-radius: 10px; font-weight: 500; font-size: 14px; transition: .14s;
  display: flex; align-items: center; gap: 11px; position: relative;
}
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.sidebar nav a:hover { color: var(--text); background: rgba(255,255,255,.03); }
.sidebar nav a.active { color: #fff; background: var(--accent-soft); }
.sidebar nav a.active svg { opacity: 1; color: var(--accent); }
.sidebar nav a.active::before {
  content: ''; position: absolute; left: -16px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}

.sidebar .logout {
  margin-top: auto;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text-dim);
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sidebar .logout:hover {
  border-color: var(--accent-line);
  color: #c4b5fd;
  filter: none;
}

main { flex: 1; padding: 32px 38px 90px; max-width: 1220px; }

h1 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.subtitle { color: var(--muted); margin: 4px 0 26px; font-size: 14px; }
h2 {
  font-size: 14px; font-weight: 600; margin-bottom: 14px; color: var(--text);
  display: flex; align-items: center; gap: 9px; letter-spacing: .1px;
}
h2 svg { width: 17px; height: 17px; color: var(--accent); flex-shrink: 0; }

/* ---------- cards de stat ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card {
  background: linear-gradient(180deg, var(--card), #11131c);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 18px 16px;
  position: relative; overflow: hidden; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--border2); }
.card .label { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; }
.card .value { font-size: 27px; font-weight: 700; margin-top: 8px; letter-spacing: -.5px; }
.card .sub { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.card .card-ico { position: absolute; top: 16px; right: 16px; width: 18px; height: 18px; color: var(--muted); opacity: .55; }
.value.green { color: var(--green); }
.value.red { color: var(--red); }
.value.yellow { color: var(--yellow); }
.value.accent { color: #a78bfa; }

.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 16px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

/* ---------- tabelas ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; padding: 0 12px 10px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid rgba(35, 38, 52, .55); font-size: 14px; vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: rgba(255,255,255,.015); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 7px; font-size: 12px; font-weight: 600; line-height: 1.5; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.accent { background: var(--accent-soft); color: #a78bfa; }
.badge.gray { background: rgba(118, 123, 145, .14); color: var(--muted); }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 13px; }
label.field span { display: block; color: var(--text-dim); font-size: 12.5px; font-weight: 500; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid var(--border2); border-radius: 9px;
  padding: 10px 12px; font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .14s, box-shadow .14s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: #565d76; }

.row { display: flex; gap: 11px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 110px; }
.row > .shrink { flex: 0 0 auto; min-width: 0; }

button {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #fff; border: none; border-radius: 9px;
  padding: 10px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: .14s;
  white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
button:hover { filter: brightness(1.1); }
button:active { transform: translateY(1px); }
button.ghost { background: transparent; border: 1px solid var(--border2); color: var(--text-dim); box-shadow: none; }
button.ghost:hover { border-color: var(--accent-line); color: #c4b5fd; filter: none; }
button.danger { background: var(--red-soft); color: var(--red); box-shadow: none; }
button.danger:hover { filter: none; background: rgba(241,112,123,.2); }
button.success { background: var(--green-soft); color: var(--green); box-shadow: none; }
button.success:hover { filter: none; background: rgba(52,211,153,.2); }
button.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
button:disabled { opacity: .4; cursor: not-allowed; }

.toolbar { display: flex; gap: 11px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar .spacer { flex: 1; }
.toolbar h2 { margin: 0; }

.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--border2); border-radius: 9px; overflow: hidden; padding: 2px; gap: 2px; }
.seg button { background: transparent; color: var(--muted); border-radius: 7px; padding: 7px 13px; font-size: 13px; font-weight: 500; box-shadow: none; }
.seg button:hover { filter: none; color: var(--text-dim); }
.seg button.active { background: var(--accent-soft); color: #a78bfa; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5, 6, 11, .7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px; backdrop-filter: blur(4px);
}
.modal {
  background: var(--card); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: 26px; width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal h3 { margin-bottom: 18px; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.modal h3 svg { width: 19px; height: 19px; color: var(--accent); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--card2); border: 1px solid var(--border2);
  padding: 11px 18px; border-radius: 10px; font-weight: 500; font-size: 13.5px;
  box-shadow: var(--shadow); animation: toastIn .18s ease; max-width: 92vw;
}
.toast.error { border-color: rgba(241,112,123,.5); color: var(--red); }
.toast.success { border-color: rgba(52,211,153,.45); color: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- componentes específicos ---------- */
.linkbox {
  background: var(--bg2); border: 1px solid var(--accent-line);
  border-radius: 9px; padding: 12px 14px; font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 12.5px; word-break: break-all; color: #a78bfa; margin: 12px 0;
}
.summary-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.summary-line.total { font-size: 18px; font-weight: 700; border-top: 1px solid var(--border); padding-top: 11px; margin-top: 7px; letter-spacing: -.3px; }
.summary-line .muted { color: var(--muted); }

.tip {
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  padding: 11px 14px; border-radius: 10px; font-size: 13px;
  color: #c4b5fd; margin-bottom: 8px; line-height: 1.5;
}
.tip.warn { background: var(--yellow-soft); border-color: rgba(245,196,81,.35); color: var(--yellow); }
.tip.bad { background: var(--red-soft); border-color: rgba(241,112,123,.4); color: var(--red); }
.tip.good { background: var(--green-soft); border-color: rgba(52,211,153,.35); color: var(--green); }

.info-stat { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid rgba(35,38,52,.55); font-size: 13.5px; }
.info-stat:last-of-type { border-bottom: none; }
.info-stat .muted { color: var(--muted); }
.info-stat b { text-align: right; font-weight: 600; }

.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 13.5px; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: fixed; bottom: 0; top: auto;
    flex-direction: row; align-items: center; padding: 6px 8px; gap: 0;
    border-right: none; border-top: 1px solid var(--border); z-index: 50;
    background: var(--bg2);
  }
  .sidebar .logo { display: none; }
  .sidebar nav { flex-direction: row; width: 100%; justify-content: space-around; gap: 0; }
  .sidebar nav a { flex-direction: column; gap: 3px; font-size: 10px; padding: 6px; }
  .sidebar nav a span { display: none; }
  .sidebar nav a svg { width: 21px; height: 21px; }
  .sidebar nav a.active::before { display: none; }
  .sidebar .logout { display: none; }
  main { padding: 20px 15px 100px; }
  .grid2 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}
