:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dde6;
  --brand: #146c5f;
  --brand-2: #0f5148;
  --warn: #a45309;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  color: var(--text);
  background: #eef2f6;
}

button.danger {
  background: var(--danger);
}

button:active {
  transform: translateY(1px);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #e9f3ef;
}

.login-box {
  width: min(100%, 390px);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-box h1 {
  margin: 0 0 4px;
  font-size: 1.7rem;
}

#login-error {
  min-height: 22px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brandline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brandline strong {
  font-size: 1.2rem;
}

#user-pill {
  border-radius: 999px;
  padding: 5px 9px;
  background: #e9f3ef;
  color: var(--brand-2);
  font-size: 0.85rem;
  font-weight: 800;
}

nav {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

nav button {
  min-width: max-content;
  min-height: 40px;
  color: var(--text);
  background: #eef2f6;
}

nav button.active {
  color: #fff;
  background: var(--brand);
}

.tab {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 14px;
}

.grid {
  display: grid;
  gap: 14px;
}

.two,
.three {
  grid-template-columns: 1fr;
}

.panel,
.card,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.panel h2,
.panel h3 {
  margin: 0;
}

.panel h2 {
  font-size: 1.15rem;
}

.panel h3 {
  font-size: 1rem;
}

.toolbar,
.row,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cup-prices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.toolbar > *,
.row > * {
  flex: 1 1 150px;
}

.list {
  display: grid;
  gap: 10px;
}

.card {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.muted {
  color: var(--muted);
}

.money,
.strong {
  font-weight: 800;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  width: max-content;
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--brand-2);
  background: #e9f3ef;
  font-size: 0.82rem;
  font-weight: 800;
}

.status.fechada {
  color: #344054;
  background: #eef2f6;
}

.status.cancelada,
.negative {
  color: var(--danger);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 1.4rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.check input {
  width: auto;
  min-height: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 6px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 0.82rem;
}

#toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  display: none;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 12px;
  color: #fff;
  background: var(--brand-2);
  box-shadow: var(--shadow);
  font-weight: 800;
}

#toast.show {
  display: flex;
}

@media (min-width: 720px) {
  .topbar {
    grid-template-columns: max-content 1fr;
    align-items: center;
    padding: 12px 18px;
  }

  .two {
    grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.35fr);
  }

  .three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .cup-prices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #toast {
    left: auto;
    width: min(420px, calc(100% - 24px));
  }
}

@media (max-width: 520px) {
  body {
    font-size: 15px;
  }

  .tab {
    padding: 10px;
  }

  .panel {
    padding: 12px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .metric strong {
    font-size: 1.25rem;
  }

  .actions button,
  .toolbar button {
    flex: 1 1 46%;
  }

  .sale-entry {
    display: grid;
    grid-template-columns: 1fr;
  }

  .sale-entry button {
    width: 100%;
  }
}
