:root {
  --bg: #0b1017;
  --bg-2: #0f1621;
  --surface: #151d28;
  --surface-2: #1b2533;
  --line: rgba(148, 163, 184, 0.16);
  --text: #eef3f8;
  --muted: #8b9bb0;
  --accent: #3ee0a2;
  --accent-2: #6ea8ff;
  --warn: #f5c14a;
  --danger: #ff6b7d;
  --ok: #3ee0a2;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --radius: 18px;
  --sidebar: 268px;
  font-family: Manrope, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { background:
  radial-gradient(1200px 500px at -10% -20%, rgba(62, 224, 162, 0.12), transparent 50%),
  radial-gradient(900px 400px at 110% 0%, rgba(110, 168, 255, 0.1), transparent 46%),
  var(--bg);
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #c5dbff; }
.muted { color: var(--muted); }
.icon { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; flex-shrink: 0; }

.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.nav-overlay { display: none; }
.sidebar {
  background: rgba(11, 16, 23, 0.92);
  border-right: 1px solid var(--line);
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 18px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(145deg, #3ee0a2, #1f8f6a);
  color: #062016; display: grid; place-items: center; font-weight: 800; letter-spacing: -0.04em;
  box-shadow: 0 8px 20px rgba(62, 224, 162, 0.25);
}
.brand small { display: block; color: var(--muted); font-size: 12px; }
.nav-block { margin-bottom: 14px; }
.nav-label {
  margin: 0 10px 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6d7d91;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c3d0de;
  padding: 10px 12px;
  border-radius: 12px;
  margin: 2px 0;
  font-weight: 600;
  font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(62, 224, 162, 0.18), rgba(62, 224, 162, 0.05));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(62, 224, 162, 0.22);
}
.nav-item.is-active .icon { color: var(--accent); }
.nav-item span { flex: 1; }
.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ff6b7d;
  color: #fff;
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}
.sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.sidebar-user strong, .sidebar-user small { display: block; }
.sidebar-user small { color: var(--muted); }
.sidebar-user > div:nth-child(2) { flex: 1; min-width: 0; }
.avatar {
  width: 36px; height: 36px; border-radius: 12px;
  background: #243246; display: grid; place-items: center; font-weight: 800;
}
.icon-btn {
  width: 38px; height: 38px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text);
  border-radius: 12px; display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { border-color: rgba(62,224,162,.4); color: #fff; }

.shell { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 22px 28px 8px;
}
.menu-btn { display: none; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.top-title { margin: 2px 0 0; font-size: 26px; letter-spacing: -0.03em; }
.main { padding: 8px 28px 36px; }

.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { display: none; }
.page-head > div > p:first-child { margin-top: 0; }
.page-head .actions { margin-left: auto; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { min-width: 180px; }

.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.work-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 18px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 14px; font-size: 15px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.card-link { display: block; color: inherit; transition: transform .15s ease, border-color .15s ease; }
.card-link:hover { transform: translateY(-2px); border-color: rgba(62,224,162,.35); color: inherit; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.stat-value { font-size: 34px; font-weight: 800; margin: 8px 0 4px; letter-spacing: -0.04em; }
.stat-foot { color: var(--muted); font-size: 13px; }
.tone-ok .stat-value { color: var(--ok); }
.tone-warn .stat-value { color: var(--warn); }
.tone-bad .stat-value { color: var(--danger); }
.tone-info .stat-value { color: var(--accent-2); }

.btn, button.btn, input[type="submit"].btn {
  background: var(--accent);
  color: #062016;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}
.btn:hover { filter: brightness(1.05); }
.btn.secondary { background: #2a3648; color: #fff; }
.btn.warn { background: var(--warn); color: #2b2108; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 700; }
table .btn, table button.btn { padding: 7px 10px; font-size: 12px; border-radius: 10px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
tbody tr:hover { background: rgba(255,255,255,0.025); }
.table-wrap { overflow-x: auto; }

.badge {
  display: inline-flex; align-items: center;
  padding: 4px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 800;
  background: #243246; color: #d5deea;
}
.badge.ativo, .badge.aquecendo, .badge.ok { background: rgba(62,224,162,.14); color: #7af0c0; }
.badge.bloqueado, .badge.overdue, .badge.perdido { background: rgba(255,107,125,.16); color: #ff9aa7; }
.badge.restauracao, .badge.soon, .badge.pausado { background: rgba(245,193,74,.16); color: #f8d58a; }
.badge.encerrado { background: #243246; color: #9aabc0; }

.flash { padding: 12px 14px; border-radius: 14px; margin-bottom: 16px; display: flex; gap: 10px; align-items: center; }
.flash-ok { background: rgba(62,224,162,.12); color: #b6f5db; }
.flash-erro { background: rgba(255,107,125,.12); color: #ffc1c8; }
.flash-aviso { background: rgba(245,193,74,.12); color: #ffe3a3; }

form, .form-grid { display: grid; gap: 12px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full, .full { grid-column: 1 / -1; }
label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  background: var(--bg-2);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(62,224,162,.5);
  box-shadow: 0 0 0 3px rgba(62,224,162,.12);
}
input[type="checkbox"], input[type="radio"] {
  width: auto;
  height: auto;
  margin: 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}
textarea { min-height: 90px; resize: vertical; }
.check-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.check-list label {
  display: flex !important;
  grid-template-columns: none;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  color: var(--text);
  font-weight: 600;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.multi-select { position: relative; }
.multi-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.multi-select-btn:focus {
  outline: none;
  border-color: rgba(62,224,162,.5);
  box-shadow: 0 0 0 3px rgba(62,224,162,.12);
}
.multi-select.is-open .multi-select-btn {
  border-color: rgba(62,224,162,.5);
}
.multi-select-value {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.multi-select-value.is-empty { color: var(--muted); font-weight: 600; }
.multi-select-caret {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  margin: -4px 4px 0 0;
  flex: 0 0 auto;
}
.multi-select.is-open .multi-select-caret { transform: rotate(225deg); margin-top: 4px; }
.multi-select-menu {
  margin-top: 6px;
  background: #1b2533;
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 240px;
  overflow: auto;
  padding: 6px;
  box-shadow: var(--shadow);
}
.multi-select-option {
  width: 100%;
  display: block;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.multi-select-option:hover { background: rgba(62,224,162,.1); }
.multi-select-option.is-on {
  background: rgba(62,224,162,.16);
  color: var(--accent);
}

.progress { height: 7px; background: #243246; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress span { display: block; height: 100%; background: var(--accent); }
.progress.low span { background: var(--warn); }
.progress.bad span { background: var(--danger); }

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.auth-card.wide { width: min(760px, 100%); }
.secret-box {
  font-family: ui-monospace, Consolas, monospace;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 12px;
  word-break: break-all;
  color: #cfe4d9;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: 1.35fr .85fr; gap: 16px; }
.public-body {
  min-height: 100vh;
  padding: 28px 16px 48px;
}
.public-page { max-width: 920px; margin: 0 auto; }
.public-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 22px;
}
.public-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: clamp(18px, 4vw, 28px);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.public-hero h1 { margin: 0 0 8px; font-size: clamp(26px, 4vw, 34px); letter-spacing: -0.04em; }
.public-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.public-stat {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.public-stat b { display: block; font-size: 22px; }
.public-stat span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.public-group { margin-bottom: 14px; }
.public-group h2 { margin: 0; }
.public-group-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--muted);
}
.empty strong { display: block; color: var(--text); margin-bottom: 6px; }

/* Barra de ações acima das tabelas */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar > form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1 1 280px; }
.toolbar .spacer { display: none; }
.toolbar-end {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.list-search {
  display: flex;
  align-items: center;
  min-width: 0;
}
.list-search .search-field { width: 100%; }
.list-search input {
  width: 100%;
  min-width: 0;
}
.list-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.list-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: -4px 0 16px;
}
form.list-form { display: block; }
.list-filters select {
  width: auto;
  min-width: 160px;
  max-width: 220px;
  flex: 0 0 auto;
}
.list-filters .btn { flex-shrink: 0; white-space: nowrap; }

.thumb {
  width: 44px; height: 44px; border-radius: 12px; object-fit: cover;
  background: #243246; display: grid; place-items: center;
  font-weight: 800; color: #9fb2c8; border: 1px solid var(--line);
  flex-shrink: 0;
}
.thumb.lg { width: 88px; height: 88px; border-radius: 22px; font-size: 28px; }
.profile-hero {
  display: flex;
  gap: 18px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.profile-hero-info { flex: 1; min-width: 0; }
.profile-hero-info h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -0.03em; }
.profile-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.profile-hero .actions { justify-content: flex-end; }

.hide-sm { }
.data-list li span { text-align: right; word-break: break-word; }
.search-field { position: relative; display: flex; align-items: center; }
.search-field .icon { position: absolute; left: 12px; color: var(--muted); }
.search-field input { padding-left: 38px; width: 100%; min-width: 0; }
.count-pill {
  padding: 8px 12px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 700;
}

/* Abas */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  color: #c3d0de; font-weight: 700; font-size: 13px;
}
.tab:hover { color: #fff; border-color: rgba(62,224,162,.3); }
.tab.is-active { background: rgba(62,224,162,.14); color: #fff; border-color: rgba(62,224,162,.45); }
.tab.is-active .icon { color: var(--accent); }
.tab b {
  min-width: 20px; padding: 0 6px; height: 19px; border-radius: 999px;
  background: var(--surface-2); color: #dbe6f2; font-size: 11px;
  display: inline-grid; place-items: center;
}
.tab.is-active b { background: var(--accent); color: #062016; }

.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main strong { display: block; }
.cell-sub { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Modal */
body.modal-open { overflow: hidden; }
.modal { display: none; position: fixed; inset: 0; z-index: 60; }
.modal.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 8, 13, .72); backdrop-filter: blur(3px); }
.modal-box {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(92vh, 900px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.modal-box.sm { width: min(520px, 100%); }
.modal-box form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 0;
}
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-head h2 { margin: 0; font-size: 17px; flex: 1; }
.modal-body {
  padding: 18px 16px 18px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #3ee0a2 #1b2533;
}
.modal-body::-webkit-scrollbar { width: 10px; }
.modal-body::-webkit-scrollbar-track {
  background: #121821;
  border-radius: 99px;
  margin: 8px 0;
}
.modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3ee0a2, #1f8f6a);
  border-radius: 99px;
  border: 2px solid #121821;
}
.modal-body::-webkit-scrollbar-thumb:hover { background: #6af0bb; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  background: rgba(11,16,23,.85);
  flex-shrink: 0;
}
fieldset {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin: 0 0 14px;
}
legend {
  padding: 0 8px; font-size: 11px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-row .icon { color: var(--muted); }
.file-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reveal summary { cursor: pointer; color: var(--accent-2); font-size: 12px; font-weight: 700; }
.reveal[open] summary { margin-bottom: 6px; }
.data-list { list-style: none; margin: 0; padding: 0; }
.data-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.data-list li:last-child { border-bottom: 0; }
.data-list b { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

@media (max-width: 1080px) {
  .work-grid, .two-col, .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(84vw, 300px);
    transform: translateX(-105%); transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: none; }
  .nav-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }
  body.nav-open .nav-overlay { display: block; }
  .menu-btn { display: grid; }
  .topbar, .main { padding-left: 16px; padding-right: 16px; }
  .toolbar { align-items: stretch; }
  .toolbar > form { flex: 1 1 100%; }
  .toolbar-end { width: 100%; margin-left: 0; }
  .list-head { grid-template-columns: 1fr; }
  .list-actions { justify-content: flex-end; width: 100%; }
  .list-filters select { min-width: 0; max-width: none; flex: 1 1 140px; }
  .hide-sm { display: none; }
  .profile-hero { flex-wrap: wrap; }
  .profile-hero .actions { width: 100%; }
  .modal.is-open { align-items: stretch; padding: 10px; }
  .modal-box, .modal-box.sm {
    width: 100%;
    max-height: none;
    height: 100%;
    border-radius: 16px;
  }
  .page-head .actions { width: 100%; justify-content: flex-end; }
}
