@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700&family=Source+Sans+3:wght@400;600&family=JetBrains+Mono:wght@400;500&display=swap");
@import "./themes.css";

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--surface);
  color: var(--ink);
  font-family: "Source Sans 3", system-ui, sans-serif;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
}
h1,
h2,
h3 {
  font-family: "Outfit", system-ui, sans-serif;
  margin: 0;
}
.num {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.micro {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink2);
  margin: 0;
}
.img-placeholder {
  background-image: repeating-linear-gradient(45deg, var(--soft) 0 10px, var(--card) 10px 20px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- shell ---------- */
#app-shell {
  height: 100vh;
  display: flex;
  overflow: hidden;
}

.sidebar {
  width: 232px;
  flex: none;
  background: var(--deep);
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.sidebar-logo {
  height: 92px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  background: var(--darker);
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}
.sidebar-logo span {
  color: var(--brand);
}
.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
}
.sidebar-menu a:hover {
  background: rgba(251, 246, 236, 0.08);
}
.sidebar-menu a.active {
  background: rgba(251, 246, 236, 0.14);
  color: #fff;
  font-weight: 600;
}
.sidebar-user {
  flex: none;
  background: var(--darker);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user .avatar {
  height: 34px;
  width: 34px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--card);
  outline: 1px solid var(--line);
  flex: none;
}
.sidebar-user .info {
  flex: 1;
  min-width: 0;
}
.sidebar-user .info .name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .info .role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}
.sidebar-user .info .profile-link {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: underline;
}
.sidebar-user button {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.85);
  font-size: 16px;
}

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}
header.bo-header {
  flex: none;
  height: 92px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}
header.bo-header .titles {
  min-width: 0;
}
header.bo-header .crumb {
  font-size: 12px;
  color: var(--ink2);
}
header.bo-header h1 {
  font-size: 20px;
}
header.bo-header .subtitle {
  font-size: 13px;
  color: var(--ink2);
}
header.bo-header .spacer {
  flex: 1;
}
header.bo-header input[type="search"] {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 16px;
  outline: none;
  width: 220px;
}

main#main {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.pending-drawer {
  flex: none;
  width: 68px;
  background: var(--card);
  border-left: 1px solid var(--line);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pending-drawer.open {
  width: 348px;
}
.pending-toggle {
  flex: none;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.pending-drawer.open .pending-toggle {
  justify-content: flex-start;
  padding: 0 16px;
}
.pending-count {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  padding: 1px 7px;
}
.pending-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: none;
}
.pending-drawer.open .pending-body {
  display: block;
}
.pending-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: var(--surface);
}
.pending-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink2);
  margin: 12px 0 6px;
}
.pending-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 13px;
}
.pending-card.today {
  border-color: var(--brand);
  background: var(--soft);
}
.pending-card.late .pending-time {
  color: var(--warn-fg);
  font-weight: 600;
}
.pending-card .top {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}
.pending-card .meta {
  color: var(--ink2);
  margin-top: 2px;
}
.pending-card button {
  margin-top: 8px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  padding: 6px;
  font-size: 12px;
  cursor: pointer;
}
.pending-card button:hover {
  background: var(--soft);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-brand {
  background: var(--brand);
  color: var(--brand-ink);
}
.btn-brand:hover {
  opacity: 0.9;
}
.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-outline {
  border-color: var(--line);
  color: var(--ink);
  background: transparent;
}
.btn-outline:hover {
  background: var(--soft);
}
.btn-soft {
  background: var(--soft);
  color: var(--ink);
}
.btn-block {
  width: 100%;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.pill {
  border-radius: 999px;
}

/* ---------- cards / kpis ---------- */
.grid {
  display: grid;
  gap: 16px;
}
.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 900px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(33, 26, 17, 0.06), 0 8px 24px rgba(33, 26, 17, 0.06);
}
.kpi-card {
  padding: 18px;
  cursor: pointer;
}
.kpi-card .label {
  font-size: 12px;
  color: var(--ink2);
}
.kpi-card .value {
  font-size: 26px;
  font-weight: 600;
  margin-top: 6px;
}
.kpi-card:hover {
  background: var(--soft);
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 160px;
  padding: 16px;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 100%;
}
.bar-stack {
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}
.bar {
  width: 60%;
  border-radius: 4px 4px 0 0;
}
.bar-in {
  background: var(--brand);
}
.bar-out {
  background: var(--danger-fg);
  opacity: 0.6;
}
.bar-col .label {
  font-size: 11px;
  color: var(--ink2);
}

/* ---------- tables ---------- */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
table.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
table.data-table tr:last-child td {
  border-bottom: none;
}
.status-ok {
  color: var(--ok);
}
.status-warn {
  color: var(--warn-fg);
}
.status-danger {
  color: var(--danger-fg);
}
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.badge-ok {
  background: rgba(47, 122, 73, 0.15);
  color: var(--ok);
}
.badge-warn {
  background: rgba(138, 90, 16, 0.15);
  color: var(--warn-fg);
}
.badge-info {
  background: var(--soft);
  color: var(--ink);
}
.badge-danger {
  background: rgba(161, 40, 30, 0.15);
  color: var(--danger-fg);
}

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
}
.chip:hover {
  background: var(--soft);
}
.chip.active {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--accent);
}

/* ---------- PDV ---------- */
.pdv-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .pdv-grid {
    grid-template-columns: 1fr;
  }
}
.pdv-line {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}
.pdv-line .thumb {
  height: 40px;
  width: 40px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--soft);
  flex: none;
}
.pdv-line .info {
  flex: 1;
  min-width: 0;
}
.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 4px;
}
.qty-stepper button {
  height: 26px;
  width: 26px;
  border-radius: 999px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
}
.qty-stepper button:hover {
  background: var(--soft);
}
.qty-stepper span {
  width: 20px;
  text-align: center;
  font-size: 13px;
}
.summary-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  padding: 18px;
  position: sticky;
  top: 0;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 8px;
}
.summary-total {
  font-size: 24px;
  font-weight: 600;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 8px;
}
.payment-methods {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

/* ---------- theme switcher (reuso do popover da loja, versão flutuante) ---------- */
.theme-fab-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 40;
}
.theme-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(33, 26, 17, 0.15);
}
.swatch-dot {
  height: 16px;
  width: 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--brand);
}
.theme-popover {
  display: none;
  position: absolute;
  right: 0;
  bottom: 52px;
  z-index: 50;
  width: 260px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 12px;
  box-shadow: 0 24px 60px rgba(23, 18, 13, 0.35);
}
.theme-popover.open {
  display: block;
}
.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  background: transparent;
  text-align: left;
}
.theme-option:hover {
  background: var(--soft);
}
.theme-option.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}
.theme-swatch-trio {
  display: inline-flex;
  height: 18px;
  width: 18px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
  flex: none;
}
.theme-swatch-trio span {
  flex: 1;
}
.mode-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.icon-btn {
  height: 36px;
  width: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--soft);
}

.field-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink2);
  margin-bottom: 8px;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 12px;
  outline: none;
}
input:focus,
select:focus {
  border-color: var(--brand);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
