:root {
  --petroleo: #0B3B3A;
  --verde: #1FC8A9;
  --amarelo: #FFC83D;
  --bg: #F5F9F8;
  --surface: #FFFFFF;
  --surface-2: #FBFDFC;
  --tile: #EEF6F5;
  --border: #D7E6E3;
  --border-soft: #EEF3F2;
  --border-strong: #C3D8D4;
  --text: #0B3B3A;
  --text-2: #2F4847;
  --muted: #4A5A59;
  --faint: #6E8481;
  --ok: #0E8C74;
  --ok-bg: #DDF6F0;
  --warn: #8A5A00;
  --warn-bg: #FFF4D6;
  --err: #A93226;
  --err-bg: #FDECEA;
  --side-bg: #FFFFFF;
  --side-active: #E3F4F1;
  --admin-bg: #0B3B3A;
  --admin-active: #134E4C;
  --admin-text: #D3E6E3;
  --admin-muted: #9DC4BE;
  --term-bg: #071C1B;
  --term-text: #EAF4F2;
  --shadow: 0 1px 2px rgb(11 59 58 / 6%);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #071C1B; --surface: #0C2524; --surface-2: #0E2A29; --tile: #12403E; --border: #1D4645; --border-soft: #163837;
    --border-strong: #2A5755; --text: #EAF4F2; --text-2: #CFE3E0; --muted: #9DB8B4; --faint: #7F9A96; --ok: #3FDDBE; --ok-bg: #12403E;
    --warn: #FFD675; --warn-bg: #3A3216; --err: #FF8A7A; --err-bg: #3D1E1B; --side-bg: #0C2524; --side-active: #12403E;
    --admin-bg: #061716; --admin-active: #12403E; color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #071C1B; --surface: #0C2524; --surface-2: #0E2A29; --tile: #12403E; --border: #1D4645; --border-soft: #163837;
  --border-strong: #2A5755; --text: #EAF4F2; --text-2: #CFE3E0; --muted: #9DB8B4; --faint: #7F9A96; --ok: #3FDDBE; --ok-bg: #12403E;
  --warn: #FFD675; --warn-bg: #3A3216; --err: #FF8A7A; --err-bg: #3D1E1B; --side-bg: #0C2524; --side-active: #12403E;
  --admin-bg: #061716; --admin-active: #12403E; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text-2); font: 14px/1.45 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: "Host Grotesk", Inter, sans-serif; color: var(--text); margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; }
.ms { font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1; display: inline-block; -webkit-font-feature-settings: "liga"; font-feature-settings: "liga"; user-select: none; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 12.5px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 6px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hidden { display: none !important; }

.shell { display: flex; min-height: 100vh; }
.side { width: 240px; flex: none; display: flex; flex-direction: column; justify-content: space-between; padding: 24px 12px; background: var(--side-bg); border-right: 1px solid var(--border-soft); position: sticky; top: 0; height: 100vh; }
.side.admin { background: var(--admin-bg); border-right: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; }
.brand b { font: 700 22px/1 "Host Grotesk", sans-serif; letter-spacing: -0.03em; color: var(--text); }
.side.admin .brand b { color: #fff; }
.badge-admin { background: var(--amarelo); color: var(--petroleo); font-size: 10px; font-weight: 800; letter-spacing: .05em; padding: 2px 6px; border-radius: 5px; }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 28px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; border-radius: 9px; text-decoration: none; color: var(--text-2); font-weight: 500; }
.nav a .ms { color: var(--muted); }
.nav a[aria-current="page"] { background: var(--side-active); color: var(--text); font-weight: 600; }
.nav a[aria-current="page"] .ms { color: var(--text); }
.side.admin .nav a { color: var(--admin-text); }
.side.admin .nav a .ms { color: var(--admin-muted); }
.side.admin .nav a[aria-current="page"] { background: var(--admin-active); color: #fff; }
.side.admin .nav a[aria-current="page"] .ms { color: #fff; }
.nav hr { border: 0; border-top: 1px solid var(--border-soft); margin: 6px 0; width: 100%; }
.side.admin .nav hr { border-color: #1D4E4C; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ok-bg); color: var(--text); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.side.admin .avatar { background: var(--verde); color: var(--petroleo); }
.me .grow { min-width: 0; }
.me b, .me span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a span { white-space: nowrap; }
.me b { display: block; font-size: 13px; color: var(--text); }
.side.admin .me b { color: #fff; }
.me span { font-size: 12px; color: var(--muted); }
.side.admin .me span { color: var(--admin-muted); }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.side.admin .icon-btn { color: var(--admin-muted); }
.icon-btn:hover { background: var(--tile); }
.side.admin .icon-btn:hover { background: var(--admin-active); }

.main { flex: 1; min-width: 0; padding: 32px 44px 48px; display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--faint); margin-bottom: 4px; }
.crumbs a { text-decoration: none; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 18px; }
.kpi .k { font-size: 13px; color: var(--muted); }
.kpi .v { font: 700 26px/1.1 "Host Grotesk", sans-serif; color: var(--text); }
.meter { height: 8px; background: var(--border-soft); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--verde); border-radius: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--petroleo); color: #fff; }
:root[data-theme="dark"] .btn.primary { background: var(--verde); color: var(--petroleo); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { background: var(--verde); color: var(--petroleo); } }
.btn.accent { background: var(--verde); color: var(--petroleo); }
.btn.ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.danger { background: var(--surface); border-color: var(--err); color: var(--err); }
.btn:disabled { opacity: .55; cursor: default; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.off { background: var(--tile); color: var(--muted); }
.tag { display: inline-flex; padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--tile); color: var(--text-2); border: 1px solid var(--border-strong); }
.tag.dark { background: var(--petroleo); color: #fff; border-color: var(--petroleo); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; padding: 12px 20px; background: var(--bg); }
.table td { padding: 14px 20px; border-top: 1px solid var(--border-soft); vertical-align: middle; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table td b { color: var(--text); font-weight: 600; }
.table-wrap { overflow-x: auto; }

.form { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
label.field.full { grid-column: 1 / -1; }
.input { height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font-weight: 400; min-width: 0; }
.input:focus { outline: 2px solid var(--verde); outline-offset: 1px; }
.suffix { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.suffix .input { border: 0; flex: 1; }
.suffix span { padding: 0 12px; color: var(--faint); }
.stepper { display: flex; align-items: center; justify-content: space-between; height: 40px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 6px; background: var(--surface); }
.stepper button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: var(--tile); color: var(--text); cursor: pointer; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg); border-radius: 9px; }

.term { background: var(--term-bg); color: var(--term-text); border-radius: 14px; padding: 18px; font: 12.5px/1.6 "IBM Plex Mono", "JetBrains Mono", monospace; white-space: pre-wrap; word-break: break-word; }
.term .c { color: #9DB8B4; }
.term .g { color: #3FDDBE; }

.hero-env { background: var(--petroleo); color: #fff; border-radius: 14px; padding: 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero-env .tile { width: 44px; height: 44px; border-radius: 10px; background: #134E4C; display: grid; place-items: center; color: var(--verde); }
.hero-env .mono { color: #9DC4BE; }
.hero-env h2 { color: #fff; font-size: 16px; }

.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login .left { padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login .right { background: var(--petroleo); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.login .right h2 { color: #fff; font-size: 34px; line-height: 1.15; }
.login .box { max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.google { display: flex; align-items: center; justify-content: center; gap: 10px; height: 48px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); }
.notice.err { background: var(--err-bg); color: var(--err); }
.notice.info { background: var(--tile); color: var(--text-2); }

.toast { position: fixed; bottom: 20px; right: 20px; max-width: 420px; padding: 12px 16px; border-radius: 10px; background: var(--petroleo); color: #fff; box-shadow: 0 6px 24px rgb(0 0 0 / 20%); z-index: 20; }
.toast.err { background: #A93226; }
.secret { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 9px; background: var(--term-bg); color: var(--term-text); }
.secret code { flex: 1; word-break: break-all; font: 12px "IBM Plex Mono", monospace; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.slots { display: flex; gap: 6px; flex-wrap: wrap; }
.slots i { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); }
.slots i.on { background: var(--verde); border-color: var(--verde); }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: sticky; top: 0; z-index: 5; padding: 12px 16px 8px; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand me" "nav nav"; gap: 8px; align-items: center; }
  .side > div:first-child { display: contents; }
  .brand { grid-area: brand; padding: 0; }
  .me { grid-area: me; }
  .me .grow, .me .avatar { display: none; }
  .nav { grid-area: nav; flex-direction: row; margin: 0; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .nav a { height: 36px; padding: 0 12px; font-size: 13px; flex: none; }
  .nav hr { display: none; }
  .main { padding: 20px 16px 40px; }
  .form { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login .right { display: none; }
  .login .left { padding: 28px 16px; gap: 40px; justify-content: flex-start; }
  .table th, .table td { padding: 12px 14px; }
  .hide-sm { display: none; }
  .hero-env .tile { display: none; }
  .hero-env .btn { width: 100%; }
  .hero-env .mono { word-break: break-all; }
  h1 { font-size: 26px; }
}
