:root {
  --navy: #1b2a4a;
  --navy-light: #26385f;
  --orange: #f7931e;
  --green: #39b54a;
  --blue: #29abe2;
  --purple: #8e44ad;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #263043;
  --text-muted: #6b7688;
  --border: #e3e7ef;
  --danger: #e0473e;
  --ok: #39b54a;
  --warn: #f7931e;
  --radius: 10px;
  --sidebar-w: 230px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform .2s ease;
}
.sidebar .brand {
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  text-align: center;
}
.sidebar .brand img { max-width: 100%; height: auto; }
.sidebar nav { padding: 10px 0; flex: 1; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  color: #cfd8e8;
  font-size: 14.5px;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.sidebar nav a.active {
  background: rgba(255,255,255,.09);
  color: #fff;
  border-left-color: var(--orange);
  font-weight: 600;
}
.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
  line-height: 1;
}
.nav-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-group .nav-parent {
  cursor: pointer;
}
.nav-caret {
  font-size: 18px !important;
  transition: transform .15s ease;
  opacity: .7;
}
.nav-group.open .nav-caret { transform: rotate(180deg); }
.nav-submenu {
  display: none;
  flex-direction: column;
  padding: 2px 0 6px 0;
}
.nav-group.open .nav-submenu { display: flex; }
.nav-submenu a {
  padding: 8px 18px 8px 46px;
  font-size: 13.5px;
  color: #cfd8e8;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-submenu a .material-symbols-rounded {
  font-size: 17px;
  opacity: .8;
}
.nav-submenu a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav-submenu a.active {
  background: rgba(255,255,255,.09);
  color: #fff;
  border-left-color: var(--orange);
  font-weight: 600;
}
.sidebar .user-box {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 13px;
}
.sidebar .user-box a { color: var(--orange); }

.menu-toggle {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 200;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
}

/* ---------- Main ---------- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 24px 28px 60px;
  width: calc(100% - var(--sidebar-w));
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 10px;
}
.topbar h1 { font-size: 22px; margin: 0; color: var(--navy); }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(20,30,60,.04);
}
.card h2, .card h3 { margin-top: 0; color: var(--navy); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 20px;
  border-left: 4px solid var(--blue);
}
.stat-card.orange { border-left-color: var(--orange); }
.stat-card.green { border-left-color: var(--green); }
.stat-card.purple { border-left-color: var(--purple); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card .label { font-size: 12.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 25px; font-weight: 700; color: var(--navy); margin-top: 4px; }
.stat-card .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.btn:hover { background: #f0f2f7; text-decoration: none; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-light); color: #fff; }
.btn-orange { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-orange:hover { background: #e08214; color: #fff; }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.form-group { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 6px; }
.form-group.full { flex-basis: 100%; }
label { font-size: 13px; font-weight: 600; color: var(--navy-light); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=color], input[type=file], select, textarea {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  width: 100%;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(41,171,226,.15); }
.hint { font-size: 12px; color: var(--text-muted); }
fieldset { border: 1px dashed var(--border); border-radius: 8px; padding: 14px; margin-bottom: 14px; }

.categoria-checklist { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; max-height: 220px; overflow-y: auto; }
.categoria-check-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-weight: 400; font-size: 14px; cursor: pointer; }
.categoria-check-filha { margin-left: 22px; color: var(--text-muted); }
legend { font-weight: 600; color: var(--navy); padding: 0 6px; font-size: 13.5px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
tbody tr:hover { background: #f8f9fc; }
.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); vertical-align: middle; margin-right: 6px; }
.thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.thumb-lg { width: 76px; height: 76px; border-radius: 8px; font-size: 12px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-rascunho { background: #eef0f4; color: #5b6472; }
.badge-enviado { background: #e6f4fc; color: #1c7fb0; }
.badge-aprovado { background: #e7f8ea; color: #218838; }
.badge-rejeitado { background: #fbe8e7; color: #c1352b; }
.badge-produzido { background: #f0e6f8; color: #6c2f8a; }
.badge-baixo { background: #fdeee2; color: #b3610d; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.alert-success { background: #e7f8ea; color: #1f7a34; border: 1px solid #bfe6c6; }
.alert-error { background: #fbe8e7; color: #b3241c; border: 1px solid #f3c2bf; }
.alert-info { background: #e6f4fc; color: #16608a; border: 1px solid #bfe1f3; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #101c34 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 36px 34px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  text-align: center;
}
.login-card img { max-width: 220px; margin-bottom: 18px; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- Misc ---------- */
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.nowrap { white-space: nowrap; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.calc-breakdown { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 14.5px; }
.calc-breakdown .total-row { font-weight: 700; color: var(--navy); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }
.price-box { border-radius: var(--radius); padding: 18px; text-align: center; color: #fff; }
.price-box.custo { background: var(--navy); }
.price-box.venda { background: var(--green); }
.price-box.promo { background: var(--orange); }
.price-box .label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; opacity: .85; }
.price-box .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.repeatable-item { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #fafbfd; position: relative; }
.remove-item { position: absolute; top: 8px; right: 8px; background: none; border: none; color: var(--danger); cursor: pointer; font-size: 16px; }

.dash-watermark { position: fixed; bottom: 10px; right: 10px; pointer-events: none; z-index: 5; }
.dash-watermark img { width: 260px; display: block; }

@media (max-width: 880px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; width: 100%; padding: 70px 16px 40px; }
  .menu-toggle { display: block; }
  .dash-watermark img { width: 90px; opacity: .85; }
}
